David Rimer / RadioHead-148
Embed: (wiki syntax)

« Back to documentation index

RHRouter Class Reference

RHReliableDatagram subclass for sending addressed, optionally acknowledged datagrams multi-hop routed across a network. More...

#include <RHRouter.h>

Inherits RHReliableDatagram.

Inherited by RHMesh.

Data Structures

struct  RoutedMessage
 Defines the structure of a RHRouter message. More...
struct  RoutedMessageHeader
 Defines the structure of the RHRouter message header, used to keep track of end-to-end delivery parameters. More...
struct  RoutingTableEntry
 Defines an entry in the routing table. More...

Public Types

enum  RouteState { Invalid = 0, Discovering, Valid }
 

Values for the possible states for routes.

More...

Public Member Functions

 RHRouter (RHGenericDriver &driver, uint8_t thisAddress=0)
 Constructor.
bool init ()
 Initialises this instance and the radio module connected to it.
void setMaxHops (uint8_t max_hops)
 Sets the max_hops to the given value This controls the maximum number of hops allowed between source and destination nodes Messages that are not delivered by the time their HOPS field exceeds max_hops on a routing node will be dropped and ignored.
void addRouteTo (uint8_t dest, uint8_t next_hop, uint8_t state=Valid)
 Adds a route to the local routing table, or updates it if already present.
RoutingTableEntrygetRouteTo (uint8_t dest)
 Finds and returns a RoutingTableEntry for the given destination node.
bool deleteRouteTo (uint8_t dest)
 Deletes from the local routing table any route for the destination node.
void retireOldestRoute ()
 Deletes the oldest (first) route from the local routing table.
void clearRoutingTable ()
 Clears all entries from the local routing table.
void printRoutingTable ()
 If RH_HAVE_SERIAL is defined, this will print out the contents of the local routing table using Serial.
uint8_t sendtoWait (uint8_t *buf, uint8_t len, uint8_t dest, uint8_t flags=0)
 Sends a message to the destination node.
uint8_t sendtoFromSourceWait (uint8_t *buf, uint8_t len, uint8_t dest, uint8_t source, uint8_t flags=0)
 Similar to sendtoWait() above, but spoofs the source address.
bool recvfromAck (uint8_t *buf, uint8_t *len, uint8_t *source=NULL, uint8_t *dest=NULL, uint8_t *id=NULL, uint8_t *flags=NULL)
 Starts the receiver if it is not running already.
bool recvfromAckTimeout (uint8_t *buf, uint8_t *len, uint16_t timeout, uint8_t *source=NULL, uint8_t *dest=NULL, uint8_t *id=NULL, uint8_t *flags=NULL)
 Starts the receiver if it is not running already.
void setTimeout (uint16_t timeout)
 Sets the minimum retransmit timeout.
void setRetries (uint8_t retries)
 Sets the maximum number of retries.
uint8_t retries ()
 Returns the currently configured maximum retries count.
bool sendtoWait (uint8_t *buf, uint8_t len, uint8_t address)
 Send the message (with retries) and waits for an ack.
uint32_t retransmissions ()
 Returns the number of retransmissions we have had to send since starting or since the last call to resetRetransmissions().
void resetRetransmissions ()
 Resets the count of the number of retransmissions to 0.
void setThisAddress (uint8_t thisAddress)
 Sets the address of this node.
bool sendto (uint8_t *buf, uint8_t len, uint8_t address)
 Sends a message to the node(s) with the given address RH_BROADCAST_ADDRESS is a valid address which will cause the message to be accepted by all RHDatagram nodes within range.
bool recvfrom (uint8_t *buf, uint8_t *len, uint8_t *from=NULL, uint8_t *to=NULL, uint8_t *id=NULL, uint8_t *flags=NULL)
 Turns the receiver on if it not already on.
bool available ()
 Tests whether a new message is available from the Driver.
void waitAvailable ()
 Starts the Driver receiver and blocks until a valid received message is available.
bool waitPacketSent ()
 Blocks until the transmitter is no longer transmitting.
