32019fc9974edddf4969b201f3e6cccd64a4e237
1 /**************************************************************************************************\r
2 * Filename: cmdLine.c\r
3 * Description: This file contains cmdLine application.\r
4 *\r
5 *\r
6 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/\r
7 *\r
8 *\r
9 * Redistribution and use in source and binary forms, with or without\r
10 * modification, are permitted provided that the following conditions\r
11 * are met:\r
12 *\r
13 * Redistributions of source code must retain the above copyright\r
14 * notice, this list of conditions and the following disclaimer.\r
15 *\r
16 * Redistributions in binary form must reproduce the above copyright\r
17 * notice, this list of conditions and the following disclaimer in the\r
18 * documentation and/or other materials provided with the\r
19 * distribution.\r
20 *\r
21 * Neither the name of Texas Instruments Incorporated nor the names of\r
22 * its contributors may be used to endorse or promote products derived\r
23 * from this software without specific prior written permission.\r
24 *\r
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
36 *\r
37 */\r
38 \r
39 /*********************************************************************\r
40 * INCLUDES\r
41 */\r
42 #include <string.h>\r
43 #include <stdio.h>\r
44 #include <unistd.h>\r
45 #include <stdlib.h>\r
46 \r
47 #include "rpc.h"\r
48 #include "mtSys.h"\r
49 #include "mtZdo.h"\r
50 #include "mtAf.h"\r
51 #include "mtParser.h"\r
52 #include "mtSapi.h"\r
53 #include "rpcTransport.h"\r
54 #include "dbgPrint.h"\r
55 #include "hostConsole.h"\r
56 \r
57 /*********************************************************************\r
58 * MACROS\r
59 */\r
60 #define KNRM "\x1B[0m"\r
61 #define KRED "\x1B[31m"\r
62 #define KGRN "\x1B[32m"\r
63 #define KYEL "\x1B[33m"\r
64 #define KBLU "\x1B[34m"\r
65 #define KMAG "\x1B[35m"\r
66 #define KCYN "\x1B[36m"\r
67 #define KWHT "\x1B[37m"\r
68 \r
69 #define SET_RSP_COLOR(); consolePrint("%s", KYEL);\r
70 #define SET_HELP_COLOR(); consolePrint("%s", KGRN);\r
71 #define SET_PARAM_COLOR(); consolePrint("%s", KCYN);\r
72 #define SET_NRM_COLOR(); consolePrint("%s", KNRM);\r
73 \r
74 /*********************************************************************\r
75 * TYPES\r
76 */\r
77 \r
78 /*********************************************************************\r
79 * LOCAL VARIABLE\r
80 */\r
81 \r
82 //init ZDO device state\r
83 devStates_t devState = DEV_HOLD;\r
84 uint8_t gSrcEndPoint = 1;\r
85 uint8_t gDstEndPoint = 1;\r
86 \r
87 /***********************************************************************/\r
88 \r
89 void usage(char* exeName)\r
90 {\r
91 consolePrint("Usage: ./%s <port>\n", exeName);\r
92 consolePrint("Eample: ./%s /dev/ttyACM0\n", exeName);\r
93 }\r
94 \r
95 /*********************************************************************\r
96 * LOCAL FUNCTIONS\r
97 */\r
98 //ZDO Callbacks\r
99 static uint8_t mtZdoStateChangeIndCb(uint8_t newDevState);\r
100 static uint8_t mtZdoGetLinkKeyCb(GetLinkKeySrspFormat_t *msg);\r
101 static uint8_t mtZdoNwkAddrRspCb(NwkAddrRspFormat_t *msg);\r
102 static uint8_t mtZdoIeeeAddrRspCb(IeeeAddrRspFormat_t *msg);\r
103 static uint8_t mtZdoNodeDescRspCb(NodeDescRspFormat_t *msg);\r
104 static uint8_t mtZdoPowerDescRspCb(PowerDescRspFormat_t *msg);\r
105 static uint8_t mtZdoSimpleDescRspCb(SimpleDescRspFormat_t *msg);\r
106 static uint8_t mtZdoActiveEpRspCb(ActiveEpRspFormat_t *msg);\r
107 static uint8_t mtZdoMatchDescRspCb(MatchDescRspFormat_t *msg);\r
108 static uint8_t mtZdoComplexDescRspCb(ComplexDescRspFormat_t *msg);\r
109 static uint8_t mtZdoUserDescRspCb(UserDescRspFormat_t *msg);\r
110 static uint8_t mtZdoUserDescConfCb(UserDescConfFormat_t *msg);\r
111 static uint8_t mtZdoServerDiscRspCb(ServerDiscRspFormat_t *msg);\r
112 static uint8_t mtZdoEndDeviceBindRspCb(EndDeviceBindRspFormat_t *msg);\r
113 static uint8_t mtZdoBindRspCb(BindRspFormat_t *msg);\r
114 static uint8_t mtZdoUnbindRspCb(UnbindRspFormat_t *msg);\r
115 static uint8_t mtZdoMgmtNwkDiscRspCb(MgmtNwkDiscRspFormat_t *msg);\r
116 static uint8_t mtZdoMgmtLqiRspCb(MgmtLqiRspFormat_t *msg);\r
117 static uint8_t mtZdoMgmtRtgRspCb(MgmtRtgRspFormat_t *msg);\r
118 static uint8_t mtZdoMgmtBindRspCb(MgmtBindRspFormat_t *msg);\r
119 static uint8_t mtZdoMgmtLeaveRspCb(MgmtLeaveRspFormat_t *msg);\r
120 static uint8_t mtZdoMgmtDirectJoinRspCb(MgmtDirectJoinRspFormat_t *msg);\r
121 static uint8_t mtZdoMgmtPermitJoinRspCb(MgmtPermitJoinRspFormat_t *msg);\r
122 static uint8_t mtZdoEndDeviceAnnceIndCb(EndDeviceAnnceIndFormat_t *msg);\r
123 static uint8_t mtZdoMatchDescRspSentCb(MatchDescRspSentFormat_t *msg);\r
124 static uint8_t mtZdoStatusErrorRspCb(StatusErrorRspFormat_t *msg);\r
125 static uint8_t mtZdoSrcRtgIndCb(SrcRtgIndFormat_t *msg);\r
126 static uint8_t mtZdoBeaconNotifyIndCb(BeaconNotifyIndFormat_t *msg);\r
127 static uint8_t mtZdoJoinCnfCb(JoinCnfFormat_t *msg);\r
128 static uint8_t mtZdoNwkDiscoveryCnfCb(NwkDiscoveryCnfFormat_t *msg);\r
129 static uint8_t mtZdoLeaveIndCb(LeaveIndFormat_t *msg);\r
130 static uint8_t mtZdoMsgCbIncomingCb(MsgCbIncomingFormat_t *msg);\r
131 \r
132 //SYS Callbacks\r
133 //static uint8_t mtSysResetInd(uint8_t resetReason, uint8_t version[5]);\r
134 static uint8_t mtSysPingSrspCb(PingSrspFormat_t *msg);\r
135 static uint8_t mtSysGetExtAddrSrspCb(GetExtAddrSrspFormat_t *msg);\r
136 static uint8_t mtSysRamReadSrspCb(RamReadSrspFormat_t *msg);\r
137 static uint8_t mtSysResetIndCb(ResetIndFormat_t *msg);\r
138 static uint8_t mtSysVersionSrspCb(VersionSrspFormat_t *msg);\r
139 static uint8_t mtSysOsalNvReadSrspCb(OsalNvReadSrspFormat_t *msg);\r
140 static uint8_t mtSysOsalNvLengthSrspCb(OsalNvLengthSrspFormat_t *msg);\r
141 static uint8_t mtSysOsalTimerExpiredCb(OsalTimerExpiredFormat_t *msg);\r
142 static uint8_t mtSysStackTuneSrspCb(StackTuneSrspFormat_t *msg);\r
143 static uint8_t mtSysAdcReadSrspCb(AdcReadSrspFormat_t *msg);\r
144 static uint8_t mtSysGpioSrspCb(GpioSrspFormat_t *msg);\r
145 static uint8_t mtSysRandomSrspCb(RandomSrspFormat_t *msg);\r
146 static uint8_t mtSysGetTimeSrspCb(GetTimeSrspFormat_t *msg);\r
147 static uint8_t mtSysSetTxPowerSrspCb(SetTxPowerSrspFormat_t *msg);\r
148 \r
149 //AF callbacks\r
150 static uint8_t mtAfDataConfirmCb(DataConfirmFormat_t *msg);\r
151 static uint8_t mtAfIncomingMsgCb(IncomingMsgFormat_t *msg);\r
152 static uint8_t mtAfIncomingMsgExt(IncomingMsgExtFormat_t *msg);\r
153 static uint8_t mtAfDataRetrieveSrspCb(DataRetrieveSrspFormat_t *msg);\r
154 static uint8_t mtAfReflectErrorCb(ReflectErrorFormat_t *msg);\r
155 \r
156 //SAPI Callbacks\r
157 static uint8_t mtSapiReadConfigurationSrspCb(ReadConfigurationSrspFormat_t *msg);\r
158 static uint8_t mtSapiGetDeviceInfoSrspCb(GetDeviceInfoSrspFormat_t *msg);\r
159 static uint8_t mtSapiFindDeviceCnfCb(FindDeviceCnfFormat_t *msg);\r
160 static uint8_t mtSapiSendDataCnfCb(SendDataCnfFormat_t *msg);\r
161 static uint8_t mtSapiReceiveDataIndCb(ReceiveDataIndFormat_t *msg);\r
162 static uint8_t mtSapiAllowBindCnfCb(AllowBindCnfFormat_t *msg);\r
163 static uint8_t mtSapiBindCnfCb(BindCnfFormat_t *msg);\r
164 static uint8_t mtSapiStartCnfCb(StartCnfFormat_t *msg);\r
165 \r
166 //helper functions\r
167 static uint8_t setNVStartup(uint8_t startupOption);\r
168 static uint8_t setNVChanList(uint32_t chanList);\r
169 static uint8_t setNVPanID(uint32_t panId);\r
170 static uint8_t setNVDevType(uint8_t devType);\r
171 static int32_t startNetwork(void);\r
172 static int32_t registerAf(void);\r
173 \r
174 typedef struct\r
175 {\r
176 char *name;\r
177 uint8_t size;\r
178 uint8_t isList;\r
179 } cmdAtt_t;\r
180 \r
181 typedef struct\r
182 {\r
183 char *cmdName;\r
184 char *cmdDesc;\r
185 uint8_t attNum;\r
186 cmdAtt_t atts[20];\r
187 } cmd_t;\r
188 #define COMMANDS_SIZE 72\r
189 \r
190 cmd_t commands[COMMANDS_SIZE];\r
191 \r
192 /*********************************************************************\r
193 * CALLBACK FUNCTIONS\r
194 */\r
195 \r
196 // SYS callbacks\r
197 static mtSysCb_t mtSysCb =\r
198 { mtSysPingSrspCb, mtSysGetExtAddrSrspCb, mtSysRamReadSrspCb,\r
199 mtSysResetIndCb, mtSysVersionSrspCb, mtSysOsalNvReadSrspCb,\r
200 mtSysOsalNvLengthSrspCb, mtSysOsalTimerExpiredCb,\r
201 mtSysStackTuneSrspCb, mtSysAdcReadSrspCb, mtSysGpioSrspCb,\r
202 mtSysRandomSrspCb, mtSysGetTimeSrspCb, mtSysSetTxPowerSrspCb };\r
203 \r
204 static mtZdoCb_t mtZdoCb =\r
205 { mtZdoNwkAddrRspCb, // MT_ZDO_NWK_ADDR_RSP\r
206 mtZdoIeeeAddrRspCb, // MT_ZDO_IEEE_ADDR_RSP\r
207 mtZdoNodeDescRspCb, // MT_ZDO_NODE_DESC_RSP\r
208 mtZdoPowerDescRspCb, // MT_ZDO_POWER_DESC_RSP\r
209 mtZdoSimpleDescRspCb, // MT_ZDO_SIMPLE_DESC_RSP\r
210 mtZdoActiveEpRspCb, // MT_ZDO_ACTIVE_EP_RSP\r
211 mtZdoMatchDescRspCb, // MT_ZDO_MATCH_DESC_RSP\r
212 mtZdoComplexDescRspCb, // MT_ZDO_COMPLEX_DESC_RSP\r
213 mtZdoUserDescRspCb, // MT_ZDO_USER_DESC_RSP\r
214 mtZdoUserDescConfCb, // MT_ZDO_USER_DESC_CONF\r
215 mtZdoServerDiscRspCb, // MT_ZDO_SERVER_DISC_RSP\r
216 mtZdoEndDeviceBindRspCb, // MT_ZDO_END_DEVICE_BIND_RSP\r
217 mtZdoBindRspCb, // MT_ZDO_BIND_RSP\r
218 mtZdoUnbindRspCb, // MT_ZDO_UNBIND_RSP\r
219 mtZdoMgmtNwkDiscRspCb, // MT_ZDO_MGMT_NWK_DISC_RSP\r
220 mtZdoMgmtLqiRspCb, // MT_ZDO_MGMT_LQI_RSP\r
221 mtZdoMgmtRtgRspCb, // MT_ZDO_MGMT_RTG_RSP\r
222 mtZdoMgmtBindRspCb, // MT_ZDO_MGMT_BIND_RSP\r
223 mtZdoMgmtLeaveRspCb, // MT_ZDO_MGMT_LEAVE_RSP\r
224 mtZdoMgmtDirectJoinRspCb, // MT_ZDO_MGMT_DIRECT_JOIN_RSP\r
225 mtZdoMgmtPermitJoinRspCb, // MT_ZDO_MGMT_PERMIT_JOIN_RSP\r
226 mtZdoStateChangeIndCb, // MT_ZDO_STATE_CHANGE_IND\r
227 mtZdoEndDeviceAnnceIndCb, // MT_ZDO_END_DEVICE_ANNCE_IND\r
228 mtZdoSrcRtgIndCb, // MT_ZDO_SRC_RTG_IND\r
229 mtZdoBeaconNotifyIndCb, //MT_ZDO_BEACON_NOTIFY_IND\r
230 mtZdoJoinCnfCb, //MT_ZDO_JOIN_CNF\r
231 mtZdoNwkDiscoveryCnfCb, //MT_ZDO_NWK_DISCOVERY_CNF\r
232 NULL, // MT_ZDO_CONCENTRATOR_IND_CB\r
233 mtZdoLeaveIndCb, // MT_ZDO_LEAVE_IND\r
234 mtZdoStatusErrorRspCb, //MT_ZDO_STATUS_ERROR_RSP\r
235 mtZdoMatchDescRspSentCb, //MT_ZDO_MATCH_DESC_RSP_SENT\r
236 mtZdoMsgCbIncomingCb, mtZdoGetLinkKeyCb };\r
237 \r
238 static mtAfCb_t mtAfCb =\r
239 { mtAfDataConfirmCb, //MT_AF_DATA_CONFIRM\r
240 mtAfIncomingMsgCb, //MT_AF_INCOMING_MSG\r
241 mtAfIncomingMsgExt, //MT_AF_INCOMING_MSG_EXT\r
242 mtAfDataRetrieveSrspCb, //MT_AF_DATA_RETRIEVE\r
243 mtAfReflectErrorCb, //MT_AF_REFLECT_ERROR\r
244 };\r
245 \r
246 // SAPI callbacks\r
247 static mtSapiCb_t mtSapiCb =\r
248 { mtSapiReadConfigurationSrspCb, //MT_SAPI_READ_CONFIGURATION\r
249 mtSapiGetDeviceInfoSrspCb, //MT_SAPI_GET_DEVICE_INFO\r
250 mtSapiFindDeviceCnfCb, //MT_SAPI_FIND_DEVICE_CNF\r
251 mtSapiSendDataCnfCb, //MT_SAPI_SEND_DATA_CNF\r
252 mtSapiReceiveDataIndCb, //MT_SAPI_RECEIVE_DATA_IND\r
253 mtSapiAllowBindCnfCb, //MT_SAPI_ALLOW_BIND_CNF\r
254 mtSapiBindCnfCb, //MT_SAPI_BIND_CNF\r
255 mtSapiStartCnfCb, //MT_SAPI_START_CNF\r
256 };\r
257 \r
258 static void InitCmds(void)\r
259 {\r
260 \r
261 commands[0].cmdName = "SYS_PING";\r
262 commands[0].cmdDesc =\r
263 " This command issues PING requests to verify if a device is active and check the\n"\r
264 " capability of the device.\n";\r
265 commands[0].attNum = 0;\r
266 commands[1].cmdName = "SYS_SET_EXTADDR";\r
267 commands[1].cmdDesc =\r
268 " This command is used to set the extended address of the device.\n";\r
269 commands[1].attNum = 1;\r
270 commands[1].atts[0].name = "ExtAddr";\r
271 commands[1].atts[0].size = 8;\r
272 commands[1].atts[0].isList = 0;\r
273 commands[2].cmdName = "SYS_GET_EXTADDR";\r
274 commands[2].cmdDesc =\r
275 " This command is used to get the extended address of the device.\n";\r
276 commands[2].attNum = 0;\r
277 commands[3].cmdName = "SYS_RAM_READ";\r
278 commands[3].cmdDesc =\r
279 " This command is used by the tester to read a single memory location in the target\n"\r
280 " RAM. The command accepts an address value and returns the memory value present in\n"\r
281 " the target RAM at that address.\n";\r
282 commands[3].attNum = 2;\r
283 commands[3].atts[0].name = "Address";\r
284 commands[3].atts[0].size = 2;\r
285 commands[3].atts[0].isList = 0;\r
286 commands[3].atts[1].name = "Len";\r
287 commands[3].atts[1].size = 1;\r
288 commands[3].atts[1].isList = 0;\r
289 commands[4].cmdName = "SYS_RAM_WRITE";\r
290 commands[4].cmdDesc =\r
291 " This command is used by the tester to write to a particular location in the target\n"\r
292 " RAM. The command accepts an address location and a memory value. The memory value\n"\r
293 " is written to the address location in the target RAM.\n";\r
294 commands[4].attNum = 3;\r
295 commands[4].atts[0].name = "Address";\r
296 commands[4].atts[0].size = 2;\r
297 commands[4].atts[0].isList = 0;\r
298 commands[4].atts[1].name = "Len";\r
299 commands[4].atts[1].size = 1;\r
300 commands[4].atts[1].isList = 0;\r
301 commands[4].atts[2].name = "Value";\r
302 commands[4].atts[2].size = 1;\r
303 commands[4].atts[2].isList = 128;\r
304 commands[5].cmdName = "SYS_RESET_REQ";\r
305 commands[5].cmdDesc =\r
306 " This command is sent by the tester to reset the target device.\n";\r
307 commands[5].attNum = 1;\r
308 commands[5].atts[0].name = "Type";\r
309 commands[5].atts[0].size = 1;\r
310 commands[5].atts[0].isList = 0;\r
311 commands[6].cmdName = "SYS_VERSION";\r
312 commands[6].cmdDesc =\r
313 " This command is used to request for the device\'s version string.\n";\r
314 commands[6].attNum = 0;\r
315 commands[7].cmdName = "SYS_OSAL_NV_READ";\r
316 commands[7].cmdDesc =\r
317 " This command is used by the tester to read a single memory item from the target\n"\r
318 " non-volatile memory. The command accepts an attribute Id value and data offset and\n"\r
319 " returns the memory value present in the target for the specified attribute Id.\n";\r
320 commands[7].attNum = 2;\r
321 commands[7].atts[0].name = "Id";\r
322 commands[7].atts[0].size = 2;\r
323 commands[7].atts[0].isList = 0;\r
324 commands[7].atts[1].name = "Offset";\r
325 commands[7].atts[1].size = 1;\r
326 commands[7].atts[1].isList = 0;\r
327 commands[8].cmdName = "SYS_OSAL_NV_WRITE";\r
328 commands[8].cmdDesc =\r
329 " This command is used by the tester to write to a particular item in non-volatile\n"\r
330 " memory. The command accepts an attribute Id, data offset, data length, and attribute\n"\r
331 " value. The attribute value is written to the location specified for the attribute\n"\r
332 " Id in the target.\n";\r
333 commands[8].attNum = 4;\r
334 commands[8].atts[0].name = "Id";\r
335 commands[8].atts[0].size = 2;\r
336 commands[8].atts[0].isList = 0;\r
337 commands[8].atts[1].name = "Offset";\r
338 commands[8].atts[1].size = 1;\r
339 commands[8].atts[1].isList = 0;\r
340 commands[8].atts[2].name = "Len";\r
341 commands[8].atts[2].size = 1;\r
342 commands[8].atts[2].isList = 0;\r
343 commands[8].atts[3].name = "Value";\r
344 commands[8].atts[3].size = 1;\r
345 commands[8].atts[3].isList = 246;\r
346 commands[9].cmdName = "SYS_OSAL_NV_ITEM_INIT";\r
347 commands[9].cmdDesc =\r
348 " This command is used by the tester to write to a particular item in non-volatile\n"\r
349 " memory. The command accepts an attribute Id, data offset, data length, and attribute\n"\r
350 " value. The attribute value is written to the location specified for the attribute\n"\r
351 " Id in the target.\n";\r
352 commands[9].attNum = 4;\r
353 commands[9].atts[0].name = "Id";\r
354 commands[9].atts[0].size = 2;\r
355 commands[9].atts[0].isList = 0;\r
356 commands[9].atts[1].name = "ItemLen";\r
357 commands[9].atts[1].size = 2;\r
358 commands[9].atts[1].isList = 0;\r
359 commands[9].atts[2].name = "InitLen";\r
360 commands[9].atts[2].size = 1;\r
361 commands[9].atts[2].isList = 0;\r
362 commands[9].atts[3].name = "InitData";\r
363 commands[9].atts[3].size = 1;\r
364 commands[9].atts[3].isList = 245;\r
365 commands[10].cmdName = "SYS_OSAL_NV_DELETE";\r
366 commands[10].cmdDesc =\r
367 " This command is used by the tester to delete an item from the non-volatile memory.\n"\r
368 " The ItemLen parameter must match the length of the NV item or the command will fail.\n"\r
369 " Use this command with caution – deleted items cannot be recovered.\n";\r
370 commands[10].attNum = 2;\r
371 commands[10].atts[0].name = "Id";\r
372 commands[10].atts[0].size = 2;\r
373 commands[10].atts[0].isList = 0;\r
374 commands[10].atts[1].name = "ItemLen";\r
375 commands[10].atts[1].size = 2;\r
376 commands[10].atts[1].isList = 0;\r
377 commands[11].cmdName = "SYS_OSAL_NV_LENGTH";\r
378 commands[11].cmdDesc =\r
379 " This command is used by the tester to get the length of an item in non-volatile\n"\r
380 " memory. A returned length of zero indicates that the NV item does not exist.\n";\r
381 commands[11].attNum = 1;\r
382 commands[11].atts[0].name = "Id";\r
383 commands[11].atts[0].size = 2;\r
384 commands[11].atts[0].isList = 0;\r
385 commands[12].cmdName = "SYS_OSAL_START_TIMER";\r
386 commands[12].cmdDesc =\r
387 " This command is used by the tester to start a timer event. The event will expired\n"\r
388 " after the indicated amount of time and a notification will be sent back to the tester.\n";\r
389 commands[12].attNum = 2;\r
390 commands[12].atts[0].name = "Id";\r
391 commands[12].atts[0].size = 1;\r
392 commands[12].atts[0].isList = 0;\r
393 commands[12].atts[1].name = "Timeout";\r
394 commands[12].atts[1].size = 2;\r
395 commands[12].atts[1].isList = 0;\r
396 commands[13].cmdName = "SYS_OSAL_STOP_TIMER";\r
397 commands[13].cmdDesc =\r
398 " This command is used by the tester to stop a timer event.\n";\r
399 commands[13].attNum = 1;\r
400 commands[13].atts[0].name = "Id";\r
401 commands[13].atts[0].size = 1;\r
402 commands[13].atts[0].isList = 0;\r
403 commands[14].cmdName = "SYS_STACK_TUNE";\r
404 commands[14].cmdDesc =\r
405 " This command is used by the tester to tune intricate or arcane settings at runtime.\n";\r
406 commands[14].attNum = 2;\r
407 commands[14].atts[0].name = "Operation";\r
408 commands[14].atts[0].size = 1;\r
409 commands[14].atts[0].isList = 0;\r
410 commands[14].atts[1].name = "Value";\r
411 commands[14].atts[1].size = 1;\r
412 commands[14].atts[1].isList = 0;\r
413 commands[15].cmdName = "SYS_ADC_READ";\r
414 commands[15].cmdDesc =\r
415 " This command reads a value from the ADC based on specified channel and resolution.\n";\r
416 commands[15].attNum = 2;\r
417 commands[15].atts[0].name = "Channel";\r
418 commands[15].atts[0].size = 1;\r
419 commands[15].atts[0].isList = 0;\r
420 commands[15].atts[1].name = "Resolution";\r
421 commands[15].atts[1].size = 1;\r
422 commands[15].atts[1].isList = 0;\r
423 commands[16].cmdName = "SYS_GPIO";\r
424 commands[16].cmdDesc =\r
425 " This command is used by the tester to control the GPIO pins.\n";\r
426 commands[16].attNum = 2;\r
427 commands[16].atts[0].name = "Operation";\r
428 commands[16].atts[0].size = 1;\r
429 commands[16].atts[0].isList = 0;\r
430 commands[16].atts[1].name = "Value";\r
431 commands[16].atts[1].size = 1;\r
432 commands[16].atts[1].isList = 0;\r
433 commands[17].cmdName = "SYS_RANDOM";\r
434 commands[17].cmdDesc =\r
435 " This command is used by the tester to get a random 16-bit number.\n";\r
436 commands[17].attNum = 0;\r
437 commands[18].cmdName = "SYS_SET_TIME";\r
438 commands[18].cmdDesc =\r
439 " This command is used by the tester to set the target system date and time. The time\n"\r
440 " can be specified in seconds since 00:00:00 on January 1, 2000 or in parsed\n"\r
441 " date/time components.\n";\r
442 commands[18].attNum = 7;\r
443 commands[18].atts[0].name = "UTCTime";\r
444 commands[18].atts[0].size = 4;\r
445 commands[18].atts[0].isList = 0;\r
446 commands[18].atts[1].name = "Hour";\r
447 commands[18].atts[1].size = 1;\r
448 commands[18].atts[1].isList = 0;\r
449 commands[18].atts[2].name = "Minute";\r
450 commands[18].atts[2].size = 1;\r
451 commands[18].atts[2].isList = 0;\r
452 commands[18].atts[3].name = "Second";\r
453 commands[18].atts[3].size = 1;\r
454 commands[18].atts[3].isList = 0;\r
455 commands[18].atts[4].name = "Month";\r
456 commands[18].atts[4].size = 1;\r
457 commands[18].atts[4].isList = 0;\r
458 commands[18].atts[5].name = "Day";\r
459 commands[18].atts[5].size = 1;\r
460 commands[18].atts[5].isList = 0;\r
461 commands[18].atts[6].name = "Year";\r
462 commands[18].atts[6].size = 2;\r
463 commands[18].atts[6].isList = 0;\r
464 commands[19].cmdName = "SYS_GET_TIME";\r
465 commands[19].cmdDesc =\r
466 " This command is used by the tester to get the target system date and time. The time\n"\r
467 " is returned in seconds since 00:00:00 on January 1, 2000 and parsed date/time\n"\r
468 " components.\n";\r
469 commands[19].attNum = 0;\r
470 commands[20].cmdName = "SYS_SET_TX_POWER";\r
471 commands[20].cmdDesc =\r
472 " This command is used by the tester to set the target system radio transmit power.\n"\r
473 " The returned TX power is the actual setting applied to the radio – nearest characterized\n"\r
474 " value for the specific radio.\n";\r
475 commands[20].attNum = 1;\r
476 commands[20].atts[0].name = "TxPower";\r
477 commands[20].atts[0].size = 1;\r
478 commands[20].atts[0].isList = 0;\r
479 commands[21].cmdName = "AF_REGISTER";\r
480 commands[21].cmdDesc =\r
481 " This command enables the tester to register an application's endpoint description.\n";\r
482 commands[21].attNum = 9;\r
483 commands[21].atts[0].name = "EndPoint";\r
484 commands[21].atts[0].size = 1;\r
485 commands[21].atts[0].isList = 0;\r
486 commands[21].atts[1].name = "AppProfId";\r
487 commands[21].atts[1].size = 2;\r
488 commands[21].atts[1].isList = 0;\r
489 commands[21].atts[2].name = "AppDeviceId";\r
490 commands[21].atts[2].size = 2;\r
491 commands[21].atts[2].isList = 0;\r
492 commands[21].atts[3].name = "AppDevVer";\r
493 commands[21].atts[3].size = 1;\r
494 commands[21].atts[3].isList = 0;\r
495 commands[21].atts[4].name = "LatencyReq";\r
496 commands[21].atts[4].size = 1;\r
497 commands[21].atts[4].isList = 0;\r
498 commands[21].atts[5].name = "AppNumInClusters";\r
499 commands[21].atts[5].size = 1;\r
500 commands[21].atts[5].isList = 0;\r
501 commands[21].atts[6].name = "AppInClusterList";\r
502 commands[21].atts[6].size = 2;\r
503 commands[21].atts[6].isList = 16;\r
504 commands[21].atts[7].name = "AppNumOutClusters";\r
505 commands[21].atts[7].size = 1;\r
506 commands[21].atts[7].isList = 0;\r
507 commands[21].atts[8].name = "AppOutClusterList";\r
508 commands[21].atts[8].size = 2;\r
509 commands[21].atts[8].isList = 16;\r
510 commands[22].cmdName = "AF_DATA_REQUEST";\r
511 commands[22].cmdDesc =\r
512 " This command is used by the tester to build and send a message through AF layer.\n";\r
513 commands[22].attNum = 9;\r
514 commands[22].atts[0].name = "DstAddr";\r
515 commands[22].atts[0].size = 2;\r
516 commands[22].atts[0].isList = 0;\r
517 commands[22].atts[1].name = "DstEndpoint";\r
518 commands[22].atts[1].size = 1;\r
519 commands[22].atts[1].isList = 0;\r
520 commands[22].atts[2].name = "SrcEndpoint";\r
521 commands[22].atts[2].size = 1;\r
522 commands[22].atts[2].isList = 0;\r
523 commands[22].atts[3].name = "ClusterID";\r
524 commands[22].atts[3].size = 2;\r
525 commands[22].atts[3].isList = 0;\r
526 commands[22].atts[4].name = "TransID";\r
527 commands[22].atts[4].size = 1;\r
528 commands[22].atts[4].isList = 0;\r
529 commands[22].atts[5].name = "Options";\r
530 commands[22].atts[5].size = 1;\r
531 commands[22].atts[5].isList = 0;\r
532 commands[22].atts[6].name = "Radius";\r
533 commands[22].atts[6].size = 1;\r
534 commands[22].atts[6].isList = 0;\r
535 commands[22].atts[7].name = "Len";\r
536 commands[22].atts[7].size = 1;\r
537 commands[22].atts[7].isList = 0;\r
538 commands[22].atts[8].name = "Data";\r
539 commands[22].atts[8].size = 1;\r
540 commands[22].atts[8].isList = 128;\r
541 commands[23].cmdName = "AF_DATA_REQUEST_EXT";\r
542 commands[23].cmdDesc =\r
543 " This extended form of the AF_DATA_REQUEST must be used to send an inter-pan message\n"\r
544 " (note that the target code must be compiled with the INTER_PAN flag defined.) This\n"\r
545 " extended data request must also be used when making a request with a huge data byte\n"\r
546 " count which is defined to be a size that would cause the RPC request to exceed the\n"\r
547 " maximum allowed size:\n \tMT_RPC_DATA_MAX – sizeof(AF_DATA_REQUEST_EXT)\n Where"\r
548 " sizeof(AF_DATA_REQUEST_EXT) counts everything but the data bytes and now stands\n"\r
549 " at 20. When making an AF_DATA_REQUEST_EXT with a huge data byte count, the request\n"\r
550 " shall not contain any data bytes. The huge data buffer is sent over separately as\n"\r
551 " a sequence of one or more AF_DATA_STORE requests. Note that the outgoing huge message\n"\r
552 " is timed-out in 15 seconds; thus all AF_DATA_STORE requests must be completed within\n"\r
553 " 15 seconds of an AF_DATA_REQUEST_EXT with a huge data byte count. And any AF_DATA_REQUEST_EXT\n"\r
554 " with a huge data byte count must be completed (or timed-out) before another will\n"\r
555 " be started. The default timeout can be changed by defining the following to other\n"\r
556 " values:\n \t#if !defined MT_AF_EXEC_CNT\n \t#define MT_AF_EXEC_CNT 15\n \t#endif\n"\r
557 " \t#if !defined MT_AF_EXEC_DLY\n \t#define MT_AF_EXEC_DLY 1000\n \t#endif\n";\r
558 commands[23].attNum = 11;\r
559 commands[23].atts[0].name = "DstAddrMode";\r
560 commands[23].atts[0].size = 1;\r
561 commands[23].atts[0].isList = 0;\r
562 commands[23].atts[1].name = "DstAddr";\r
563 commands[23].atts[1].size = 8;\r
564 commands[23].atts[1].isList = 0;\r
565 commands[23].atts[2].name = "DstEndpoint";\r
566 commands[23].atts[2].size = 1;\r
567 commands[23].atts[2].isList = 0;\r
568 commands[23].atts[3].name = "DstPanID";\r
569 commands[23].atts[3].size = 2;\r
570 commands[23].atts[3].isList = 0;\r
571 commands[23].atts[4].name = "SrcEndpoint";\r
572 commands[23].atts[4].size = 1;\r
573 commands[23].atts[4].isList = 0;\r
574 commands[23].atts[5].name = "ClusterId";\r
575 commands[23].atts[5].size = 2;\r
576 commands[23].atts[5].isList = 0;\r
577 commands[23].atts[6].name = "TransId";\r
578 commands[23].atts[6].size = 1;\r
579 commands[23].atts[6].isList = 0;\r
580 commands[23].atts[7].name = "Options";\r
581 commands[23].atts[7].size = 1;\r
582 commands[23].atts[7].isList = 0;\r
583 commands[23].atts[8].name = "Radius";\r
584 commands[23].atts[8].size = 1;\r
585 commands[23].atts[8].isList = 0;\r
586 commands[23].atts[9].name = "Len";\r
587 commands[23].atts[9].size = 2;\r
588 commands[23].atts[9].isList = 0;\r
589 commands[23].atts[10].name = "Data";\r
590 commands[23].atts[10].size = 1;\r
591 commands[23].atts[10].isList = 230;\r
592 commands[24].cmdName = "AF_DATA_REQUEST_SRC_RTG";\r
593 commands[24].cmdDesc =\r
594 " This command is used by the tester to build and send a message through AF layer\n"\r
595 " using source routing.\n";\r
596 commands[24].attNum = 11;\r
597 commands[24].atts[0].name = "DstAddr";\r
598 commands[24].atts[0].size = 2;\r
599 commands[24].atts[0].isList = 0;\r
600 commands[24].atts[1].name = "DstEndpoint";\r
601 commands[24].atts[1].size = 1;\r
602 commands[24].atts[1].isList = 0;\r
603 commands[24].atts[2].name = "SrcEndpoint";\r
604 commands[24].atts[2].size = 1;\r
605 commands[24].atts[2].isList = 0;\r
606 commands[24].atts[3].name = "ClusterID";\r
607 commands[24].atts[3].size = 2;\r
608 commands[24].atts[3].isList = 0;\r
609 commands[24].atts[4].name = "TransID";\r
610 commands[24].atts[4].size = 1;\r
611 commands[24].atts[4].isList = 0;\r
612 commands[24].atts[5].name = "Options";\r
613 commands[24].atts[5].size = 1;\r
614 commands[24].atts[5].isList = 0;\r
615 commands[24].atts[6].name = "Radius";\r
616 commands[24].atts[6].size = 1;\r
617 commands[24].atts[6].isList = 0;\r
618 commands[24].atts[7].name = "RelayCount";\r
619 commands[24].atts[7].size = 1;\r
620 commands[24].atts[7].isList = 0;\r
621 commands[24].atts[8].name = "RelayList";\r
622 commands[24].atts[8].size = 2;\r
623 commands[24].atts[8].isList = 255;\r
624 commands[24].atts[9].name = "Len";\r
625 commands[24].atts[9].size = 1;\r
626 commands[24].atts[9].isList = 0;\r
627 commands[24].atts[10].name = "Data";\r
628 commands[24].atts[10].size = 1;\r
629 commands[24].atts[10].isList = 128;\r
630 commands[25].cmdName = "AF_INTER_PAN_CTL";\r
631 commands[25].cmdDesc =\r
632 " Inter-Pan control command and data. The data content depends upon the command and\n"\r
633 " the available commands are enumerated as InterPanCtl_t.\n";\r
634 commands[25].attNum = 2;\r
635 commands[25].atts[0].name = "Command";\r
636 commands[25].atts[0].size = 1;\r
637 commands[25].atts[0].isList = 0;\r
638 commands[25].atts[1].name = "Data";\r
639 commands[25].atts[1].size = 1;\r
640 commands[25].atts[1].isList = 3;\r
641 commands[26].cmdName = "AF_DATA_STORE";\r
642 commands[26].cmdDesc =\r
643 " Huge AF data request data buffer store command and data.\n";\r
644 commands[26].attNum = 3;\r
645 commands[26].atts[0].name = "Index";\r
646 commands[26].atts[0].size = 2;\r
647 commands[26].atts[0].isList = 0;\r
648 commands[26].atts[1].name = "Length";\r
649 commands[26].atts[1].size = 1;\r
650 commands[26].atts[1].isList = 0;\r
651 commands[26].atts[2].name = "Data";\r
652 commands[26].atts[2].size = 1;\r
653 commands[26].atts[2].isList = 247;\r
654 commands[27].cmdName = "AF_DATA_RETRIEVE";\r
655 commands[27].cmdDesc =\r
656 " Huge AF incoming message data buffer retrieve command.\n";\r
657 commands[27].attNum = 3;\r
658 commands[27].atts[0].name = "TimeStamp";\r
659 commands[27].atts[0].size = 4;\r
660 commands[27].atts[0].isList = 0;\r
661 commands[27].atts[1].name = "Index";\r
662 commands[27].atts[1].size = 2;\r
663 commands[27].atts[1].isList = 0;\r
664 commands[27].atts[2].name = "Length";\r
665 commands[27].atts[2].size = 1;\r
666 commands[27].atts[2].isList = 0;\r
667 commands[28].cmdName = "AF_APSF_CONFIG_SET";\r
668 commands[28].cmdDesc = " MT proxy for afAPSF_ConfigSet().\n";\r
669 commands[28].attNum = 3;\r
670 commands[28].atts[0].name = "Endpoint";\r
671 commands[28].atts[0].size = 1;\r
672 commands[28].atts[0].isList = 0;\r
673 commands[28].atts[1].name = "FrameDelay";\r
674 commands[28].atts[1].size = 1;\r
675 commands[28].atts[1].isList = 0;\r
676 commands[28].atts[2].name = "WindowSize";\r
677 commands[28].atts[2].size = 1;\r
678 commands[28].atts[2].isList = 0;\r
679 commands[29].cmdName = "ZDO_NWK_ADDR_REQ";\r
680 commands[29].cmdDesc =\r
681 " This message will request the device to send a Network Address Request.\n"\r
682 " This message sends a broadcast message looking for a 16 bit address with a known\n"\r
683 " 64 bit IEEE address.\n";\r
684 commands[29].attNum = 3;\r
685 commands[29].atts[0].name = "IEEEAddress";\r
686 commands[29].atts[0].size = 8;\r
687 commands[29].atts[0].isList = 0;\r
688 commands[29].atts[1].name = "ReqType";\r
689 commands[29].atts[1].size = 1;\r
690 commands[29].atts[1].isList = 0;\r
691 commands[29].atts[2].name = "StartIndex";\r
692 commands[29].atts[2].size = 1;\r
693 commands[29].atts[2].isList = 0;\r
694 commands[30].cmdName = "ZDO_IEEE_ADDR_REQ";\r
695 commands[30].cmdDesc =\r
696 " This command will request a device's IEEE 64-bit address.\n";\r
697 commands[30].attNum = 3;\r
698 commands[30].atts[0].name = "ShortAddr";\r
699 commands[30].atts[0].size = 2;\r
700 commands[30].atts[0].isList = 0;\r
701 commands[30].atts[1].name = "ReqType";\r
702 commands[30].atts[1].size = 1;\r
703 commands[30].atts[1].isList = 0;\r
704 commands[30].atts[2].name = "StartIndex";\r
705 commands[30].atts[2].size = 1;\r
706 commands[30].atts[2].isList = 0;\r
707 commands[31].cmdName = "ZDO_NODE_DESC_REQ";\r
708 commands[31].cmdDesc =\r
709 " This command is generated to inquire about the Node Descriptor information of the\n"\r
710 " destination device\n";\r
711 commands[31].attNum = 2;\r
712 commands[31].atts[0].name = "DstAddr";\r
713 commands[31].atts[0].size = 2;\r
714 commands[31].atts[0].isList = 0;\r
715 commands[31].atts[1].name = "NwkAddrOfInterest";\r
716 commands[31].atts[1].size = 2;\r
717 commands[31].atts[1].isList = 0;\r
718 commands[32].cmdName = "ZDO_POWER_DESC_REQ";\r
719 commands[32].cmdDesc =\r
720 " This command is generated to inquire about the Power Descriptor information of the\n"\r
721 " destination device.\n";\r
722 commands[32].attNum = 2;\r
723 commands[32].atts[0].name = "DstAddr";\r
724 commands[32].atts[0].size = 2;\r
725 commands[32].atts[0].isList = 0;\r
726 commands[32].atts[1].name = "NwkAddrOfInterest";\r
727 commands[32].atts[1].size = 2;\r
728 commands[32].atts[1].isList = 0;\r
729 commands[33].cmdName = "ZDO_SIMPLE_DESC_REQ";\r
730 commands[33].cmdDesc =\r
731 " This command is generated to inquire as to the Simple Descriptor of the destination\n"\r
732 " devices Endpoint.\n";\r
733 commands[33].attNum = 3;\r
734 commands[33].atts[0].name = "DstAddr";\r
735 commands[33].atts[0].size = 2;\r
736 commands[33].atts[0].isList = 0;\r
737 commands[33].atts[1].name = "NwkAddrOfInterest";\r
738 commands[33].atts[1].size = 2;\r
739 commands[33].atts[1].isList = 0;\r
740 commands[33].atts[2].name = "Endpoint";\r
741 commands[33].atts[2].size = 1;\r
742 commands[33].atts[2].isList = 0;\r
743 commands[34].cmdName = "ZDO_ACTIVE_EP_REQ";\r
744 commands[34].cmdDesc =\r
745 " This command is generated to request a list of active endpoint from the destination\n"\r
746 " device.\n";\r
747 commands[34].attNum = 2;\r
748 commands[34].atts[0].name = "DstAddr";\r
749 commands[34].atts[0].size = 2;\r
750 commands[34].atts[0].isList = 0;\r
751 commands[34].atts[1].name = "NwkAddrOfInterest";\r
752 commands[34].atts[1].size = 2;\r
753 commands[34].atts[1].isList = 0;\r
754 commands[35].cmdName = "ZDO_MATCH_DESC_REQ";\r
755 commands[35].cmdDesc =\r
756 " This command is generated to request the device match descriptor.\n";\r
757 commands[35].attNum = 7;\r
758 commands[35].atts[0].name = "DstAddr";\r
759 commands[35].atts[0].size = 2;\r
760 commands[35].atts[0].isList = 0;\r
761 commands[35].atts[1].name = "NwkAddrOfInterest";\r
762 commands[35].atts[1].size = 2;\r
763 commands[35].atts[1].isList = 0;\r
764 commands[35].atts[2].name = "ProfileID";\r
765 commands[35].atts[2].size = 2;\r
766 commands[35].atts[2].isList = 0;\r
767 commands[35].atts[3].name = "NumInClusters";\r
768 commands[35].atts[3].size = 1;\r
769 commands[35].atts[3].isList = 0;\r
770 commands[35].atts[4].name = "InClusterList";\r
771 commands[35].atts[4].size = 2;\r
772 commands[35].atts[4].isList = 16;\r
773 commands[35].atts[5].name = "NumOutClusters";\r
774 commands[35].atts[5].size = 1;\r
775 commands[35].atts[5].isList = 0;\r
776 commands[35].atts[6].name = "OutClusterList";\r
777 commands[35].atts[6].size = 2;\r
778 commands[35].atts[6].isList = 16;\r
779 commands[36].cmdName = "ZDO_COMPLEX_DESC_REQ";\r
780 commands[36].cmdDesc =\r
781 " This command is generated to request for the destination device’s complex descriptor.\n";\r
782 commands[36].attNum = 2;\r
783 commands[36].atts[0].name = "DstAddr";\r
784 commands[36].atts[0].size = 2;\r
785 commands[36].atts[0].isList = 0;\r
786 commands[36].atts[1].name = "NwkAddrOfInterest";\r
787 commands[36].atts[1].size = 2;\r
788 commands[36].atts[1].isList = 0;\r
789 commands[37].cmdName = "ZDO_USER_DESC_REQ";\r
790 commands[37].cmdDesc =\r
791 " This command is generated to request for the destination device’s user descriptor.\n";\r
792 commands[37].attNum = 2;\r
793 commands[37].atts[0].name = "DstAddr";\r
794 commands[37].atts[0].size = 2;\r
795 commands[37].atts[0].isList = 0;\r
796 commands[37].atts[1].name = "NwkAddrOfInterest";\r
797 commands[37].atts[1].size = 2;\r
798 commands[37].atts[1].isList = 0;\r
799 commands[38].cmdName = "ZDO_DEVICE_ANNCE";\r
800 commands[38].cmdDesc =\r
801 " This command will cause the CC2480 device to issue an “End device announce�\n"\r
802 " broadcast packet to the network. This is typically used by an end-device to announce\n"\r
803 " itself to the network.\n";\r
804 commands[38].attNum = 3;\r
805 commands[38].atts[0].name = "NWKAddr";\r
806 commands[38].atts[0].size = 2;\r
807 commands[38].atts[0].isList = 0;\r
808 commands[38].atts[1].name = "IEEEAddr";\r
809 commands[38].atts[1].size = 8;\r
810 commands[38].atts[1].isList = 0;\r
811 commands[38].atts[2].name = "Capabilities";\r
812 commands[38].atts[2].size = 1;\r
813 commands[38].atts[2].isList = 0;\r
814 commands[39].cmdName = "ZDO_USER_DESC_SET";\r
815 commands[39].cmdDesc =\r
816 " This command is generated to write a User Descriptor value to the targeted device\n";\r
817 commands[39].attNum = 4;\r
818 commands[39].atts[0].name = "DstAddr";\r
819 commands[39].atts[0].size = 2;\r
820 commands[39].atts[0].isList = 0;\r
821 commands[39].atts[1].name = "NwkAddrOfInterest";\r
822 commands[39].atts[1].size = 2;\r
823 commands[39].atts[1].isList = 0;\r
824 commands[39].atts[2].name = "Len";\r
825 commands[39].atts[2].size = 1;\r
826 commands[39].atts[2].isList = 0;\r
827 commands[39].atts[3].name = "UserDescriptor";\r
828 commands[39].atts[3].size = 1;\r
829 commands[39].atts[3].isList = 16;\r
830 commands[40].cmdName = "ZDO_SERVER_DISC_REQ";\r
831 commands[40].cmdDesc =\r
832 " The command is used for local device to discover the location of a particular system\n"\r
833 " server or servers as indicated by the ServerMask parameter. The destination addressing\n"\r
834 " on this request is broadcast to all RxOnWhenIdle devices.\n";\r
835 commands[40].attNum = 1;\r
836 commands[40].atts[0].name = "ServerMask";\r
837 commands[40].atts[0].size = 2;\r
838 commands[40].atts[0].isList = 0;\r
839 commands[41].cmdName = "ZDO_END_DEVICE_BIND_REQ";\r
840 commands[41].cmdDesc =\r
841 " This command is generated to request an End Device Bind with the destination device.\n";\r
842 commands[41].attNum = 9;\r
843 commands[41].atts[0].name = "DstAddr";\r
844 commands[41].atts[0].size = 2;\r
845 commands[41].atts[0].isList = 0;\r
846 commands[41].atts[1].name = "LocalCoordinator";\r
847 commands[41].atts[1].size = 2;\r
848 commands[41].atts[1].isList = 0;\r
849 commands[41].atts[2].name = "CoordinatorIEEE";\r
850 commands[41].atts[2].size = 8;\r
851 commands[41].atts[2].isList = 0;\r
852 commands[41].atts[3].name = "EndPoint";\r
853 commands[41].atts[3].size = 1;\r
854 commands[41].atts[3].isList = 0;\r
855 commands[41].atts[4].name = "ProfileID";\r
856 commands[41].atts[4].size = 2;\r
857 commands[41].atts[4].isList = 0;\r
858 commands[41].atts[5].name = "NumInClusters";\r
859 commands[41].atts[5].size = 1;\r
860 commands[41].atts[5].isList = 0;\r
861 commands[41].atts[6].name = "InClusterList";\r
862 commands[41].atts[6].size = 2;\r
863 commands[41].atts[6].isList = 16;\r
864 commands[41].atts[7].name = "NumOutClusters";\r
865 commands[41].atts[7].size = 1;\r
866 commands[41].atts[7].isList = 0;\r
867 commands[41].atts[8].name = "OutClusterList";\r
868 commands[41].atts[8].size = 2;\r
869 commands[41].atts[8].isList = 16;\r
870 commands[42].cmdName = "ZDO_BIND_REQ";\r
871 commands[42].cmdDesc = " This command is generated to request a Bind.\n";\r
872 commands[42].attNum = 7;\r
873 commands[42].atts[0].name = "DstAddr";\r
874 commands[42].atts[0].size = 2;\r
875 commands[42].atts[0].isList = 0;\r
876 commands[42].atts[1].name = "SrcAddress";\r
877 commands[42].atts[1].size = 8;\r
878 commands[42].atts[1].isList = 0;\r
879 commands[42].atts[2].name = "SrcEndpoint";\r
880 commands[42].atts[2].size = 1;\r
881 commands[42].atts[2].isList = 0;\r
882 commands[42].atts[3].name = "ClusterID";\r
883 commands[42].atts[3].size = 2;\r
884 commands[42].atts[3].isList = 0;\r
885 commands[42].atts[4].name = "DstAddrMode";\r
886 commands[42].atts[4].size = 1;\r
887 commands[42].atts[4].isList = 0;\r
888 commands[42].atts[5].name = "DstAddress";\r
889 commands[42].atts[5].size = 8;\r
890 commands[42].atts[5].isList = 0;\r
891 commands[42].atts[6].name = "DstEndpoint";\r
892 commands[42].atts[6].size = 1;\r
893 commands[42].atts[6].isList = 0;\r
894 commands[43].cmdName = "ZDO_UNBIND_REQ";\r
895 commands[43].cmdDesc =\r
896 " This command is generated to request an un-bind.\n";\r
897 commands[43].attNum = 7;\r
898 commands[43].atts[0].name = "DstAddr";\r
899 commands[43].atts[0].size = 2;\r
900 commands[43].atts[0].isList = 0;\r
901 commands[43].atts[1].name = "SrcAddress";\r
902 commands[43].atts[1].size = 8;\r
903 commands[43].atts[1].isList = 0;\r
904 commands[43].atts[2].name = "SrcEndpoint";\r
905 commands[43].atts[2].size = 1;\r
906 commands[43].atts[2].isList = 0;\r
907 commands[43].atts[3].name = "ClusterID";\r
908 commands[43].atts[3].size = 2;\r
909 commands[43].atts[3].isList = 0;\r
910 commands[43].atts[4].name = "DstAddrMode";\r
911 commands[43].atts[4].size = 1;\r
912 commands[43].atts[4].isList = 0;\r
913 commands[43].atts[5].name = "DstAddress";\r
914 commands[43].atts[5].size = 8;\r
915 commands[43].atts[5].isList = 0;\r
916 commands[43].atts[6].name = "DstEndpoint";\r
917 commands[43].atts[6].size = 1;\r
918 commands[43].atts[6].isList = 0;\r
919 commands[44].cmdName = "ZDO_MGMT_NWK_DISC_REQ";\r
920 commands[44].cmdDesc =\r
921 " This command is generated to request the destination device to perform a network\n"\r
922 " discovery.\n";\r
923 commands[44].attNum = 4;\r
924 commands[44].atts[0].name = "DstAddr";\r
925 commands[44].atts[0].size = 2;\r
926 commands[44].atts[0].isList = 0;\r
927 commands[44].atts[1].name = "ScanChannels";\r
928 commands[44].atts[1].size = 4;\r
929 commands[44].atts[1].isList = 0;\r
930 commands[44].atts[2].name = "ScanDuration";\r
931 commands[44].atts[2].size = 1;\r
932 commands[44].atts[2].isList = 0;\r
933 commands[44].atts[3].name = "StartIndex";\r
934 commands[44].atts[3].size = 1;\r
935 commands[44].atts[3].isList = 0;\r
936 commands[45].cmdName = "ZDO_MGMT_LQI_REQ";\r
937 commands[45].cmdDesc =\r
938 " This command is generated to request the destination device to perform a LQI query\n"\r
939 " of other devices in the network.\n";\r
940 commands[45].attNum = 2;\r
941 commands[45].atts[0].name = "DstAddr";\r
942 commands[45].atts[0].size = 2;\r
943 commands[45].atts[0].isList = 0;\r
944 commands[45].atts[1].name = "StartIndex";\r
945 commands[45].atts[1].size = 1;\r
946 commands[45].atts[1].isList = 0;\r
947 commands[46].cmdName = "ZDO_MGMT_RTG_REQ";\r
948 commands[46].cmdDesc =\r
949 " This command is generated to request the Routing Table of the destination device\n";\r
950 commands[46].attNum = 2;\r
951 commands[46].atts[0].name = "DstAddr";\r
952 commands[46].atts[0].size = 2;\r
953 commands[46].atts[0].isList = 0;\r
954 commands[46].atts[1].name = "StartIndex";\r
955 commands[46].atts[1].size = 1;\r
956 commands[46].atts[1].isList = 0;\r
957 commands[47].cmdName = "ZDO_MGMT_BIND_REQ";\r
958 commands[47].cmdDesc =\r
959 " This command is generated to request the Binding Table of the destination device.\n";\r
960 commands[47].attNum = 2;\r
961 commands[47].atts[0].name = "DstAddr";\r
962 commands[47].atts[0].size = 2;\r
963 commands[47].atts[0].isList = 0;\r
964 commands[47].atts[1].name = "StartIndex";\r
965 commands[47].atts[1].size = 1;\r
966 commands[47].atts[1].isList = 0;\r
967 commands[48].cmdName = "ZDO_MGMT_LEAVE_REQ";\r
968 commands[48].cmdDesc =\r
969 " This command is generated to request a Management Leave Request for the target device\n";\r
970 commands[48].attNum = 3;\r
971 commands[48].atts[0].name = "DstAddr";\r
972 commands[48].atts[0].size = 2;\r
973 commands[48].atts[0].isList = 0;\r
974 commands[48].atts[1].name = "DeviceAddr";\r
975 commands[48].atts[1].size = 8;\r
976 commands[48].atts[1].isList = 0;\r
977 commands[48].atts[2].name = "RemoveChildre_Rejoin";\r
978 commands[48].atts[2].size = 1;\r
979 commands[48].atts[2].isList = 0;\r
980 commands[49].cmdName = "ZDO_MGMT_DIRECT_JOIN_REQ";\r
981 commands[49].cmdDesc =\r
982 " This command is generated to request the Management Direct Join Request of a designated\n"\r
983 " device.\n";\r
984 commands[49].attNum = 3;\r
985 commands[49].atts[0].name = "DstAddr";\r
986 commands[49].atts[0].size = 2;\r
987 commands[49].atts[0].isList = 0;\r
988 commands[49].atts[1].name = "DeviceAddr";\r
989 commands[49].atts[1].size = 8;\r
990 commands[49].atts[1].isList = 0;\r
991 commands[49].atts[2].name = "CapInfo";\r
992 commands[49].atts[2].size = 1;\r
993 commands[49].atts[2].isList = 0;\r
994 commands[50].cmdName = "ZDO_MGMT_PERMIT_JOIN_REQ";\r
995 commands[50].cmdDesc =\r
996 " This command is generated to set the Permit Join for the destination device\n";\r
997 commands[50].attNum = 4;\r
998 commands[50].atts[0].name = "AddrMode";\r
999 commands[50].atts[0].size = 1;\r
1000 commands[50].atts[0].isList = 0;\r
1001 commands[50].atts[1].name = "DstAddr";\r
1002 commands[50].atts[1].size = 2;\r
1003 commands[50].atts[1].isList = 0;\r
1004 commands[50].atts[2].name = "Duration";\r
1005 commands[50].atts[2].size = 1;\r
1006 commands[50].atts[2].isList = 0;\r
1007 commands[50].atts[3].name = "TCSignificance";\r
1008 commands[50].atts[3].size = 1;\r
1009 commands[50].atts[3].isList = 0;\r
1010 commands[51].cmdName = "ZDO_MGMT_NWK_UPDATE_REQ";\r
1011 commands[51].cmdDesc =\r
1012 " This command is provided to allow updating of network configuration parameters or\n"\r
1013 " to request information from devices on network conditions in the local operating\n"\r
1014 " environment.\n";\r
1015 commands[51].attNum = 6;\r
1016 commands[51].atts[0].name = "DstAddr";\r
1017 commands[51].atts[0].size = 2;\r
1018 commands[51].atts[0].isList = 0;\r
1019 commands[51].atts[1].name = "DstAddrMode";\r
1020 commands[51].atts[1].size = 1;\r
1021 commands[51].atts[1].isList = 0;\r
1022 commands[51].atts[2].name = "ChannelMask";\r
1023 commands[51].atts[2].size = 4;\r
1024 commands[51].atts[2].isList = 0;\r
1025 commands[51].atts[3].name = "ScanDuration";\r
1026 commands[51].atts[3].size = 1;\r
1027 commands[51].atts[3].isList = 0;\r
1028 commands[51].atts[4].name = "ScanCount";\r
1029 commands[51].atts[4].size = 1;\r
1030 commands[51].atts[4].isList = 0;\r
1031 commands[51].atts[5].name = "NwkManagerAddr";\r
1032 commands[51].atts[5].size = 2;\r
1033 commands[51].atts[5].isList = 0;\r
1034 commands[52].cmdName = "ZDO_STARTUP_FROM_APP";\r
1035 commands[52].cmdDesc = " This command starts the device in the network.\n";\r
1036 commands[52].attNum = 1;\r
1037 commands[52].atts[0].name = "StartDelay";\r
1038 commands[52].atts[0].size = 2;\r
1039 commands[52].atts[0].isList = 0;\r
1040 commands[53].cmdName = "ZDO_AUTO_FIND_DESTINATION";\r
1041 commands[53].cmdDesc =\r
1042 " This function will issue a Match Description Request for the requested endpoint\n"\r
1043 " outputs. This message will generate a broadcast message.\n";\r
1044 commands[53].attNum = 1;\r
1045 commands[53].atts[0].name = "Endpoint";\r
1046 commands[53].atts[0].size = 1;\r
1047 commands[53].atts[0].isList = 0;\r
1048 commands[54].cmdName = "ZDO_SET_LINK_KEY";\r
1049 commands[54].cmdDesc =\r
1050 " This command sets the application link key for a given device.\n";\r
1051 commands[54].attNum = 3;\r
1052 commands[54].atts[0].name = "ShortAddr";\r
1053 commands[54].atts[0].size = 2;\r
1054 commands[54].atts[0].isList = 0;\r
1055 commands[54].atts[1].name = "IEEEaddr";\r
1056 commands[54].atts[1].size = 8;\r
1057 commands[54].atts[1].isList = 0;\r
1058 commands[54].atts[2].name = "LinkKeyData";\r
1059 commands[54].atts[2].size = 16;\r
1060 commands[54].atts[2].isList = 0;\r
1061 commands[55].cmdName = "ZDO_REMOVE_LINK_KEY";\r
1062 commands[55].cmdDesc =\r
1063 " This command removes the application link key of a given device.\n";\r
1064 commands[55].attNum = 1;\r
1065 commands[55].atts[0].name = "IEEEaddr";\r
1066 commands[55].atts[0].size = 8;\r
1067 commands[55].atts[0].isList = 0;\r
1068 commands[56].cmdName = "ZDO_GET_LINK_KEY";\r
1069 commands[56].cmdDesc =\r
1070 " This command retrieves the application link key of a given device.\n";\r
1071 commands[56].attNum = 1;\r
1072 commands[56].atts[0].name = "IEEEaddr";\r
1073 commands[56].atts[0].size = 8;\r
1074 commands[56].atts[0].isList = 0;\r
1075 commands[57].cmdName = "ZDO_NWK_DISCOVERY_REQ";\r
1076 commands[57].cmdDesc =\r
1077 " This command is used to initiate a network discovery (active scan).\n";\r
1078 commands[57].attNum = 2;\r
1079 commands[57].atts[0].name = "ScanChannels";\r
1080 commands[57].atts[0].size = 4;\r
1081 commands[57].atts[0].isList = 0;\r
1082 commands[57].atts[1].name = "ScanDuration";\r
1083 commands[57].atts[1].size = 1;\r
1084 commands[57].atts[1].isList = 0;\r
1085 commands[58].cmdName = "ZDO_JOIN_REQ";\r
1086 commands[58].cmdDesc =\r
1087 " This command is used to request the device to join itself to a parent device on\n"\r
1088 " a network.\n";\r
1089 commands[58].attNum = 6;\r
1090 commands[58].atts[0].name = "LogicalChannel";\r
1091 commands[58].atts[0].size = 1;\r
1092 commands[58].atts[0].isList = 0;\r
1093 commands[58].atts[1].name = "PanID";\r
1094 commands[58].atts[1].size = 2;\r
1095 commands[58].atts[1].isList = 0;\r
1096 commands[58].atts[2].name = "ExtendedPanID";\r
1097 commands[58].atts[2].size = 8;\r
1098 commands[58].atts[2].isList = 0;\r
1099 commands[58].atts[3].name = "ChosenParent";\r
1100 commands[58].atts[3].size = 2;\r
1101 commands[58].atts[3].isList = 0;\r
1102 commands[58].atts[4].name = "ParentDepth";\r
1103 commands[58].atts[4].size = 1;\r
1104 commands[58].atts[4].isList = 0;\r
1105 commands[58].atts[5].name = "StackProfile";\r
1106 commands[58].atts[5].size = 1;\r
1107 commands[58].atts[5].isList = 0;\r
1108 commands[59].cmdName = "ZDO_MSG_CB_REGISTER";\r
1109 commands[59].cmdDesc = " This command registers for a ZDO callback.\n";\r
1110 commands[59].attNum = 1;\r
1111 commands[59].atts[0].name = "ClusterID";\r
1112 commands[59].atts[0].size = 2;\r
1113 commands[59].atts[0].isList = 0;\r
1114 commands[60].cmdName = "ZDO_MSG_CB_REMOVE";\r
1115 commands[60].cmdDesc =\r
1116 " This command removes a registration for a ZDO callback\n";\r
1117 commands[60].attNum = 1;\r
1118 commands[60].atts[0].name = "ClusterID";\r
1119 commands[60].atts[0].size = 2;\r
1120 commands[60].atts[0].isList = 0;\r
1121 commands[61].cmdName = "ZB_SYSTEM_RESET";\r
1122 commands[61].cmdDesc =\r
1123 " This command will reset the device by using a soft reset (i.e. a jump to the reset\n"\r
1124 " vector) vice a hardware reset (i.e. watchdog reset.) This is especially useful in\n"\r
1125 " the CC2531, for instance, so that the USB host does not have to contend with the\n"\r
1126 " USB H/W resetting (and thus causing the USB host to re-enumerate the device which\n"\r
1127 " can cause an open virtual serial port to hang.)\n";\r
1128 commands[61].attNum = 0;\r
1129 commands[62].cmdName = "ZB_APP_REGISTER_REQ";\r
1130 commands[62].cmdDesc =\r
1131 " This command enables the application processor to register its application with\n"\r
1132 " a ZNP device.\n";\r
1133 commands[62].attNum = 9;\r
1134 commands[62].atts[0].name = "AppEndpoint";\r
1135 commands[62].atts[0].size = 1;\r
1136 commands[62].atts[0].isList = 0;\r
1137 commands[62].atts[1].name = "AppProfileId";\r
1138 commands[62].atts[1].size = 2;\r
1139 commands[62].atts[1].isList = 0;\r
1140 commands[62].atts[2].name = "DeviceId";\r
1141 commands[62].atts[2].size = 2;\r
1142 commands[62].atts[2].isList = 0;\r
1143 commands[62].atts[3].name = "DeviceVersion";\r
1144 commands[62].atts[3].size = 1;\r
1145 commands[62].atts[3].isList = 0;\r
1146 commands[62].atts[4].name = "Unused";\r
1147 commands[62].atts[4].size = 1;\r
1148 commands[62].atts[4].isList = 0;\r
1149 commands[62].atts[5].name = "InputCommandsNum";\r
1150 commands[62].atts[5].size = 1;\r
1151 commands[62].atts[5].isList = 0;\r
1152 commands[62].atts[6].name = "InputCommandsList";\r
1153 commands[62].atts[6].size = 2;\r
1154 commands[62].atts[6].isList = 255;\r
1155 commands[62].atts[7].name = "OutputCommandsNum";\r
1156 commands[62].atts[7].size = 1;\r
1157 commands[62].atts[7].isList = 0;\r
1158 commands[62].atts[8].name = "OutputCommandsList";\r
1159 commands[62].atts[8].size = 2;\r
1160 commands[62].atts[8].isList = 255;\r
1161 commands[63].cmdName = "ZB_START_REQ";\r
1162 commands[63].cmdDesc =\r
1163 " This command starts the ZigBee stack. When the ZigBee stack starts, the device reads\n"\r
1164 " configuration parameters from nonvolatile memory and the device joins its network.\n"\r
1165 " The ZigBee stack calls the zb_StartConfirm callback function when the startup process\n"\r
1166 " completes. After the start request process completes, the device is ready to send,\n"\r
1167 " receive, and route network traffic.\n";\r
1168 commands[63].attNum = 0;\r
1169 commands[64].cmdName = "ZB_PERMIT_JOINING_REQ";\r
1170 commands[64].cmdDesc =\r
1171 " This command is used to control the joining permissions and thus allows or disallows\n"\r
1172 " new devices from joining the network.\n";\r
1173 commands[64].attNum = 2;\r
1174 commands[64].atts[0].name = "Destination";\r
1175 commands[64].atts[0].size = 2;\r
1176 commands[64].atts[0].isList = 0;\r
1177 commands[64].atts[1].name = "Timeout";\r
1178 commands[64].atts[1].size = 1;\r
1179 commands[64].atts[1].isList = 0;\r
1180 commands[65].cmdName = "ZB_BIND_DEVICE";\r
1181 commands[65].cmdDesc =\r
1182 " This command establishes or removes a ‘binding’ between two devices. Once bound,\n"\r
1183 " an application can send messages to a device by referencing the commandId for the\n"\r
1184 " binding.\n";\r
1185 commands[65].attNum = 3;\r
1186 commands[65].atts[0].name = "Create";\r
1187 commands[65].atts[0].size = 1;\r
1188 commands[65].atts[0].isList = 0;\r
1189 commands[65].atts[1].name = "CommandId";\r
1190 commands[65].atts[1].size = 2;\r
1191 commands[65].atts[1].isList = 0;\r
1192 commands[65].atts[2].name = "DstIeee";\r
1193 commands[65].atts[2].size = 8;\r
1194 commands[65].atts[2].isList = 0;\r
1195 commands[66].cmdName = "ZB_ALLOW_BIND";\r
1196 commands[66].cmdDesc =\r
1197 " This command puts the device into the Allow Binding Mode for a given period of time.\n"\r
1198 " A peer device can establish a binding to a device in the Allow Binding Mode by calling\n"\r
1199 " zb_BindDevice with a destination address of NULL.\n";\r
1200 commands[66].attNum = 1;\r
1201 commands[66].atts[0].name = "Timeout";\r
1202 commands[66].atts[0].size = 1;\r
1203 commands[66].atts[0].isList = 0;\r
1204 commands[67].cmdName = "ZB_SEND_DATA_REQ";\r
1205 commands[67].cmdDesc =\r
1206 " This command initiates transmission of data to a peer device.\n";\r
1207 commands[67].attNum = 7;\r
1208 commands[67].atts[0].name = "Destination";\r
1209 commands[67].atts[0].size = 2;\r
1210 commands[67].atts[0].isList = 0;\r
1211 commands[67].atts[1].name = "CommandId";\r
1212 commands[67].atts[1].size = 2;\r
1213 commands[67].atts[1].isList = 0;\r
1214 commands[67].atts[2].name = "Handle";\r
1215 commands[67].atts[2].size = 1;\r
1216 commands[67].atts[2].isList = 0;\r
1217 commands[67].atts[3].name = "Ack";\r
1218 commands[67].atts[3].size = 1;\r
1219 commands[67].atts[3].isList = 0;\r
1220 commands[67].atts[4].name = "Radius";\r
1221 commands[67].atts[4].size = 1;\r
1222 commands[67].atts[4].isList = 0;\r
1223 commands[67].atts[5].name = "Len";\r
1224 commands[67].atts[5].size = 1;\r
1225 commands[67].atts[5].isList = 0;\r
1226 commands[67].atts[6].name = "Data";\r
1227 commands[67].atts[6].size = 1;\r
1228 commands[67].atts[6].isList = 99;\r
1229 commands[68].cmdName = "ZB_FIND_DEVICE_REQ";\r
1230 commands[68].cmdDesc =\r
1231 " This command is used to determine the short address for a device in the network.\n"\r
1232 " The device initiating a call to zbFindDeviceRequest and the device being discovered\n"\r
1233 " must both be a member of the same network. When the search is complete, the zbFindDeviceConfirm\n"\r
1234 " callback function is called.\n";\r
1235 commands[68].attNum = 1;\r
1236 commands[68].atts[0].name = "SearchKey";\r
1237 commands[68].atts[0].size = 8;\r
1238 commands[68].atts[0].isList = 0;\r
1239 commands[69].cmdName = "ZB_WRITE_CONFIGURATION";\r
1240 commands[69].cmdDesc =\r
1241 " This command is used to write a Configuration Property to nonvolatile memory.\n";\r
1242 commands[69].attNum = 3;\r
1243 commands[69].atts[0].name = "ConfigId";\r
1244 commands[69].atts[0].size = 1;\r
1245 commands[69].atts[0].isList = 0;\r
1246 commands[69].atts[1].name = "Len";\r
1247 commands[69].atts[1].size = 1;\r
1248 commands[69].atts[1].isList = 0;\r
1249 commands[69].atts[2].name = "Value";\r
1250 commands[69].atts[2].size = 1;\r
1251 commands[69].atts[2].isList = 128;\r
1252 commands[70].cmdName = "ZB_GET_DEVICE_INFO";\r
1253 commands[70].cmdDesc =\r
1254 " This command retrieves a Device Information Property.\n";\r
1255 commands[70].attNum = 1;\r
1256 commands[70].atts[0].name = "Param";\r
1257 commands[70].atts[0].size = 1;\r
1258 commands[70].atts[0].isList = 0;\r
1259 commands[71].cmdName = "ZB_READ_CONFIGURATION";\r
1260 commands[71].cmdDesc =\r
1261 " This command is used to get a configuration property from nonvolatile memory.\n";\r
1262 commands[71].attNum = 1;\r
1263 commands[71].atts[0].name = "ConfigId";\r
1264 commands[71].atts[0].size = 1;\r
1265 commands[71].atts[0].isList = 0;\r
1266 }\r
1267 \r
1268 /********************************************************************\r
1269 * START OF SYS CALL BACK FUNCTIONS\r
1270 */\r
1271 \r
1272 static uint8_t mtSysPingSrspCb(PingSrspFormat_t *msg)\r
1273 {\r
1274 SET_RSP_COLOR();\r
1275 consolePrint("mtSysPingSrspCb\n");\r
1276 consolePrint("Capabilities: 0x%04X\n", msg->Capabilities);\r
1277 SET_NRM_COLOR();\r
1278 return 0;\r
1279 }\r
1280 static uint8_t mtSysGetExtAddrSrspCb(GetExtAddrSrspFormat_t *msg)\r
1281 {\r
1282 SET_RSP_COLOR();\r
1283 consolePrint("mtSysGetExtAddrSrspCb\n");\r
1284 consolePrint("ExtAddr: 0x%016llX\n", (long long unsigned int) msg->ExtAddr);\r
1285 SET_NRM_COLOR();\r
1286 return 0;\r
1287 }\r
1288 static uint8_t mtSysRamReadSrspCb(RamReadSrspFormat_t *msg)\r
1289 {\r
1290 SET_RSP_COLOR();\r
1291 consolePrint("mtSysRamReadSrspCb\n");\r
1292 if (msg->Status == MT_RPC_SUCCESS)\r
1293 {\r
1294 consolePrint("Status: 0x%02X\n", msg->Status);\r
1295 consolePrint("Len: 0x%02X\n", msg->Len);\r
1296 uint32_t i;\r
1297 for (i = 0; i < msg->Len; i++)\r
1298 {\r
1299 consolePrint("Value[%d]: 0x%02X\n", i, msg->Value[i]);\r
1300 }\r
1301 }\r
1302 else\r
1303 {\r
1304 consolePrint("RamReadSrsp Status: FAIL 0x%02X\n", msg->Status);\r
1305 }\r
1306 SET_NRM_COLOR();\r
1307 return msg->Status;\r
1308 }\r
1309 static uint8_t mtSysResetIndCb(ResetIndFormat_t *msg)\r
1310 {\r
1311 SET_RSP_COLOR();\r
1312 consolePrint("ZNP Version: %d.%d.%d\n", msg->MajorRel, msg->MinorRel,\r
1313 msg->HwRev);\r
1314 SET_NRM_COLOR();\r
1315 return 0;\r
1316 }\r
1317 static uint8_t mtSysVersionSrspCb(VersionSrspFormat_t *msg)\r
1318 {\r
1319 SET_RSP_COLOR();\r
1320 consolePrint("mtSysVersionSrspCb\n");\r
1321 consolePrint("TransportRev: 0x%02X\n", msg->TransportRev);\r
1322 consolePrint("Product: 0x%02X\n", msg->Product);\r
1323 consolePrint("MajorRel: 0x%02X\n", msg->MajorRel);\r
1324 consolePrint("MinorRel: 0x%02X\n", msg->MinorRel);\r
1325 consolePrint("MaintRel: 0x%02X\n", msg->MaintRel);\r
1326 SET_NRM_COLOR();\r
1327 return 0;\r
1328 }\r
1329 static uint8_t mtSysOsalNvReadSrspCb(OsalNvReadSrspFormat_t *msg)\r
1330 {\r
1331 SET_RSP_COLOR();\r
1332 consolePrint("mtSysOsalNvReadSrspCb\n");\r
1333 if (msg->Status == MT_RPC_SUCCESS)\r
1334 {\r
1335 consolePrint("Status: 0x%02X\n", msg->Status);\r
1336 consolePrint("Len: 0x%02X\n", msg->Len);\r
1337 uint32_t i;\r
1338 for (i = 0; i < msg->Len; i++)\r
1339 {\r
1340 consolePrint("Value[%d]: 0x%02X\n", i, msg->Value[i]);\r
1341 }\r
1342 }\r
1343 else\r
1344 {\r
1345 consolePrint("OsalNvReadSrsp Status: FAIL 0x%02X\n", msg->Status);\r
1346 }\r
1347 SET_NRM_COLOR();\r
1348 return msg->Status;\r
1349 }\r
1350 static uint8_t mtSysOsalNvLengthSrspCb(OsalNvLengthSrspFormat_t *msg)\r
1351 {\r
1352 SET_RSP_COLOR();\r
1353 consolePrint("mtSysOsalNvLengthSrspCb\n");\r
1354 consolePrint("ItemLen: 0x%04X\n", msg->ItemLen);\r
1355 SET_NRM_COLOR();\r
1356 return 0;\r
1357 }\r
1358 static uint8_t mtSysOsalTimerExpiredCb(OsalTimerExpiredFormat_t *msg)\r
1359 {\r
1360 SET_RSP_COLOR();\r
1361 consolePrint("mtSysOsalTimerExpiredCb\n");\r
1362 consolePrint("Id: 0x%02X\n", msg->Id);\r
1363 SET_NRM_COLOR();\r
1364 return 0;\r
1365 }\r
1366 static uint8_t mtSysStackTuneSrspCb(StackTuneSrspFormat_t *msg)\r
1367 {\r
1368 SET_RSP_COLOR();\r
1369 consolePrint("mtSysStackTuneSrspCb\n");\r
1370 consolePrint("Value: 0x%02X\n", msg->Value);\r
1371 SET_NRM_COLOR();\r
1372 return 0;\r
1373 }\r
1374 static uint8_t mtSysAdcReadSrspCb(AdcReadSrspFormat_t *msg)\r
1375 {\r
1376 SET_RSP_COLOR();\r
1377 consolePrint("mtSysAdcReadSrspCb\n");\r
1378 consolePrint("Value: 0x%04X\n", msg->Value);\r
1379 SET_NRM_COLOR();\r
1380 return 0;\r
1381 }\r
1382 static uint8_t mtSysGpioSrspCb(GpioSrspFormat_t *msg)\r
1383 {\r
1384 SET_RSP_COLOR();\r
1385 consolePrint("mtSysGpioSrspCb\n");\r
1386 consolePrint("Value: 0x%02X\n", msg->Value);\r
1387 SET_NRM_COLOR();\r
1388 return 0;\r
1389 }\r
1390 static uint8_t mtSysRandomSrspCb(RandomSrspFormat_t *msg)\r
1391 {\r
1392 SET_RSP_COLOR();\r
1393 consolePrint("mtSysRandomSrspCb\n");\r
1394 consolePrint("Value: 0x%04X\n", msg->Value);\r
1395 SET_NRM_COLOR();\r
1396 return 0;\r
1397 }\r
1398 static uint8_t mtSysGetTimeSrspCb(GetTimeSrspFormat_t *msg)\r
1399 {\r
1400 SET_RSP_COLOR();\r
1401 consolePrint("mtSysGetTimeSrspCb\n");\r
1402 consolePrint("UTCTime: 0x%08X\n", msg->UTCTime);\r
1403 consolePrint("Hour: 0x%02X\n", msg->Hour);\r
1404 consolePrint("Minute: 0x%02X\n", msg->Minute);\r
1405 consolePrint("Second: 0x%02X\n", msg->Second);\r
1406 consolePrint("Month: 0x%02X\n", msg->Month);\r
1407 consolePrint("Day: 0x%02X\n", msg->Day);\r
1408 consolePrint("Year: 0x%04X\n", msg->Year);\r
1409 SET_NRM_COLOR();\r
1410 return 0;\r
1411 }\r
1412 static uint8_t mtSysSetTxPowerSrspCb(SetTxPowerSrspFormat_t *msg)\r
1413 {\r
1414 SET_RSP_COLOR();\r
1415 consolePrint("mtSysSetTxPowerSrspCb\n");\r
1416 consolePrint("TxPower: 0x%02X\n", msg->TxPower);\r
1417 SET_NRM_COLOR();\r
1418 return 0;\r
1419 }\r
1420 /********************************************************************\r
1421 * END OF SYS CALL BACK FUNCTIONS\r
1422 */\r
1423 \r
1424 /********************************************************************\r
1425 * START OF ZDO CALL BACK FUNCTIONS\r
1426 */\r
1427 \r
1428 /********************************************************************\r
1429 * @fn Callback function for ZDO State Change Indication\r
1430 \r
1431 * @brief receives the AREQ status and specifies the change ZDO state\r
1432 *\r
1433 * @param uint8 zdoState\r
1434 *\r
1435 * @return SUCCESS or FAILURE\r
1436 */\r
1437 static uint8_t mtZdoStateChangeIndCb(uint8_t newDevState)\r
1438 {\r
1439 SET_RSP_COLOR();\r
1440 \r
1441 switch ((devStates_t) newDevState)\r
1442 {\r
1443 case DEV_HOLD:\r
1444 dbg_print(PRINT_LEVEL_INFO,\r
1445 "mtZdoStateChangeIndCb: Initialized - not started automatically\n");\r
1446 break;\r
1447 case DEV_INIT:\r
1448 dbg_print(PRINT_LEVEL_INFO,\r
1449 "mtZdoStateChangeIndCb: Initialized - not connected to anything\n");\r
1450 break;\r
1451 case DEV_NWK_DISC:\r
1452 dbg_print(PRINT_LEVEL_INFO,\r
1453 "mtZdoStateChangeIndCb: Discovering PAN's to join\n");\r
1454 consolePrint("Network Discovering\n");\r
1455 break;\r
1456 case DEV_NWK_JOINING:\r
1457 dbg_print(PRINT_LEVEL_INFO, "mtZdoStateChangeIndCb: Joining a PAN\n");\r
1458 consolePrint("Network Joining\n");\r
1459 break;\r
1460 case DEV_NWK_REJOIN:\r
1461 dbg_print(PRINT_LEVEL_INFO,\r
1462 "mtZdoStateChangeIndCb: ReJoining a PAN, only for end devices\n");\r
1463 consolePrint("Network Rejoining\n");\r
1464 break;\r
1465 case DEV_END_DEVICE_UNAUTH:\r
1466 consolePrint("Network Authenticating\n");\r
1467 dbg_print(PRINT_LEVEL_INFO,\r
1468 "mtZdoStateChangeIndCb: Joined but not yet authenticated by trust center\n");\r
1469 break;\r
1470 case DEV_END_DEVICE:\r
1471 consolePrint("Network Joined\n");\r
1472 dbg_print(PRINT_LEVEL_INFO,\r
1473 "mtZdoStateChangeIndCb: Started as device after authentication\n");\r
1474 break;\r
1475 case DEV_ROUTER:\r
1476 consolePrint("Network Joined\n");\r
1477 dbg_print(PRINT_LEVEL_INFO,\r
1478 "mtZdoStateChangeIndCb: Device joined, authenticated and is a router\n");\r
1479 break;\r
1480 case DEV_COORD_STARTING:\r
1481 consolePrint("Network Starting\n");\r
1482 dbg_print(PRINT_LEVEL_INFO,\r
1483 "mtZdoStateChangeIndCb: Started as Zigbee Coordinator\n");\r
1484 break;\r
1485 case DEV_ZB_COORD:\r
1486 consolePrint("Network Started\n");\r
1487 dbg_print(PRINT_LEVEL_INFO,\r
1488 "mtZdoStateChangeIndCb: Started as Zigbee Coordinator\n");\r
1489 break;\r
1490 case DEV_NWK_ORPHAN:\r
1491 consolePrint("Network Orphaned\n");\r
1492 dbg_print(PRINT_LEVEL_INFO,\r
1493 "mtZdoStateChangeIndCb: Device has lost information about its parent\n");\r
1494 break;\r
1495 default:\r
1496 dbg_print(PRINT_LEVEL_INFO, "mtZdoStateChangeIndCb: unknown state");\r
1497 break;\r
1498 }\r
1499 \r
1500 devState = (devStates_t) newDevState;\r
1501 \r
1502 SET_NRM_COLOR();\r
1503 \r
1504 return SUCCESS;\r
1505 }\r
1506 \r
1507 static uint8_t mtZdoGetLinkKeyCb(GetLinkKeySrspFormat_t *msg)\r
1508 {\r
1509 SET_RSP_COLOR();\r
1510 \r
1511 consolePrint("mtZdoGetLinkKeyCb\n");\r
1512 if (msg->Status == MT_RPC_SUCCESS)\r
1513 {\r
1514 consolePrint("Status: 0x%02X\n", msg->Status);\r
1515 consolePrint("IEEEAddr: 0x%016llX\n",\r
1516 (long long unsigned int) msg->IEEEAddr);\r
1517 }\r
1518 else\r
1519 {\r
1520 consolePrint("GetLinkKey Status: FAIL 0x%02X\n", msg->Status);\r
1521 }\r
1522 SET_NRM_COLOR();\r
1523 \r
1524 return msg->Status;\r
1525 }\r
1526 static uint8_t mtZdoNwkAddrRspCb(NwkAddrRspFormat_t *msg)\r
1527 {\r
1528 SET_RSP_COLOR();\r
1529 consolePrint("mtZdoNwkAddrRspCb\n");\r
1530 if (msg->Status == MT_RPC_SUCCESS)\r
1531 {\r
1532 consolePrint("Status: 0x%02X\n", msg->Status);\r
1533 consolePrint("IEEEAddr: 0x%016llX\n",\r
1534 (long long unsigned int) msg->IEEEAddr);\r
1535 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
1536 consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
1537 consolePrint("NumAssocDev: 0x%02X\n", msg->NumAssocDev);\r
1538 uint32_t i;\r
1539 for (i = 0; i < msg->NumAssocDev; i++)\r
1540 {\r
1541 consolePrint("AssocDevList[%d]: 0x%04X\n", i, msg->AssocDevList[i]);\r
1542 }\r
1543 }\r
1544 else\r
1545 {\r
1546 consolePrint("NwkAddrRsp Status: FAIL 0x%02X\n", msg->Status);\r
1547 }\r
1548 SET_NRM_COLOR();\r
1549 \r
1550 return msg->Status;\r
1551 }\r
1552 static uint8_t mtZdoIeeeAddrRspCb(IeeeAddrRspFormat_t *msg)\r
1553 {\r
1554 SET_RSP_COLOR();\r
1555 consolePrint("mtZdoIeeeAddrRspCb\n");\r
1556 if (msg->Status == MT_RPC_SUCCESS)\r
1557 {\r
1558 consolePrint("Status: 0x%02X\n", msg->Status);\r
1559 consolePrint("IEEEAddr: 0x%016llX\n",\r
1560 (long long unsigned int) msg->IEEEAddr);\r
1561 //consolePrint("%08X\n", msg -> IEEEAddr);\r
1562 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
1563 consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
1564 consolePrint("NumAssocDev: 0x%02X\n", msg->NumAssocDev);\r
1565 uint32_t i;\r
1566 for (i = 0; i < msg->NumAssocDev; i++)\r
1567 {\r
1568 consolePrint("AssocDevList[%d]: 0x%04X\n", i, msg->AssocDevList[i]);\r
1569 }\r
1570 }\r
1571 else\r
1572 {\r
1573 consolePrint("IeeeAddrRsp Status: FAIL 0x%02X\n", msg->Status);\r
1574 }\r
1575 SET_NRM_COLOR();\r
1576 \r
1577 return msg->Status;\r
1578 }\r
1579 static uint8_t mtZdoNodeDescRspCb(NodeDescRspFormat_t *msg)\r
1580 {\r
1581 SET_RSP_COLOR();\r
1582 consolePrint("mtZdoNodeDescRspCb\n");\r
1583 if (msg->Status == MT_RPC_SUCCESS)\r
1584 {\r
1585 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1586 consolePrint("Status: 0x%02X\n", msg->Status);\r
1587 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
1588 consolePrint("LoTy_ComDescAv_UsrDesAv: 0x%02X\n",\r
1589 msg->LoTy_ComDescAv_UsrDesAv);\r
1590 consolePrint("APSFlg_FrqBnd: 0x%02X\n", msg->APSFlg_FrqBnd);\r
1591 consolePrint("MACCapFlg: 0x%02X\n", msg->MACCapFlg);\r
1592 consolePrint("ManufacturerCode: 0x%04X\n", msg->ManufacturerCode);\r
1593 consolePrint("MaxBufferSize: 0x%02X\n", msg->MaxBufferSize);\r
1594 consolePrint("MaxTransferSize: 0x%04X\n", msg->MaxTransferSize);\r
1595 consolePrint("ServerMask: 0x%04X\n", msg->ServerMask);\r
1596 consolePrint("MaxOutTransferSize: 0x%04X\n", msg->MaxOutTransferSize);\r
1597 consolePrint("DescriptorCapabilities: 0x%02X\n",\r
1598 msg->DescriptorCapabilities);\r
1599 }\r
1600 else\r
1601 {\r
1602 consolePrint("NodeDescRsp Status: FAIL 0x%02X\n", msg->Status);\r
1603 }\r
1604 SET_NRM_COLOR();\r
1605 \r
1606 return msg->Status;\r
1607 }\r
1608 static uint8_t mtZdoPowerDescRspCb(PowerDescRspFormat_t *msg)\r
1609 {\r
1610 SET_RSP_COLOR();\r
1611 consolePrint("mtZdoPowerDescRspCb\n");\r
1612 if (msg->Status == MT_RPC_SUCCESS)\r
1613 {\r
1614 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1615 consolePrint("Status: 0x%02X\n", msg->Status);\r
1616 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
1617 consolePrint("CurrntPwrMode_AvalPwrSrcs: 0x%02X\n",\r
1618 msg->CurrntPwrMode_AvalPwrSrcs);\r
1619 consolePrint("CurrntPwrSrc_CurrntPwrSrcLvl: 0x%02X\n",\r
1620 msg->CurrntPwrSrc_CurrntPwrSrcLvl);\r
1621 }\r
1622 else\r
1623 {\r
1624 consolePrint("PowerDescRsp Status: FAIL 0x%02X\n", msg->Status);\r
1625 }\r
1626 SET_NRM_COLOR();\r
1627 \r
1628 return msg->Status;\r
1629 }\r
1630 static uint8_t mtZdoSimpleDescRspCb(SimpleDescRspFormat_t *msg)\r
1631 {\r
1632 SET_RSP_COLOR();\r
1633 consolePrint("mtZdoSimpleDescRspCb\n");\r
1634 if (msg->Status == MT_RPC_SUCCESS)\r
1635 {\r
1636 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1637 consolePrint("Status: 0x%02X\n", msg->Status);\r
1638 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
1639 consolePrint("Len: 0x%02X\n", msg->Len);\r
1640 consolePrint("Endpoint: 0x%02X\n", msg->Endpoint);\r
1641 consolePrint("ProfileID: 0x%04X\n", msg->ProfileID);\r
1642 consolePrint("DeviceID: 0x%04X\n", msg->DeviceID);\r
1643 consolePrint("DeviceVersion: 0x%02X\n", msg->DeviceVersion);\r
1644 consolePrint("NumInClusters: 0x%02X\n", msg->NumInClusters);\r
1645 uint32_t i;\r
1646 for (i = 0; i < msg->NumInClusters; i++)\r
1647 {\r
1648 consolePrint("InClusterList[%d]: 0x%04X\n", i,\r
1649 msg->InClusterList[i]);\r
1650 }\r
1651 consolePrint("NumOutClusters: 0x%02X\n", msg->NumOutClusters);\r
1652 for (i = 0; i < msg->NumOutClusters; i++)\r
1653 {\r
1654 consolePrint("OutClusterList[%d]: 0x%04X\n", i,\r
1655 msg->OutClusterList[i]);\r
1656 }\r
1657 }\r
1658 else\r
1659 {\r
1660 consolePrint("SimpleDescRsp Status: FAIL 0x%02X\n", msg->Status);\r
1661 }\r
1662 SET_NRM_COLOR();\r
1663 \r
1664 return msg->Status;\r
1665 }\r
1666 static uint8_t mtZdoActiveEpRspCb(ActiveEpRspFormat_t *msg)\r
1667 {\r
1668 SET_RSP_COLOR();\r
1669 consolePrint("mtZdoActiveEpRspCb\n");\r
1670 if (msg->Status == MT_RPC_SUCCESS)\r
1671 {\r
1672 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1673 consolePrint("Status: 0x%02X\n", msg->Status);\r
1674 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
1675 consolePrint("ActiveEPCount: 0x%02X\n", msg->ActiveEPCount);\r
1676 uint32_t i;\r
1677 for (i = 0; i < msg->ActiveEPCount; i++)\r
1678 {\r
1679 consolePrint("ActiveEPList[%d]: 0x%02X\n", i, msg->ActiveEPList[i]);\r
1680 }\r
1681 }\r
1682 else\r
1683 {\r
1684 consolePrint("ActiveEpRsp Status: FAIL 0x%02X\n", msg->Status);\r
1685 }\r
1686 SET_NRM_COLOR();\r
1687 \r
1688 return msg->Status;\r
1689 }\r
1690 static uint8_t mtZdoMatchDescRspCb(MatchDescRspFormat_t *msg)\r
1691 {\r
1692 SET_RSP_COLOR();\r
1693 consolePrint("mtZdoMatchDescRspCb\n");\r
1694 if (msg->Status == MT_RPC_SUCCESS)\r
1695 {\r
1696 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1697 consolePrint("Status: 0x%02X\n", msg->Status);\r
1698 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
1699 consolePrint("MatchLength: 0x%02X\n", msg->MatchLength);\r
1700 uint32_t i;\r
1701 for (i = 0; i < msg->MatchLength; i++)\r
1702 {\r
1703 consolePrint("MatchList[%d]: 0x%02X\n", i, msg->MatchList[i]);\r
1704 }\r
1705 }\r
1706 else\r
1707 {\r
1708 consolePrint("MatchDescRsp Status: FAIL 0x%02X\n", msg->Status);\r
1709 }\r
1710 SET_NRM_COLOR();\r
1711 \r
1712 return msg->Status;\r
1713 }\r
1714 static uint8_t mtZdoComplexDescRspCb(ComplexDescRspFormat_t *msg)\r
1715 {\r
1716 SET_RSP_COLOR();\r
1717 consolePrint("mtZdoComplexDescRspCb\n");\r
1718 \r
1719 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1720 consolePrint("Status: 0x%02X\n", msg->Status);\r
1721 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
1722 consolePrint("ComplexLength: 0x%02X\n", msg->ComplexLength);\r
1723 uint32_t i;\r
1724 for (i = 0; i < msg->ComplexLength; i++)\r
1725 {\r
1726 consolePrint("ComplexList[%d]: 0x%02X\n", i, msg->ComplexList[i]);\r
1727 }\r
1728 SET_NRM_COLOR();\r
1729 \r
1730 return msg->Status;\r
1731 }\r
1732 static uint8_t mtZdoUserDescRspCb(UserDescRspFormat_t *msg)\r
1733 {\r
1734 SET_RSP_COLOR();\r
1735 consolePrint("mtZdoUserDescRspCb\n");\r
1736 if (msg->Status == MT_RPC_SUCCESS)\r
1737 {\r
1738 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1739 consolePrint("Status: 0x%02X\n", msg->Status);\r
1740 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
1741 consolePrint("Len: 0x%02X\n", msg->Len);\r
1742 uint32_t i;\r
1743 for (i = 0; i < msg->Len; i++)\r
1744 {\r
1745 consolePrint("CUserDescriptor[%d]: 0x%02X\n", i,\r
1746 msg->CUserDescriptor[i]);\r
1747 }\r
1748 }\r
1749 else\r
1750 {\r
1751 consolePrint("UserDescRsp Status: FAIL 0x%02X\n", msg->Status);\r
1752 }\r
1753 SET_NRM_COLOR();\r
1754 \r
1755 return msg->Status;\r
1756 }\r
1757 static uint8_t mtZdoUserDescConfCb(UserDescConfFormat_t *msg)\r
1758 {\r
1759 SET_RSP_COLOR();\r
1760 consolePrint("mtZdoUserDescConfCb\n");\r
1761 if (msg->Status == MT_RPC_SUCCESS)\r
1762 {\r
1763 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1764 consolePrint("Status: 0x%02X\n", msg->Status);\r
1765 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
1766 }\r
1767 else\r
1768 {\r
1769 consolePrint("UserDescConf Status: FAIL 0x%02X\n", msg->Status);\r
1770 }\r
1771 SET_NRM_COLOR();\r
1772 \r
1773 return msg->Status;\r
1774 }\r
1775 static uint8_t mtZdoServerDiscRspCb(ServerDiscRspFormat_t *msg)\r
1776 {\r
1777 SET_RSP_COLOR();\r
1778 consolePrint("mtZdoServerDiscRspCb\n");\r
1779 if (msg->Status == MT_RPC_SUCCESS)\r
1780 {\r
1781 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1782 consolePrint("Status: 0x%02X\n", msg->Status);\r
1783 consolePrint("ServerMask: 0x%04X\n", msg->ServerMask);\r
1784 }\r
1785 else\r
1786 {\r
1787 consolePrint("ServerDiscRsp Status: FAIL 0x%02X\n", msg->Status);\r
1788 }\r
1789 SET_NRM_COLOR();\r
1790 \r
1791 return msg->Status;\r
1792 }\r
1793 static uint8_t mtZdoEndDeviceBindRspCb(EndDeviceBindRspFormat_t *msg)\r
1794 {\r
1795 SET_RSP_COLOR();\r
1796 consolePrint("mtZdoEndDeviceBindRspCb\n");\r
1797 if (msg->Status == MT_RPC_SUCCESS)\r
1798 {\r
1799 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1800 consolePrint("Status: 0x%02X\n", msg->Status);\r
1801 }\r
1802 else\r
1803 {\r
1804 consolePrint("EndDeviceBindRsp Status: FAIL 0x%02X\n", msg->Status);\r
1805 }\r
1806 SET_NRM_COLOR();\r
1807 \r
1808 return msg->Status;\r
1809 }\r
1810 static uint8_t mtZdoBindRspCb(BindRspFormat_t *msg)\r
1811 {\r
1812 SET_RSP_COLOR();\r
1813 consolePrint("mtZdoBindRspCb\n");\r
1814 if (msg->Status == MT_RPC_SUCCESS)\r
1815 {\r
1816 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1817 consolePrint("Status: 0x%02X\n", msg->Status);\r
1818 }\r
1819 else\r
1820 {\r
1821 consolePrint("BindRsp Status: FAIL 0x%02X\n", msg->Status);\r
1822 }\r
1823 SET_NRM_COLOR();\r
1824 \r
1825 return msg->Status;\r
1826 }\r
1827 static uint8_t mtZdoUnbindRspCb(UnbindRspFormat_t *msg)\r
1828 {\r
1829 SET_RSP_COLOR();\r
1830 consolePrint("mtZdoUnbindRspCb\n");\r
1831 if (msg->Status == MT_RPC_SUCCESS)\r
1832 {\r
1833 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1834 consolePrint("Status: 0x%02X\n", msg->Status);\r
1835 }\r
1836 else\r
1837 {\r
1838 consolePrint("UnbindRsp Status: FAIL 0x%02X\n", msg->Status);\r
1839 }\r
1840 SET_NRM_COLOR();\r
1841 \r
1842 return msg->Status;\r
1843 }\r
1844 static uint8_t mtZdoMgmtNwkDiscRspCb(MgmtNwkDiscRspFormat_t *msg)\r
1845 {\r
1846 SET_RSP_COLOR();\r
1847 consolePrint("mtZdoMgmtNwkDiscRspCb\n");\r
1848 if (msg->Status == MT_RPC_SUCCESS)\r
1849 {\r
1850 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1851 consolePrint("Status: 0x%02X\n", msg->Status);\r
1852 consolePrint("NetworkCount: 0x%02X\n", msg->NetworkCount);\r
1853 consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
1854 consolePrint("NetworkListCount: 0x%02X\n", msg->NetworkListCount);\r
1855 \r
1856 uint32_t i;\r
1857 for (i = 0; i < msg->NetworkListCount; i++)\r
1858 {\r
1859 consolePrint("mtZdoNetworkListItems[%d]:\n", i);\r
1860 consolePrint("\tPanID: 0x%016llX\n",\r
1861 (long long unsigned int) msg->NetworkList[i].PanID);\r
1862 consolePrint("\tLogicalChannel: 0x%02X\n",\r
1863 msg->NetworkList[i].LogicalChannel);\r
1864 consolePrint("\tStackProf_ZigVer: 0x%02X\n",\r
1865 msg->NetworkList[i].StackProf_ZigVer);\r
1866 consolePrint("\tBeacOrd_SupFramOrd: 0x%02X\n",\r
1867 msg->NetworkList[i].BeacOrd_SupFramOrd);\r
1868 consolePrint("\tPermitJoin: 0x%02X\n\n",\r
1869 msg->NetworkList[i].PermitJoin);\r
1870 }\r
1871 }\r
1872 else\r
1873 {\r
1874 consolePrint("MgmtNwkDiscRsp Status: FAIL 0x%02X\n", msg->Status);\r
1875 }\r
1876 SET_NRM_COLOR();\r
1877 \r
1878 return msg->Status;\r
1879 }\r
1880 static uint8_t mtZdoMgmtLqiRspCb(MgmtLqiRspFormat_t *msg)\r
1881 {\r
1882 SET_RSP_COLOR();\r
1883 consolePrint("mtZdoMgmtLqiRspCb\n");\r
1884 if (msg->Status == MT_RPC_SUCCESS)\r
1885 {\r
1886 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1887 consolePrint("Status: 0x%02X\n", msg->Status);\r
1888 consolePrint("NeighborTableEntries: 0x%02X\n",\r
1889 msg->NeighborTableEntries);\r
1890 consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
1891 consolePrint("NeighborLqiListCount: 0x%02X\n",\r
1892 msg->NeighborLqiListCount);\r
1893 uint32_t i;\r
1894 for (i = 0; i < msg->NeighborLqiListCount; i++)\r
1895 {\r
1896 \r
1897 consolePrint("mtZdoNeighborLqiListItem[%d]:\n", i);\r
1898 \r
1899 consolePrint("\tExtendedPanID: 0x%016llX\n",\r
1900 (long long unsigned int) msg->NeighborLqiList[i].ExtendedPanID);\r
1901 consolePrint("\tExtendedAddress: 0x%016llX\n",\r
1902 (long long unsigned int) msg->NeighborLqiList[i].ExtendedAddress);\r
1903 consolePrint("\tNetworkAddress: 0x%04X\n",\r
1904 msg->NeighborLqiList[i].NetworkAddress);\r
1905 consolePrint("\tDevTyp_RxOnWhenIdle_Relat: 0x%02X\n",\r
1906 msg->NeighborLqiList[i].DevTyp_RxOnWhenIdle_Relat);\r
1907 consolePrint("\tPermitJoining: 0x%02X\n",\r
1908 msg->NeighborLqiList[i].PermitJoining);\r
1909 consolePrint("\tDepth: 0x%02X\n", msg->NeighborLqiList[i].Depth);\r
1910 consolePrint("\tLQI: 0x%02X\n", msg->NeighborLqiList[i].LQI);\r
1911 }\r
1912 }\r
1913 else\r
1914 {\r
1915 consolePrint("MgmtLqiRsp Status: FAIL 0x%02X\n", msg->Status);\r
1916 }\r
1917 SET_NRM_COLOR();\r
1918 \r
1919 return msg->Status;\r
1920 }\r
1921 static uint8_t mtZdoMgmtRtgRspCb(MgmtRtgRspFormat_t *msg)\r
1922 {\r
1923 SET_RSP_COLOR();\r
1924 consolePrint("mtZdoMgmtRtgRspCb\n");\r
1925 if (msg->Status == MT_RPC_SUCCESS)\r
1926 {\r
1927 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1928 consolePrint("Status: 0x%02X\n", msg->Status);\r
1929 consolePrint("RoutingTableEntries: 0x%02X\n", msg->RoutingTableEntries);\r
1930 consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
1931 consolePrint("RoutingTableListCount: 0x%02X\n",\r
1932 msg->RoutingTableListCount);\r
1933 uint32_t i;\r
1934 for (i = 0; i < msg->RoutingTableListCount; i++)\r
1935 {\r
1936 consolePrint("RoutingTableListItem[%d]:\n", i);\r
1937 consolePrint("\tDstAddr: 0x%04X\n",\r
1938 msg->RoutingTableList[i].DstAddr);\r
1939 consolePrint("\tStatus: 0x%02X\n", msg->RoutingTableList[i].Status);\r
1940 consolePrint("\tNextHop: 0x%04X\n",\r
1941 msg->RoutingTableList[i].NextHop);\r
1942 }\r
1943 }\r
1944 else\r
1945 {\r
1946 consolePrint("MgmtRtgRsp Status: FAIL 0x%02X\n", msg->Status);\r
1947 }\r
1948 SET_NRM_COLOR();\r
1949 \r
1950 return msg->Status;\r
1951 }\r
1952 static uint8_t mtZdoMgmtBindRspCb(MgmtBindRspFormat_t *msg)\r
1953 {\r
1954 SET_RSP_COLOR();\r
1955 consolePrint("mtZdoMgmtBindRspCb\n");\r
1956 if (msg->Status == MT_RPC_SUCCESS)\r
1957 {\r
1958 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1959 consolePrint("Status: 0x%02X\n", msg->Status);\r
1960 consolePrint("BindingTableEntries: 0x%02X\n", msg->BindingTableEntries);\r
1961 consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
1962 consolePrint("BindingTableListCount: 0x%02X\n",\r
1963 msg->BindingTableListCount);\r
1964 uint32_t i;\r
1965 for (i = 0; i < msg->BindingTableListCount; i++)\r
1966 {\r
1967 consolePrint("BindingTableList[%d]:\n", i);\r
1968 consolePrint("SrcIEEEAddr: 0x%016llX\n",\r
1969 (long long unsigned int) msg->BindingTableList[i].SrcIEEEAddr);\r
1970 consolePrint("\tSrcEndpoint: 0x%02X\n",\r
1971 msg->BindingTableList[i].SrcEndpoint);\r
1972 consolePrint("\tClusterID: 0x%02X\n",\r
1973 msg->BindingTableList[i].ClusterID);\r
1974 consolePrint("\tDstAddrMode: 0x%02X\n",\r
1975 msg->BindingTableList[i].DstAddrMode);\r
1976 consolePrint("DstIEEEAddr: 0x%016llX\n",\r
1977 (long long unsigned int) msg->BindingTableList[i].DstIEEEAddr);\r
1978 consolePrint("\tDstEndpoint: 0x%02X\n",\r
1979 msg->BindingTableList[i].DstEndpoint);\r
1980 }\r
1981 }\r
1982 else\r
1983 {\r
1984 consolePrint("MgmtBindRsp Status: FAIL 0x%02X\n", msg->Status);\r
1985 }\r
1986 SET_NRM_COLOR();\r
1987 \r
1988 return msg->Status;\r
1989 }\r
1990 static uint8_t mtZdoMgmtLeaveRspCb(MgmtLeaveRspFormat_t *msg)\r
1991 {\r
1992 SET_RSP_COLOR();\r
1993 consolePrint("mtZdoMgmtLeaveRspCb\n");\r
1994 if (msg->Status == MT_RPC_SUCCESS)\r
1995 {\r
1996 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
1997 consolePrint("Status: 0x%02X\n", msg->Status);\r
1998 }\r
1999 else\r
2000 {\r
2001 consolePrint("MgmtLeaveRsp Status: FAIL 0x%02X\n", msg->Status);\r
2002 }\r
2003 SET_NRM_COLOR();\r
2004 \r
2005 return msg->Status;\r
2006 }\r
2007 static uint8_t mtZdoMgmtDirectJoinRspCb(MgmtDirectJoinRspFormat_t *msg)\r
2008 {\r
2009 SET_RSP_COLOR();\r
2010 consolePrint("mtZdoMgmtDirectJoinRspCb\n");\r
2011 if (msg->Status == MT_RPC_SUCCESS)\r
2012 {\r
2013 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
2014 consolePrint("Status: 0x%02X\n", msg->Status);\r
2015 }\r
2016 else\r
2017 {\r
2018 consolePrint("MgmtDirectJoinRsp Status: FAIL 0x%02X\n", msg->Status);\r
2019 }\r
2020 SET_NRM_COLOR();\r
2021 \r
2022 return msg->Status;\r
2023 }\r
2024 static uint8_t mtZdoMgmtPermitJoinRspCb(MgmtPermitJoinRspFormat_t *msg)\r
2025 {\r
2026 SET_RSP_COLOR();\r
2027 consolePrint("mtZdoMgmtPermitJoinRspCb\n");\r
2028 if (msg->Status == MT_RPC_SUCCESS)\r
2029 {\r
2030 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
2031 consolePrint("Status: 0x%02X\n", msg->Status);\r
2032 }\r
2033 else\r
2034 {\r
2035 consolePrint("MgmtPermitJoinRsp Status: FAIL 0x%02X\n", msg->Status);\r
2036 }\r
2037 SET_NRM_COLOR();\r
2038 \r
2039 return msg->Status;\r
2040 }\r
2041 static uint8_t mtZdoEndDeviceAnnceIndCb(EndDeviceAnnceIndFormat_t *msg)\r
2042 {\r
2043 SET_RSP_COLOR();\r
2044 consolePrint("mtZdoEndDeviceAnnceIndCb\n");\r
2045 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
2046 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
2047 consolePrint("IEEEAddr: 0x%016llX\n",\r
2048 (long long unsigned int) msg->IEEEAddr);\r
2049 consolePrint("Capabilities: 0x%02X\n", msg->Capabilities);\r
2050 SET_NRM_COLOR();\r
2051 return 0;\r
2052 }\r
2053 static uint8_t mtZdoMatchDescRspSentCb(MatchDescRspSentFormat_t *msg)\r
2054 {\r
2055 SET_RSP_COLOR();\r
2056 consolePrint("mtZdoMatchDescRspSentCb\n");\r
2057 consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
2058 consolePrint("NumInClusters: 0x%02X\n", msg->NumInClusters);\r
2059 uint32_t i;\r
2060 for (i = 0; i < msg->NumInClusters; i++)\r
2061 {\r
2062 consolePrint("InClusterList[%d]: 0x%04X\n", i, msg->InClusterList[i]);\r
2063 }\r
2064 consolePrint("NumOutClusters: 0x%02X\n", msg->NumOutClusters);\r
2065 for (i = 0; i < msg->NumOutClusters; i++)\r
2066 {\r
2067 consolePrint("OutClusterList[%d]: 0x%04X\n", i, msg->OutClusterList[i]);\r
2068 }\r
2069 SET_NRM_COLOR();\r
2070 \r
2071 return 0;\r
2072 }\r
2073 static uint8_t mtZdoStatusErrorRspCb(StatusErrorRspFormat_t *msg)\r
2074 {\r
2075 SET_RSP_COLOR();\r
2076 consolePrint("mtZdoStatusErrorRspCb\n");\r
2077 if (msg->Status == MT_RPC_SUCCESS)\r
2078 {\r
2079 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
2080 consolePrint("Status: 0x%02X\n", msg->Status);\r
2081 }\r
2082 else\r
2083 {\r
2084 consolePrint("StatusErrorRsp Status: FAIL 0x%02X\n", msg->Status);\r
2085 }\r
2086 SET_NRM_COLOR();\r
2087 \r
2088 return msg->Status;\r
2089 }\r
2090 static uint8_t mtZdoSrcRtgIndCb(SrcRtgIndFormat_t *msg)\r
2091 {\r
2092 SET_RSP_COLOR();\r
2093 consolePrint("mtZdoSrcRtgIndCb\n");\r
2094 consolePrint("DstAddr: 0x%04X\n", msg->DstAddr);\r
2095 consolePrint("RelayCount: 0x%02X\n", msg->RelayCount);\r
2096 uint32_t i;\r
2097 for (i = 0; i < msg->RelayCount; i++)\r
2098 {\r
2099 consolePrint("RelayList[%d]: 0x%04X\n", i, msg->RelayList[i]);\r
2100 }\r
2101 SET_NRM_COLOR();\r
2102 \r
2103 return 0;\r
2104 }\r
2105 static uint8_t mtZdoBeaconNotifyIndCb(BeaconNotifyIndFormat_t *msg)\r
2106 {\r
2107 SET_RSP_COLOR();\r
2108 consolePrint("mtZdoBeaconNotifyIndCb\n");\r
2109 consolePrint("BeaconCount: 0x%02X\n", msg->BeaconCount);\r
2110 uint32_t i;\r
2111 for (i = 0; i < msg->BeaconCount; i++)\r
2112 {\r
2113 consolePrint("BeaconListItem[%d]:\n", i);\r
2114 \r
2115 consolePrint("\tSrcAddr: 0x%04X\n", msg->BeaconList[i].SrcAddr);\r
2116 consolePrint("\tPanId: 0x%04X\n", msg->BeaconList[i].PanId);\r
2117 consolePrint("\tLogicalChannel: 0x%02X\n",\r
2118 msg->BeaconList[i].LogicalChannel);\r
2119 consolePrint("\tPermitJoining: 0x%02X\n",\r
2120 msg->BeaconList[i].PermitJoining);\r
2121 consolePrint("\tRouterCap: 0x%02X\n", msg->BeaconList[i].RouterCap);\r
2122 consolePrint("\tPDevCap: 0x%02X\n", msg->BeaconList[i].DevCap);\r
2123 consolePrint("\tProtocolVer: 0x%02X\n", msg->BeaconList[i].ProtocolVer);\r
2124 consolePrint("\tStackProf: 0x%02X\n", msg->BeaconList[i].StackProf);\r
2125 consolePrint("\tLQI: 0x%02X\n", msg->BeaconList[i].Lqi);\r
2126 consolePrint("\tDepth: 0x%02X\n", msg->BeaconList[i].Depth);\r
2127 consolePrint("\tUpdateId: 0x%02X\n", msg->BeaconList[i].UpdateId);\r
2128 consolePrint("ExtendedPanID: 0x%016llX\n",\r
2129 (long long unsigned int) msg->BeaconList[i].ExtendedPanId);\r
2130 }\r
2131 SET_NRM_COLOR();\r
2132 \r
2133 return 0;\r
2134 }\r
2135 static uint8_t mtZdoJoinCnfCb(JoinCnfFormat_t *msg)\r
2136 {\r
2137 SET_RSP_COLOR();\r
2138 consolePrint("mtZdoJoinCnfCb\n");\r
2139 if (msg->Status == MT_RPC_SUCCESS)\r
2140 {\r
2141 consolePrint("Status: 0x%02X\n", msg->Status);\r
2142 consolePrint("DevAddr: 0x%04X\n", msg->DevAddr);\r
2143 consolePrint("ParentAddr: 0x%04X\n", msg->ParentAddr);\r
2144 }\r
2145 else\r
2146 {\r
2147 consolePrint("JoinCnf Status: FAIL 0x%02X\n", msg->Status);\r
2148 }\r
2149 SET_NRM_COLOR();\r
2150 \r
2151 return msg->Status;\r
2152 }\r
2153 static uint8_t mtZdoNwkDiscoveryCnfCb(NwkDiscoveryCnfFormat_t *msg)\r
2154 {\r
2155 SET_RSP_COLOR();\r
2156 consolePrint("mtZdoNwkDiscoveryCnfCb\n");\r
2157 if (msg->Status == MT_RPC_SUCCESS)\r
2158 {\r
2159 consolePrint("Status: 0x%02X\n", msg->Status);\r
2160 }\r
2161 else\r
2162 {\r
2163 consolePrint("NwkDiscoveryCnf Status: FAIL 0x%02X\n", msg->Status);\r
2164 }\r
2165 SET_NRM_COLOR();\r
2166 \r
2167 return msg->Status;\r
2168 }\r
2169 static uint8_t mtZdoLeaveIndCb(LeaveIndFormat_t *msg)\r
2170 {\r
2171 SET_RSP_COLOR();\r
2172 consolePrint("mtZdoLeaveIndCb\n");\r
2173 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
2174 consolePrint("ExtAddr: 0x%016llX\n", (long long unsigned int) msg->ExtAddr);\r
2175 consolePrint("Request: 0x%02X\n", msg->Request);\r
2176 consolePrint("Remove: 0x%02X\n", msg->Remove);\r
2177 consolePrint("Rejoin: 0x%02X\n", msg->Rejoin);\r
2178 return 0;\r
2179 }\r
2180 static uint8_t mtZdoMsgCbIncomingCb(MsgCbIncomingFormat_t *msg)\r
2181 {\r
2182 SET_RSP_COLOR();\r
2183 \r
2184 consolePrint("mtZdoMsgCbIncomingCb\n");\r
2185 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
2186 consolePrint("WasBroadcast: 0x%02X\n", msg->WasBroadcast);\r
2187 consolePrint("ClusterID: 0x%04X\n", msg->ClusterID);\r
2188 consolePrint("SecurityUse: 0x%02X\n", msg->SecurityUse);\r
2189 consolePrint("SeqNum: 0x%02X\n", msg->SeqNum);\r
2190 consolePrint("MacDstAddr: 0x%04X\n", msg->MacDstAddr);\r
2191 uint32_t i;\r
2192 for (i = 0; i < msg->MacDstAddr; i++)\r
2193 {\r
2194 consolePrint("Data[%d]: 0x%02X\n", i, msg->Data[i]);\r
2195 }\r
2196 SET_NRM_COLOR();\r
2197 return 0;\r
2198 }\r
2199 \r
2200 /********************************************************************\r
2201 * END OF ZDO CALL BACK FUNCTIONS\r
2202 */\r
2203 \r
2204 /********************************************************************\r
2205 * START OF AF CALL BACK FUNCTIONS\r
2206 */\r
2207 \r
2208 static uint8_t mtAfDataConfirmCb(DataConfirmFormat_t *msg)\r
2209 {\r
2210 SET_RSP_COLOR();\r
2211 consolePrint("mtAfDataConfirmCb\n");\r
2212 if (msg->Status == MT_RPC_SUCCESS)\r
2213 {\r
2214 consolePrint("Status: 0x%02X\n", msg->Status);\r
2215 consolePrint("Endpoint: 0x%02X\n", msg->Endpoint);\r
2216 consolePrint("TransId: 0x%02X\n", msg->TransId);\r
2217 }\r
2218 else\r
2219 {\r
2220 consolePrint("DataConfirm Status: FAIL 0x%02X\n", msg->Status);\r
2221 }\r
2222 SET_NRM_COLOR();\r
2223 \r
2224 return msg->Status;\r
2225 }\r
2226 static uint8_t mtAfIncomingMsgCb(IncomingMsgFormat_t *msg)\r
2227 {\r
2228 SET_RSP_COLOR();\r
2229 consolePrint("mtAfIncomingMsgCb\n");\r
2230 consolePrint("GroupId: 0x%04X\n", msg->GroupId);\r
2231 consolePrint("ClusterId: 0x%04X\n", msg->ClusterId);\r
2232 consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
2233 consolePrint("SrcEndpoint: 0x%02X\n", msg->SrcEndpoint);\r
2234 consolePrint("DstEndpoint: 0x%02X\n", msg->DstEndpoint);\r
2235 consolePrint("WasVroadcast: 0x%02X\n", msg->WasVroadcast);\r
2236 consolePrint("LinkQuality: 0x%02X\n", msg->LinkQuality);\r
2237 consolePrint("SecurityUse: 0x%02X\n", msg->SecurityUse);\r
2238 consolePrint("TimeStamp: 0x%08X\n", msg->TimeStamp);\r
2239 consolePrint("TransSeqNum: 0x%02X\n", msg->TransSeqNum);\r
2240 consolePrint("Len: 0x%02X\n", msg->Len);\r
2241 uint32_t i;\r
2242 for (i = 0; i < msg->Len; i++)\r
2243 {\r
2244 consolePrint("Data[%d]: 0x%02X\n", i, msg->Data[i]);\r
2245 }\r
2246 SET_NRM_COLOR();\r
2247 \r
2248 return 0;\r
2249 }\r
2250 static uint8_t mtAfIncomingMsgExt(IncomingMsgExtFormat_t *msg)\r
2251 {\r
2252 SET_RSP_COLOR();\r
2253 consolePrint("mtAfIncomingMsgExt\n");\r
2254 consolePrint("GroupId: 0x%04X\n", msg->GroupId);\r
2255 consolePrint("ClusterId: 0x%04X\n", msg->ClusterId);\r
2256 consolePrint("SrcAddrMode: 0x%02X\n", msg->SrcAddrMode);\r
2257 consolePrint("SrcAddr: 0x%016llX\n", (long long unsigned int) msg->SrcAddr);\r
2258 consolePrint("SrcEndpoint: 0x%02X\n", msg->SrcEndpoint);\r
2259 consolePrint("SrcPanId: 0x%04X\n", msg->SrcPanId);\r
2260 consolePrint("DstEndpoint: 0x%02X\n", msg->DstEndpoint);\r
2261 consolePrint("WasVroadcast: 0x%02X\n", msg->WasVroadcast);\r
2262 consolePrint("LinkQuality: 0x%02X\n", msg->LinkQuality);\r
2263 consolePrint("SecurityUse: 0x%02X\n", msg->SecurityUse);\r
2264 consolePrint("TimeStamp: 0x%08X\n", msg->TimeStamp);\r
2265 consolePrint("TransSeqNum: 0x%02X\n", msg->TransSeqNum);\r
2266 consolePrint("Len: 0x%02X\n", msg->Len);\r
2267 uint32_t i;\r
2268 for (i = 0; i < msg->Len; i++)\r
2269 {\r
2270 consolePrint("Data[%d]: 0x%02X\n", i, msg->Data[i]);\r
2271 }\r
2272 SET_NRM_COLOR();\r
2273 \r
2274 return 0;\r
2275 }\r
2276 static uint8_t mtAfDataRetrieveSrspCb(DataRetrieveSrspFormat_t *msg)\r
2277 {\r
2278 SET_RSP_COLOR();\r
2279 consolePrint("mtAfDataRetrieveSrspCb\n");\r
2280 if (msg->Status == MT_RPC_SUCCESS)\r
2281 {\r
2282 consolePrint("Status: 0x%02X\n", msg->Status);\r
2283 consolePrint("Length: 0x%02X\n", msg->Length);\r
2284 uint32_t i;\r
2285 for (i = 0; i < msg->Length; i++)\r
2286 {\r
2287 consolePrint("Data[%d]: 0x%02X\n", i, msg->Data[i]);\r
2288 }\r
2289 }\r
2290 else\r
2291 {\r
2292 consolePrint("DataRetrieveSrsp Status: FAIL 0x%02X\n", msg->Status);\r
2293 }\r
2294 SET_NRM_COLOR();\r
2295 \r
2296 return msg->Status;\r
2297 }\r
2298 static uint8_t mtAfReflectErrorCb(ReflectErrorFormat_t *msg)\r
2299 {\r
2300 SET_RSP_COLOR();\r
2301 consolePrint("mtAfReflectErrorCb\n");\r
2302 if (msg->Status == MT_RPC_SUCCESS)\r
2303 {\r
2304 consolePrint("Status: 0x%02X\n", msg->Status);\r
2305 consolePrint("Endpoint: 0x%02X\n", msg->Endpoint);\r
2306 consolePrint("TransId: 0x%02X\n", msg->TransId);\r
2307 consolePrint("DstAddrMode: 0x%02X\n", msg->DstAddrMode);\r
2308 consolePrint("DstAddr: 0x%04X\n", msg->DstAddr);\r
2309 }\r
2310 else\r
2311 {\r
2312 consolePrint("ReflectError Status: FAIL 0x%02X\n", msg->Status);\r
2313 }\r
2314 \r
2315 SET_NRM_COLOR();\r
2316 return msg->Status;\r
2317 }\r
2318 \r
2319 /********************************************************************\r
2320 * END OF AF CALL BACK FUNCTIONS\r
2321 */\r
2322 \r
2323 /********************************************************************\r
2324 * START OF SAPI CALL BACK FUNCTIONS\r
2325 */\r
2326 \r
2327 static uint8_t mtSapiReadConfigurationSrspCb(ReadConfigurationSrspFormat_t *msg)\r
2328 {\r
2329 SET_RSP_COLOR();\r
2330 consolePrint("mtSapiReadConfigurationSrspCb\n");\r
2331 if (msg->Status == MT_RPC_SUCCESS)\r
2332 {\r
2333 consolePrint("Status: 0x%02X\n", msg->Status);\r
2334 consolePrint("ConfigId: 0x%02X\n", msg->ConfigId);\r
2335 consolePrint("Len: 0x%02X\n", msg->Len);\r
2336 uint32_t i;\r
2337 for (i = 0; i < msg->Len; i++)\r
2338 {\r
2339 consolePrint("Value[%d]: 0x%02X\n", i, msg->Value[i]);\r
2340 }\r
2341 }\r
2342 else\r
2343 {\r
2344 consolePrint("ReadConfigurationSrsp Status: FAIL 0x%02X\n",\r
2345 msg->Status);\r
2346 }\r
2347 SET_NRM_COLOR();\r
2348 return msg->Status;\r
2349 }\r
2350 static uint8_t mtSapiGetDeviceInfoSrspCb(GetDeviceInfoSrspFormat_t *msg)\r
2351 {\r
2352 SET_RSP_COLOR();\r
2353 consolePrint("mtSapiGetDeviceInfoSrspCb\n");\r
2354 \r
2355 switch (msg->Param)\r
2356 {\r
2357 case 0:\r
2358 consolePrint("Param: (0x%02X) State\n", msg->Param);\r
2359 consolePrint("Value: 0x%01X\n", msg->Value[0]);\r
2360 break;\r
2361 case 1:\r
2362 consolePrint("Param: (0x%02X) IEEE Address\n", msg->Param);\r
2363 consolePrint(\r
2364 "Value: 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X\n",\r
2365 (unsigned char) msg->Value[0], (unsigned char) msg->Value[1],\r
2366 (unsigned char) msg->Value[2], (unsigned char) msg->Value[3],\r
2367 (unsigned char) msg->Value[4], (unsigned char) msg->Value[5],\r
2368 (unsigned char) msg->Value[6], (unsigned char) msg->Value[7]);\r
2369 break;\r
2370 case 2:\r
2371 consolePrint("Param: (0x%02X) Short Address\n", msg->Param);\r
2372 consolePrint("Value: 0x%04X\n",\r
2373 BUILD_UINT16(msg->Value[0], msg->Value[1]));\r
2374 break;\r
2375 case 3:\r
2376 consolePrint("Param: (0x%02X) Parent Short Address\n", msg->Param);\r
2377 consolePrint("Value: 0x%04X\n",\r
2378 BUILD_UINT16(msg->Value[0], msg->Value[1]));\r
2379 break;\r
2380 case 4:\r
2381 consolePrint("Param: (0x%02X) Parent IEEE Address\n", msg->Param);\r
2382 consolePrint(\r
2383 "Value: 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X\n",\r
2384 (unsigned char) msg->Value[0], (unsigned char) msg->Value[1],\r
2385 (unsigned char) msg->Value[2], (unsigned char) msg->Value[3],\r
2386 (unsigned char) msg->Value[4], (unsigned char) msg->Value[5],\r
2387 (unsigned char) msg->Value[6], (unsigned char) msg->Value[7]);\r
2388 break;\r
2389 case 5:\r
2390 consolePrint("Param: (0x%02X) Channel\n", msg->Param);\r
2391 consolePrint("Value: 0x%01X\n", msg->Value[0]);\r
2392 break;\r
2393 case 6:\r
2394 consolePrint("Param: (0x%02X) PAN ID\n", msg->Param);\r
2395 consolePrint("Value: 0x%04X\n",\r
2396 BUILD_UINT16(msg->Value[0], msg->Value[1]));\r
2397 break;\r
2398 case 7:\r
2399 consolePrint("Param: (0x%02X) Extended PAN ID\n", msg->Param);\r
2400 consolePrint(\r
2401 "Value: 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X\n",\r
2402 (unsigned char) msg->Value[0], (unsigned char) msg->Value[1],\r
2403 (unsigned char) msg->Value[2], (unsigned char) msg->Value[3],\r
2404 (unsigned char) msg->Value[4], (unsigned char) msg->Value[5],\r
2405 (unsigned char) msg->Value[6], (unsigned char) msg->Value[7]);\r
2406 break;\r
2407 \r
2408 }\r
2409 \r
2410 SET_NRM_COLOR();\r
2411 \r
2412 return 0;\r
2413 }\r
2414 static uint8_t mtSapiFindDeviceCnfCb(FindDeviceCnfFormat_t *msg)\r
2415 {\r
2416 SET_RSP_COLOR();\r
2417 consolePrint("mtSapiFindDeviceCnfCb\n");\r
2418 consolePrint("SearchKey: 0x%04X\n", msg->SearchKey);\r
2419 consolePrint("Result: 0x%016llX\n", (long long unsigned int) msg->Result);\r
2420 SET_NRM_COLOR();\r
2421 return 0;\r
2422 }\r
2423 static uint8_t mtSapiSendDataCnfCb(SendDataCnfFormat_t *msg)\r
2424 {\r
2425 SET_RSP_COLOR();\r
2426 consolePrint("mtSapiSendDataCnfCb\n");\r
2427 if (msg->Status == MT_RPC_SUCCESS)\r
2428 {\r
2429 consolePrint("Handle: 0x%02X\n", msg->Handle);\r
2430 consolePrint("Status: 0x%02X\n", msg->Status);\r
2431 }\r
2432 else\r
2433 {\r
2434 consolePrint("SendDataCnf Status: FAIL 0x%02X\n", msg->Status);\r
2435 }\r
2436 SET_NRM_COLOR();\r
2437 return msg->Status;\r
2438 }\r
2439 static uint8_t mtSapiReceiveDataIndCb(ReceiveDataIndFormat_t *msg)\r
2440 {\r
2441 SET_RSP_COLOR();\r
2442 consolePrint("mtSapiReceiveDataIndCb\n");\r
2443 consolePrint("Source: 0x%04X\n", msg->Source);\r
2444 consolePrint("Command: 0x%04X\n", msg->Command);\r
2445 consolePrint("Len: 0x%04X\n", msg->Len);\r
2446 uint32_t i;\r
2447 for (i = 0; i < msg->Len; i++)\r
2448 {\r
2449 consolePrint("Data[%d]: 0x%02X\n", i, msg->Data[i]);\r
2450 }\r
2451 SET_NRM_COLOR();\r
2452 return 0;\r
2453 }\r
2454 static uint8_t mtSapiAllowBindCnfCb(AllowBindCnfFormat_t *msg)\r
2455 {\r
2456 SET_RSP_COLOR();\r
2457 consolePrint("mtSapiAllowBindCnfCb\n");\r
2458 consolePrint("Source: 0x%04X\n", msg->Source);\r
2459 SET_NRM_COLOR();\r
2460 return 0;\r
2461 }\r
2462 static uint8_t mtSapiBindCnfCb(BindCnfFormat_t *msg)\r
2463 {\r
2464 SET_RSP_COLOR();\r
2465 consolePrint("mtSapiBindCnfCb\n");\r
2466 if (msg->Status == MT_RPC_SUCCESS)\r
2467 {\r
2468 consolePrint("CommandId: 0x%04X\n", msg->CommandId);\r
2469 consolePrint("Status: 0x%02X\n", msg->Status);\r
2470 }\r
2471 else\r
2472 {\r
2473 consolePrint("BindCnf Status: FAIL 0x%02X\n", msg->Status);\r
2474 }\r
2475 SET_NRM_COLOR();\r
2476 return msg->Status;\r
2477 }\r
2478 static uint8_t mtSapiStartCnfCb(StartCnfFormat_t *msg)\r
2479 {\r
2480 SET_RSP_COLOR();\r
2481 consolePrint("mtSapiStartCnfCb\n");\r
2482 if (msg->Status == MT_RPC_SUCCESS)\r
2483 {\r
2484 consolePrint("Status: 0x%02X\n", msg->Status);\r
2485 }\r
2486 else\r
2487 {\r
2488 consolePrint("StartCnf Status: FAIL 0x%02X\n", msg->Status);\r
2489 }\r
2490 SET_NRM_COLOR();\r
2491 return msg->Status;\r
2492 }\r
2493 \r
2494 /********************************************************************\r
2495 * END OF SAPI CALL BACK FUNCTIONS\r
2496 */\r
2497 \r
2498 // helper functions for building and sending the NV messages\r
2499 static uint8_t setNVStartup(uint8_t startupOption)\r
2500 {\r
2501 uint8_t status;\r
2502 OsalNvWriteFormat_t nvWrite;\r
2503 \r
2504 // sending startup option\r
2505 nvWrite.Id = ZCD_NV_STARTUP_OPTION;\r
2506 nvWrite.Offset = 0;\r
2507 nvWrite.Len = 1;\r
2508 nvWrite.Value[0] = startupOption;\r
2509 status = sysOsalNvWrite(&nvWrite);\r
2510 \r
2511 dbg_print(PRINT_LEVEL_INFO, "\n");\r
2512 \r
2513 dbg_print(PRINT_LEVEL_INFO, "NV Write Startup Option cmd sent[%d]...\n",\r
2514 status);\r
2515 \r
2516 return status;\r
2517 }\r
2518 \r
2519 static uint8_t setNVDevType(uint8_t devType)\r
2520 {\r
2521 uint8_t status;\r
2522 OsalNvWriteFormat_t nvWrite;\r
2523 \r
2524 nvWrite.Id = ZCD_NV_LOGICAL_TYPE;\r
2525 nvWrite.Offset = 0;\r
2526 nvWrite.Len = 1;\r
2527 nvWrite.Value[0] = devType;\r
2528 status = sysOsalNvWrite(&nvWrite);\r
2529 \r
2530 dbg_print(PRINT_LEVEL_INFO, "\n");\r
2531 dbg_print(PRINT_LEVEL_INFO, "NV Write Device Type cmd sent... [%d]\n",\r
2532 status);\r
2533 \r
2534 return status;\r
2535 }\r
2536 \r
2537 static uint8_t setNVPanID(uint32_t panId)\r
2538 {\r
2539 uint8_t status;\r
2540 OsalNvWriteFormat_t nvWrite;\r
2541 \r
2542 dbg_print(PRINT_LEVEL_INFO, "\n");\r
2543 dbg_print(PRINT_LEVEL_INFO, "NV Write PAN ID cmd sending...\n");\r
2544 \r
2545 nvWrite.Id = ZCD_NV_PANID;\r
2546 nvWrite.Offset = 0;\r
2547 nvWrite.Len = 2;\r
2548 nvWrite.Value[0] = LO_UINT16(panId);\r
2549 nvWrite.Value[1] = HI_UINT16(panId);\r
2550 status = sysOsalNvWrite(&nvWrite);\r
2551 \r
2552 dbg_print(PRINT_LEVEL_INFO, "\n");\r
2553 dbg_print(PRINT_LEVEL_INFO, "NV Write PAN ID cmd sent...[%d]\n", status);\r
2554 \r
2555 return status;\r
2556 }\r
2557 \r
2558 static uint8_t setNVChanList(uint32_t chanList)\r
2559 {\r
2560 OsalNvWriteFormat_t nvWrite;\r
2561 uint8_t status;\r
2562 \r
2563 // setting chanList\r
2564 nvWrite.Id = ZCD_NV_CHANLIST;\r
2565 nvWrite.Offset = 0;\r
2566 nvWrite.Len = 4;\r
2567 nvWrite.Value[0] = BREAK_UINT32(chanList, 0);\r
2568 nvWrite.Value[1] = BREAK_UINT32(chanList, 1);\r
2569 nvWrite.Value[2] = BREAK_UINT32(chanList, 2);\r
2570 nvWrite.Value[3] = BREAK_UINT32(chanList, 3);\r
2571 status = sysOsalNvWrite(&nvWrite);\r
2572 \r
2573 dbg_print(PRINT_LEVEL_INFO, "\n");\r
2574 dbg_print(PRINT_LEVEL_INFO, "NV Write Channel List cmd sent...[%d]\n",\r
2575 status);\r
2576 \r
2577 return status;\r
2578 }\r
2579 \r
2580 static int32_t startNetwork(void)\r
2581 {\r
2582 char cDevType;\r
2583 uint8_t devType;\r
2584 int32_t status;\r
2585 uint8_t newNwk = 0;\r
2586 char sCh[128];\r
2587 \r
2588 do\r
2589 {\r
2590 consolePrint("Do you wish to start/join a new network? (y/n)\n");\r
2591 consoleGetLine(sCh, 128);\r
2592 if (sCh[0] == 'n' || sCh[0] == 'N')\r
2593 {\r
2594 status = setNVStartup(0);\r
2595 }\r
2596 else if (sCh[0] == 'y' || sCh[0] == 'Y')\r
2597 {\r
2598 status = setNVStartup(\r
2599 ZCD_STARTOPT_CLEAR_STATE | ZCD_STARTOPT_CLEAR_CONFIG);\r
2600 newNwk = 1;\r
2601 \r
2602 }\r
2603 else\r
2604 {\r
2605 consolePrint("Incorrect input please type y or n\n");\r
2606 }\r
2607 } while (sCh[0] != 'y' && sCh[0] != 'Y' && sCh[0] != 'n' && sCh[0] != 'N');\r
2608 \r
2609 if (status != MT_RPC_SUCCESS)\r
2610 {\r
2611 dbg_print(PRINT_LEVEL_WARNING, "network start failed\n");\r
2612 return -1;\r
2613 }\r
2614 consolePrint("Resetting ZNP\n");\r
2615 ResetReqFormat_t resReq;\r
2616 resReq.Type = 1;\r
2617 sysResetReq(&resReq);\r
2618 //flush the rsp\r
2619 rpcWaitMqClientMsg(5000);\r
2620 \r
2621 if (newNwk)\r
2622 {\r
2623 consolePrint(\r
2624 "Enter device type c: Coordinator, r: Router, e: End Device:\n");\r
2625 consoleGetLine(sCh, 128);\r
2626 cDevType = sCh[0];\r
2627 \r
2628 switch (cDevType)\r
2629 {\r
2630 case 'c':\r
2631 case 'C':\r
2632 devType = DEVICETYPE_COORDINATOR;\r
2633 break;\r
2634 case 'r':\r
2635 case 'R':\r
2636 devType = DEVICETYPE_ROUTER;\r
2637 break;\r
2638 case 'e':\r
2639 case 'E':\r
2640 default:\r
2641 devType = DEVICETYPE_ENDDEVICE;\r
2642 break;\r
2643 }\r
2644 status = setNVDevType(devType);\r
2645 \r
2646 if (status != MT_RPC_SUCCESS)\r
2647 {\r
2648 dbg_print(PRINT_LEVEL_WARNING, "setNVDevType failed\n");\r
2649 return 0;\r
2650 }\r
2651 //Select random PAN ID for Coord and join any PAN for RTR/ED\r
2652 status = setNVPanID(0xFFFF);\r
2653 if (status != MT_RPC_SUCCESS)\r
2654 {\r
2655 dbg_print(PRINT_LEVEL_WARNING, "setNVPanID failed\n");\r
2656 return -1;\r
2657 }\r
2658 consolePrint("Enter channel 11-26:\n");\r
2659 consoleGetLine(sCh, 128);\r
2660 \r
2661 status = setNVChanList(1 << atoi(sCh));\r
2662 if (status != MT_RPC_SUCCESS)\r
2663 {\r
2664 dbg_print(PRINT_LEVEL_INFO, "setNVPanID failed\n");\r
2665 return -1;\r
2666 }\r
2667 \r
2668 }\r
2669 \r
2670 registerAf();\r
2671 consolePrint("EndPoint: 1\n");\r
2672 \r
2673 status = zdoInit();\r
2674 if (status == NEW_NETWORK)\r
2675 {\r
2676 dbg_print(PRINT_LEVEL_INFO, "zdoInit NEW_NETWORK\n");\r
2677 status = MT_RPC_SUCCESS;\r
2678 }\r
2679 else if (status == RESTORED_NETWORK)\r
2680 {\r
2681 dbg_print(PRINT_LEVEL_INFO, "zdoInit RESTORED_NETWORK\n");\r
2682 status = MT_RPC_SUCCESS;\r
2683 }\r
2684 else\r
2685 {\r
2686 dbg_print(PRINT_LEVEL_INFO, "zdoInit failed\n");\r
2687 status = -1;\r
2688 }\r
2689 \r
2690 dbg_print(PRINT_LEVEL_INFO, "process zdoStatechange callbacks\n");\r
2691 \r
2692 //flush AREQ ZDO State Change messages\r
2693 while (status != -1)\r
2694 {\r
2695 status = rpcWaitMqClientMsg(5000);\r
2696 \r
2697 if (((devType == DEVICETYPE_COORDINATOR) && (devState == DEV_ZB_COORD))\r
2698 || ((devType == DEVICETYPE_ROUTER) && (devState == DEV_ROUTER))\r
2699 || ((devType == DEVICETYPE_ENDDEVICE)\r
2700 && (devState == DEV_END_DEVICE)))\r
2701 {\r
2702 break;\r
2703 }\r
2704 }\r
2705 //set startup option back to keep configuration in case of reset\r
2706 status = setNVStartup(0);\r
2707 if (devState < DEV_END_DEVICE)\r
2708 {\r
2709 //start network failed\r
2710 return -1;\r
2711 }\r
2712 \r
2713 return 0;\r
2714 }\r
2715 \r
2716 static int32_t registerAf(void)\r
2717 {\r
2718 int32_t status = 0;\r
2719 RegisterFormat_t reg;\r
2720 \r
2721 reg.EndPoint = 1;\r
2722 reg.AppProfId = 0x0104;\r
2723 reg.AppDeviceId = 0x0100;\r
2724 reg.AppDevVer = 1;\r
2725 reg.LatencyReq = 0;\r
2726 reg.AppNumInClusters = 1;\r
2727 reg.AppInClusterList[0] = 0x0006;\r
2728 reg.AppNumOutClusters = 0;\r
2729 \r
2730 status = afRegister(®);\r
2731 return status;\r
2732 }\r
2733 \r
2734 /*********************************************************************\r
2735 * INTERFACE FUNCTIONS\r
2736 */\r
2737 uint32_t appInit(void)\r
2738 {\r
2739 int32_t status = 0;\r
2740 uint32_t msgCnt = 0;\r
2741 \r
2742 //Flush all messages from the que\r
2743 while (status != -1)\r
2744 {\r
2745 status = rpcWaitMqClientMsg(10);\r
2746 if (status != -1)\r
2747 {\r
2748 msgCnt++;\r
2749 }\r
2750 }\r
2751 \r
2752 dbg_print(PRINT_LEVEL_INFO, "flushed %d message from msg queue\n", msgCnt);\r
2753 \r
2754 //Register Callbacks MT system callbacks\r
2755 sysRegisterCallbacks(mtSysCb);\r
2756 zdoRegisterCallbacks(mtZdoCb);\r
2757 afRegisterCallbacks(mtAfCb);\r
2758 sapiRegisterCallbacks(mtSapiCb);\r
2759 \r
2760 return 0;\r
2761 }\r
2762 /*********************************************************************\r
2763 * START OF COMMANDS PROCESSING\r
2764 */\r
2765 static void sendCmd(uint8_t* req, uint8_t index)\r
2766 {\r
2767 switch (index)\r
2768 {\r
2769 case 0:\r
2770 sysPing();\r
2771 break;\r
2772 case 1:\r
2773 sysSetExtAddr((SetExtAddrFormat_t*) req);\r
2774 break;\r
2775 case 2:\r
2776 sysGetExtAddr();\r
2777 break;\r
2778 case 3:\r
2779 sysRamRead((RamReadFormat_t*) req);\r
2780 break;\r
2781 case 4:\r
2782 sysRamWrite((RamWriteFormat_t*) req);\r
2783 break;\r
2784 case 5:\r
2785 sysResetReq((ResetReqFormat_t*) req);\r
2786 break;\r
2787 case 6:\r
2788 sysVersion();\r
2789 break;\r
2790 case 7:\r
2791 sysOsalNvRead((OsalNvReadFormat_t*) req);\r
2792 break;\r
2793 case 8:\r
2794 sysOsalNvWrite((OsalNvWriteFormat_t*) req);\r
2795 break;\r
2796 case 9:\r
2797 sysOsalNvItemInit((OsalNvItemInitFormat_t*) req);\r
2798 break;\r
2799 case 10:\r
2800 sysOsalNvDelete((OsalNvDeleteFormat_t*) req);\r
2801 break;\r
2802 case 11:\r
2803 sysOsalNvLength((OsalNvLengthFormat_t*) req);\r
2804 break;\r
2805 case 12:\r
2806 sysOsalStartTimer((OsalStartTimerFormat_t*) req);\r
2807 break;\r
2808 case 13:\r
2809 sysOsalStopTimer((OsalStopTimerFormat_t*) req);\r
2810 break;\r
2811 case 14:\r
2812 sysStackTune((StackTuneFormat_t*) req);\r
2813 break;\r
2814 case 15:\r
2815 sysAdcRead((AdcReadFormat_t*) req);\r
2816 break;\r
2817 case 16:\r
2818 sysGpio((GpioFormat_t*) req);\r
2819 break;\r
2820 case 17:\r
2821 sysRandom();\r
2822 break;\r
2823 case 18:\r
2824 sysSetTime((SetTimeFormat_t*) req);\r
2825 break;\r
2826 case 19:\r
2827 sysGetTime();\r
2828 break;\r
2829 case 20:\r
2830 sysSetTxPower((SetTxPowerFormat_t*) req);\r
2831 break;\r
2832 case 21:\r
2833 afRegister((RegisterFormat_t*) req);\r
2834 break;\r
2835 case 22:\r
2836 afDataRequest((DataRequestFormat_t*) req);\r
2837 break;\r
2838 case 23:\r
2839 afDataRequestExt((DataRequestExtFormat_t*) req);\r
2840 break;\r
2841 case 24:\r
2842 afDataRequestSrcRtg((DataRequestSrcRtgFormat_t*) req);\r
2843 break;\r
2844 case 25:\r
2845 afInterPanCtl((InterPanCtlFormat_t*) req);\r
2846 break;\r
2847 case 26:\r
2848 afDataStore((DataStoreFormat_t*) req);\r
2849 break;\r
2850 case 27:\r
2851 afDataRetrieve((DataRetrieveFormat_t*) req);\r
2852 break;\r
2853 case 28:\r
2854 afApsfConfigSet((ApsfConfigSetFormat_t*) req);\r
2855 break;\r
2856 case 29:\r
2857 zdoNwkAddrReq((NwkAddrReqFormat_t*) req);\r
2858 break;\r
2859 case 30:\r
2860 zdoIeeeAddrReq((IeeeAddrReqFormat_t*) req);\r
2861 break;\r
2862 case 31:\r
2863 zdoNodeDescReq((NodeDescReqFormat_t*) req);\r
2864 break;\r
2865 case 32:\r
2866 zdoPowerDescReq((PowerDescReqFormat_t*) req);\r
2867 break;\r
2868 case 33:\r
2869 zdoSimpleDescReq((SimpleDescReqFormat_t*) req);\r
2870 break;\r
2871 case 34:\r
2872 zdoActiveEpReq((ActiveEpReqFormat_t*) req);\r
2873 break;\r
2874 case 35:\r
2875 zdoMatchDescReq((MatchDescReqFormat_t*) req);\r
2876 break;\r
2877 case 36:\r
2878 zdoComplexDescReq((ComplexDescReqFormat_t*) req);\r
2879 break;\r
2880 case 37:\r
2881 zdoUserDescReq((UserDescReqFormat_t*) req);\r
2882 break;\r
2883 case 38:\r
2884 zdoDeviceAnnce((DeviceAnnceFormat_t*) req);\r
2885 break;\r
2886 case 39:\r
2887 zdoUserDescSet((UserDescSetFormat_t*) req);\r
2888 break;\r
2889 case 40:\r
2890 zdoServerDiscReq((ServerDiscReqFormat_t*) req);\r
2891 break;\r
2892 case 41:\r
2893 zdoEndDeviceBindReq((EndDeviceBindReqFormat_t*) req);\r
2894 break;\r
2895 case 42:\r
2896 zdoBindReq((BindReqFormat_t*) req);\r
2897 break;\r
2898 case 43:\r
2899 zdoUnbindReq((UnbindReqFormat_t*) req);\r
2900 break;\r
2901 case 44:\r
2902 zdoMgmtNwkDiscReq((MgmtNwkDiscReqFormat_t*) req);\r
2903 break;\r
2904 case 45:\r
2905 zdoMgmtLqiReq((MgmtLqiReqFormat_t*) req);\r
2906 break;\r
2907 case 46:\r
2908 zdoMgmtRtgReq((MgmtRtgReqFormat_t*) req);\r
2909 break;\r
2910 case 47:\r
2911 zdoMgmtBindReq((MgmtBindReqFormat_t*) req);\r
2912 break;\r
2913 case 48:\r
2914 zdoMgmtLeaveReq((MgmtLeaveReqFormat_t*) req);\r
2915 break;\r
2916 case 49:\r
2917 zdoMgmtDirectJoinReq((MgmtDirectJoinReqFormat_t*) req);\r
2918 break;\r
2919 case 50:\r
2920 zdoMgmtPermitJoinReq((MgmtPermitJoinReqFormat_t*) req);\r
2921 break;\r
2922 case 51:\r
2923 zdoMgmtNwkUpdateReq((MgmtNwkUpdateReqFormat_t*) req);\r
2924 break;\r
2925 case 52:\r
2926 zdoStartupFromApp((StartupFromAppFormat_t*) req);\r
2927 break;\r
2928 case 53:\r
2929 zdoAutoFindDestination((AutoFindDestinationFormat_t*) req);\r
2930 break;\r
2931 case 54:\r
2932 zdoSetLinkKey((SetLinkKeyFormat_t*) req);\r
2933 break;\r
2934 case 55:\r
2935 zdoRemoveLinkKey((RemoveLinkKeyFormat_t*) req);\r
2936 break;\r
2937 case 56:\r
2938 zdoGetLinkKey((GetLinkKeyFormat_t*) req);\r
2939 break;\r
2940 case 57:\r
2941 zdoNwkDiscoveryReq((NwkDiscoveryReqFormat_t*) req);\r
2942 break;\r
2943 case 58:\r
2944 zdoJoinReq((JoinReqFormat_t*) req);\r
2945 break;\r
2946 case 59:\r
2947 zdoMsgCbRegister((MsgCbRegisterFormat_t*) req);\r
2948 break;\r
2949 case 60:\r
2950 zdoMsgCbRemove((MsgCbRemoveFormat_t*) req);\r
2951 break;\r
2952 case 61:\r
2953 zbSystemReset();\r
2954 break;\r
2955 case 62:\r
2956 zbAppRegisterReq((AppRegisterReqFormat_t*) req);\r
2957 break;\r
2958 case 63:\r
2959 zbStartReq();\r
2960 break;\r
2961 case 64:\r
2962 zbPermitJoiningReq((PermitJoiningReqFormat_t*) req);\r
2963 break;\r
2964 case 65:\r
2965 zbBindDevice((BindDeviceFormat_t*) req);\r
2966 break;\r
2967 case 66:\r
2968 zbAllowBind((AllowBindFormat_t*) req);\r
2969 break;\r
2970 case 67:\r
2971 zbSendDataReq((SendDataReqFormat_t*) req);\r
2972 break;\r
2973 case 68:\r
2974 zbFindDeviceReq((FindDeviceReqFormat_t*) req);\r
2975 break;\r
2976 case 69:\r
2977 zbWriteConfiguration((WriteConfigurationFormat_t*) req);\r
2978 break;\r
2979 case 70:\r
2980 zbGetDeviceInfo((GetDeviceInfoFormat_t*) req);\r
2981 break;\r
2982 case 71:\r
2983 zbReadConfiguration((ReadConfigurationFormat_t*) req);\r
2984 break;\r
2985 \r
2986 }\r
2987 \r
2988 }\r
2989 uint8_t matchedCmds[250];\r
2990 uint8_t matchedLength;\r
2991 static void inputCmd(uint16_t index)\r
2992 {\r
2993 char value[128];\r
2994 char* strPos = value;\r
2995 uint8_t commandSize = 0;\r
2996 uint8_t attSize = 0;\r
2997 uint16_t currentPos = 0;\r
2998 \r
2999 uint8_t x;\r
3000 for (x = 0; x < commands[index].attNum; x++)\r
3001 {\r
3002 commandSize += commands[index].atts[x].size\r
3003 * (commands[index].atts[x].isList == 0 ?\r
3004 1 : commands[index].atts[x].isList);\r
3005 commandSize += (\r
3006 (commands[index].atts[x].size == 2 && (commandSize % 2) != 0) ?\r
3007 1 : 0);\r
3008 }\r
3009 \r
3010 uint8_t *input = malloc(commandSize);\r
3011 int tem;\r
3012 \r
3013 SET_PARAM_COLOR();\r
3014 consolePrint("Command: %s\n", commands[index].cmdName);\r
3015 SET_NRM_COLOR();\r
3016 for (x = 0; x < commands[index].attNum; x++)\r
3017 {\r
3018 attSize = commands[index].atts[x].size;\r
3019 if (commands[index].atts[x].isList == 0)\r
3020 {\r
3021 SET_PARAM_COLOR();\r
3022 consolePrint("Enter %s: (%dB)\n", commands[index].atts[x].name,\r
3023 attSize);\r
3024 SET_NRM_COLOR();\r
3025 consoleGetLine(value, 128);\r
3026 \r
3027 if (attSize == 2)\r
3028 {\r
3029 sscanf(value, "%x", &tem);\r
3030 sprintf(value, "%04X", tem);\r
3031 //strPos = value;\r
3032 if (currentPos % 2 != 0)\r
3033 {\r
3034 currentPos++;\r
3035 }\r
3036 }\r
3037 else if (attSize == 4)\r
3038 {\r
3039 sscanf(value, "%x", &tem);\r
3040 sprintf(value, "%08X", tem);\r
3041 //strPos = value;\r
3042 }\r
3043 else if (attSize == 1)\r
3044 {\r
3045 sscanf(value, "%x", &tem);\r
3046 sprintf(value, "%02X", tem);\r
3047 //strPos = value;\r
3048 }\r
3049 strPos = value;\r
3050 uint8_t idx;\r
3051 for (idx = 0; idx < attSize; idx++)\r
3052 {\r
3053 if (strlen(strPos) > 0)\r
3054 {\r
3055 \r
3056 sscanf(strPos, "%2hhx",\r
3057 &input[currentPos + attSize - 1 - idx]);\r
3058 strPos += (strPos[2] == ':' ? 3 : 2);\r
3059 }\r
3060 else\r
3061 {\r
3062 input[currentPos + attSize - 1 - idx] = 0;\r
3063 }\r
3064 \r
3065 }\r
3066 currentPos += attSize;\r
3067 }\r
3068 else\r
3069 {\r
3070 uint16_t tempPos = currentPos;\r
3071 uint8_t listLen = input[currentPos - 1];\r
3072 uint8_t listIdx;\r
3073 for (listIdx = 0; listIdx < listLen; listIdx++)\r
3074 {\r
3075 SET_PARAM_COLOR();\r
3076 consolePrint("Enter %s[%d]:\n", commands[index].atts[x].name,\r
3077 listIdx);\r
3078 SET_NRM_COLOR();\r
3079 consoleGetLine(value, 128);\r
3080 if (attSize == 2)\r
3081 {\r
3082 sscanf(value, "%x", &tem);\r
3083 sprintf(value, "%04X", tem);\r
3084 //strPos = value;\r
3085 if (tempPos % 2 != 0)\r
3086 {\r
3087 tempPos++;\r
3088 currentPos++;\r
3089 }\r
3090 }\r
3091 else if (attSize == 1)\r
3092 {\r
3093 sscanf(value, "%x", &tem);\r
3094 sprintf(value, "%02X", tem);\r
3095 //strPos = value;\r
3096 }\r
3097 strPos = value;\r
3098 uint8_t idx;\r
3099 for (idx = 0; idx < attSize; idx++)\r
3100 {\r
3101 if (strlen(strPos) > 0)\r
3102 {\r
3103 sscanf(strPos, "%2hhx",\r
3104 &input[tempPos + attSize - 1 - idx]);\r
3105 strPos += (strPos[2] == ':' ? 3 : 2);\r
3106 }\r
3107 else\r
3108 {\r
3109 input[currentPos + attSize - 1 - idx] = 0;\r
3110 }\r
3111 }\r
3112 tempPos += attSize;\r
3113 }\r
3114 currentPos += (attSize * commands[index].atts[x].isList);\r
3115 }\r
3116 }\r
3117 \r
3118 sendCmd(input, index);\r
3119 free(input);\r
3120 \r
3121 }\r
3122 static uint8_t getMatched(char* cmd)\r
3123 {\r
3124 uint8_t cmdLength = strlen(cmd);\r
3125 uint8_t tempLength = 0;\r
3126 uint16_t cmdMatches = 0;\r
3127 uint8_t matchedTemp[250];\r
3128 char tempcmd[200];\r
3129 \r
3130 uint16_t Idx;\r
3131 for (Idx = 0; Idx < COMMANDS_SIZE; Idx++)\r
3132 {\r
3133 tempLength = strlen(commands[Idx].cmdName);\r
3134 if (tempLength >= cmdLength)\r
3135 {\r
3136 strcpy(tempcmd, commands[Idx].cmdName);\r
3137 tempcmd[cmdLength] = '\0';\r
3138 if (strcmp(cmd, tempcmd) == 0)\r
3139 {\r
3140 if (tempLength == cmdLength)\r
3141 {\r
3142 matchedTemp[0] = Idx;\r
3143 cmdMatches = 1;\r
3144 matchedLength = 0;\r
3145 Idx = COMMANDS_SIZE;\r
3146 }\r
3147 else\r
3148 {\r
3149 matchedTemp[cmdMatches] = Idx;\r
3150 cmdMatches++;\r
3151 }\r
3152 }\r
3153 }\r
3154 }\r
3155 uint8_t index = strlen(cmd);\r
3156 if (cmdMatches > 1 && (matchedLength == cmdMatches || matchedLength == 0))\r
3157 {\r
3158 \r
3159 matchedLength = cmdMatches;\r
3160 cmd[index] = commands[matchedTemp[0]].cmdName[index];\r
3161 cmd[index + 1] = '\0';\r
3162 getMatched(cmd);\r
3163 matchedLength = cmdMatches;\r
3164 memcpy(matchedCmds, matchedTemp, cmdMatches);\r
3165 return 0;\r
3166 }\r
3167 memcpy(matchedCmds, matchedTemp, cmdMatches);\r
3168 if (matchedLength != 0)\r
3169 cmd[index - 1] = '\0';\r
3170 matchedLength = cmdMatches;\r
3171 return 0;\r
3172 \r
3173 }\r
3174 \r
3175 uint8_t histIdx = 0;\r
3176 uint8_t isHistRollOver = 0;\r
3177 uint32_t maxHist = 256;\r
3178 char hist[256][256];\r
3179 static uint8_t clGetCmd(void)\r
3180 {\r
3181 char ch;\r
3182 char tempStr[256];\r
3183 char tempHist[256];\r
3184 uint8_t cPos = 0;\r
3185 char cmdStr[256] =\r
3186 { 0 };\r
3187 char lastChar;\r
3188 uint32_t cmdStrIdx = 0;\r
3189 uint32_t currHist = 0;\r
3190 uint8_t cmdComplete = 0;\r
3191 uint8_t isDir;\r
3192 isDir = 0;\r
3193 cmdStr[0] = '\0';\r
3194 consolePrint("Enter CMD\n");\r
3195 \r
3196 while (cmdComplete == 0)\r
3197 {\r
3198 ch = consoleGetCh();\r
3199 switch (ch)\r
3200 {\r
3201 case '\t':\r
3202 consoleClearLn()\r
3203 ;\r
3204 consolePrint("\r%s", cmdStr);\r
3205 \r
3206 getMatched(cmdStr);\r
3207 \r
3208 if (matchedLength == 1) // there was only 1 match\r
3209 {\r
3210 if (lastChar == '\t') //2 tabs pressed then print command description\r
3211 {\r
3212 SET_HELP_COLOR();\r
3213 consolePrint("\nDescription:\n%s",\r
3214 commands[matchedCmds[0]].cmdDesc);\r
3215 SET_NRM_COLOR();\r
3216 consolePrint("\nEnter CMD\n");\r
3217 ch = ' ';\r
3218 }\r
3219 else\r
3220 {\r
3221 strcpy(cmdStr, commands[matchedCmds[0]].cmdName);\r
3222 }\r
3223 }\r
3224 else if (matchedLength > 1) // there was more than 1 match\r
3225 {\r
3226 if (lastChar == '\t') //2 tabs pressed then print all commands that start with\r
3227 {\r
3228 consolePrint("\n\n");\r
3229 uint8_t mIdx;\r
3230 SET_HELP_COLOR();\r
3231 for (mIdx = 0; mIdx < matchedLength; mIdx++)\r
3232 {\r
3233 consolePrint("%s\n",\r
3234 commands[matchedCmds[mIdx]].cmdName);\r
3235 }\r
3236 SET_NRM_COLOR();\r
3237 consolePrint("\n\nEnter CMD\n");\r
3238 ch = ' ';\r
3239 }\r
3240 }\r
3241 cmdStrIdx = strlen(cmdStr);\r
3242 consoleClearLn()\r
3243 ;\r
3244 consolePrint("\r%s", cmdStr);\r
3245 matchedLength = 0;\r
3246 consolePrint("%s", KNRM);\r
3247 break;\r
3248 case '\n':\r
3249 //enter was press\r
3250 getMatched(cmdStr);\r
3251 if ((histIdx == 0 && isHistRollOver == 0)\r
3252 || strcmp(hist[(maxHist + histIdx - 1) % maxHist], cmdStr)\r
3253 != 0)\r
3254 {\r
3255 strcpy(hist[histIdx], cmdStr);\r
3256 histIdx = ((histIdx + 1) % maxHist);\r
3257 }\r
3258 if (histIdx == 0)\r
3259 {\r
3260 isHistRollOver = 1;\r
3261 }\r
3262 if (matchedLength == 1)\r
3263 {\r
3264 if (strcmp(cmdStr, commands[matchedCmds[0]].cmdName) == 0)\r
3265 {\r
3266 consolePrint("\n");\r
3267 inputCmd(matchedCmds[0]);\r
3268 \r
3269 }\r
3270 \r
3271 }\r
3272 matchedLength = 0;\r
3273 cmdComplete = 1;\r
3274 break;\r
3275 case 127:\r
3276 //backspace was press\r
3277 //clear line\r
3278 if (cmdStrIdx > 0)\r
3279 {\r
3280 if (cPos < cmdStrIdx)\r
3281 {\r
3282 uint8_t x;\r
3283 for (x = 0; x < cPos; x++)\r
3284 {\r
3285 cmdStr[cmdStrIdx - cPos + x - 1] =\r
3286 tempStr[cPos - x - 1];\r
3287 }\r
3288 cmdStr[--cmdStrIdx] = '\0';\r
3289 }\r
3290 \r
3291 consoleClearLn();\r
3292 consolePrint("\r%s", cmdStr);\r
3293 \r
3294 }\r
3295 else\r
3296 {\r
3297 consoleClearLn();\r
3298 consolePrint("\r");\r
3299 }\r
3300 break;\r
3301 case 27:\r
3302 isDir = 1;\r
3303 if (cmdStrIdx > 0)\r
3304 {\r
3305 consoleClearLn();\r
3306 consolePrint("\r%s", cmdStr);\r
3307 \r
3308 }\r
3309 else\r
3310 {\r
3311 consoleClearLn();\r
3312 consolePrint("\r");\r
3313 }\r
3314 \r
3315 break;\r
3316 default:\r
3317 if (isDir)\r
3318 {\r
3319 if (ch == '[')\r
3320 {\r
3321 isDir = 1;\r
3322 }\r
3323 else if (ch == 'A')\r
3324 {\r
3325 if (currHist < histIdx)\r
3326 {\r
3327 cPos = 0;\r
3328 if (currHist)\r
3329 {\r
3330 strcpy(hist[histIdx - currHist], cmdStr);\r
3331 }\r
3332 if (currHist == 0)\r
3333 strcpy(tempHist, cmdStr);\r
3334 currHist++;\r
3335 strcpy(cmdStr, hist[histIdx - currHist]);\r
3336 cmdStrIdx = strlen(cmdStr);\r
3337 \r
3338 }\r
3339 \r
3340 isDir = 0;\r
3341 }\r
3342 else if (ch == 'B')\r
3343 {\r
3344 if (currHist)\r
3345 {\r
3346 strcpy(hist[histIdx - currHist], cmdStr);\r
3347 currHist--;\r
3348 if (currHist)\r
3349 {\r
3350 strcpy(cmdStr, hist[histIdx - currHist]);\r
3351 }\r
3352 else\r
3353 {\r
3354 strcpy(cmdStr, tempHist);\r
3355 }\r
3356 cmdStrIdx = strlen(cmdStr);\r
3357 \r
3358 }\r
3359 isDir = 0;\r
3360 }\r
3361 else if (ch == 'C')\r
3362 {\r
3363 if (cPos > 0)\r
3364 {\r
3365 cPos--;\r
3366 }\r
3367 \r
3368 isDir = 0;\r
3369 }\r
3370 else if (ch == 'D')\r
3371 {\r
3372 if (cPos < cmdStrIdx)\r
3373 {\r
3374 tempStr[cPos] = cmdStr[cmdStrIdx - cPos - 1];\r
3375 cPos++;\r
3376 }\r
3377 isDir = 0;\r
3378 }\r
3379 else\r
3380 {\r
3381 isDir = 0;\r
3382 }\r
3383 }\r
3384 else\r
3385 {\r
3386 if (cPos != 0)\r
3387 {\r
3388 cmdStr[cmdStrIdx - cPos] = ch;\r
3389 uint8_t x;\r
3390 for (x = 1; x <= cPos; x++)\r
3391 {\r
3392 cmdStr[cmdStrIdx - cPos + x] = tempStr[cPos - x];\r
3393 }\r
3394 cmdStr[++cmdStrIdx] = '\0';\r
3395 }\r
3396 else\r
3397 {\r
3398 cmdStr[cmdStrIdx++] = ch;\r
3399 cmdStr[cmdStrIdx] = '\0';\r
3400 }\r
3401 \r
3402 }\r
3403 consoleClearLn()\r
3404 ;\r
3405 consolePrint("\r%s", cmdStr);\r
3406 break;\r
3407 }\r
3408 \r
3409 uint8_t x;\r
3410 for (x = 1; x <= cPos; x++)\r
3411 {\r
3412 consolePrint("\b");\r
3413 }\r
3414 consoleFlush();\r
3415 lastChar = ch;\r
3416 }\r
3417 \r
3418 return 0;\r
3419 }\r
3420 \r
3421 /*********************************************************************\r
3422 * END OF COMMANDS PROCESSING\r
3423 *********************************************************************/\r
3424 \r
3425 void appProcess(void *argument)\r
3426 {\r
3427 int32_t status;\r
3428 InitCmds();\r
3429 \r
3430 //Flush all messages from the que\r
3431 do\r
3432 {\r
3433 status = rpcWaitMqClientMsg(50);\r
3434 } while (status != -1);\r
3435 \r
3436 //init variable\r
3437 devState = DEV_HOLD;\r
3438 gSrcEndPoint = 1;\r
3439 gDstEndPoint = 1;\r
3440 \r
3441 status = startNetwork();\r
3442 if (status != -1)\r
3443 {\r
3444 consolePrint("Network up\n\n");\r
3445 }\r
3446 else\r
3447 {\r
3448 consolePrint("Network Error\n\n");\r
3449 }\r
3450 \r
3451 sysGetExtAddr();\r
3452 \r
3453 OsalNvWriteFormat_t nvWrite;\r
3454 nvWrite.Id = ZCD_NV_ZDO_DIRECT_CB;\r
3455 nvWrite.Offset = 0;\r
3456 nvWrite.Len = 1;\r
3457 nvWrite.Value[0] = 1;\r
3458 status = sysOsalNvWrite(&nvWrite);\r
3459 \r
3460 while (1)\r
3461 {\r
3462 status = clGetCmd();\r
3463 while (status != -1)\r
3464 {\r
3465 status = rpcWaitMqClientMsg(1000);\r
3466 consolePrint("\n");\r
3467 }\r
3468 }\r
3469 }\r
3470 \r