Z-Wave Protocol Controller Reference
zwapi_protocol_controller.h
Go to the documentation of this file.
1/******************************************************************************
2 * # License
3 * <b>Copyright 2021 Silicon Laboratories Inc. www.silabs.com</b>
4 ******************************************************************************
5 * The licensor of this software is Silicon Laboratories Inc. Your use of this
6 * software is governed by the terms of Silicon Labs Master Software License
7 * Agreement (MSLA) available at
8 * www.silabs.com/about-us/legal/master-software-license-agreement. This
9 * software is distributed to you in Source Code format and is governed by the
10 * sections of the MSLA applicable to Source Code.
11 *
12 *****************************************************************************/
13
19#ifndef ZWAPI_PROTOCOL_CONTROLLER_H
20#define ZWAPI_PROTOCOL_CONTROLLER_H
21
22#include <stdint.h>
23#include <stdbool.h>
24#include "sl_status.h"
25#include "zwapi_protocol_transport.h" //We need zwapi_tx_report_t here
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
42#define ADD_NODE_ANY 1
43#define ADD_NODE_CONTROLLER 2
44#define ADD_NODE_END_NODE 3
45#define ADD_NODE_EXISTING 4
46#define ADD_NODE_STOP 5
47#define ADD_NODE_STOP_FAILED 6
48#define ADD_NODE_ANY_S2 7
49#define ADD_NODE_HOME_ID 8
50#define ADD_NODE_SMART_START 9
52
54#define ADD_NODE_MODE_MASK 0x0F
55
58#define ADD_NODE_OPTION_NORMAL_POWER 0x80
59#define ADD_NODE_OPTION_NETWORK_WIDE 0x40
60#define ADD_NODE_OPTION_LONG_RANGE 0x20
62
65#define ADD_NODE_STATUS_LEARN_READY 1
66#define ADD_NODE_STATUS_NODE_FOUND 2
67#define ADD_NODE_STATUS_ADDING_END_NODE 3
68#define ADD_NODE_STATUS_ADDING_CONTROLLER 4
69#define ADD_NODE_STATUS_PROTOCOL_DONE 5
70#define ADD_NODE_STATUS_DONE 6
71#define ADD_NODE_STATUS_FAILED 7
72#define ADD_NODE_STATUS_SECURITY_FAILED 9
73#define ADD_NODE_STATUS_INTERVIEW_DONE 10
74#define ADD_NODE_STATUS_NOT_PRIMARY 0x23
76
79#define REMOVE_NODE_ANY ADD_NODE_ANY
80#define REMOVE_NODE_CONTROLLER ADD_NODE_CONTROLLER
81#define REMOVE_NODE_END_NODE ADD_NODE_END_NODE
82#define REMOVE_NODE_STOP ADD_NODE_STOP
84
86#define REMOVE_NODE_MODE_MASK ADD_NODE_MODE_MASK
87
90#define REMOVE_NODE_OPTION_NORMAL_POWER ADD_NODE_OPTION_NORMAL_POWER
91#define REMOVE_NODE_OPTION_NETWORK_WIDE ADD_NODE_OPTION_NETWORK_WIDE
93
96#define REMOVE_NODE_STATUS_LEARN_READY ADD_NODE_STATUS_LEARN_READY
97#define REMOVE_NODE_STATUS_NODE_FOUND ADD_NODE_STATUS_NODE_FOUND
98#define REMOVE_NODE_STATUS_REMOVING_END_NODE ADD_NODE_STATUS_ADDING_END_NODE
99#define REMOVE_NODE_STATUS_REMOVING_CONTROLLER ADD_NODE_STATUS_ADDING_CONTROLLER
100#define REMOVE_NODE_STATUS_DONE ADD_NODE_STATUS_DONE
101#define REMOVE_NODE_STATUS_FAILED ADD_NODE_STATUS_FAILED
103
106#define CREATE_PRIMARY_START ADD_NODE_CONTROLLER
107#define CREATE_PRIMARY_STOP ADD_NODE_STOP
108#define CREATE_PRIMARY_STOP_FAILED ADD_NODE_STOP_FAILED
110
113#define CONTROLLER_CHANGE_START ADD_NODE_CONTROLLER
114#define CONTROLLER_CHANGE_STOP ADD_NODE_STOP
115#define CONTROLLER_CHANGE_STOP_FAILED ADD_NODE_STOP_FAILED
117
120#define LEARN_MODE_DISABLE 0x00
121#define LEARN_MODE_DIRECT_RANGE 0x01
122#define LEARN_MODE_NWI 0x81
123#define LEARN_MODE_NWE 0x83
124#define LEARN_MODE_SMART_START 0x84
126
128#define ZW_LEARN_MODE_RETURN_INTERVIEW_STATUS 0x01
129
132#define LEARN_MODE_STARTED ADD_NODE_STATUS_LEARN_READY
133#define LEARN_MODE_DONE ADD_NODE_STATUS_DONE
134#define LEARN_MODE_FAILED ADD_NODE_STATUS_FAILED
135#define LEARN_MODE_INTERVIEW_COMPLETED 0x0A
137
140#define REQUEST_NEIGHBOR_UPDATE_STARTED 0x21
141#define REQUEST_NEIGHBOR_UPDATE_DONE 0x22
142#define REQUEST_NEIGHBOR_UPDATE_FAILED 0x23
144
147#define UPDATE_STATE_SUC_ID 0x10
148#define UPDATE_STATE_DELETE_DONE 0x20
149#define UPDATE_STATE_NEW_ID_ASSIGNED 0x40
150#define UPDATE_STATE_ROUTING_PENDING 0x80
151#define UPDATE_STATE_NODE_INFO_REQ_FAILED 0x81
152#define UPDATE_STATE_NODE_INFO_REQ_DONE 0x82
153#define UPDATE_STATE_NOP_POWER_RECEIVED 0x83
154#define UPDATE_STATE_NODE_INFO_RECEIVED 0x84
155#define UPDATE_STATE_NODE_INFO_FOREIGN_HOMEID_RECEIVED 0x85
156#define UPDATE_STATE_INCLUDED_NODE_INFO_RECEIVED 0x86
157#define UPDATE_STATE_NODE_INFO_SMARTSTART_HOMEID_RECEIVED_LR 0x87
159
163#define ZW_FAILED_NODE_REMOVE_STARTED 0x00
166#define ZW_NOT_PRIMARY_CONTROLLER 0x02
168#define ZW_NO_CALLBACK_FUNCTION 0x04
170#define ZW_FAILED_NODE_NOT_FOUND 0x08
172#define ZW_FAILED_NODE_REMOVE_PROCESS_BUSY 0x10
174#define ZW_FAILED_NODE_REMOVE_FAIL 0x20
176
180#define ZW_NODE_OK 0
182#define ZW_FAILED_NODE_REMOVED 1
184#define ZW_FAILED_NODE_NOT_REMOVED 2
186
191#define ZW_FAILED_NODE_REPLACE 3
193#define ZW_FAILED_NODE_REPLACE_DONE 4
195#define ZW_FAILED_NODE_REPLACE_FAILED 5
197
200#define ZW_SUC_UPDATE_DONE 0x00
201#define ZW_SUC_UPDATE_ABORT 0x01
202#define ZW_SUC_UPDATE_WAIT 0x02
203#define ZW_SUC_UPDATE_DISABLED 0x03
204#define ZW_SUC_UPDATE_OVERFLOW 0x04
205#define ZW_SUC_SET_SUCCEEDED 0x05
206#define ZW_SUC_SET_FAILED 0x06
208
210#define ZW_SUC_FUNC_NODEID_SERVER 0x01
211
214#define CONTROLLER_IS_SECONDARY 0x01
215#define CONTROLLER_ON_OTHER_NETWORK 0x02
216#define CONTROLLER_NODEID_SERVER_PRESENT 0x04
217#define CONTROLLER_IS_REAL_PRIMARY 0x08
218#define CONTROLLER_IS_SUC 0x10
219#define NO_NODES_INCLUDED 0x20
221
224#define ZW_RF_SPEED_NONE 0x0000
225#define ZW_RF_SPEED_9600 0x0001
226#define ZW_RF_SPEED_40K 0x0002
227#define ZW_RF_SPEED_100K 0x0003
228#define ZW_RF_SPEED_MASK 0x0007
230
233#define GET_ROUTING_INFO_REMOVE_BAD 0x80
234#define GET_ROUTING_INFO_REMOVE_NON_REPS 0x40
235#define ZW_GET_ROUTING_INFO_ANY ZW_RF_SPEED_NONE
236#define ZW_GET_ROUTING_INFO_9600 ZW_RF_SPEED_9600
237#define ZW_GET_ROUTING_INFO_40K ZW_RF_SPEED_40K
238#define ZW_GET_ROUTING_INFO_100K ZW_RF_SPEED_100K
239#define ZW_GET_ROUTING_INFO_SPEED_MASK ZW_RF_SPEED_MASK
241
244#define ROUTECACHE_LINE_CONF_SIZE 1
245#define ROUTECACHE_LINE_SIZE (MAX_REPEATERS + ROUTECACHE_LINE_CONF_SIZE)
247
250#define ROUTECACHE_LINE_REPEATER_0_INDEX 0
251#define ROUTECACHE_LINE_REPEATER_1_INDEX 1
252#define ROUTECACHE_LINE_REPEATER_2_INDEX 2
253#define ROUTECACHE_LINE_REPEATER_3_INDEX 3
254#define ROUTECACHE_LINE_CONF_INDEX 4
256
259#define ZW_PRIORITY_ROUTE_SPEED_9600 ZW_RF_SPEED_9600
260#define ZW_PRIORITY_ROUTE_SPEED_40K ZW_RF_SPEED_40K
261#define ZW_PRIORITY_ROUTE_SPEED_100K ZW_RF_SPEED_100K
263
267#define ZW_PRIORITY_ROUTE_APP_PR 0x10
269#define ZW_PRIORITY_ROUTE_ZW_LWR 0x01
271#define ZW_PRIORITY_ROUTE_ZW_NLWR 0x02
273
279#define ASSIGN_COMPLETE 0x00
280#define ASSIGN_NODEID_DONE 0x01
281#define ASSIGN_RANGE_INFO_UPDATE 0x02
283
289#define VIRTUAL_END_NODE_LEARN_MODE_DISABLE 0x00
293#define VIRTUAL_END_NODE_LEARN_MODE_ENABLE 0x01
296#define VIRTUAL_END_NODE_LEARN_MODE_ADD 0x02
299#define VIRTUAL_END_NODE_LEARN_MODE_REMOVE 0x03
301
306#define MULTI_DEST_MASK_LEN_MASK 0x1F
309#define MULTI_DEST_MASK_OFFSET_MASK 0xE0
311
313#define GET_NLS_NODES_OFFSET_GRANULARITY_IN_BYTES 128
314
315typedef struct _ZW_MULTI_DEST_ {
326
328typedef struct LEARN_INFO {
329 uint8_t bStatus;
331 uint8_t *pCmd;
332 uint8_t bLen;
334
339 uint8_t capability;
340 uint8_t security;
341 uint8_t reserved;
345
355
373 const uint8_t *pData,
374 uint8_t dataLength,
375 uint8_t txOptions,
376 void (*completedFunc)(uint8_t));
377
387 zwapi_node_info_header_t *node_info_header);
404 zwave_node_id_t bDstNodeID,
405 void (*completedFunc)(uint8_t bStatus));
406
420 void (*completedFunc)(uint8_t bStatus));
421
429sl_status_t zwapi_set_default(void (*completedFunc)(void));
430
441
473 void (*completedFunc)(uint8_t));
474
513 bool bNormalPower,
514 void (*completedFunc)(uint8_t));
515
533 uint8_t SUCState,
534 uint8_t bTxOption,
535 uint8_t bCapabilities,
536 void (*completedFunc)(uint8_t txStatus));
537
546
597 zwapi_request_network_update(void (*completedFunc)(uint8_t txStatus));
598
616 void (*completedFunc)(uint8_t bStatus));
617
634 void (*completedFunc)(uint8_t bStatus));
635
647 void (*completedFunc)(uint8_t));
648
659
675 void (*completedFunc)(LEARN_INFO *));
676
698
711
731 void (*completedFunc)(LEARN_INFO *));
732
752 void (*completedFunc)(LEARN_INFO *));
753
771 void (*completedFunc)(LEARN_INFO *));
772
790 void (*completedFunc)(LEARN_INFO *));
791
810sl_status_t zwapi_set_max_source_route(uint8_t maxRouteTries);
811
859 uint8_t *pPriorityRoute);
860
898 uint8_t *pPriorityRoute);
899
924 zwave_node_id_t node,
925 uint8_t mode,
926 void (*learnFunc)(uint8_t bStatus,
927 zwave_node_id_t orgID,
928 zwave_node_id_t newID));
929
940
963 uint8_t *buf,
964 uint8_t bRemoveBad,
965 uint8_t bRemoveNonReps);
966
981sl_status_t zwapi_enable_suc(uint8_t state, uint8_t capabilities);
982
1002 uint8_t bMode, const uint8_t *dsk, void (*completedFunc)(LEARN_INFO *));
1003
1019 zwave_node_id_t dstNode,
1020 uint8_t listening,
1021 const node_type_t *node_type,
1022 uint8_t *nodeParm,
1023 uint8_t parmLength);
1024
1034 const zwave_node_id_t srcNode,
1035 const uint8_t decryptionKey,
1036 uint8_t payloadLength,
1037 const uint8_t * const payload);
1038
1047
1056sl_status_t zwapi_get_node_nls(const zwave_node_id_t nodeId, uint8_t* nls_state, uint8_t* nls_support);
1057
1066sl_status_t zwapi_get_nls_nodes(uint16_t *list_length,
1067 zwave_nodemask_t node_list);
1068
1080 uint8_t tx_status, const zwapi_tx_report_t *tx_report, uint8_t session_id);
1081
1083
1084#ifdef __cplusplus
1085}
1086#endif
1087
1088#endif // ZWAPI_PROTOCOL_CONTROLLER_H
sl_status_t zwapi_add_node_to_network(uint8_t bMode, void(*completedFunc)(LEARN_INFO *))
Add any type of node to the network.
Definition: zwapi_protocol_controller.c:131
sl_status_t zwapi_set_default(void(*completedFunc)(void))
Remove all Nodes and timers from the EEPROM memory.
Definition: zwapi_protocol_controller.c:90
sl_status_t zwapi_get_virtual_nodes(zwave_nodemask_t nodeMask)
Request nodemask containing virtual nodes in controller bridge.
Definition: zwapi_protocol_controller.c:70
uint8_t zwapi_get_controller_capabilities(void)
Get capabilities of a controller.
Definition: zwapi_protocol_controller.c:531
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.
Definition: zwapi_protocol_controller.c:210
sl_status_t zwapi_create_new_primary_ctrl(uint8_t bMode, void(*completedFunc)(LEARN_INFO *))
Create a new primary controller.
Definition: zwapi_protocol_controller.c:118
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.
sl_status_t zwapi_transfer_primary_ctrl_role(uint8_t bMode, void(*completedFunc)(LEARN_INFO *))
Transfer the role as primary controller to another controller.
Definition: zwapi_protocol_controller.c:103
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.
Definition: zwapi_protocol_controller.c:42
sl_status_t zwapi_remove_node_from_network(uint8_t bMode, void(*completedFunc)(LEARN_INFO *))
Remove any type of node from the network.
Definition: zwapi_protocol_controller.c:146
sl_status_t zwapi_enable_suc(uint8_t state, uint8_t capabilities)
Enable the SUC functionality in a controller.
Definition: zwapi_protocol_controller.c:717
struct _ZW_MULTI_DEST_ ZW_MULTI_DEST
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.
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.
Definition: zwapi_protocol_controller.c:341
sl_status_t zwapi_set_learn_mode(uint8_t mode, void(*completedFunc)(LEARN_INFO *))
Enable/disable Z-Wave Learn Mode.
Definition: zwapi_protocol_controller.c:373
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.
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.
Definition: zwapi_protocol_controller.c:811
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.
sl_status_t zwapi_replication_receive_complete(void)
Send command completed to primary controller.
Definition: zwapi_protocol_controller.c:575
sl_status_t zwapi_request_node_info(zwave_node_id_t node_id)
Request node information from a node.
Definition: zwapi_protocol_controller.c:425
sl_status_t zwapi_enable_node_nls(const zwave_node_id_t nodeId)
Set the NLS State of the node in the controller NVM.
Definition: zwapi_protocol_controller.c:787
struct LEARN_INFO LEARN_INFO
Learn mode state information passed by the call back function.
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.
Definition: zwapi_protocol_controller.c:633
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.
Definition: zwapi_protocol_controller.c:763
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.
Definition: zwapi_protocol_controller.c:688
struct zwapi_node_info_header zwapi_node_info_header_t
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.
bool zwapi_is_node_failed(zwave_node_id_t nodeID)
Check if a node is in the failed nodes table.
Definition: zwapi_protocol_controller.c:585
zwave_node_id_t zwapi_get_suc_node_id(void)
Get the currently registered SUC node ID.
Definition: zwapi_protocol_controller.c:316
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.
Definition: zwapi_protocol_controller.c:161
sl_status_t zwapi_request_neighbor_update(zwave_node_id_t bNodeID, void(*completedFunc)(uint8_t))
Start neighbor discovery for bNodeID.
Definition: zwapi_protocol_controller.c:27
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.
Definition: zwapi_protocol_controller.c:898
bool zwapi_is_node_primary_ctrl(void)
Query whether the controller is a primary controller or a secondary controller in the network.
Definition: zwapi_protocol_controller.c:580
sl_status_t zwapi_request_network_update(void(*completedFunc)(uint8_t txStatus))
Request network topology updates from the SUC/SIS node.
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.
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.
Definition: zwapi_protocol_controller.c:841
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.
Definition: zwapi_protocol_controller.c:607
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...
Definition: zwapi_protocol_controller.c:447
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.
Definition: zwapi_protocol_controller.c:660
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.
Definition: zwapi_protocol_controller.c:740
uint32_t sl_status_t
Definition: sl_status.h:139
uint8_t zwave_nodemask_t[ZW_LR_MAX_NODEMASK_LENGTH]
Node mask.
Definition: zwave_node_id_definitions.h:81
uint16_t zwave_node_id_t
Z-Wave NodeID type.
Definition: zwave_node_id_definitions.h:84
SL Status Codes.
Learn mode state information passed by the call back function.
Definition: zwapi_protocol_controller.h:328
uint8_t bLen
Node info length.
Definition: zwapi_protocol_controller.h:332
uint8_t * pCmd
Pointer to Application Node information.
Definition: zwapi_protocol_controller.h:331
uint8_t bStatus
Status of learn mode.
Definition: zwapi_protocol_controller.h:329
zwave_node_id_t bSource
Node id of the node that send node info.
Definition: zwapi_protocol_controller.h:330
Definition: zwapi_protocol_controller.h:315
uint8_t multiDestsNodeMask
Definition: zwapi_protocol_controller.h:324
uint8_t multiDestsOffset_NodeMaskLen
Definition: zwapi_protocol_controller.h:320
Node type structure, used in Node Information Frames.
Definition: zwave_node_id_definitions.h:128
Definition: zwapi_protocol_controller.h:338
uint8_t capability
Network capabilities.
Definition: zwapi_protocol_controller.h:339
uint8_t reserved
Definition: zwapi_protocol_controller.h:341
uint8_t security
Network security.
Definition: zwapi_protocol_controller.h:340
node_type_t node_type
Basic, Generic and Specific Device types - Basic is generated...
Definition: zwapi_protocol_controller.h:343
Detailed report and data about Z-Wave transmissions.
Definition: zwapi_protocol_transport.h:225
const zwave_node_id_t node_id
Z-Wave API for transport application layer interface.
static send_data_state_t state
Definition: zwave_crc16_transport.c:52