Trident IoT Z-Wave SDK
 
Loading...
Searching...
No Matches
ZW_controller_api.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Silicon Laboratories Inc. <https://www.silabs.com/>
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
10#ifndef _ZW_CONTROLLER_API_H_
11#define _ZW_CONTROLLER_API_H_
12
13#ifdef ZW_CONTROLLER
14
15/* These are a part of the standard controller API */
16#include <ZW_basis_api.h>
17#include <NodeMask.h>
18
19
27/* Mode parameters to ZW_AddNodeToNetwork */
28#define ADD_NODE_ANY 1
29#define ADD_NODE_CONTROLLER 2
30#define ADD_NODE_SLAVE 3
31#define ADD_NODE_EXISTING 4
32#define ADD_NODE_STOP 5
33#define ADD_NODE_STOP_FAILED 6
34#define ADD_NODE_RESERVED 7
35#define ADD_NODE_HOME_ID 8
36#define ADD_NODE_SMART_START 9
37
38#define ADD_NODE_MODE_MASK 0x0F
39#define ADD_NODE_OPTION_NORMAL_POWER 0x80
40#define ADD_NODE_OPTION_NETWORK_WIDE 0x40
41#define ADD_NODE_OPTION_LR 0x20
42#define ADD_NODE_OPTION_NO_FL_SEARCH 0x10
43
44/* Callback states from ZW_AddNodeToNetwork */
45#define ADD_NODE_STATUS_LEARN_READY 1
46#define ADD_NODE_STATUS_NODE_FOUND 2
47#define ADD_NODE_STATUS_ADDING_SLAVE 3
48#define ADD_NODE_STATUS_ADDING_CONTROLLER 4
49#define ADD_NODE_STATUS_PROTOCOL_DONE 5
50#define ADD_NODE_STATUS_DONE 6
51#define ADD_NODE_STATUS_FAILED 7
52#define ADD_NODE_STATUS_FIND_NEIGHBORS_DONE 11 // Sent if SFLND == true
53#define ADD_NODE_STATUS_NOT_PRIMARY 0x23
54
55/* Mode parameters to ZW_RemoveNodeFromNetwork/ZW_RemoveNodeIDFromNetwork */
56#define REMOVE_NODE_ANY ADD_NODE_ANY
57#define REMOVE_NODE_CONTROLLER ADD_NODE_CONTROLLER
58#define REMOVE_NODE_SLAVE ADD_NODE_SLAVE
59#define REMOVE_NODE_STOP ADD_NODE_STOP
60
61#define REMOVE_NODE_MODE_MASK ADD_NODE_MODE_MASK
62#define REMOVE_NODE_OPTION_NORMAL_POWER ADD_NODE_OPTION_NORMAL_POWER
63#define REMOVE_NODE_OPTION_NETWORK_WIDE ADD_NODE_OPTION_NETWORK_WIDE
64
65/* Node paramter to ZW_RemoveNodeIDFromNetwork */
66#define REMOVE_NODE_ID_ANY 0
67
68/* Callback states from ZW_RemoveNodeFromNetwork/ZW_RemoveNodeIDFromNetwork */
69#define REMOVE_NODE_STATUS_LEARN_READY ADD_NODE_STATUS_LEARN_READY
70#define REMOVE_NODE_STATUS_NODE_FOUND ADD_NODE_STATUS_NODE_FOUND
71#define REMOVE_NODE_STATUS_REMOVING_SLAVE ADD_NODE_STATUS_ADDING_SLAVE
72#define REMOVE_NODE_STATUS_REMOVING_CONTROLLER ADD_NODE_STATUS_ADDING_CONTROLLER
73#define REMOVE_NODE_STATUS_DONE ADD_NODE_STATUS_DONE
74#define REMOVE_NODE_STATUS_FAILED ADD_NODE_STATUS_FAILED
75
76/* Mode parameters to ZW_CreateNewPrimary */
77#define CREATE_PRIMARY_START ADD_NODE_CONTROLLER
78#define CREATE_PRIMARY_STOP ADD_NODE_STOP
79#define CREATE_PRIMARY_STOP_FAILED ADD_NODE_STOP_FAILED
80
81/* Mode parameters to ZW_ControllerChange */
82#define CONTROLLER_CHANGE_START ADD_NODE_CONTROLLER
83#define CONTROLLER_CHANGE_STOP ADD_NODE_STOP
84#define CONTROLLER_CHANGE_STOP_FAILED ADD_NODE_STOP_FAILED
85
86/* Callback states from ZW_SetLearnMode */
87#define LEARN_MODE_STARTED ADD_NODE_STATUS_LEARN_READY
88#define LEARN_MODE_DONE ADD_NODE_STATUS_DONE
89#define LEARN_MODE_FAILED ADD_NODE_STATUS_FAILED
90
91/* Callback states from ZW_REQUEST_NODE_NEIGHBOR_UPDATE */
92#define REQUEST_NEIGHBOR_UPDATE_STARTED 0x21
93#define REQUEST_NEIGHBOR_UPDATE_DONE 0x22
94#define REQUEST_NEIGHBOR_UPDATE_FAILED 0x23
95
96/* ApplicationcControllerUpdate status */
97#define UPDATE_STATE_SUC_ID 0x10
98#define UPDATE_STATE_DELETE_DONE 0x20
99#define UPDATE_STATE_NEW_ID_ASSIGNED 0x40
100#define UPDATE_STATE_ROUTING_PENDING 0x80
101#define UPDATE_STATE_NODE_INFO_REQ_FAILED 0x81
102#define UPDATE_STATE_NODE_INFO_REQ_DONE 0x82
103#define UPDATE_STATE_NOP_POWER_RECEIVED 0x83
104#define UPDATE_STATE_NODE_INFO_RECEIVED 0x84
105#define UPDATE_STATE_NODE_INFO_SMARTSTART_HOMEID_RECEIVED 0x85
106#define UPDATE_STATE_INCLUDED_NODE_INFO_RECEIVED 0x86
107#define UPDATE_STATE_NODE_INFO_SMARTSTART_HOMEID_RECEIVED_LR 0x87
108
109/* ZW_GetNeighborCount special return values */
110#define NEIGHBORS_ID_INVALID 0xFE
111#define NEIGHBORS_COUNT_FAILED 0xFF /* Could not access routing info try again later */
112
113
114/* ZW_RemoveFailedNode and ZW_ReplaceFailedNode return value definitions */
115#define NOT_PRIMARY_CONTROLLER 1 /* The removing process was */
116 /* aborted because the controller */
117 /* is not the primary one */
118
119#define NO_CALLBACK_FUNCTION 2 /* The removing process was */
120 /* aborted because no call back */
121 /* function is used */
122#define FAILED_NODE_NOT_FOUND 3 /* The removing process aborted */
123 /* because the node was node */
124 /* found */
125#define FAILED_NODE_REMOVE_PROCESS_BUSY 4 /* The removing process is busy */
126#define FAILED_NODE_REMOVE_FAIL 5 /* The removing process could not */
127 /* be started */
128#define ZW_FAILED_NODE_REMOVE_STARTED 0 /* The removing/replacing failed node process started */
129#define ZW_NOT_PRIMARY_CONTROLLER (1 << NOT_PRIMARY_CONTROLLER)
130#define ZW_NO_CALLBACK_FUNCTION (1 << NO_CALLBACK_FUNCTION)
131#define ZW_FAILED_NODE_NOT_FOUND (1 << FAILED_NODE_NOT_FOUND)
132#define ZW_FAILED_NODE_REMOVE_PROCESS_BUSY (1 << FAILED_NODE_REMOVE_PROCESS_BUSY)
133#define ZW_FAILED_NODE_REMOVE_FAIL (1 << FAILED_NODE_REMOVE_FAIL)
134/* ZW_RemoveFailedNode and ZW_ReplaceFailedNode callback status definitions */
135#define ZW_NODE_OK 0 /* The node is working properly (removed from the failed nodes list ) */
136
137/* ZW_RemoveFailedNode callback status definitions */
138#define ZW_FAILED_NODE_REMOVED 1 /* The failed node was removed from the failed nodes list */
139#define ZW_FAILED_NODE_NOT_REMOVED 2 /* The failed node was not removed from the failing nodes list */
140
141/* ZW_ReplaceFailedNode callback status definitions */
142#define ZW_FAILED_NODE_REPLACE 3 /* The failed node are ready to be replaced and controller */
143 /* is ready to add new node with nodeID of the failed node */
144#define ZW_FAILED_NODE_REPLACE_DONE 4 /* The failed node has been replaced */
145#define ZW_FAILED_NODE_REPLACE_FAILED 5 /* The failed node has not been replaced */
146
147
148/* ZW_RequestNetworkUpdate callback values*/
149#define ZW_SUC_UPDATE_DONE 0x00
150#define ZW_SUC_UPDATE_ABORT 0x01
151#define ZW_SUC_UPDATE_WAIT 0x02
152#define ZW_SUC_UPDATE_DISABLED 0x03
153#define ZW_SUC_UPDATE_OVERFLOW 0x04
154
155#define ZW_SUC_SET_SUCCEEDED 0x05
156#define ZW_SUC_SET_FAILED 0x06
157
158/* SUC capabilities used in ZW_SetSUCNodeID */
159#define ZW_SUC_FUNC_NODEID_SERVER 0x01
160
161/* Defines for ZW_GetControllerCapabilities */
162#define CONTROLLER_IS_SECONDARY 0x01 /* - If bit is set then the controller is a secondary controller */
163#define CONTROLLER_ON_OTHER_NETWORK 0x02 /* - If this bit is set then this controller is not using its built-in home ID */
164#define CONTROLLER_NODEID_SERVER_PRESENT 0x04 /* - If this bit is set then there is a SUC ID server (SIS) in the */
165 /* network and this controller can therefore include/exclude nodes */
166 /* in the network. This is called an inclusion controller */
167#define CONTROLLER_IS_REAL_PRIMARY 0x08 /* - If this bit is set then this controller was the original primary controller */
168 /* in the network before the SIS was added to the network */
169#define CONTROLLER_IS_SUC 0x10 /* - If this bit is set then this controller is a SUC */
170#define NO_NODES_INCLUDED 0x20 /* - If this bit is set then no nodes are included */
171
172/* Z-Wave RF speed definitions */
173#define ZW_RF_SPEED_NONE 0x0000
174#define ZW_RF_SPEED_9600 0x0001
175#define ZW_RF_SPEED_40K 0x0002
176#define ZW_RF_SPEED_100K 0x0003
177#define ZW_RF_SPEED_100KLR 0x0004
178#define ZW_RF_SPEED_MASK 0x0007
179
180/* Z-Wave Long Range Channel */
181#define ZW_LR_CHANNEL_A 0x01
182#define ZW_LR_CHANNEL_B 0x02
183#define ZW_LR_CHANNEL_AUTO 0xFF
184
185/* ZW_GetRoutingInfo() options */
186#define GET_ROUTING_INFO_REMOVE_BAD 0x80
187#define GET_ROUTING_INFO_REMOVE_NON_REPS 0x40
188#define ZW_GET_ROUTING_INFO_ANY ZW_RF_SPEED_NONE
189#define ZW_GET_ROUTING_INFO_9600 ZW_RF_SPEED_9600
190#define ZW_GET_ROUTING_INFO_40K ZW_RF_SPEED_40K
191#define ZW_GET_ROUTING_INFO_100K ZW_RF_SPEED_100K
192#define ZW_GET_ROUTING_INFO_100KLR ZW_RF_SPEED_100KLR
193#define ZW_GET_ROUTING_INFO_SPEED_MASK ZW_RF_SPEED_MASK
194
195/* Listening bit in the NODEINFO capability byte */
196#define NODEINFO_LISTENING_SUPPORT 0x80
197/* Routing bit in the NODEINFO capability byte */
198#define NODEINFO_ROUTING_SUPPORT 0x40
199
200/* Optional functionality bit in the NODEINFO security byte*/
201#define NODEINFO_OPTIONAL_FUNC_SUPPORT 0x80
202
203/* Beam wakeup mode type bits in the NODEINFO security byte */
204#define NODEINFO_ZWAVE_SENSOR_MODE_WAKEUP_1000 0x40
205#define NODEINFO_ZWAVE_SENSOR_MODE_WAKEUP_250 0x20
206
207/* Learn node state information passed by the call back function */
208typedef struct _LEARN_INFO_T_
209{
210 uint8_t bStatus; /* Status of learn mode */
211 node_id_t bSource; /* Node id of the node that send node info */
212 uint8_t *pCmd; /* Pointer to Application Node information */
213 uint8_t bLen; /* Node info length */
214} LEARN_INFO_T;
215
216/* Learn node "Application Node information" passed by call back function */
217/* to Application when controller is in SMART START mode and an aspiring */
218/* nodeinformation frame is received */
219typedef struct _LEARN_INFO_SMARTSTART_
220{
221 uint8_t homeID[HOMEID_LENGTH]; /* HomeID the Nodeinfo was received with */
222 uint8_t nodeInfoLength; /* Length of NodeInfo parameters */
223 NODE_TYPE nodeType; /* Basic, Generic and Specific Device Type */
224 uint8_t nodeInfo[NODEPARM_MAX]; /* Device status */
225} LEARN_INFO_SMARTSTART;
226
227typedef void (*learn_mode_callback_t)(LEARN_INFO_T *);
228
232#define INIF_OPTIONS_TX_REASON_MASK 0x03
233
237typedef struct _CONTROLLER_UPDATE_INCLUDED_NODE_INFORMATION_FRAME_
238{
239 uint8_t bINIFrxStatus;
240 uint8_t abINIFsmartStartNWIHomeID[HOMEID_LENGTH]; /* homeID used when using Smart Start */
241} CONTROLLER_UPDATE_INCLUDED_NODE_INFORMATION_FRAME;
242
243
244/* Route definitions defining Route structure used in */
245/* ZW_GetPriorityRoute/ZW_GetLastWorkingRoute and ZW_SetPriorityRoute/ZW_SetLastWorkingRoute */
246#define ROUTECACHE_LINE_CONF_SIZE 1
247#define ROUTECACHE_LINE_SIZE (MAX_REPEATERS + ROUTECACHE_LINE_CONF_SIZE)
248
249/* PriorityRoute/LastWorkingRoute index definitions */
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
255
256/* ZW_GetPriorityRoute and ZW_SetPriorityRoute speed definitions */
257#define ZW_PRIORITY_ROUTE_SPEED_9600 ZW_RF_SPEED_9600
258#define ZW_PRIORITY_ROUTE_SPEED_40K ZW_RF_SPEED_40K
259#define ZW_PRIORITY_ROUTE_SPEED_100K ZW_RF_SPEED_100K
260
261/* ZW_GetPriorityRoute function return value definitions */
262/* Route returned is a Application defined Priority Route - APP_PR */
263#define ZW_PRIORITY_ROUTE_APP_PR 0x10
264/* Route returned is a Last Working Route - ZW_LWR */
265#define ZW_PRIORITY_ROUTE_ZW_LWR 0x01
266/* Route returned is a Next to Last Working Route - ZW_NLWR */
267#define ZW_PRIORITY_ROUTE_ZW_NLWR 0x02
268
269/* Obsolete - ZW_GetLastWorkingRoute and ZW_SetLastWorkingRoute speed definitions */
270#define ZW_LAST_WORKING_ROUTE_SPEED_9600 ZW_PRIORITY_ROUTE_SPEED_9600
271#define ZW_LAST_WORKING_ROUTE_SPEED_40K ZW_PRIORITY_ROUTE_SPEED_40K
272#define ZW_LAST_WORKING_ROUTE_SPEED_100K ZW_PRIORITY_ROUTE_SPEED_100K
273
276
277#endif /* ZW_CONTROLLER */
278
279#endif /* _ZW_CONTROLLER_API_H_ */
280
#define HOMEID_LENGTH
Number of bytes in a homeID.
Definition ZW_transport_api.h:42
#define NODEPARM_MAX
max. number of parameters
Definition ZW_transport_api.h:41
uint16_t node_id_t
Node ID type.
Definition zpal_radio.h:230
Definition ZW_basis_api.h:50