Node discovery
XBee modules provide some features for discovering and searching nodes.
Structure used in discovery
Discovering nodes is used to discover and report all modules on its current operating channel and PAN ID.
To store the reported information by other nodes, a structure called Node has been created.
MY
: 16-bit Network Address of the reported module (always 0xFFFE)SH[4]
andSL[4]
: 64-bit MAC Source Address of the reported moduleNI
: Node Identifier of the reported modulePMY
: Parent 16-bit network address. It specifies the 16-bit network address of its parent (always 0xFFFE)DT
: Device Type. It specifies if the node is a Coordinator (0), Router (1) or End Device (2)ST
: Status (Reserved)PID
: Profile ID. Profile ID used to application layer addressingMID
: Manufacturer ID. ID set by the manufacturer to identify the moduleRSSI
: RSSI of last hop (disabled in XBee 900HP by default)
To store the found brothers, an array called scannedBrothers
has been created. It is an array of structures Node
. To specify the maximum number of found brothers, it is defined a constant called MAX_BROTHERS
. It is also a variable called totalScannedBrothers
that indicates the number of brothers have been discovered. Using this variable as index in the scannedBrothers
array, it will be possible to read the information about each node discovered.
Example of use:
Related variables:
xbee900HP.totalScannedBrothers
→ stores the number of discovered brothers
xbee900HP.scannedBrothers
→ Node structure array that stores the info
Scan network example:
https://development.libelium.com/waspmote/900hp-09-scan-network
Searching specific nodes
Another possibility for discovering a node is searching for a specific one. This search is based on using the Node Identifier. The NI of the node to discover is used as the input in the API function responsible of this purpose.
The Node Identifier can be set calling the setNodeIdentifier()
function:
Searching a specific node is done by the nodeSearch()
function. It is necessary to indicate the Node Identifier to search and the buffer where the MAC address is stored.
Example of use:
Related variables:
mac[0-7]
→ Stores the 64-bit address of the searched node
Node search example:
https://development.libelium.com/waspmote/900hp-10a-node-search-tx
https://development.libelium.com/waspmote/900hp-10b-node-search-rx
Node discovery to a specific node
When executing a Node Discovery all the nodes respond to it. If its Node Identifier is known, a Node Discovery using its NI as an input can be executed.
Example of use:
Related variables:
xbee900HP.totalScannedBrothers
→ stores the number of discovered brothers. Must be '1'.
xbee900HP.scannedBrothers
→ Node
structure array that stores the info
Node discovery time
It is the amount of time a node will wait for responses from other nodes when performing a ND.
Parameter range: From 0x0020 to 0x2EE0 [x100 ms].
Default value: 0x0082.
Example of use:
Available Information:
xbee900HP.scanTime[0-1]
→ stores the time a node will wait for responses.
Last updated