Skip to content

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, uint8_t *header, mira_size_t data_len, uint8_t *data);

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_neighbour_data_get() 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_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

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

mira_status_t mira_diag_mac_set_packet_logger(mira_diag_mac_logger_callback_t logger_cb);

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_get_statistics

mira_status_t mira_diag_mac_get_statistics(mira_diag_mac_statistics_t *stats);

Get MAC statistics.

The values are counted (with wrap around) from startup.

Parameters

Name Description
stats the collected statistics

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.

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_SUCCESS neighbour data successfully sent to callback.