Z-Wave Protocol Controller Reference
zwapi_protocol_controller.h File Reference

Z-Wave API for Z-Wave controllers (network setup and maintenance) More...

#include <stdint.h>
#include <stdbool.h>
#include "sl_status.h"
#include "zwapi_protocol_transport.h"
Include dependency graph for zwapi_protocol_controller.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _ZW_MULTI_DEST_
 
struct  LEARN_INFO
 Learn mode state information passed by the call back function. More...
 
struct  zwapi_node_info_header
 

Macros

#define ADD_NODE_MODE_MASK   0x0F
 zwapi_add_node_to_network() mode mask More...
 
#define ZW_LEARN_MODE_RETURN_INTERVIEW_STATUS   0x01
 zwapi_set_learn_mode() return interview status bit More...
 
#define ZW_SUC_FUNC_NODEID_SERVER   0x01
 SUC capabilities used in zwapi_set_suc_node_id() More...
 
#define GET_NLS_NODES_OFFSET_GRANULARITY_IN_BYTES   128
 Each increase in offset in nodeID is reflected in this value multiplied by 8. More...
 
zwapi_add_node_to_network() mode values
#define ADD_NODE_ANY   1
 
#define ADD_NODE_CONTROLLER   2
 
#define ADD_NODE_END_NODE   3
 
#define ADD_NODE_EXISTING   4
 
#define ADD_NODE_STOP   5
 
#define ADD_NODE_STOP_FAILED   6
 
#define ADD_NODE_ANY_S2   7
 
#define ADD_NODE_HOME_ID   8
 
#define ADD_NODE_SMART_START   9
 
zwapi_add_node_to_network() option values
#define ADD_NODE_OPTION_NORMAL_POWER   0x80
 
#define ADD_NODE_OPTION_NETWORK_WIDE   0x40
 
#define ADD_NODE_OPTION_LONG_RANGE   0x20
 
zwapi_add_node_to_network() callback status values
#define ADD_NODE_STATUS_LEARN_READY   1
 
#define ADD_NODE_STATUS_NODE_FOUND   2
 
#define ADD_NODE_STATUS_ADDING_END_NODE   3
 
#define ADD_NODE_STATUS_ADDING_CONTROLLER   4
 
#define ADD_NODE_STATUS_PROTOCOL_DONE   5
 
#define ADD_NODE_STATUS_DONE   6
 
#define ADD_NODE_STATUS_FAILED   7
 
#define ADD_NODE_STATUS_SECURITY_FAILED   9
 
#define ADD_NODE_STATUS_INTERVIEW_DONE   10
 
#define ADD_NODE_STATUS_NOT_PRIMARY   0x23
 
zwapi_remove_node_from_network() mode values
#define REMOVE_NODE_ANY   ADD_NODE_ANY
 
#define REMOVE_NODE_CONTROLLER   ADD_NODE_CONTROLLER
 
#define REMOVE_NODE_END_NODE   ADD_NODE_END_NODE
 
#define REMOVE_NODE_STOP   ADD_NODE_STOP
 
zwapi_remove_node_from_network() mode mask
#define REMOVE_NODE_MODE_MASK   ADD_NODE_MODE_MASK
 
zwapi_remove_node_from_network() option values
#define REMOVE_NODE_OPTION_NORMAL_POWER   ADD_NODE_OPTION_NORMAL_POWER
 
#define REMOVE_NODE_OPTION_NETWORK_WIDE   ADD_NODE_OPTION_NETWORK_WIDE
 
zwapi_remove_node_from_network() callback status values
#define REMOVE_NODE_STATUS_LEARN_READY   ADD_NODE_STATUS_LEARN_READY
 
#define REMOVE_NODE_STATUS_NODE_FOUND   ADD_NODE_STATUS_NODE_FOUND
 
#define REMOVE_NODE_STATUS_REMOVING_END_NODE   ADD_NODE_STATUS_ADDING_END_NODE
 
#define REMOVE_NODE_STATUS_REMOVING_CONTROLLER   ADD_NODE_STATUS_ADDING_CONTROLLER
 
#define REMOVE_NODE_STATUS_DONE   ADD_NODE_STATUS_DONE
 
