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