Device Table#
API and Callbacks for the Device Table Component.
Simple C-based rules engine for demonstrating automatic control through a gateway.
Modules#
sl_zigbee_af_plugin_device_table_entry_t
API#
Send a message using the device table.
Send a message using the device table.
Send a CLI command based on an index and an endpoint.
Send an internally-generated command.
Send an internally-generated command.
Send an internally-generated command.
Compute the EUI64 from the node ID in the device table.
Compute the node ID from the device table index.
Find the endpoint index from node ID and endpoint number.
Find the index based on the node ID.
Find the index based on the EUI64.
Find the index based on the EUI64 and endpoint.
Find the node ID based on the EUI64.
Change the device status based on the last sent message.
Send a leave message to a device based on the index.
Inform the device table that a message was received.
Kick off device table route repair.
Return a pointer to the device table structure.
Return a pointer to the device table entry.
Inform the device table that a new device joined.
Calculate time since the device heard the last message.
Return true if the two EUI64 parameters match.
Clear the device table.
Called when a device has been removed from the device table.
Called when the device table has been initialized.
Enumerations#
Typedefs#
Macros#
API Documentation#
sl_zigbee_af_device_table_cli_index_send#
void sl_zigbee_af_device_table_cli_index_send (uint16_t index)
Send a message using the device table.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | N/A | index | The index of the device to which to send the CLI command. |
Sends the current framework ZCL command to the device specified by an index.
79
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_send#
void sl_zigbee_af_device_table_send (sl_802154_long_addr_t eui64, uint8_t endpoint)
Send a message using the device table.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_long_addr_t | N/A | eui64 | EUI64 to which to send the CLI command. |
uint8_t | N/A | endpoint | Endpoint of the device to which to send the CLI command. |
Sends the current framework ZCL command using a device specified by the EUI64 and endpoint.
89
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_cli_index_send_with_endpoint#
void sl_zigbee_af_device_table_cli_index_send_with_endpoint (uint16_t index, uint8_t endpoint)
Send a CLI command based on an index and an endpoint.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | N/A | index | The index of the device to which to send the command. |
uint8_t | N/A | endpoint | The endpoint of the device to which to send the command. |
Sends the current framework ZCL command using a device indexed in the device table.
99
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_command_index_send#
void sl_zigbee_af_device_table_command_index_send (uint16_t index)
Send an internally-generated command.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | N/A | index | index of the device to which to send the command. |
Sends an internally-generated command, such as generated by the sl_zigbee_af_fill_command_on_off_cluster_on(); command. Note: this is different from the above send command, which works with the CLI-generated outgoing commands.
111
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_command_send_with_endpoint#
void sl_zigbee_af_device_table_command_send_with_endpoint (sl_802154_long_addr_t eui64, uint8_t endpoint)
Send an internally-generated command.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_long_addr_t | N/A | eui64 | EUI64 of the device to which to send the command. |
uint8_t | N/A | endpoint | The endpoint of the device to which to send the command. |
Sends an internally-generated command, such as generated by the sl_zigbee_af_fill_command_on_off_cluster_on(); command. Note: this is different from the above send command, which works with the CLI-generated outgoing commands.
123
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_command_index_send_with_endpoint#
void sl_zigbee_af_device_table_command_index_send_with_endpoint (uint16_t index, uint8_t endpoint)
Send an internally-generated command.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | N/A | index | The index of the device to which to send the command. |
uint8_t | N/A | endpoint | The endpoint of the device to which to send the command. |
Sends an internally-generated command, such as generated by the sl_zigbee_af_fill_command_on_off_cluster_on(); command. Note: this is different from the above send command, which works with the CLI-generated outgoing commands.
136
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_get_eui64_from_node_id#
bool sl_zigbee_af_device_table_get_eui64_from_node_id (sl_802154_short_addr_t sl_zigbee_node_id, sl_802154_long_addr_t eui64)
Compute the EUI64 from the node ID in the device table.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_short_addr_t | N/A | sl_zigbee_node_id | The node ID of the device. |
sl_802154_long_addr_t | N/A | eui64 | The location of the EUI64 variable. |
This function looks up the device-table entry using the node ID and return the EUI64.
Returns
bool True if an EUI can be found, false if not.
149
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_get_node_id_from_index#
uint16_t sl_zigbee_af_device_table_get_node_id_from_index (uint16_t index)
Compute the node ID from the device table index.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | N/A | index | The index of the device. |
Looks up the device table entry based on the index and returns the node ID.
Returns
The node ID of the device.
161
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_get_endpoint_from_node_id_and_endpoint#
uint16_t sl_zigbee_af_device_table_get_endpoint_from_node_id_and_endpoint (sl_802154_short_addr_t sl_zigbee_node_id, uint8_t endpoint)
Find the endpoint index from node ID and endpoint number.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_short_addr_t | N/A | sl_zigbee_node_id | The node ID of the device. |
uint8_t | N/A | endpoint | The desired endpoint. |
Computes the index into the endpoint table based on the node ID and the endpoint number.
Returns
The index of the device.
173
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_get_index_from_node_id#
uint16_t sl_zigbee_af_device_table_get_index_from_node_id (sl_802154_short_addr_t sl_zigbee_node_id)
Find the index based on the node ID.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_short_addr_t | N/A | sl_zigbee_node_id | The node ID of the current device. |
Computes the device-table index based on the node ID.
Returns
The index in the device-table.
184
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_get_first_index_from_eui64#
uint16_t sl_zigbee_af_device_table_get_first_index_from_eui64 (sl_802154_long_addr_t eui64)
Find the index based on the EUI64.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_long_addr_t | N/A | eui64 | EUI64 of the desired node ID. |
Computes the first device table index from the EUI64.
Returns
The first index that matches the EUI64.
194
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_get_index_from_eui64_and_endpoint#
uint16_t sl_zigbee_af_device_table_get_index_from_eui64_and_endpoint (sl_802154_long_addr_t eui64, uint8_t endpoint)
Find the index based on the EUI64 and endpoint.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_long_addr_t | N/A | eui64 | EUI64 of the desired index. |
uint8_t | N/A | endpoint | The endpoint for the desired index. |
Computes the node ID based on the device table entry that matches the EUI64.
Returns
Index that matches the EUI64
205
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_get_node_id_from_eui64#
uint16_t sl_zigbee_af_device_table_get_node_id_from_eui64 (sl_802154_long_addr_t eui64)
Find the node ID based on the EUI64.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_long_addr_t | N/A | eui64 | EUI64 of the desired node ID. |
Computes the node ID based on the device table entry that matches the EUI64.
Returns
The node ID that matches the EUI64.
216
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_message_sent_status#
void sl_zigbee_af_device_table_message_sent_status (sl_802154_short_addr_t nodeId, sl_status_t status, uint16_t profileId, uint16_t clusterId)
Change the device status based on the last sent message.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_short_addr_t | N/A | nodeId | The node ID in the last outgoing message. |
sl_status_t | N/A | status | sl_status_t of the last outgoing message. |
uint16_t | N/A | profileId | The profile ID of the last outgoing message. |
uint16_t | N/A | clusterId | The cluster ID of the last outgoing message. |
If the last sent message was a success, change the device state to "joined". However, if the last message sent was not a success, change the device state to unresponsive.
229
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_send_leave#
void sl_zigbee_af_device_table_send_leave (uint16_t index)
Send a leave message to a device based on the index.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | N/A | index | The index of the device to whom to send the leave message. |
Sends a leave message to the device indicated by the index.
240
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_message_received#
void sl_zigbee_af_device_table_message_received (sl_802154_short_addr_t nodeId)
Inform the device table that a message was received.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_short_addr_t | N/A | nodeId | The node ID from which the last incoming message came. |
The device table keeps track of whether a device has become unresponsive. Hearing from a known device causes the device table to transition the device state from "unresponsive" to "joined". Hearing from an unknown device causes the device table to discover the device, potentially fixing routing issues (i.e., if the node ID has changed).
252
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_initiate_route_repair#
void sl_zigbee_af_device_table_initiate_route_repair (sl_802154_short_addr_t nodeId)
Kick off device table route repair.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_short_addr_t | N/A | nodeId | The node ID of the newly unresponsive node. |
A message was sent to the device and failed. Therefore, the route repair will be attempted and the node marked as unresponsive. Currently, route repair simply sends a broadcast message looking for the node ID based on the EUI64. It may be replaced with something more sophisticated in the future.
264
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_pointer#
sl_zigbee_af_plugin_device_table_entry_t * sl_zigbee_af_device_table_pointer (void )
Return a pointer to the device table structure.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns a pointer to the device table structure.
Returns
A pointer to the device table structure.
272
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_find_device_table_entry#
sl_zigbee_af_plugin_device_table_entry_t * sl_zigbee_af_device_table_find_device_table_entry (uint16_t index)
Return a pointer to the device table entry.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | N/A | index | The index of the device table entry in which we are interested. |
Returns a pointer to the device table entry based on the device table index.
Returns
A pointer to the device table entry.
282
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_new_device_join_handler#
void sl_zigbee_af_device_table_new_device_join_handler (sl_802154_short_addr_t newNodeId, sl_802154_long_addr_t newNodeEui64)
Inform the device table that a new device joined.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_short_addr_t | N/A | newNodeId | The node ID of the newly joined device. |
sl_802154_long_addr_t | N/A | newNodeEui64 | The EUI64 of the newly joined device. |
Call this function in the device table when a device joins, rejoins, or sends an end-device announce. If the device is new, it will generate a new device table entry and kick off the discovery process. If the device is not new, the device-table will make sure the node ID matches the EUI64 and make an update if necessary. It will also check to verify the discovery process has completed and attempt to complete it.
298
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_time_since_last_message#
uint32_t sl_zigbee_af_device_table_time_since_last_message (uint16_t index)
Calculate time since the device heard the last message.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | N/A | index | The index of the device. |
Computes the amount of time, in seconds, since receiving a message from the device.
Returns
The time since the last message (in seconds).
310
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_match_eui64#
bool sl_zigbee_af_device_table_match_eui64 (sl_802154_long_addr_t a, sl_802154_long_addr_t b)
Return true if the two EUI64 parameters match.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_802154_long_addr_t | N/A | a | The first EUI64 to compare. |
sl_802154_long_addr_t | N/A | b | The second EUI64 to compare. |
Determines whether two EUI64 values are the same. The function will print a feedback message to indicate if both EUI64 values are NULL. The function will also print out a feedback message to indicate if the EUI64 values match but in reverse order.
322
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_clear#
void sl_zigbee_af_device_table_clear (void )
Clear the device table.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Clears the device table and the backup file of the device table is also cleared if it is a host.
330
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_index_removed_cb#
void sl_zigbee_af_device_table_index_removed_cb (uint16_t currentIndex)
Called when a device has been removed from the device table.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | N/A | currentIndex | Index of the removed device. |
Called when the device has been removed from the table.
338
of file app/framework/plugin/device-table/device-table.h
sl_zigbee_af_device_table_initialized#
void sl_zigbee_af_device_table_initialized (void )
Called when the device table has been initialized.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Called when the device table has been initialized
345
of file app/framework/plugin/device-table/device-table.h
Enumeration Documentation#
sl_zigbee_af_plugin_device_table_device_state_t#
sl_zigbee_af_plugin_device_table_device_state_t
Enumerator | |
---|---|
SL_ZIGBEE_AF_PLUGIN_DEVICE_TABLE_STATE_NULL | |
SL_ZIGBEE_AF_PLUGIN_DEVICE_TABLE_STATE_JOINED | |
SL_ZIGBEE_AF_PLUGIN_DEVICE_TABLE_STATE_UNRESPONSIVE | |
SL_ZIGBEE_AF_PLUGIN_DEVICE_TABLE_STATE_LEAVE_SENT | |
SL_ZIGBEE_AF_PLUGIN_DEVICE_TABLE_STATE_LEFT | |
SL_ZIGBEE_AF_PLUGIN_DEVICE_TABLE_STATE_UNKNOWN |
37
of file app/framework/plugin/device-table/device-table.h
Typedef Documentation#
sl_zigbee_af_plugin_device_table_device_state_t#
typedef uint8_t sl_zigbee_af_plugin_device_table_device_state_t
35
of file app/framework/plugin/device-table/device-table.h