#define REMOVE_NODE_STATUS_FAILED   ADD_NODE_STATUS_FAILED
 
zwapi_create_new_primary_ctrl() mode values
#define CREATE_PRIMARY_START   ADD_NODE_CONTROLLER
 
#define CREATE_PRIMARY_STOP   ADD_NODE_STOP
 
#define CREATE_PRIMARY_STOP_FAILED   ADD_NODE_STOP_FAILED
 
zwapi_transfer_primary_ctrl_role() mode values
#define CONTROLLER_CHANGE_START   ADD_NODE_CONTROLLER
 
#define CONTROLLER_CHANGE_STOP   ADD_NODE_STOP
 
#define CONTROLLER_CHANGE_STOP_FAILED   ADD_NODE_STOP_FAILED
 
zwapi_set_learn_mode() mode values
#define LEARN_MODE_DISABLE   0x00
 
#define LEARN_MODE_DIRECT_RANGE   0x01
 
#define LEARN_MODE_NWI   0x81
 
#define LEARN_MODE_NWE   0x83
 
#define LEARN_MODE_SMART_START   0x84
 
zwapi_set_learn_mode() callback status values
#define LEARN_MODE_STARTED   ADD_NODE_STATUS_LEARN_READY
 
#define LEARN_MODE_DONE   ADD_NODE_STATUS_DONE
 
#define LEARN_MODE_FAILED   ADD_NODE_STATUS_FAILED
 
#define LEARN_MODE_INTERVIEW_COMPLETED   0x0A
 
zwapi_request_neighbor_update() callback status values
#define REQUEST_NEIGHBOR_UPDATE_STARTED   0x21
 
#define REQUEST_NEIGHBOR_UPDATE_DONE   0x22
 
#define REQUEST_NEIGHBOR_UPDATE_FAILED   0x23
 
application_controller_update_function() callback status values
#define UPDATE_STATE_SUC_ID   0x10
 
#define UPDATE_STATE_DELETE_DONE   0x20
 
#define UPDATE_STATE_NEW_ID_ASSIGNED   0x40
 
#define UPDATE_STATE_ROUTING_PENDING   0x80
 
#define UPDATE_STATE_NODE_INFO_REQ_FAILED   0x81
 
#define UPDATE_STATE_NODE_INFO_REQ_DONE   0x82
 
#define UPDATE_STATE_NOP_POWER_RECEIVED   0x83
 
#define UPDATE_STATE_NODE_INFO_RECEIVED   0x84
 
#define UPDATE_STATE_NODE_INFO_FOREIGN_HOMEID_RECEIVED   0x85
 
#define UPDATE_STATE_INCLUDED_NODE_INFO_RECEIVED   0x86
 
#define UPDATE_STATE_NODE_INFO_SMARTSTART_HOMEID_RECEIVED_LR   0x87
 
zwapi_remove_failed_node() and zwapi_replace_failed_node() return value and bit flags

The removing/replacing failed node process started

#define ZW_FAILED_NODE_REMOVE_STARTED   0x00
 
#define ZW_NOT_PRIMARY_CONTROLLER   0x02
 
#define ZW_NO_CALLBACK_FUNCTION   0x04
 The removing process was aborted because no call back function is used. More...
 
#define ZW_FAILED_NODE_NOT_FOUND   0x08
 The removing process aborted because the node was node found. More...
 
#define ZW_FAILED_NODE_REMOVE_PROCESS_BUSY   0x10
 The removing process is busy. More...
 
#define ZW_FAILED_NODE_REMOVE_FAIL   0x20
 The removing process could not be started. More...
 
zwapi_remove_failed_node() and zwapi_replace_failed_node() callback status values

The node is working properly (removed from the failed nodes list)

#define ZW_NODE_OK   0
 
#define ZW_FAILED_NODE_REMOVED   1
 The failed node was removed from the failed nodes list. More...
 
#define ZW_FAILED_NODE_NOT_REMOVED   2
 The failed node was not removed from the failing nodes list. More...
 
zwapi_replace_failed_node() callback status definitions

The failed node are ready to be replaced and controller is ready to add new node with nodeID of the failed node

#define ZW_FAILED_NODE_REPLACE   3
 
#define ZW_FAILED_NODE_REPLACE_DONE   4
 The failed node has been replaced. More...
 