bool waitPacketSent (uint16_t timeout)
 Blocks until the transmitter is no longer transmitting.
bool waitAvailableTimeout (uint16_t timeout)
 Starts the Driver receiver and blocks until a received message is available or a timeout.
void setHeaderTo (uint8_t to)
 Sets the TO header to be sent in all subsequent messages.
void setHeaderFrom (uint8_t from)
 Sets the FROM header to be sent in all subsequent messages.
void setHeaderId (uint8_t id)
 Sets the ID header to be sent in all subsequent messages.
void setHeaderFlags (uint8_t set, uint8_t clear=RH_FLAGS_NONE)
 Sets and clears bits in the FLAGS header to be sent in all subsequent messages.
uint8_t headerTo ()
 Returns the TO header of the last received message.
uint8_t headerFrom ()
 Returns the FROM header of the last received message.
uint8_t headerId ()
 Returns the ID header of the last received message.
uint8_t headerFlags ()
 Returns the FLAGS header of the last received message.
uint8_t thisAddress ()
 Returns the address of this node.

Protected Member Functions

virtual void peekAtMessage (RoutedMessage *message, uint8_t messageLen)
 Lets sublasses peek at messages going past before routing or local delivery.
virtual uint8_t route (RoutedMessage *message, uint8_t messageLen)
 Finds the next-hop route and sends the message via RHReliableDatagram::sendtoWait().
void deleteRoute (uint8_t index)
 Deletes a specific rout entry from therouting table.
void acknowledge (uint8_t id, uint8_t from)
 Send an ACK for the message id to the given from address Blocks until the ACK has been sent.
bool haveNewMessage ()
 Checks whether the message currently in the Rx buffer is a new message, not previously received based on the from address and the sequence.

Protected Attributes

uint8_t _lastE2ESequenceNumber
 The last end-to-end sequence number to be used Defaults to 0.
uint8_t _max_hops
 The maximum number of hops permitted in routed messages.
RHGenericDriver_driver
 The Driver we are to use.
uint8_t _thisAddress
 The address of this node.

Detailed Description

RHReliableDatagram subclass for sending addressed, optionally acknowledged datagrams multi-hop routed across a network.

Manager class that extends RHReliableDatagram to define addressed messages That are reliably transmitted and routed across a network. Each message is transmitted reliably between each hop in order to get from the source node to the destination node.

With RHRouter, routes are hard wired. This means that each node must have programmed in it how to reach each of the other nodes it will be trying to communicate with. This means you must specify the next-hop node address for each of the destination nodes, using the addRouteTo() function.

When sendtoWait() is called with a new message to deliver, and the destination address, RHRouter looks up the next hop node for the destination node. It then uses RHReliableDatagram to (reliably) deliver the message to the next hop (which is expected also to be running an RHRouter). If that next-hop node is not the final destination, it will also look up the next hop for the destination node and (reliably) deliver the message to the next hop. By this method, messages can be delivered across a network of nodes, even if each node cannot hear all of the others in the network. Each time a message is received for another node and retransmitted to the next hop, the HOPS filed in teh header is incremented. If a message is received for routing to another node which has exceed the routers max_hops, the message wioll be dropped and ignored. This helps prevent infinite routing loops.

RHRouter supports messages with a dest of RH_BROADCAST_ADDRESS. Such messages are not routed, and are broadcast (once) to all nodes within range.

The recvfromAck() function is responsible not just for receiving and delivering messages addressed to this node (or RH_BROADCAST_ADDRESS), but it is also responsible for routing other message to their next hop. This means that it is important to call recvfromAck() or recvfromAckTimeout() frequently in your main loop. recvfromAck() will return false if it receives a message but it is not for this node.

RHRouter does not provide reliable end-to-end delivery, but uses reliable hop-to-hop delivery. If a message is unable to be delivered to an end node during to a delivery failure between 2 hops, the source node will not be told about it.

