Network statistics
Network statistics¶
This section describes the methods of retreiving and monitoring the network. Data can be collected to provide the routing tree of the network, link quality, etc.
Retrieving statistics¶
To retreive statistics from the nodes in the network, the NETWORK_GET_STATISTICS
message is sent to the Mira module. This command can be addressed to
a specific node in the network, or broadcasted to all nodes.
When broadcasted to all nodes, the responses may cause a network flood resulting in dropped packets. To avoid this, the payload to this message is a parameter to specify a time interval (in seconds) where the nodes will reply randomly within this time frame. It is recommended to set this interval as long as possible if the network is large. If this message is addressed directly to one node, this parameter is ignored and the node will respond immediately.
Message class | Message type | Data length | Data |
---|---|---|---|
0x7 | 0x3 | 1 | Time interval (in seconds) |
The nodes will respond with a NETWORK_STATISTICS
message containing a set of node data.
Message class | Message type | Parameter length | Data |
---|---|---|---|
0x7 | 0x4 | 51 | Statistics data block |
The statistics data block is built up of the following parameters:
Parameter | Data type | Data size | Description |
---|---|---|---|
node_eui | uint8_t | 8 | Node's EUI64 address |
parent_eui | uint8_t | 8 | Parent's EUID64 address |
os_version_major | uint8_t | 1 | MiraOS version, major |
os_version_minor | uint8_t | 1 | MiraOS version, minor |
link_quality | uint8_t | 1 | Average link quality to parent |
channel_error_rate | uint16_t | 16 | RF channel error rate per channel |
Discovering all nodes¶
To build list of all nodes in the network, it is recommeded to broadcast the NETWORK_GET_STATISTICS
command as described above to the entire network. It is,
to reduce the risk of dropped packets, recommended to use a long response time frame, and to send the command at least twice.
From the data received it is possible to build network graphs to show the network topology and to build a list of all nodes in the network.
Ping a device¶
It's possible to send a ping to a device to see if it is online using the NETWORK_PING
message. It's possible to include a payload data for testing purposes that will be looped in the device.
Message class | Message type | Data length | Data |
---|---|---|---|
0x7 | 0x9 | 33 | Ping parameters |
The ping parameters are:
Parameter | Data type | Data size | Description |
---|---|---|---|
length | uint8_t | 1 | Loop data length |
data | uint8_t | 32 | Loop data |
The addressed node will respond with a NETWORK PONG
message. The node will loop back the data into the message.
Message class | Message type | Data length | Data |
---|---|---|---|
0x7 | 0xA | 33 | Pong parameters |
The pong parameters are:
Parameter | Data type | Data size | Description |
---|---|---|---|
length | uint8_t | 1 | Loop data length |
data | uint8_t | 32 | Loop data |
Response codes¶
When sending a message to the Mira module, the application should expect to receive response codes from the Mira module. These response codes will be sent from the Mira module to the application as a response to every request. The application shall not send responses to the Mira module.
Response type | Message class | Message type | Data type | Data length | Data |
---|---|---|---|---|---|
NETWORK_ACK | 0x7 | 0x1 | n/a | 0 | n/a |
NETWORK_ERROR | 0x7 | 0x2 | uint8_t | 1 | 0x02 – unknown message type |
0x03 – incorrect message size |
|||||
0x05 – invalid addressing mode |