#define ZW_FAILED_NODE_REPLACE_FAILED   5
 The failed node has not been replaced. More...
 
zwapi_request_network_update() callback values
#define ZW_SUC_UPDATE_DONE   0x00
 
#define ZW_SUC_UPDATE_ABORT   0x01
 
#define ZW_SUC_UPDATE_WAIT   0x02
 
#define ZW_SUC_UPDATE_DISABLED   0x03
 
#define ZW_SUC_UPDATE_OVERFLOW   0x04
 
#define ZW_SUC_SET_SUCCEEDED   0x05
 
#define ZW_SUC_SET_FAILED   0x06
 
zwapi_get_controller_capabilities() bit flag values
#define CONTROLLER_IS_SECONDARY   0x01
 
#define CONTROLLER_ON_OTHER_NETWORK   0x02
 
#define CONTROLLER_NODEID_SERVER_PRESENT   0x04
 
#define CONTROLLER_IS_REAL_PRIMARY   0x08
 
#define CONTROLLER_IS_SUC   0x10
 
#define NO_NODES_INCLUDED   0x20
 
Z-Wave RF speed definitions
#define ZW_RF_SPEED_NONE   0x0000
 
#define ZW_RF_SPEED_9600   0x0001
 
#define ZW_RF_SPEED_40K   0x0002
 
#define ZW_RF_SPEED_100K   0x0003
 
#define ZW_RF_SPEED_MASK   0x0007
 
zwapi_get_old_routing_info() options
#define GET_ROUTING_INFO_REMOVE_BAD   0x80
 
#define GET_ROUTING_INFO_REMOVE_NON_REPS   0x40
 
#define ZW_GET_ROUTING_INFO_ANY   ZW_RF_SPEED_NONE
 
#define ZW_GET_ROUTING_INFO_9600   ZW_RF_SPEED_9600
 
#define ZW_GET_ROUTING_INFO_40K   ZW_RF_SPEED_40K
 
#define ZW_GET_ROUTING_INFO_100K   ZW_RF_SPEED_100K
 
#define ZW_GET_ROUTING_INFO_SPEED_MASK   ZW_RF_SPEED_MASK
 
zwapi_get_priority_route() and zwapi_set_priority_route() route structure definitions
#define ROUTECACHE_LINE_CONF_SIZE   1
 
#define ROUTECACHE_LINE_SIZE   (MAX_REPEATERS + ROUTECACHE_LINE_CONF_SIZE)
 
PriorityRoute index definitions
#define ROUTECACHE_LINE_REPEATER_0_INDEX   0
 
#define ROUTECACHE_LINE_REPEATER_1_INDEX   1
 
#define ROUTECACHE_LINE_REPEATER_2_INDEX   2
 
#define ROUTECACHE_LINE_REPEATER_3_INDEX   3
 
#define ROUTECACHE_LINE_CONF_INDEX   4
 
zwapi_get_priority_route() and zwapi_set_priority_route() speed definitions
#define ZW_PRIORITY_ROUTE_SPEED_9600   ZW_RF_SPEED_9600
 
#define ZW_PRIORITY_ROUTE_SPEED_40K   ZW_RF_SPEED_40K
 
#define ZW_PRIORITY_ROUTE_SPEED_100K   ZW_RF_SPEED_100K
 
zwapi_get_priority_route() function return values

Route returned is a Application defined Priority Route - APP_PR

#define ZW_PRIORITY_ROUTE_APP_PR   0x10
 
#define ZW_PRIORITY_ROUTE_ZW_LWR   0x01
 Route returned is a Last Working Route - ZW_LWR. More...
 
#define ZW_PRIORITY_ROUTE_ZW_NLWR   0x02
 Route returned is a Next to Last Working Route - ZW_NLWR. More...
 
virtual End Nodes inclusion/exclusion defines

Are returned as callback parameter when callback, setup with zwapi_set_virtual_node_to_learn_mode(), is called during inclusion/exclusion process

#define ASSIGN_COMPLETE   0x00
 
#define ASSIGN_NODEID_DONE   0x01
 Node ID have been assigned. More...
 
#define ASSIGN_RANGE_INFO_UPDATE   0x02
 Node is doing Neighbor discovery. More...
 