Note: This class is most useful for networks of nodes that are essentially static (i.e. the nodes dont move around), and for which the routing never changes. If that is not the case for your proposed network, see RHMesh instead.

The Routing Table

The routing table is a local table in RHRouter that holds the information about the next hop node address for each destination address you may want to send a message to. It is your responsibility to make sure every node in an RHRouter network has been configured with a unique address and the routing information so that messages are correctly routed across the network from source node to destination node. This is usually done once in setup() by calling addRouteTo(). The hardwired routing will in general be different on each node, and will depend on the physical topololgy of the network. You can also use addRouteTo() to change a route and deleteRouteTo() to delete a route at run time. Youcan also clear the entire routing table

The Routing Table has limited capacity for entries (defined by RH_ROUTING_TABLE_SIZE, which is 10) if more than RH_ROUTING_TABLE_SIZE are added, the oldest (first) one will be removed by calling retireOldestRoute()

Message Format

RHRouter add to the lower level RHReliableDatagram (and even lower level RH) class message formats. In those lower level classes, the hop-to-hop message headers are in the RH message headers, and are handled automcatically by tyhe RH hardware. RHRouter and its subclasses add an end-to-end addressing header in the payload of the RH message, and before the RHRouter application data.

  • 1 octet DEST, the destination node address (ie the address of the final destination node for this message)
  • 1 octet SOURCE, the source node address (ie the address of the originating node that first sent the message).
  • 1 octet HOPS, the number of hops this message has traversed so far.
  • 1 octet ID, an incrementing message ID for end-to-end message tracking for use by subclasses. Not used by RHRouter.
  • 1 octet FLAGS, a bitmask for use by subclasses. Not used by RHRouter.
  • 0 or more octets DATA, the application payload data. The length of this data is implicit in the length of the entire message.

You should be careful to note that there are ID and FLAGS fields in the low level per-hop message header too. These are used only for hop-to-hop, and in general will be different to the ones at the RHRouter level.

Testing

Bench testing of such networks is notoriously difficult, especially simulating limited radio connectivity between some nodes. To assist testing (both during RH development and for your own networks) RHRouter.cpp has the ability to simulate a number of different small network topologies. Each simulated network supports 4 nodes with addresses 1 to 4. It operates by pretending to not hear RH messages from certain other nodes. You can enable testing with a #define TEST_NETWORK in RHRouter.h The sample programs rf22_mesh_* rely on this feature.

