rfSend (Function) |
Top Previous Next |
rfSend will send a package (see RF Functions for details) to any peer set up with the correct parameters and actively listening for a package with rfReceive.
A package is defined by a block of data with a given length specified with the "data" and "size" parameters. A package can contain up to 60 bytes of data.
The "receiver" is the ID of the peer nodes to accept the package as specified by rfOpen on the peer node. When the "receiver" parameter is 0, a broadcast package is transmitted and will be received by any peer awaiting a package with rfReceive. Also see the RF Functions for more information.
When simultaneously using rfSend and rfReceive, it may occur that rfSend will be temporarily blocked until rfReceive has finished the operation. The time to actually perform a transmission is therefore variable as a "listen-before-send" technique is deployed to minimize data transmission collision which maximizes the actual data throughput.
Input: data : PTR Address of the buffer that contains the data.
size : INT ( 0 .. 60 ) ( default 0 ) Number of bytes to send from the buffer.
receiver : INT ( 0 .. 254 ) ( default 0 ) Used by rfReceive on receiving device(s) to filter packages. When broadcasting to all IDs, use "0".
Returns: INT
Declaration: FUNCTION rfSend : INT;
Example: INCLUDE rtcu.inc |