Monitoring and Diagnostics¶
Types¶
mira_diag_mac_logger_callback_t¶
typedef void(* mira_diag_mac_logger_callback_t) (uint8_t status, uint8_t header_len, const uint8_t *header, mira_size_t data_len, const uint8_t *data);
mira_diag_mac_packet_filter_callback_t¶
typedef mira_bool_t(* mira_diag_mac_packet_filter_callback_t) (mira_diag_mac_packet_filter_t *metadata);
The callback function for filtering network packets.
The callback is invoked with the metadata of type mira_diag_mac_packet_filter_t. The function should implement the filtering criteria such that it returns:
Return value¶
Name | Description |
---|---|
MIRA_TRUE | For Filtering the network packet. |
MIRA_FALSE | For NOT filtering the network packet. |
mira_diag_net_topology_callback_t¶
typedef void(* mira_diag_net_topology_callback_t) (const mira_diag_net_topology_node_t *node_info, void *storage);
mira_diag_net_neighbour_data_handler_t¶
typedef void(* mira_diag_net_neighbour_data_handler_t) (const mira_diag_net_neighbour_data_t *nbr_data, void *storage);
Callback that receives neighbour data when mira_diag_net_get_neighbour_info() is called.
Enums¶
mira_diag_mac_logger_status_t¶
Status messages of packets sent to the network logger.
Name | Description |
---|---|
MIRA_DIAG_MAC_LOGGER_STATUS_RX_PKT |
|
MIRA_DIAG_MAC_LOGGER_STATUS_TX_PKT |
|
MIRA_DIAG_MAC_LOGGER_STATUS_RX_ACK |
|
MIRA_DIAG_MAC_LOGGER_STATUS_TX_ACK |
|
MIRA_DIAG_MAC_LOGGER_STATUS_PKT_TYPE_MASK |
|
MIRA_DIAG_MAC_LOGGER_STATUS_IS_OK |
|
MIRA_DIAG_MAC_LOGGER_STATUS_IS_FILTERED |
|
MIRA_DIAG_MAC_LOGGER_STATUS_IS_DROPPED |
|
MIRA_DIAG_MAC_LOGGER_STATUS_COLLISION |
Structs¶
mira_diag_mac_packet_filter_t¶
Name | Type | Description |
---|---|---|
source_address |
uint8_t * |
|
source_address_len |
uint8_t |
|
destination_address |
uint8_t * |
|
destination_address_len |
uint8_t |
mira_diag_mac_statistics_t¶
Statistics about sent/received packets.
All Nodes LLMC are packets broadcasted to a node's neighbour. Custom LLMC are packets sent to neighbours that listen to the LLMC address. Unicast packets are packets sent to a specific neighbour.
Name | Type | Description |
---|---|---|
rx_all_nodes_llmc_packets |
uint32_t |
All Nodes Link-Layer Multicast |
rx_unicast_packets |
uint32_t |
|
rx_custom_llmc_packets |
uint32_t |
Custom Link-Layer Multicast |
tx_all_nodes_llmc_packets |
uint32_t |
All Nodes Link-Layer Multicast |
tx_unicast_packets |
uint32_t |
|
tx_custom_llmc_packets |
uint32_t |
Custom Link-Layer Multicast |
rx_missed_slots |
uint32_t |
Receive slots where packets couldn't receive because of lacking buffers |
rx_not_for_us_packets |
uint32_t |
Packet received that wasn't for us. |
tx_dropped |
uint32_t |
Unable to send because of full queues etc |
tx_failed |
uint32_t |
Failed to transmit |
used_tx_queue |
uint32_t |
|
rf_occupancy |
uint32_t |
Measure of radio occupancy |
packet_rate |
uint32_t |
Number of packets received |
mira_diag_net_topology_node_t¶
Topology data about a node.
Name | Type | Description |
---|---|---|
lifetime_left_in_seconds |
uint32_t |
|
node_address |
mira_net_address_t |
|
parent_address |
mira_net_address_t |
mira_diag_net_neighbour_data_t¶
Name | Type | Description |
---|---|---|
addr |
mira_net_address_t |
|
link_met |
mira_link_metric_t |
|
link_met_measurements |
uint8_t |
|
rssi |
int16_t |
|
rate |
uint8_t |
Functions¶
mira_diag_mac_set_packet_logger¶
Register a callback to log network packets.
The status parameter to the callback will describe what kind of packet is being logged. All received packets are sent here, even packets that are not for the current node and packets with errors.
The callback gets a status indicating what kind of packet is being logged and its state. The header and data pointers' memory should be logged after each other.
Note
This function should only be used at the request of LumenRadio.
mira_diag_mac_set_packet_filter¶
Register a callback to filter network packets.
Parameters¶
Name | Description |
---|---|
filter_cb | The callback function that implements the filtering. |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | The filter callback successfully registered. |
MIRA_ERROR_NOT_INITIALIZED | Network stack is not initialized. |
mira_diag_mac_get_statistics¶
Get MAC statistics.
The values are counted (with wrap around) from startup.
Parameters¶
Name | Description |
---|---|
stats | the collected statistics |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | Successfully got statistics. |
MIRA_ERROR_NOT_INITIALIZED | Network stack is not initialized. |
MIRA_ERROR_UNKNOWN | Unknown error occurred. |
mira_diag_net_get_topology¶
mira_status_t mira_diag_net_get_topology(mira_diag_net_topology_callback_t callback, void *storage);
Get network topology info.
The callback with be called with info about every node known to the current node.
The result can be used for network monitoring and diagnostics, but it should not be used for node reachability.
Note
Use UDP messages for heartbeat and reachability queries.
Parameters¶
Name | Description |
---|---|
callback | the callback called for every node. |
storage | pointer passed on to the callback. |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | Successfully returned the topology. |
MIRA_ERROR_NOT_SUPPORTED | Node is not root, or does not support topology output. |
MIRA_ERROR_NOT_INITIALIZED | Network stack is not initialized. |
mira_diag_net_get_neighbour_info¶
mira_status_t mira_diag_net_get_neighbour_info(mira_diag_net_neighbour_data_handler_t callback, void *storage);
Register a callback that will get data about neighbouring nodes Supports multiple calls, but callback must be given and valid for each call.
Parameters¶
Name | Description |
---|---|
callback | Function pointer to callback that will be called for every neighbour found. |
storage | Storage pointer sent to data_handler function. |
Return value¶
Name | Description |
---|---|
MIRA_ERROR_INVALID_VALUE | data_handler is an invalid pointer. |
MIRA_NET_ERROR_NOT_ASSOCIATED | network not started or joined. |
MIRA_SUCCESS | neighbour data successfully sent to callback. |