Part of the Arduino RH library for operating with HopeRF RH compatible transceivers (see http://www.hoperf.com)

Definition at line 132 of file RHRouter.h.


Member Enumeration Documentation

enum RouteState

Values for the possible states for routes.

Enumerator:
Invalid 

No valid route is known.

Discovering 

Discovering a route (not currently used)

Valid 

Route is valid.

Definition at line 155 of file RHRouter.h.


Constructor & Destructor Documentation

RHRouter ( RHGenericDriver driver,
uint8_t  thisAddress = 0 
)

Constructor.

Parameters:
[in]driverThe RadioHead driver to use to transport messages.
[in]thisAddressThe address to assign to this node. Defaults to 0

Definition at line 20 of file RHRouter.cpp.


Member Function Documentation

void acknowledge ( uint8_t  id,
uint8_t  from 
) [protected, inherited]

Send an ACK for the message id to the given from address Blocks until the ACK has been sent.

Definition at line 176 of file RHReliableDatagram.cpp.

void addRouteTo ( uint8_t  dest,
uint8_t  next_hop,
uint8_t  state = Valid 
)

Adds a route to the local routing table, or updates it if already present.

If there is not enough room the oldest (first) route will be deleted by calling retireOldestRoute().

Parameters:
[in]destThe destination node address. RH_BROADCAST_ADDRESS is permitted.
[in]next_hopThe address of the next hop to send messages destined for dest
[in]stateThe satte of the route. Defaults to Valid

Definition at line 44 of file RHRouter.cpp.

bool available (  ) [inherited]

Tests whether a new message is available from the Driver.

On most drivers, this will also put the Driver into RHModeRx mode until a message is actually received bythe transport, when it will be returned to RHModeIdle. This can be called multiple times in a timeout loop.

Returns:
true if a new, complete, error-free uncollected message is available to be retreived by recv()

Definition at line 52 of file RHDatagram.cpp.

void clearRoutingTable (  )

Clears all entries from the local routing table.

Definition at line 146 of file RHRouter.cpp.

void deleteRoute ( uint8_t  index ) [protected]

Deletes a specific rout entry from therouting table.

Parameters:
[in]indexThe 0 based index of the routing table entry to delete

Definition at line 97 of file RHRouter.cpp.

bool deleteRouteTo ( uint8_t  dest )

Deletes from the local routing table any route for the destination node.

Parameters:
[in]destThe destination node address
Returns:
true if the route was present

Definition at line 124 of file RHRouter.cpp.

RHRouter::RoutingTableEntry * getRouteTo ( uint8_t  dest )

Finds and returns a RoutingTableEntry for the given destination node.

Parameters:
[in]destThe desired destination node address.
Returns:
pointer to a RoutingTableEntry for dest

Definition at line 87 of file RHRouter.cpp.

bool haveNewMessage (  ) [protected, inherited]

Checks whether the message currently in the Rx buffer is a new message, not previously received based on the from address and the sequence.

If it is new, it is acknowledged and returns true

Returns:
true if there is a message received and it is a new message
uint8_t headerFlags (  ) [inherited]

Returns the FLAGS header of the last received message.

Returns:
The FLAGS header of the most recently received message.

Definition at line 117 of file RHDatagram.cpp.

uint8_t headerFrom (  ) [inherited]

Returns the FROM header of the last received message.

Returns:
The FROM header of the most recently received message.

Definition at line 107 of file RHDatagram.cpp.

uint8_t headerId (  ) [inherited]

Returns the ID header of the last received message.

Returns:
The ID header of the most recently received message.

Definition at line 112 of file RHDatagram.cpp.

uint8_t headerTo (  ) [inherited]

Returns the TO header of the last received message.

Returns:
The TO header of the most recently received message.

Definition at line 102 of file RHDatagram.cpp.

bool init (  )

Initialises this instance and the radio module connected to it.

Overrides the init() function in RH. Sets max_hops to the default of RH_DEFAULT_MAX_HOPS (30)

Reimplemented from RHDatagram.

Definition at line 29 of file RHRouter.cpp.

void peekAtMessage ( RoutedMessage message,
uint8_t  messageLen 
) [protected, virtual]

Lets sublasses peek at messages going past before routing or local delivery.

Called by recvfromAck() immediately after it gets the message from RHReliableDatagram

Parameters:
[in]messagePointer to the RHRouter message that was received.
[in]messageLenLength of message in octets

Reimplemented in RHMesh.

Definition at line 198 of file RHRouter.cpp.

void printRoutingTable (  )

If RH_HAVE_SERIAL is defined, this will print out the contents of the local routing table using Serial.

Definition at line 106 of file RHRouter.cpp.

bool recvfrom ( uint8_t *  buf,
uint8_t *  len,
uint8_t *  from = NULL,
uint8_t *  to = NULL,
uint8_t *  id = NULL,
uint8_t *  flags = NULL 
) [inherited]

Turns the receiver on if it not already on.

If there is a valid message available for this node, copy it to buf and return true The SRC address is placed in *from if present and not NULL. The DEST address is placed in *to if present and not NULL. If a message is copied, *len is set to the length. You should be sure to call this function frequently enough to not miss any messages It is recommended that you call it in your main loop.

Parameters:
[in]bufLocation to copy the received message
[in,out]lenPointer to available space in buf. Set to the actual number of octets copied.
[in]fromIf present and not NULL, the referenced uint8_t will be set to the FROM address
[in]toIf present and not NULL, the referenced uint8_t will be set to the TO address
[in]idIf present and not NULL, the referenced uint8_t will be set to the ID
[in]flagsIf present and not NULL, the referenced uint8_t will be set to the FLAGS (not just those addressed to this node).
Returns:
true if a valid message was copied to buf

Definition at line 39 of file RHDatagram.cpp.

bool recvfromAck ( uint8_t *  buf,
uint8_t *  len,
uint8_t *  source = NULL,
uint8_t *  dest = NULL,
uint8_t *  id = NULL,
uint8_t *  flags = NULL 
)

Starts the receiver if it is not running already.

If there is a valid message available for this node (or RH_BROADCAST_ADDRESS), send an acknowledgement to the last hop address (blocking until this is complete), then copy the application message payload data 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 originator SOURCE address is placed in *source. If to is not NULL, the DEST address is placed in *dest. This might be this nodes address or RH_BROADCAST_ADDRESS. 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]bufLocation to copy the received message
[in,out]lenAvailable space in buf. Set to the actual number of octets copied.
[in]sourceIf present and not NULL, the referenced uint8_t will be set to the SOURCE address
[in]destIf present and not NULL, the referenced uint8_t will be set to the DEST address
[in]idIf present and not NULL, the referenced uint8_t will be set to the ID
[in]flagsIf present and not NULL, the referenced uint8_t will be set to the FLAGS (not just those addressed to this node).
Returns:
true if a valid message was recvived for this node copied to buf