zwapi_set_virtual_node_to_learn_mode() mode values

Disable End Node Learn Mode (disable possibility to add/remove Virtual End Nodes) Allowed when bridge is a primary controller, an inclusion controller or a secondary controller

#define VIRTUAL_END_NODE_LEARN_MODE_DISABLE   0x00
 
#define VIRTUAL_END_NODE_LEARN_MODE_ENABLE   0x01
 
#define VIRTUAL_END_NODE_LEARN_MODE_ADD   0x02
 
#define VIRTUAL_END_NODE_LEARN_MODE_REMOVE   0x03
 
Bit mask for multiDestsOffset_NodeMaskLen byte in the ZW_MULTI_DEST structure

Mask masking the number of bytes in multiDestNodeMask array. Valid value range [0 - 29]

#define MULTI_DEST_MASK_LEN_MASK   0x1F
 
#define MULTI_DEST_MASK_OFFSET_MASK   0xE0
 

Typedefs

typedef struct _ZW_MULTI_DEST_ ZW_MULTI_DEST
 
typedef struct LEARN_INFO LEARN_INFO
 Learn mode state information passed by the call back function. More...
 
typedef struct zwapi_node_info_header zwapi_node_info_header_t
 

Functions

sl_status_t zwapi_replication_receive_complete (void)
 Send command completed to primary controller. More...
 
sl_status_t zwapi_send_controller_replication (zwave_node_id_t destNodeID, const uint8_t *pData, uint8_t dataLength, uint8_t txOptions, void(*completedFunc)(uint8_t))
 Send the payload and expect the receiver to respond with a command complete message. More...
 
sl_status_t zwapi_get_protocol_info (zwave_node_id_t node_id, zwapi_node_info_header_t *node_info_header)
 Copy the Node's current protocol information from the non-volatile memory. More...
 
sl_status_t zwapi_assign_return_route (zwave_node_id_t bSrcNodeID, zwave_node_id_t bDstNodeID, void(*completedFunc)(uint8_t bStatus))
 Assign static return routes within a Routing End Node. More...
 
sl_status_t zwapi_delete_return_route (zwave_node_id_t nodeID, void(*completedFunc)(uint8_t bStatus))
 Delete static return routes within a Routing End Node. More...
 
sl_status_t zwapi_set_default (void(*completedFunc)(void))
 Remove all Nodes and timers from the EEPROM memory. More...
 
bool zwapi_is_node_failed (zwave_node_id_t nodeID)
 Check if a node is in the failed nodes table. More...
 
uint8_t zwapi_remove_failed_node (zwave_node_id_t NodeID, void(*completedFunc)(uint8_t))
 Remove a node from the failed node list, if it already exist. More...
 
uint8_t zwapi_replace_failed_node (zwave_node_id_t bNodeID, bool bNormalPower, void(*completedFunc)(uint8_t))
 Replace a node from the failed node list. More...
 
sl_status_t zwapi_set_suc_node_id (zwave_node_id_t nodeID, uint8_t SUCState, uint8_t bTxOption, uint8_t bCapabilities, void(*completedFunc)(uint8_t txStatus))
 Enable/disable the Static Update Controller functionality in a specified static controller. More...
 
zwave_node_id_t zwapi_get_suc_node_id (void)
 Get the currently registered SUC node ID. More...
 
sl_status_t zwapi_request_network_update (void(*completedFunc)(uint8_t txStatus))
 Request network topology updates from the SUC/SIS node. More...
 
sl_status_t zwapi_assign_suc_return_route (zwave_node_id_t bSrcNodeID, void(*completedFunc)(uint8_t bStatus))
 Assign static return routes within a Routing End Node. More...
 
sl_status_t zwapi_delete_suc_return_route (zwave_node_id_t bNodeID, void(*completedFunc)(uint8_t bStatus))
 Delete the (Static Update Controller -SUC-) static return routes within a Routing End Node. More...
 
sl_status_t zwapi_request_neighbor_update (zwave_node_id_t bNodeID, void(*completedFunc)(uint8_t))
 Start neighbor discovery for bNodeID. More...
 
bool zwapi_is_node_primary_ctrl (void)
 Query whether the controller is a primary controller or a secondary controller in the network. More...
 
