|
| HRFReliableDatagram (HardwareSerial *serial=&Serial, uint8_t thisAddress=0) |
|
virtual void | setTimeout (long timeout) |
|
virtual void | setRetries (uint8_t retries) |
|
virtual uint8_t | sendtoWait (uint8_t address, uint8_t *buf, uint8_t len) |
|
virtual uint8_t | recvfromAck (uint8_t *buf, uint8_t *len, uint8_t *from=NULL, uint8_t *to=NULL) |
|
| HRFDatagram (HardwareSerial *serial=&Serial, uint8_t thisAddress=0) |
|
virtual void | setThisAddress (uint8_t thisAddress) |
|
virtual uint8_t | sendto (uint8_t address, uint8_t *buf, uint8_t len) |
|
virtual uint8_t | recvfrom (uint8_t *buf, uint8_t *len, uint8_t *from=NULL, uint8_t *to=NULL, uint8_t promiscuous=0) |
|
virtual uint8_t | recv (uint8_t *buf, uint8_t *len) |
|
| HRFMessage (HardwareSerial *serial=&Serial) |
|
virtual uint8_t | send (uint8_t *buf, uint8_t len) |
|
virtual uint8_t | available () |
|
virtual uint8_t | rx_bad (void) |
|
virtual uint8_t | rx_good (void) |
|
virtual void | waitAvailable (void) |
|
Class for sending addressed, acknowledged, retransmitted datagrams.
Extends HRFDatagram to define addressed, reliable datagrams with acknowledgement and retransmission. Based on HRFDatagram, adds flags and sequence numbers. HRFReliableDatagram is reliable in the sense that messages are acknowledged, and unacknowledged messages are retransmitted until acknowledged or the retries are exhausted. When addressed messages are collected by the application (recvfromAck), an acknowledgement is automatically sent. When addressed messages are sent (by sendtoWait), it will wait for an ack, and retransmit after timeout until an ack is received or retries are exhausted ReliableDatagrams have format LEN DEST SRC FLAG/SQN payload FCS-LO FCS-HI Low 7 bits of FLAG/SQN is the sequence number. Most significant bit is the ACK flag.
Part of the Arduino HopeRF library for operating with HopeRF HM-TR transceivers (see http://www.hoperf.com)
uint8_t HRFReliableDatagram::recvfromAck |
( |
uint8_t * |
buf, |
|
|
uint8_t * |
len, |
|
|
uint8_t * |
from = NULL , |
|
|
uint8_t * |
to = NULL |
|
) |
| |
|
virtual |
If there is a valid message available for this node, send an acknowledgement to the SRC address (blocking until this is complete), then copy the message to buf and return true else return false. If a message is copied, *len is set to the length.. If from is not NULL, the SRC address is placed in *from. If to is not NULL, the DEST address is placed in *to. This is the preferred function for getting messages addressed to this node. If the message is not a broadcast, acknowledge to the sender before returning.
- Parameters
-
[in] | buf | Location to copy the received message |
[in] | len | Available space in buf. Set to the actual number of octets copied. |
[in] | from | If present and not NULL, the referenced uint8_t will be set to the SRC address |
[in] | to | If present and not NULL, the referenced uint8_t will be set to the DEST address |
References HRFDatagram::recvfrom(), and HRFDatagram::sendto().