Reimplemented from RHReliableDatagram.

Reimplemented in RHMesh.

Definition at line 204 of file RHRouter.cpp.

bool recvfromAckTimeout ( uint8_t *  buf,
uint8_t *  len,
uint16_t  timeout,
uint8_t *  source = NULL,
uint8_t *  dest = NULL,
uint8_t *  id = NULL,
uint8_t *  flags = NULL 
)

Starts the receiver if it is not running already.

Similar to recvfromAck(), this will block until either a valid message available for this node or the timeout expires.

Parameters:
[in]bufLocation to copy the received message
[in,out]lenAvailable space in buf. Set to the actual number of octets copied.
[in]timeoutMaximum time to wait in milliseconds
[in]sourceIf present and not NULL, the referenced uint8_t will be set to the SOURCE address
[in]destIf present and not NULL, the referenced uint8_t will be set to the DEST address
[in]idIf present and not NULL, the referenced uint8_t will be set to the ID
[in]flagsIf present and not NULL, the referenced uint8_t will be set to the FLAGS (not just those addressed to this node).
Returns:
true if a valid message was copied to buf

Reimplemented from RHReliableDatagram.

Reimplemented in RHMesh.

Definition at line 291 of file RHRouter.cpp.

void resetRetransmissions (  ) [inherited]

Resets the count of the number of retransmissions to 0.

Definition at line 171 of file RHReliableDatagram.cpp.

void retireOldestRoute (  )

Deletes the oldest (first) route from the local routing table.

Definition at line 139 of file RHRouter.cpp.

uint32_t retransmissions (  ) [inherited]

Returns the number of retransmissions we have had to send since starting or since the last call to resetRetransmissions().

Returns:
The number of retransmissions since initialisation.

Definition at line 166 of file RHReliableDatagram.cpp.

uint8_t retries (  ) [inherited]

Returns the currently configured maximum retries count.

Can be changed with setRetries().

Returns:
The currently configured maximum number of retries.

Definition at line 41 of file RHReliableDatagram.cpp.

uint8_t route ( RoutedMessage message,
uint8_t  messageLen 
) [protected, virtual]

Finds the next-hop route and sends the message via RHReliableDatagram::sendtoWait().

This is virtual, which lets subclasses override or intercept the route() function. Called by sendtoWait after the message header has been filled in.

Parameters:
[in]messagePointer to the RHRouter message to be sent.
[in]messageLenLength of message in octets

Reimplemented in RHMesh.

Definition at line 178 of file RHRouter.cpp.

bool sendto ( uint8_t *  buf,
uint8_t  len,
uint8_t  address 
) [inherited]