sl_status_t zwapi_create_new_primary_ctrl (uint8_t bMode, void(*completedFunc)(LEARN_INFO *))
 Create a new primary controller. More...
 
uint8_t zwapi_get_controller_capabilities (void)
 Get capabilities of a controller. More...
 
sl_status_t zwapi_request_node_info (zwave_node_id_t node_id)
 Request node information from a node. More...
 
sl_status_t zwapi_set_learn_mode (uint8_t mode, void(*completedFunc)(LEARN_INFO *))
 Enable/disable Z-Wave Learn Mode. More...
 
sl_status_t zwapi_add_node_to_network (uint8_t bMode, void(*completedFunc)(LEARN_INFO *))
 Add any type of node to the network. More...
 
sl_status_t zwapi_remove_node_from_network (uint8_t bMode, void(*completedFunc)(LEARN_INFO *))
 Remove any type of node from the network. More...
 
sl_status_t zwapi_transfer_primary_ctrl_role (uint8_t bMode, void(*completedFunc)(LEARN_INFO *))
 Transfer the role as primary controller to another controller. More...
 
sl_status_t zwapi_set_max_source_route (uint8_t maxRouteTries)
 Set the maximum number of source routing attempts before the explorer frame mechanism kicks in. More...
 
uint8_t zwapi_get_priority_route (zwave_node_id_t bNodeID, uint8_t *pPriorityRoute)
 Get the Last Working Route (LWR) for a destination node if any exist. More...
 
sl_status_t zwapi_set_priority_route (zwave_node_id_t bNodeID, uint8_t *pPriorityRoute)
 Set the Last Working Route (LWR) for a destination node. More...
 
sl_status_t zwapi_set_virtual_node_to_learn_mode (zwave_node_id_t node, uint8_t mode, void(*learnFunc)(uint8_t bStatus, zwave_node_id_t orgID, zwave_node_id_t newID))
 Enable/disable learn mode for a virtual node. More...
 
sl_status_t zwapi_get_virtual_nodes (zwave_nodemask_t nodeMask)
 Request nodemask containing virtual nodes in controller bridge. More...
 
sl_status_t zwapi_get_old_routing_info (zwave_node_id_t bNodeID, uint8_t *buf, uint8_t bRemoveBad, uint8_t bRemoveNonReps)
 Read out neighbor information. More...
 
sl_status_t zwapi_enable_suc (uint8_t state, uint8_t capabilities)
 Enable the SUC functionality in a controller. More...
 
sl_status_t zwapi_add_smartstart_node_to_network (uint8_t bMode, const uint8_t *dsk, void(*completedFunc)(LEARN_INFO *))
 Add any type of node to the network and accept prekit inclusion. More...
 
sl_status_t zwapi_set_virtual_node_application_node_information (zwave_node_id_t dstNode, uint8_t listening, const node_type_t *node_type, uint8_t *nodeParm, uint8_t parmLength)
 Sets the Application Node Information data for all virtual nodes owned by the Z-Wave API Module. More...
 
sl_status_t zwapi_transfer_protocol_cc (const zwave_node_id_t srcNode, const uint8_t decryptionKey, uint8_t payloadLength, const uint8_t *const payload)
 Transfer a decrypted Protocol Command Class to the controller module. More...
 
sl_status_t zwapi_enable_node_nls (const zwave_node_id_t nodeId)
 Set the NLS State of the node in the controller NVM. More...
 
sl_status_t zwapi_get_node_nls (const zwave_node_id_t nodeId, uint8_t *nls_state, uint8_t *nls_support)
 Get the NLS State of the node in the controller NVM. More...
 
sl_status_t zwapi_get_nls_nodes (uint16_t *list_length, zwave_nodemask_t node_list)
 Get the NLS State of the nodes of a network in the controller NVM. More...
 
sl_status_t zwapi_request_protocol_cc_encryption_callback (uint8_t tx_status, const zwapi_tx_report_t *tx_report, uint8_t session_id)
 Sends TX status, TX report and session ID of the ongoing protocol command class encryption session to the Z-Wave API module. More...
 

Detailed Description

Z-Wave API for Z-Wave controllers (network setup and maintenance)