Sends a message to the node(s) with the given address RH_BROADCAST_ADDRESS is a valid address which will cause the message to be accepted by all RHDatagram nodes within range.

Parameters:
[in]bufPointer to the binary message to send
[in]lenNumber of octets to send (> 0)
[in]addressThe address to send the message to.
Returns:
true if the message not too loing fot eh driver, and the message was transmitted.

Definition at line 33 of file RHDatagram.cpp.

uint8_t sendtoFromSourceWait ( uint8_t *  buf,
uint8_t  len,
uint8_t  dest,
uint8_t  source,
uint8_t  flags = 0 
)

Similar to sendtoWait() above, but spoofs the source address.

For internal use only during routing

Parameters:
[in]bufThe application message data.
[in]lenNumber of octets in the application message data. 0 is permitted.
[in]destThe destination node address.
[in]sourceThe (fake) originating node address.
[in]flagsOptional flags for use by subclasses or application layer, delivered end-to-end to the dest address. The receiver can recover the flags with recvFromAck().
Returns:
The result code:
  • RH_ROUTER_ERROR_NONE Message was routed and deliverd to the next hop (not necessarily to the final dest address)
  • RH_ROUTER_ERROR_NO_ROUTE There was no route for dest in the local routing table
  • RH_ROUTER_ERROR_UNABLE_TO_DELIVER Noyt able to deliver to the next hop (usually because it dod not acknowledge due to being off the air or out of range

Definition at line 161 of file RHRouter.cpp.

uint8_t sendtoWait ( uint8_t *  buf,
uint8_t  len,
uint8_t  dest,
uint8_t  flags = 0 
)

Sends a message to the destination node.

Initialises the RHRouter message header (the SOURCE address is set to the address of this node, HOPS to 0) and calls route() which looks up in the routing table the next hop to deliver to and sends the message to the next hop. Waits for an acknowledgement from the next hop (but not from the destination node (if that is different).

Parameters:
[in]bufThe application message data
[in]lenNumber of octets in the application message data. 0 is permitted
[in]destThe destination node address
[in]flagsOptional flags for use by subclasses or application layer, delivered end-to-end to the dest address. The receiver can recover the flags with recvFromAck().
Returns:
The result code:
  • RH_ROUTER_ERROR_NONE Message was routed and delivered to the next hop (not necessarily to the final dest address)
  • RH_ROUTER_ERROR_NO_ROUTE There was no route for dest in the local routing table
  • RH_ROUTER_ERROR_UNABLE_TO_DELIVER Not able to deliver to the next hop (usually because it dod not acknowledge due to being off the air or out of range

Reimplemented in RHMesh.

Definition at line 154 of file RHRouter.cpp.

bool sendtoWait ( uint8_t *  buf,
uint8_t  len,
uint8_t  address 
) [inherited]

Send the message (with retries) and waits for an ack.

Returns true if an acknowledgement is received. Synchronous: any message other than the desired ACK received while waiting is discarded. Blocks until an ACK is received or all retries are exhausted (ie up to retries*timeout milliseconds). If the destination address is the broadcast address RH_BROADCAST_ADDRESS (255), the message will be sent as a broadcast, but receiving nodes do not acknowledge, and sendtoWait() returns true immediately without waiting for any acknowledgements.

Parameters:
[in]addressThe address to send the message to.
[in]bufPointer to the binary message to send
[in]lenNumber of octets to send
Returns:
true if the message was transmitted and an acknowledgement was received.

Definition at line 47 of file RHReliableDatagram.cpp.

void setHeaderFlags ( uint8_t  set,
uint8_t  clear = RH_FLAGS_NONE 
) [inherited]

Sets and clears bits in the FLAGS header to be sent in all subsequent messages.

Parameters:
[in]setbitmask of bits to be set
[in]clearbitmask of flags to clear

Definition at line 97 of file RHDatagram.cpp.

void setHeaderFrom ( uint8_t  from ) [inherited]

Sets the FROM header to be sent in all subsequent messages.

Parameters:
[in]fromThe new FROM header value

Definition at line 87 of file RHDatagram.cpp.

void setHeaderId ( uint8_t  id ) [inherited]

Sets the ID header to be sent in all subsequent messages.

Parameters:
[in]idThe new ID header value

Definition at line 92 of file RHDatagram.cpp.

void setHeaderTo ( uint8_t  to ) [inherited]

Sets the TO header to be sent in all subsequent messages.

Parameters:
[in]toThe new TO header value

Definition at line 82 of file RHDatagram.cpp.

void setMaxHops ( uint8_t  max_hops )

Sets the max_hops to the given value This controls the maximum number of hops allowed between source and destination nodes Messages that are not delivered by the time their HOPS field exceeds max_hops on a routing node will be dropped and ignored.

Parameters:
[in]max_hopsThe new value for max_hops

Definition at line 38 of file RHRouter.cpp.

void setRetries ( uint8_t  retries ) [inherited]

Sets the maximum number of retries.

Defaults to 3 at construction time. If set to 0, each message will only ever be sent once. sendtoWait will give up and return false if there is no ack received after all transmissions time out and the retries count is exhausted. param[in] retries The maximum number a retries.

Definition at line 35 of file RHReliableDatagram.cpp.

void setThisAddress ( uint8_t  thisAddress ) [inherited]

Sets the address of this node.

Defaults to 0. This will be used to set the FROM address of all messages sent by this node. In a conventional multinode system, all nodes will have a unique address (which you could store in EEPROM).

Parameters:
[in]thisAddressThe address of this node

Definition at line 25 of file RHDatagram.cpp.

void setTimeout ( uint16_t  timeout ) [inherited]

Sets the minimum retransmit timeout.

If sendtoWait is waiting for an ack longer than this time (in milliseconds), it will retransmit the message. Defaults to 200ms. The timeout is measured from the end of transmission of the message. It must be at least longer than the the transmit time of the acknowledgement (preamble+6 octets) plus the latency/poll time of the receiver. For fast modulation schemes you can considerably shorten this time. The actual timeout is randomly varied between timeout and timeout*2.

Parameters:
[in]timeoutThe new timeout period in milliseconds

Definition at line 29 of file RHReliableDatagram.cpp.

uint8_t thisAddress (  ) [inherited]

Returns the address of this node.

Returns:
The address of this node

Definition at line 77 of file RHDatagram.cpp.

void waitAvailable (  ) [inherited]

Starts the Driver receiver and blocks until a valid received message is available.

Definition at line 57 of file RHDatagram.cpp.

bool waitAvailableTimeout ( uint16_t  timeout ) [inherited]

Starts the Driver receiver and blocks until a received message is available or a timeout.

Parameters:
[in]timeoutMaximum time to wait in milliseconds.
Returns:
true if a message is available

Definition at line 72 of file RHDatagram.cpp.

bool waitPacketSent ( uint16_t  timeout ) [inherited]

Blocks until the transmitter is no longer transmitting.

or until the timeout occuers, whichever happens first

Parameters:
[in]timeoutMaximum time to wait in milliseconds.
Returns:
true if the radio completed transmission within the timeout period. False if it timed out.

Definition at line 67 of file RHDatagram.cpp.

bool waitPacketSent (  ) [inherited]

Blocks until the transmitter is no longer transmitting.

Definition at line 62 of file RHDatagram.cpp.


Field Documentation

RHGenericDriver& _driver [protected, inherited]

The Driver we are to use.

Definition at line 156 of file RHDatagram.h.

uint8_t _lastE2ESequenceNumber [protected]

The last end-to-end sequence number to be used Defaults to 0.

Definition at line 308 of file RHRouter.h.

uint8_t _max_hops [protected]

The maximum number of hops permitted in routed messages.

If a routed message would exceed this number of hops it is dropped and ignored.

Definition at line 312 of file RHRouter.h.

uint8_t _thisAddress [protected, inherited]

The address of this node.

Definition at line 159 of file RHDatagram.h.