diff --git a/examples/cmdLine/cmdLine.c~ b/examples/cmdLine/cmdLine.c~
+++ /dev/null
@@ -1,3474 +0,0 @@
-/**************************************************************************************************\r
- * Filename: cmdLine.c\r
- * Description: This file contains cmdLine application.\r
- *\r
- *\r
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/\r
- *\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- *\r
- * Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- *\r
- * Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the\r
- * distribution.\r
- *\r
- * Neither the name of Texas Instruments Incorporated nor the names of\r
- * its contributors may be used to endorse or promote products derived\r
- * from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- *\r
- */\r
-\r
-/*********************************************************************\r
- * INCLUDES\r
- */\r
-#include <string.h>\r
-#include <stdio.h>\r
-#include <unistd.h>\r
-#include <stdlib.h>\r
-\r
-#include "rpc.h"\r
-#include "mtSys.h"\r
-#include "mtZdo.h"\r
-#include "mtAf.h"\r
-#include "mtParser.h"\r
-#include "mtSapi.h"\r
-#include "rpcTransport.h"\r
-#include "dbgPrint.h"\r
-#include "hostConsole.h"\r
-\r
-/*********************************************************************\r
- * MACROS\r
- */\r
-#define KNRM "\x1B[0m"\r
-#define KRED "\x1B[31m"\r
-#define KGRN "\x1B[32m"\r
-#define KYEL "\x1B[33m"\r
-#define KBLU "\x1B[34m"\r
-#define KMAG "\x1B[35m"\r
-#define KCYN "\x1B[36m"\r
-#define KWHT "\x1B[37m"\r
-\r
-#define SET_RSP_COLOR(); consolePrint("%s", KYEL);\r
-#define SET_HELP_COLOR(); consolePrint("%s", KGRN);\r
-#define SET_PARAM_COLOR(); consolePrint("%s", KCYN);\r
-#define SET_NRM_COLOR(); consolePrint("%s", KNRM);\r
-\r
-/*********************************************************************\r
- * TYPES\r
- */\r
-\r
-/*********************************************************************\r
- * LOCAL VARIABLE\r
- */\r
-\r
-//init ZDO device state\r
-devStates_t devState = DEV_HOLD;\r
-uint8_t gSrcEndPoint = 1;\r
-uint8_t gDstEndPoint = 1;\r
-\r
-/***********************************************************************/\r
-\r
-void usage(char* exeName)\r
-{\r
- consolePrint("Usage: ./%s <port>\n", exeName);\r
- consolePrint("Eample: ./%s /dev/ttyACM0\n", exeName);\r
-}\r
-\r
-/*********************************************************************\r
- * LOCAL FUNCTIONS\r
- */\r
-//ZDO Callbacks\r
-static uint8_t mtZdoStateChangeIndCb(uint8_t newDevState);\r
-static uint8_t mtZdoGetLinkKeyCb(GetLinkKeySrspFormat_t *msg);\r
-static uint8_t mtZdoNwkAddrRspCb(NwkAddrRspFormat_t *msg);\r
-static uint8_t mtZdoIeeeAddrRspCb(IeeeAddrRspFormat_t *msg);\r
-static uint8_t mtZdoNodeDescRspCb(NodeDescRspFormat_t *msg);\r
-static uint8_t mtZdoPowerDescRspCb(PowerDescRspFormat_t *msg);\r
-static uint8_t mtZdoSimpleDescRspCb(SimpleDescRspFormat_t *msg);\r
-static uint8_t mtZdoActiveEpRspCb(ActiveEpRspFormat_t *msg);\r
-static uint8_t mtZdoMatchDescRspCb(MatchDescRspFormat_t *msg);\r
-static uint8_t mtZdoComplexDescRspCb(ComplexDescRspFormat_t *msg);\r
-static uint8_t mtZdoUserDescRspCb(UserDescRspFormat_t *msg);\r
-static uint8_t mtZdoUserDescConfCb(UserDescConfFormat_t *msg);\r
-static uint8_t mtZdoServerDiscRspCb(ServerDiscRspFormat_t *msg);\r
-static uint8_t mtZdoEndDeviceBindRspCb(EndDeviceBindRspFormat_t *msg);\r
-static uint8_t mtZdoBindRspCb(BindRspFormat_t *msg);\r
-static uint8_t mtZdoUnbindRspCb(UnbindRspFormat_t *msg);\r
-static uint8_t mtZdoMgmtNwkDiscRspCb(MgmtNwkDiscRspFormat_t *msg);\r
-static uint8_t mtZdoMgmtLqiRspCb(MgmtLqiRspFormat_t *msg);\r
-static uint8_t mtZdoMgmtRtgRspCb(MgmtRtgRspFormat_t *msg);\r
-static uint8_t mtZdoMgmtBindRspCb(MgmtBindRspFormat_t *msg);\r
-static uint8_t mtZdoMgmtLeaveRspCb(MgmtLeaveRspFormat_t *msg);\r
-static uint8_t mtZdoMgmtDirectJoinRspCb(MgmtDirectJoinRspFormat_t *msg);\r
-static uint8_t mtZdoMgmtPermitJoinRspCb(MgmtPermitJoinRspFormat_t *msg);\r
-static uint8_t mtZdoEndDeviceAnnceIndCb(EndDeviceAnnceIndFormat_t *msg);\r
-static uint8_t mtZdoMatchDescRspSentCb(MatchDescRspSentFormat_t *msg);\r
-static uint8_t mtZdoStatusErrorRspCb(StatusErrorRspFormat_t *msg);\r
-static uint8_t mtZdoSrcRtgIndCb(SrcRtgIndFormat_t *msg);\r
-static uint8_t mtZdoBeaconNotifyIndCb(BeaconNotifyIndFormat_t *msg);\r
-static uint8_t mtZdoJoinCnfCb(JoinCnfFormat_t *msg);\r
-static uint8_t mtZdoNwkDiscoveryCnfCb(NwkDiscoveryCnfFormat_t *msg);\r
-static uint8_t mtZdoLeaveIndCb(LeaveIndFormat_t *msg);\r
-static uint8_t mtZdoMsgCbIncomingCb(MsgCbIncomingFormat_t *msg);\r
-\r
-//SYS Callbacks\r
-//static uint8_t mtSysResetInd(uint8_t resetReason, uint8_t version[5]);\r
-static uint8_t mtSysPingSrspCb(PingSrspFormat_t *msg);\r
-static uint8_t mtSysGetExtAddrSrspCb(GetExtAddrSrspFormat_t *msg);\r
-static uint8_t mtSysRamReadSrspCb(RamReadSrspFormat_t *msg);\r
-static uint8_t mtSysResetIndCb(ResetIndFormat_t *msg);\r
-static uint8_t mtSysVersionSrspCb(VersionSrspFormat_t *msg);\r
-static uint8_t mtSysOsalNvReadSrspCb(OsalNvReadSrspFormat_t *msg);\r
-static uint8_t mtSysOsalNvLengthSrspCb(OsalNvLengthSrspFormat_t *msg);\r
-static uint8_t mtSysOsalTimerExpiredCb(OsalTimerExpiredFormat_t *msg);\r
-static uint8_t mtSysStackTuneSrspCb(StackTuneSrspFormat_t *msg);\r
-static uint8_t mtSysAdcReadSrspCb(AdcReadSrspFormat_t *msg);\r
-static uint8_t mtSysGpioSrspCb(GpioSrspFormat_t *msg);\r
-static uint8_t mtSysRandomSrspCb(RandomSrspFormat_t *msg);\r
-static uint8_t mtSysGetTimeSrspCb(GetTimeSrspFormat_t *msg);\r
-static uint8_t mtSysSetTxPowerSrspCb(SetTxPowerSrspFormat_t *msg);\r
-\r
-//AF callbacks\r
-static uint8_t mtAfDataConfirmCb(DataConfirmFormat_t *msg);\r
-static uint8_t mtAfIncomingMsgCb(IncomingMsgFormat_t *msg);\r
-static uint8_t mtAfIncomingMsgExt(IncomingMsgExtFormat_t *msg);\r
-static uint8_t mtAfDataRetrieveSrspCb(DataRetrieveSrspFormat_t *msg);\r
-static uint8_t mtAfReflectErrorCb(ReflectErrorFormat_t *msg);\r
-\r
-//SAPI Callbacks\r
-static uint8_t mtSapiReadConfigurationSrspCb(ReadConfigurationSrspFormat_t *msg);\r
-static uint8_t mtSapiGetDeviceInfoSrspCb(GetDeviceInfoSrspFormat_t *msg);\r
-static uint8_t mtSapiFindDeviceCnfCb(FindDeviceCnfFormat_t *msg);\r
-static uint8_t mtSapiSendDataCnfCb(SendDataCnfFormat_t *msg);\r
-static uint8_t mtSapiReceiveDataIndCb(ReceiveDataIndFormat_t *msg);\r
-static uint8_t mtSapiAllowBindCnfCb(AllowBindCnfFormat_t *msg);\r
-static uint8_t mtSapiBindCnfCb(BindCnfFormat_t *msg);\r
-static uint8_t mtSapiStartCnfCb(StartCnfFormat_t *msg);\r
-\r
-//helper functions\r
-static uint8_t setNVStartup(uint8_t startupOption);\r
-static uint8_t setNVChanList(uint32_t chanList);\r
-static uint8_t setNVPanID(uint32_t panId);\r
-static uint8_t setNVDevType(uint8_t devType);\r
-static int32_t startNetwork(void);\r
-static int32_t registerAf(void);\r
-\r
-typedef struct\r
-{\r
- char *name;\r
- uint8_t size;\r
- uint8_t isList;\r
-} cmdAtt_t;\r
-\r
-typedef struct\r
-{\r
- char *cmdName;\r
- char *cmdDesc;\r
- uint8_t attNum;\r
- cmdAtt_t atts[20];\r
-} cmd_t;\r
-#define COMMANDS_SIZE 72\r
-\r
-cmd_t commands[COMMANDS_SIZE];\r
-\r
-/*********************************************************************\r
- * CALLBACK FUNCTIONS\r
- */\r
-\r
-// SYS callbacks\r
-static mtSysCb_t mtSysCb =\r
- { mtSysPingSrspCb, mtSysGetExtAddrSrspCb, mtSysRamReadSrspCb,\r
- mtSysResetIndCb, mtSysVersionSrspCb, mtSysOsalNvReadSrspCb,\r
- mtSysOsalNvLengthSrspCb, mtSysOsalTimerExpiredCb,\r
- mtSysStackTuneSrspCb, mtSysAdcReadSrspCb, mtSysGpioSrspCb,\r
- mtSysRandomSrspCb, mtSysGetTimeSrspCb, mtSysSetTxPowerSrspCb };\r
-\r
-static mtZdoCb_t mtZdoCb =\r
- { mtZdoNwkAddrRspCb, // MT_ZDO_NWK_ADDR_RSP\r
- mtZdoIeeeAddrRspCb, // MT_ZDO_IEEE_ADDR_RSP\r
- mtZdoNodeDescRspCb, // MT_ZDO_NODE_DESC_RSP\r
- mtZdoPowerDescRspCb, // MT_ZDO_POWER_DESC_RSP\r
- mtZdoSimpleDescRspCb, // MT_ZDO_SIMPLE_DESC_RSP\r
- mtZdoActiveEpRspCb, // MT_ZDO_ACTIVE_EP_RSP\r
- mtZdoMatchDescRspCb, // MT_ZDO_MATCH_DESC_RSP\r
- mtZdoComplexDescRspCb, // MT_ZDO_COMPLEX_DESC_RSP\r
- mtZdoUserDescRspCb, // MT_ZDO_USER_DESC_RSP\r
- mtZdoUserDescConfCb, // MT_ZDO_USER_DESC_CONF\r
- mtZdoServerDiscRspCb, // MT_ZDO_SERVER_DISC_RSP\r
- mtZdoEndDeviceBindRspCb, // MT_ZDO_END_DEVICE_BIND_RSP\r
- mtZdoBindRspCb, // MT_ZDO_BIND_RSP\r
- mtZdoUnbindRspCb, // MT_ZDO_UNBIND_RSP\r
- mtZdoMgmtNwkDiscRspCb, // MT_ZDO_MGMT_NWK_DISC_RSP\r
- mtZdoMgmtLqiRspCb, // MT_ZDO_MGMT_LQI_RSP\r
- mtZdoMgmtRtgRspCb, // MT_ZDO_MGMT_RTG_RSP\r
- mtZdoMgmtBindRspCb, // MT_ZDO_MGMT_BIND_RSP\r
- mtZdoMgmtLeaveRspCb, // MT_ZDO_MGMT_LEAVE_RSP\r
- mtZdoMgmtDirectJoinRspCb, // MT_ZDO_MGMT_DIRECT_JOIN_RSP\r
- mtZdoMgmtPermitJoinRspCb, // MT_ZDO_MGMT_PERMIT_JOIN_RSP\r
- mtZdoStateChangeIndCb, // MT_ZDO_STATE_CHANGE_IND\r
- mtZdoEndDeviceAnnceIndCb, // MT_ZDO_END_DEVICE_ANNCE_IND\r
- mtZdoSrcRtgIndCb, // MT_ZDO_SRC_RTG_IND\r
- mtZdoBeaconNotifyIndCb, //MT_ZDO_BEACON_NOTIFY_IND\r
- mtZdoJoinCnfCb, //MT_ZDO_JOIN_CNF\r
- mtZdoNwkDiscoveryCnfCb, //MT_ZDO_NWK_DISCOVERY_CNF\r
- NULL, // MT_ZDO_CONCENTRATOR_IND_CB\r
- mtZdoLeaveIndCb, // MT_ZDO_LEAVE_IND\r
- mtZdoStatusErrorRspCb, //MT_ZDO_STATUS_ERROR_RSP\r
- mtZdoMatchDescRspSentCb, //MT_ZDO_MATCH_DESC_RSP_SENT\r
- mtZdoMsgCbIncomingCb, mtZdoGetLinkKeyCb };\r
-\r
-static mtAfCb_t mtAfCb =\r
- { mtAfDataConfirmCb, //MT_AF_DATA_CONFIRM\r
- mtAfIncomingMsgCb, //MT_AF_INCOMING_MSG\r
- mtAfIncomingMsgExt, //MT_AF_INCOMING_MSG_EXT\r
- mtAfDataRetrieveSrspCb, //MT_AF_DATA_RETRIEVE\r
- mtAfReflectErrorCb, //MT_AF_REFLECT_ERROR\r
- };\r
-\r
-// SAPI callbacks\r
-static mtSapiCb_t mtSapiCb =\r
- { mtSapiReadConfigurationSrspCb, //MT_SAPI_READ_CONFIGURATION\r
- mtSapiGetDeviceInfoSrspCb, //MT_SAPI_GET_DEVICE_INFO\r
- mtSapiFindDeviceCnfCb, //MT_SAPI_FIND_DEVICE_CNF\r
- mtSapiSendDataCnfCb, //MT_SAPI_SEND_DATA_CNF\r
- mtSapiReceiveDataIndCb, //MT_SAPI_RECEIVE_DATA_IND\r
- mtSapiAllowBindCnfCb, //MT_SAPI_ALLOW_BIND_CNF\r
- mtSapiBindCnfCb, //MT_SAPI_BIND_CNF\r
- mtSapiStartCnfCb, //MT_SAPI_START_CNF\r
- };\r
-\r
-static void InitCmds(void)\r
-{\r
-\r
- commands[0].cmdName = "SYS_PING";\r
- commands[0].cmdDesc =\r
- " This command issues PING requests to verify if a device is active and check the\n"\r
- " capability of the device.\n";\r
- commands[0].attNum = 0;\r
- commands[1].cmdName = "SYS_SET_EXTADDR";\r
- commands[1].cmdDesc =\r
- " This command is used to set the extended address of the device.\n";\r
- commands[1].attNum = 1;\r
- commands[1].atts[0].name = "ExtAddr";\r
- commands[1].atts[0].size = 8;\r
- commands[1].atts[0].isList = 0;\r
- commands[2].cmdName = "SYS_GET_EXTADDR";\r
- commands[2].cmdDesc =\r
- " This command is used to get the extended address of the device.\n";\r
- commands[2].attNum = 0;\r
- commands[3].cmdName = "SYS_RAM_READ";\r
- commands[3].cmdDesc =\r
- " This command is used by the tester to read a single memory location in the target\n"\r
- " RAM. The command accepts an address value and returns the memory value present in\n"\r
- " the target RAM at that address.\n";\r
- commands[3].attNum = 2;\r
- commands[3].atts[0].name = "Address";\r
- commands[3].atts[0].size = 2;\r
- commands[3].atts[0].isList = 0;\r
- commands[3].atts[1].name = "Len";\r
- commands[3].atts[1].size = 1;\r
- commands[3].atts[1].isList = 0;\r
- commands[4].cmdName = "SYS_RAM_WRITE";\r
- commands[4].cmdDesc =\r
- " This command is used by the tester to write to a particular location in the target\n"\r
- " RAM. The command accepts an address location and a memory value. The memory value\n"\r
- " is written to the address location in the target RAM.\n";\r
- commands[4].attNum = 3;\r
- commands[4].atts[0].name = "Address";\r
- commands[4].atts[0].size = 2;\r
- commands[4].atts[0].isList = 0;\r
- commands[4].atts[1].name = "Len";\r
- commands[4].atts[1].size = 1;\r
- commands[4].atts[1].isList = 0;\r
- commands[4].atts[2].name = "Value";\r
- commands[4].atts[2].size = 1;\r
- commands[4].atts[2].isList = 128;\r
- commands[5].cmdName = "SYS_RESET_REQ";\r
- commands[5].cmdDesc =\r
- " This command is sent by the tester to reset the target device.\n";\r
- commands[5].attNum = 1;\r
- commands[5].atts[0].name = "Type";\r
- commands[5].atts[0].size = 1;\r
- commands[5].atts[0].isList = 0;\r
- commands[6].cmdName = "SYS_VERSION";\r
- commands[6].cmdDesc =\r
- " This command is used to request for the device\'s version string.\n";\r
- commands[6].attNum = 0;\r
- commands[7].cmdName = "SYS_OSAL_NV_READ";\r
- commands[7].cmdDesc =\r
- " This command is used by the tester to read a single memory item from the target\n"\r
- " non-volatile memory. The command accepts an attribute Id value and data offset and\n"\r
- " returns the memory value present in the target for the specified attribute Id.\n";\r
- commands[7].attNum = 2;\r
- commands[7].atts[0].name = "Id";\r
- commands[7].atts[0].size = 2;\r
- commands[7].atts[0].isList = 0;\r
- commands[7].atts[1].name = "Offset";\r
- commands[7].atts[1].size = 1;\r
- commands[7].atts[1].isList = 0;\r
- commands[8].cmdName = "SYS_OSAL_NV_WRITE";\r
- commands[8].cmdDesc =\r
- " This command is used by the tester to write to a particular item in non-volatile\n"\r
- " memory. The command accepts an attribute Id, data offset, data length, and attribute\n"\r
- " value. The attribute value is written to the location specified for the attribute\n"\r
- " Id in the target.\n";\r
- commands[8].attNum = 4;\r
- commands[8].atts[0].name = "Id";\r
- commands[8].atts[0].size = 2;\r
- commands[8].atts[0].isList = 0;\r
- commands[8].atts[1].name = "Offset";\r
- commands[8].atts[1].size = 1;\r
- commands[8].atts[1].isList = 0;\r
- commands[8].atts[2].name = "Len";\r
- commands[8].atts[2].size = 1;\r
- commands[8].atts[2].isList = 0;\r
- commands[8].atts[3].name = "Value";\r
- commands[8].atts[3].size = 1;\r
- commands[8].atts[3].isList = 246;\r
- commands[9].cmdName = "SYS_OSAL_NV_ITEM_INIT";\r
- commands[9].cmdDesc =\r
- " This command is used by the tester to write to a particular item in non-volatile\n"\r
- " memory. The command accepts an attribute Id, data offset, data length, and attribute\n"\r
- " value. The attribute value is written to the location specified for the attribute\n"\r
- " Id in the target.\n";\r
- commands[9].attNum = 4;\r
- commands[9].atts[0].name = "Id";\r
- commands[9].atts[0].size = 2;\r
- commands[9].atts[0].isList = 0;\r
- commands[9].atts[1].name = "ItemLen";\r
- commands[9].atts[1].size = 2;\r
- commands[9].atts[1].isList = 0;\r
- commands[9].atts[2].name = "InitLen";\r
- commands[9].atts[2].size = 1;\r
- commands[9].atts[2].isList = 0;\r
- commands[9].atts[3].name = "InitData";\r
- commands[9].atts[3].size = 1;\r
- commands[9].atts[3].isList = 245;\r
- commands[10].cmdName = "SYS_OSAL_NV_DELETE";\r
- commands[10].cmdDesc =\r
- " This command is used by the tester to delete an item from the non-volatile memory.\n"\r
- " The ItemLen parameter must match the length of the NV item or the command will fail.\n"\r
- " Use this command with caution – deleted items cannot be recovered.\n";\r
- commands[10].attNum = 2;\r
- commands[10].atts[0].name = "Id";\r
- commands[10].atts[0].size = 2;\r
- commands[10].atts[0].isList = 0;\r
- commands[10].atts[1].name = "ItemLen";\r
- commands[10].atts[1].size = 2;\r
- commands[10].atts[1].isList = 0;\r
- commands[11].cmdName = "SYS_OSAL_NV_LENGTH";\r
- commands[11].cmdDesc =\r
- " This command is used by the tester to get the length of an item in non-volatile\n"\r
- " memory. A returned length of zero indicates that the NV item does not exist.\n";\r
- commands[11].attNum = 1;\r
- commands[11].atts[0].name = "Id";\r
- commands[11].atts[0].size = 2;\r
- commands[11].atts[0].isList = 0;\r
- commands[12].cmdName = "SYS_OSAL_START_TIMER";\r
- commands[12].cmdDesc =\r
- " This command is used by the tester to start a timer event. The event will expired\n"\r
- " after the indicated amount of time and a notification will be sent back to the tester.\n";\r
- commands[12].attNum = 2;\r
- commands[12].atts[0].name = "Id";\r
- commands[12].atts[0].size = 1;\r
- commands[12].atts[0].isList = 0;\r
- commands[12].atts[1].name = "Timeout";\r
- commands[12].atts[1].size = 2;\r
- commands[12].atts[1].isList = 0;\r
- commands[13].cmdName = "SYS_OSAL_STOP_TIMER";\r
- commands[13].cmdDesc =\r
- " This command is used by the tester to stop a timer event.\n";\r
- commands[13].attNum = 1;\r
- commands[13].atts[0].name = "Id";\r
- commands[13].atts[0].size = 1;\r
- commands[13].atts[0].isList = 0;\r
- commands[14].cmdName = "SYS_STACK_TUNE";\r
- commands[14].cmdDesc =\r
- " This command is used by the tester to tune intricate or arcane settings at runtime.\n";\r
- commands[14].attNum = 2;\r
- commands[14].atts[0].name = "Operation";\r
- commands[14].atts[0].size = 1;\r
- commands[14].atts[0].isList = 0;\r
- commands[14].atts[1].name = "Value";\r
- commands[14].atts[1].size = 1;\r
- commands[14].atts[1].isList = 0;\r
- commands[15].cmdName = "SYS_ADC_READ";\r
- commands[15].cmdDesc =\r
- " This command reads a value from the ADC based on specified channel and resolution.\n";\r
- commands[15].attNum = 2;\r
- commands[15].atts[0].name = "Channel";\r
- commands[15].atts[0].size = 1;\r
- commands[15].atts[0].isList = 0;\r
- commands[15].atts[1].name = "Resolution";\r
- commands[15].atts[1].size = 1;\r
- commands[15].atts[1].isList = 0;\r
- commands[16].cmdName = "SYS_GPIO";\r
- commands[16].cmdDesc =\r
- " This command is used by the tester to control the GPIO pins.\n";\r
- commands[16].attNum = 2;\r
- commands[16].atts[0].name = "Operation";\r
- commands[16].atts[0].size = 1;\r
- commands[16].atts[0].isList = 0;\r
- commands[16].atts[1].name = "Value";\r
- commands[16].atts[1].size = 1;\r
- commands[16].atts[1].isList = 0;\r
- commands[17].cmdName = "SYS_RANDOM";\r
- commands[17].cmdDesc =\r
- " This command is used by the tester to get a random 16-bit number.\n";\r
- commands[17].attNum = 0;\r
- commands[18].cmdName = "SYS_SET_TIME";\r
- commands[18].cmdDesc =\r
- " This command is used by the tester to set the target system date and time. The time\n"\r
- " can be specified in seconds since 00:00:00 on January 1, 2000 or in parsed\n"\r
- " date/time components.\n";\r
- commands[18].attNum = 7;\r
- commands[18].atts[0].name = "UTCTime";\r
- commands[18].atts[0].size = 4;\r
- commands[18].atts[0].isList = 0;\r
- commands[18].atts[1].name = "Hour";\r
- commands[18].atts[1].size = 1;\r
- commands[18].atts[1].isList = 0;\r
- commands[18].atts[2].name = "Minute";\r
- commands[18].atts[2].size = 1;\r
- commands[18].atts[2].isList = 0;\r
- commands[18].atts[3].name = "Second";\r
- commands[18].atts[3].size = 1;\r
- commands[18].atts[3].isList = 0;\r
- commands[18].atts[4].name = "Month";\r
- commands[18].atts[4].size = 1;\r
- commands[18].atts[4].isList = 0;\r
- commands[18].atts[5].name = "Day";\r
- commands[18].atts[5].size = 1;\r
- commands[18].atts[5].isList = 0;\r
- commands[18].atts[6].name = "Year";\r
- commands[18].atts[6].size = 2;\r
- commands[18].atts[6].isList = 0;\r
- commands[19].cmdName = "SYS_GET_TIME";\r
- commands[19].cmdDesc =\r
- " This command is used by the tester to get the target system date and time. The time\n"\r
- " is returned in seconds since 00:00:00 on January 1, 2000 and parsed date/time\n"\r
- " components.\n";\r
- commands[19].attNum = 0;\r
- commands[20].cmdName = "SYS_SET_TX_POWER";\r
- commands[20].cmdDesc =\r
- " This command is used by the tester to set the target system radio transmit power.\n"\r
- " The returned TX power is the actual setting applied to the radio – nearest characterized\n"\r
- " value for the specific radio.\n";\r
- commands[20].attNum = 1;\r
- commands[20].atts[0].name = "TxPower";\r
- commands[20].atts[0].size = 1;\r
- commands[20].atts[0].isList = 0;\r
- commands[21].cmdName = "AF_REGISTER";\r
- commands[21].cmdDesc =\r
- " This command enables the tester to register an application's endpoint description.\n";\r
- commands[21].attNum = 9;\r
- commands[21].atts[0].name = "EndPoint";\r
- commands[21].atts[0].size = 1;\r
- commands[21].atts[0].isList = 0;\r
- commands[21].atts[1].name = "AppProfId";\r
- commands[21].atts[1].size = 2;\r
- commands[21].atts[1].isList = 0;\r
- commands[21].atts[2].name = "AppDeviceId";\r
- commands[21].atts[2].size = 2;\r
- commands[21].atts[2].isList = 0;\r
- commands[21].atts[3].name = "AppDevVer";\r
- commands[21].atts[3].size = 1;\r
- commands[21].atts[3].isList = 0;\r
- commands[21].atts[4].name = "LatencyReq";\r
- commands[21].atts[4].size = 1;\r
- commands[21].atts[4].isList = 0;\r
- commands[21].atts[5].name = "AppNumInClusters";\r
- commands[21].atts[5].size = 1;\r
- commands[21].atts[5].isList = 0;\r
- commands[21].atts[6].name = "AppInClusterList";\r
- commands[21].atts[6].size = 2;\r
- commands[21].atts[6].isList = 16;\r
- commands[21].atts[7].name = "AppNumOutClusters";\r
- commands[21].atts[7].size = 1;\r
- commands[21].atts[7].isList = 0;\r
- commands[21].atts[8].name = "AppOutClusterList";\r
- commands[21].atts[8].size = 2;\r
- commands[21].atts[8].isList = 16;\r
- commands[22].cmdName = "AF_DATA_REQUEST";\r
- commands[22].cmdDesc =\r
- " This command is used by the tester to build and send a message through AF layer.\n";\r
- commands[22].attNum = 9;\r
- commands[22].atts[0].name = "DstAddr";\r
- commands[22].atts[0].size = 2;\r
- commands[22].atts[0].isList = 0;\r
- commands[22].atts[1].name = "DstEndpoint";\r
- commands[22].atts[1].size = 1;\r
- commands[22].atts[1].isList = 0;\r
- commands[22].atts[2].name = "SrcEndpoint";\r
- commands[22].atts[2].size = 1;\r
- commands[22].atts[2].isList = 0;\r
- commands[22].atts[3].name = "ClusterID";\r
- commands[22].atts[3].size = 2;\r
- commands[22].atts[3].isList = 0;\r
- commands[22].atts[4].name = "TransID";\r
- commands[22].atts[4].size = 1;\r
- commands[22].atts[4].isList = 0;\r
- commands[22].atts[5].name = "Options";\r
- commands[22].atts[5].size = 1;\r
- commands[22].atts[5].isList = 0;\r
- commands[22].atts[6].name = "Radius";\r
- commands[22].atts[6].size = 1;\r
- commands[22].atts[6].isList = 0;\r
- commands[22].atts[7].name = "Len";\r
- commands[22].atts[7].size = 1;\r
- commands[22].atts[7].isList = 0;\r
- commands[22].atts[8].name = "Data";\r
- commands[22].atts[8].size = 1;\r
- commands[22].atts[8].isList = 128;\r
- commands[23].cmdName = "AF_DATA_REQUEST_EXT";\r
- commands[23].cmdDesc =\r
- " This extended form of the AF_DATA_REQUEST must be used to send an inter-pan message\n"\r
- " (note that the target code must be compiled with the INTER_PAN flag defined.) This\n"\r
- " extended data request must also be used when making a request with a huge data byte\n"\r
- " count which is defined to be a size that would cause the RPC request to exceed the\n"\r
- " maximum allowed size:\n \tMT_RPC_DATA_MAX – sizeof(AF_DATA_REQUEST_EXT)\n Where"\r
- " sizeof(AF_DATA_REQUEST_EXT) counts everything but the data bytes and now stands\n"\r
- " at 20. When making an AF_DATA_REQUEST_EXT with a huge data byte count, the request\n"\r
- " shall not contain any data bytes. The huge data buffer is sent over separately as\n"\r
- " a sequence of one or more AF_DATA_STORE requests. Note that the outgoing huge message\n"\r
- " is timed-out in 15 seconds; thus all AF_DATA_STORE requests must be completed within\n"\r
- " 15 seconds of an AF_DATA_REQUEST_EXT with a huge data byte count. And any AF_DATA_REQUEST_EXT\n"\r
- " with a huge data byte count must be completed (or timed-out) before another will\n"\r
- " be started. The default timeout can be changed by defining the following to other\n"\r
- " values:\n \t#if !defined MT_AF_EXEC_CNT\n \t#define MT_AF_EXEC_CNT 15\n \t#endif\n"\r
- " \t#if !defined MT_AF_EXEC_DLY\n \t#define MT_AF_EXEC_DLY 1000\n \t#endif\n";\r
- commands[23].attNum = 11;\r
- commands[23].atts[0].name = "DstAddrMode";\r
- commands[23].atts[0].size = 1;\r
- commands[23].atts[0].isList = 0;\r
- commands[23].atts[1].name = "DstAddr";\r
- commands[23].atts[1].size = 8;\r
- commands[23].atts[1].isList = 0;\r
- commands[23].atts[2].name = "DstEndpoint";\r
- commands[23].atts[2].size = 1;\r
- commands[23].atts[2].isList = 0;\r
- commands[23].atts[3].name = "DstPanID";\r
- commands[23].atts[3].size = 2;\r
- commands[23].atts[3].isList = 0;\r
- commands[23].atts[4].name = "SrcEndpoint";\r
- commands[23].atts[4].size = 1;\r
- commands[23].atts[4].isList = 0;\r
- commands[23].atts[5].name = "ClusterId";\r
- commands[23].atts[5].size = 2;\r
- commands[23].atts[5].isList = 0;\r
- commands[23].atts[6].name = "TransId";\r
- commands[23].atts[6].size = 1;\r
- commands[23].atts[6].isList = 0;\r
- commands[23].atts[7].name = "Options";\r
- commands[23].atts[7].size = 1;\r
- commands[23].atts[7].isList = 0;\r
- commands[23].atts[8].name = "Radius";\r
- commands[23].atts[8].size = 1;\r
- commands[23].atts[8].isList = 0;\r
- commands[23].atts[9].name = "Len";\r
- commands[23].atts[9].size = 2;\r
- commands[23].atts[9].isList = 0;\r
- commands[23].atts[10].name = "Data";\r
- commands[23].atts[10].size = 1;\r
- commands[23].atts[10].isList = 230;\r
- commands[24].cmdName = "AF_DATA_REQUEST_SRC_RTG";\r
- commands[24].cmdDesc =\r
- " This command is used by the tester to build and send a message through AF layer\n"\r
- " using source routing.\n";\r
- commands[24].attNum = 11;\r
- commands[24].atts[0].name = "DstAddr";\r
- commands[24].atts[0].size = 2;\r
- commands[24].atts[0].isList = 0;\r
- commands[24].atts[1].name = "DstEndpoint";\r
- commands[24].atts[1].size = 1;\r
- commands[24].atts[1].isList = 0;\r
- commands[24].atts[2].name = "SrcEndpoint";\r
- commands[24].atts[2].size = 1;\r
- commands[24].atts[2].isList = 0;\r
- commands[24].atts[3].name = "ClusterID";\r
- commands[24].atts[3].size = 2;\r
- commands[24].atts[3].isList = 0;\r
- commands[24].atts[4].name = "TransID";\r
- commands[24].atts[4].size = 1;\r
- commands[24].atts[4].isList = 0;\r
- commands[24].atts[5].name = "Options";\r
- commands[24].atts[5].size = 1;\r
- commands[24].atts[5].isList = 0;\r
- commands[24].atts[6].name = "Radius";\r
- commands[24].atts[6].size = 1;\r
- commands[24].atts[6].isList = 0;\r
- commands[24].atts[7].name = "RelayCount";\r
- commands[24].atts[7].size = 1;\r
- commands[24].atts[7].isList = 0;\r
- commands[24].atts[8].name = "RelayList";\r
- commands[24].atts[8].size = 2;\r
- commands[24].atts[8].isList = 255;\r
- commands[24].atts[9].name = "Len";\r
- commands[24].atts[9].size = 1;\r
- commands[24].atts[9].isList = 0;\r
- commands[24].atts[10].name = "Data";\r
- commands[24].atts[10].size = 1;\r
- commands[24].atts[10].isList = 128;\r
- commands[25].cmdName = "AF_INTER_PAN_CTL";\r
- commands[25].cmdDesc =\r
- " Inter-Pan control command and data. The data content depends upon the command and\n"\r
- " the available commands are enumerated as InterPanCtl_t.\n";\r
- commands[25].attNum = 2;\r
- commands[25].atts[0].name = "Command";\r
- commands[25].atts[0].size = 1;\r
- commands[25].atts[0].isList = 0;\r
- commands[25].atts[1].name = "Data";\r
- commands[25].atts[1].size = 1;\r
- commands[25].atts[1].isList = 3;\r
- commands[26].cmdName = "AF_DATA_STORE";\r
- commands[26].cmdDesc =\r
- " Huge AF data request data buffer store command and data.\n";\r
- commands[26].attNum = 3;\r
- commands[26].atts[0].name = "Index";\r
- commands[26].atts[0].size = 2;\r
- commands[26].atts[0].isList = 0;\r
- commands[26].atts[1].name = "Length";\r
- commands[26].atts[1].size = 1;\r
- commands[26].atts[1].isList = 0;\r
- commands[26].atts[2].name = "Data";\r
- commands[26].atts[2].size = 1;\r
- commands[26].atts[2].isList = 247;\r
- commands[27].cmdName = "AF_DATA_RETRIEVE";\r
- commands[27].cmdDesc =\r
- " Huge AF incoming message data buffer retrieve command.\n";\r
- commands[27].attNum = 3;\r
- commands[27].atts[0].name = "TimeStamp";\r
- commands[27].atts[0].size = 4;\r
- commands[27].atts[0].isList = 0;\r
- commands[27].atts[1].name = "Index";\r
- commands[27].atts[1].size = 2;\r
- commands[27].atts[1].isList = 0;\r
- commands[27].atts[2].name = "Length";\r
- commands[27].atts[2].size = 1;\r
- commands[27].atts[2].isList = 0;\r
- commands[28].cmdName = "AF_APSF_CONFIG_SET";\r
- commands[28].cmdDesc = " MT proxy for afAPSF_ConfigSet().\n";\r
- commands[28].attNum = 3;\r
- commands[28].atts[0].name = "Endpoint";\r
- commands[28].atts[0].size = 1;\r
- commands[28].atts[0].isList = 0;\r
- commands[28].atts[1].name = "FrameDelay";\r
- commands[28].atts[1].size = 1;\r
- commands[28].atts[1].isList = 0;\r
- commands[28].atts[2].name = "WindowSize";\r
- commands[28].atts[2].size = 1;\r
- commands[28].atts[2].isList = 0;\r
- commands[29].cmdName = "ZDO_NWK_ADDR_REQ";\r
- commands[29].cmdDesc =\r
- " This message will request the device to send a Network Address Request.\n"\r
- " This message sends a broadcast message looking for a 16 bit address with a known\n"\r
- " 64 bit IEEE address.\n";\r
- commands[29].attNum = 3;\r
- commands[29].atts[0].name = "IEEEAddress";\r
- commands[29].atts[0].size = 8;\r
- commands[29].atts[0].isList = 0;\r
- commands[29].atts[1].name = "ReqType";\r
- commands[29].atts[1].size = 1;\r
- commands[29].atts[1].isList = 0;\r
- commands[29].atts[2].name = "StartIndex";\r
- commands[29].atts[2].size = 1;\r
- commands[29].atts[2].isList = 0;\r
- commands[30].cmdName = "ZDO_IEEE_ADDR_REQ";\r
- commands[30].cmdDesc =\r
- " This command will request a device's IEEE 64-bit address.\n";\r
- commands[30].attNum = 3;\r
- commands[30].atts[0].name = "ShortAddr";\r
- commands[30].atts[0].size = 2;\r
- commands[30].atts[0].isList = 0;\r
- commands[30].atts[1].name = "ReqType";\r
- commands[30].atts[1].size = 1;\r
- commands[30].atts[1].isList = 0;\r
- commands[30].atts[2].name = "StartIndex";\r
- commands[30].atts[2].size = 1;\r
- commands[30].atts[2].isList = 0;\r
- commands[31].cmdName = "ZDO_NODE_DESC_REQ";\r
- commands[31].cmdDesc =\r
- " This command is generated to inquire about the Node Descriptor information of the\n"\r
- " destination device\n";\r
- commands[31].attNum = 2;\r
- commands[31].atts[0].name = "DstAddr";\r
- commands[31].atts[0].size = 2;\r
- commands[31].atts[0].isList = 0;\r
- commands[31].atts[1].name = "NwkAddrOfInterest";\r
- commands[31].atts[1].size = 2;\r
- commands[31].atts[1].isList = 0;\r
- commands[32].cmdName = "ZDO_POWER_DESC_REQ";\r
- commands[32].cmdDesc =\r
- " This command is generated to inquire about the Power Descriptor information of the\n"\r
- " destination device.\n";\r
- commands[32].attNum = 2;\r
- commands[32].atts[0].name = "DstAddr";\r
- commands[32].atts[0].size = 2;\r
- commands[32].atts[0].isList = 0;\r
- commands[32].atts[1].name = "NwkAddrOfInterest";\r
- commands[32].atts[1].size = 2;\r
- commands[32].atts[1].isList = 0;\r
- commands[33].cmdName = "ZDO_SIMPLE_DESC_REQ";\r
- commands[33].cmdDesc =\r
- " This command is generated to inquire as to the Simple Descriptor of the destination\n"\r
- " devices Endpoint.\n";\r
- commands[33].attNum = 3;\r
- commands[33].atts[0].name = "DstAddr";\r
- commands[33].atts[0].size = 2;\r
- commands[33].atts[0].isList = 0;\r
- commands[33].atts[1].name = "NwkAddrOfInterest";\r
- commands[33].atts[1].size = 2;\r
- commands[33].atts[1].isList = 0;\r
- commands[33].atts[2].name = "Endpoint";\r
- commands[33].atts[2].size = 1;\r
- commands[33].atts[2].isList = 0;\r
- commands[34].cmdName = "ZDO_ACTIVE_EP_REQ";\r
- commands[34].cmdDesc =\r
- " This command is generated to request a list of active endpoint from the destination\n"\r
- " device.\n";\r
- commands[34].attNum = 2;\r
- commands[34].atts[0].name = "DstAddr";\r
- commands[34].atts[0].size = 2;\r
- commands[34].atts[0].isList = 0;\r
- commands[34].atts[1].name = "NwkAddrOfInterest";\r
- commands[34].atts[1].size = 2;\r
- commands[34].atts[1].isList = 0;\r
- commands[35].cmdName = "ZDO_MATCH_DESC_REQ";\r
- commands[35].cmdDesc =\r
- " This command is generated to request the device match descriptor.\n";\r
- commands[35].attNum = 7;\r
- commands[35].atts[0].name = "DstAddr";\r
- commands[35].atts[0].size = 2;\r
- commands[35].atts[0].isList = 0;\r
- commands[35].atts[1].name = "NwkAddrOfInterest";\r
- commands[35].atts[1].size = 2;\r
- commands[35].atts[1].isList = 0;\r
- commands[35].atts[2].name = "ProfileID";\r
- commands[35].atts[2].size = 2;\r
- commands[35].atts[2].isList = 0;\r
- commands[35].atts[3].name = "NumInClusters";\r
- commands[35].atts[3].size = 1;\r
- commands[35].atts[3].isList = 0;\r
- commands[35].atts[4].name = "InClusterList";\r
- commands[35].atts[4].size = 2;\r
- commands[35].atts[4].isList = 16;\r
- commands[35].atts[5].name = "NumOutClusters";\r
- commands[35].atts[5].size = 1;\r
- commands[35].atts[5].isList = 0;\r
- commands[35].atts[6].name = "OutClusterList";\r
- commands[35].atts[6].size = 2;\r
- commands[35].atts[6].isList = 16;\r
- commands[36].cmdName = "ZDO_COMPLEX_DESC_REQ";\r
- commands[36].cmdDesc =\r
- " This command is generated to request for the destination device’s complex descriptor.\n";\r
- commands[36].attNum = 2;\r
- commands[36].atts[0].name = "DstAddr";\r
- commands[36].atts[0].size = 2;\r
- commands[36].atts[0].isList = 0;\r
- commands[36].atts[1].name = "NwkAddrOfInterest";\r
- commands[36].atts[1].size = 2;\r
- commands[36].atts[1].isList = 0;\r
- commands[37].cmdName = "ZDO_USER_DESC_REQ";\r
- commands[37].cmdDesc =\r
- " This command is generated to request for the destination device’s user descriptor.\n";\r
- commands[37].attNum = 2;\r
- commands[37].atts[0].name = "DstAddr";\r
- commands[37].atts[0].size = 2;\r
- commands[37].atts[0].isList = 0;\r
- commands[37].atts[1].name = "NwkAddrOfInterest";\r
- commands[37].atts[1].size = 2;\r
- commands[37].atts[1].isList = 0;\r
- commands[38].cmdName = "ZDO_DEVICE_ANNCE";\r
- commands[38].cmdDesc =\r
- " This command will cause the CC2480 device to issue an “End device announce�\n"\r
- " broadcast packet to the network. This is typically used by an end-device to announce\n"\r
- " itself to the network.\n";\r
- commands[38].attNum = 3;\r
- commands[38].atts[0].name = "NWKAddr";\r
- commands[38].atts[0].size = 2;\r
- commands[38].atts[0].isList = 0;\r
- commands[38].atts[1].name = "IEEEAddr";\r
- commands[38].atts[1].size = 8;\r
- commands[38].atts[1].isList = 0;\r
- commands[38].atts[2].name = "Capabilities";\r
- commands[38].atts[2].size = 1;\r
- commands[38].atts[2].isList = 0;\r
- commands[39].cmdName = "ZDO_USER_DESC_SET";\r
- commands[39].cmdDesc =\r
- " This command is generated to write a User Descriptor value to the targeted device\n";\r
- commands[39].attNum = 4;\r
- commands[39].atts[0].name = "DstAddr";\r
- commands[39].atts[0].size = 2;\r
- commands[39].atts[0].isList = 0;\r
- commands[39].atts[1].name = "NwkAddrOfInterest";\r
- commands[39].atts[1].size = 2;\r
- commands[39].atts[1].isList = 0;\r
- commands[39].atts[2].name = "Len";\r
- commands[39].atts[2].size = 1;\r
- commands[39].atts[2].isList = 0;\r
- commands[39].atts[3].name = "UserDescriptor";\r
- commands[39].atts[3].size = 1;\r
- commands[39].atts[3].isList = 16;\r
- commands[40].cmdName = "ZDO_SERVER_DISC_REQ";\r
- commands[40].cmdDesc =\r
- " The command is used for local device to discover the location of a particular system\n"\r
- " server or servers as indicated by the ServerMask parameter. The destination addressing\n"\r
- " on this request is broadcast to all RxOnWhenIdle devices.\n";\r
- commands[40].attNum = 1;\r
- commands[40].atts[0].name = "ServerMask";\r
- commands[40].atts[0].size = 2;\r
- commands[40].atts[0].isList = 0;\r
- commands[41].cmdName = "ZDO_END_DEVICE_BIND_REQ";\r
- commands[41].cmdDesc =\r
- " This command is generated to request an End Device Bind with the destination device.\n";\r
- commands[41].attNum = 9;\r
- commands[41].atts[0].name = "DstAddr";\r
- commands[41].atts[0].size = 2;\r
- commands[41].atts[0].isList = 0;\r
- commands[41].atts[1].name = "LocalCoordinator";\r
- commands[41].atts[1].size = 2;\r
- commands[41].atts[1].isList = 0;\r
- commands[41].atts[2].name = "CoordinatorIEEE";\r
- commands[41].atts[2].size = 8;\r
- commands[41].atts[2].isList = 0;\r
- commands[41].atts[3].name = "EndPoint";\r
- commands[41].atts[3].size = 1;\r
- commands[41].atts[3].isList = 0;\r
- commands[41].atts[4].name = "ProfileID";\r
- commands[41].atts[4].size = 2;\r
- commands[41].atts[4].isList = 0;\r
- commands[41].atts[5].name = "NumInClusters";\r
- commands[41].atts[5].size = 1;\r
- commands[41].atts[5].isList = 0;\r
- commands[41].atts[6].name = "InClusterList";\r
- commands[41].atts[6].size = 2;\r
- commands[41].atts[6].isList = 16;\r
- commands[41].atts[7].name = "NumOutClusters";\r
- commands[41].atts[7].size = 1;\r
- commands[41].atts[7].isList = 0;\r
- commands[41].atts[8].name = "OutClusterList";\r
- commands[41].atts[8].size = 2;\r
- commands[41].atts[8].isList = 16;\r
- commands[42].cmdName = "ZDO_BIND_REQ";\r
- commands[42].cmdDesc = " This command is generated to request a Bind.\n";\r
- commands[42].attNum = 7;\r
- commands[42].atts[0].name = "DstAddr";\r
- commands[42].atts[0].size = 2;\r
- commands[42].atts[0].isList = 0;\r
- commands[42].atts[1].name = "SrcAddress";\r
- commands[42].atts[1].size = 8;\r
- commands[42].atts[1].isList = 0;\r
- commands[42].atts[2].name = "SrcEndpoint";\r
- commands[42].atts[2].size = 1;\r
- commands[42].atts[2].isList = 0;\r
- commands[42].atts[3].name = "ClusterID";\r
- commands[42].atts[3].size = 2;\r
- commands[42].atts[3].isList = 0;\r
- commands[42].atts[4].name = "DstAddrMode";\r
- commands[42].atts[4].size = 1;\r
- commands[42].atts[4].isList = 0;\r
- commands[42].atts[5].name = "DstAddress";\r
- commands[42].atts[5].size = 8;\r
- commands[42].atts[5].isList = 0;\r
- commands[42].atts[6].name = "DstEndpoint";\r
- commands[42].atts[6].size = 1;\r
- commands[42].atts[6].isList = 0;\r
- commands[43].cmdName = "ZDO_UNBIND_REQ";\r
- commands[43].cmdDesc =\r
- " This command is generated to request an un-bind.\n";\r
- commands[43].attNum = 7;\r
- commands[43].atts[0].name = "DstAddr";\r
- commands[43].atts[0].size = 2;\r
- commands[43].atts[0].isList = 0;\r
- commands[43].atts[1].name = "SrcAddress";\r
- commands[43].atts[1].size = 8;\r
- commands[43].atts[1].isList = 0;\r
- commands[43].atts[2].name = "SrcEndpoint";\r
- commands[43].atts[2].size = 1;\r
- commands[43].atts[2].isList = 0;\r
- commands[43].atts[3].name = "ClusterID";\r
- commands[43].atts[3].size = 2;\r
- commands[43].atts[3].isList = 0;\r
- commands[43].atts[4].name = "DstAddrMode";\r
- commands[43].atts[4].size = 1;\r
- commands[43].atts[4].isList = 0;\r
- commands[43].atts[5].name = "DstAddress";\r
- commands[43].atts[5].size = 8;\r
- commands[43].atts[5].isList = 0;\r
- commands[43].atts[6].name = "DstEndpoint";\r
- commands[43].atts[6].size = 1;\r
- commands[43].atts[6].isList = 0;\r
- commands[44].cmdName = "ZDO_MGMT_NWK_DISC_REQ";\r
- commands[44].cmdDesc =\r
- " This command is generated to request the destination device to perform a network\n"\r
- " discovery.\n";\r
- commands[44].attNum = 4;\r
- commands[44].atts[0].name = "DstAddr";\r
- commands[44].atts[0].size = 2;\r
- commands[44].atts[0].isList = 0;\r
- commands[44].atts[1].name = "ScanChannels";\r
- commands[44].atts[1].size = 4;\r
- commands[44].atts[1].isList = 0;\r
- commands[44].atts[2].name = "ScanDuration";\r
- commands[44].atts[2].size = 1;\r
- commands[44].atts[2].isList = 0;\r
- commands[44].atts[3].name = "StartIndex";\r
- commands[44].atts[3].size = 1;\r
- commands[44].atts[3].isList = 0;\r
- commands[45].cmdName = "ZDO_MGMT_LQI_REQ";\r
- commands[45].cmdDesc =\r
- " This command is generated to request the destination device to perform a LQI query\n"\r
- " of other devices in the network.\n";\r
- commands[45].attNum = 2;\r
- commands[45].atts[0].name = "DstAddr";\r
- commands[45].atts[0].size = 2;\r
- commands[45].atts[0].isList = 0;\r
- commands[45].atts[1].name = "StartIndex";\r
- commands[45].atts[1].size = 1;\r
- commands[45].atts[1].isList = 0;\r
- commands[46].cmdName = "ZDO_MGMT_RTG_REQ";\r
- commands[46].cmdDesc =\r
- " This command is generated to request the Routing Table of the destination device\n";\r
- commands[46].attNum = 2;\r
- commands[46].atts[0].name = "DstAddr";\r
- commands[46].atts[0].size = 2;\r
- commands[46].atts[0].isList = 0;\r
- commands[46].atts[1].name = "StartIndex";\r
- commands[46].atts[1].size = 1;\r
- commands[46].atts[1].isList = 0;\r
- commands[47].cmdName = "ZDO_MGMT_BIND_REQ";\r
- commands[47].cmdDesc =\r
- " This command is generated to request the Binding Table of the destination device.\n";\r
- commands[47].attNum = 2;\r
- commands[47].atts[0].name = "DstAddr";\r
- commands[47].atts[0].size = 2;\r
- commands[47].atts[0].isList = 0;\r
- commands[47].atts[1].name = "StartIndex";\r
- commands[47].atts[1].size = 1;\r
- commands[47].atts[1].isList = 0;\r
- commands[48].cmdName = "ZDO_MGMT_LEAVE_REQ";\r
- commands[48].cmdDesc =\r
- " This command is generated to request a Management Leave Request for the target device\n";\r
- commands[48].attNum = 3;\r
- commands[48].atts[0].name = "DstAddr";\r
- commands[48].atts[0].size = 2;\r
- commands[48].atts[0].isList = 0;\r
- commands[48].atts[1].name = "DeviceAddr";\r
- commands[48].atts[1].size = 8;\r
- commands[48].atts[1].isList = 0;\r
- commands[48].atts[2].name = "RemoveChildre_Rejoin";\r
- commands[48].atts[2].size = 1;\r
- commands[48].atts[2].isList = 0;\r
- commands[49].cmdName = "ZDO_MGMT_DIRECT_JOIN_REQ";\r
- commands[49].cmdDesc =\r
- " This command is generated to request the Management Direct Join Request of a designated\n"\r
- " device.\n";\r
- commands[49].attNum = 3;\r
- commands[49].atts[0].name = "DstAddr";\r
- commands[49].atts[0].size = 2;\r
- commands[49].atts[0].isList = 0;\r
- commands[49].atts[1].name = "DeviceAddr";\r
- commands[49].atts[1].size = 8;\r
- commands[49].atts[1].isList = 0;\r
- commands[49].atts[2].name = "CapInfo";\r
- commands[49].atts[2].size = 1;\r
- commands[49].atts[2].isList = 0;\r
- commands[50].cmdName = "ZDO_MGMT_PERMIT_JOIN_REQ";\r
- commands[50].cmdDesc =\r
- " This command is generated to set the Permit Join for the destination device\n";\r
- commands[50].attNum = 4;\r
- commands[50].atts[0].name = "AddrMode";\r
- commands[50].atts[0].size = 1;\r
- commands[50].atts[0].isList = 0;\r
- commands[50].atts[1].name = "DstAddr";\r
- commands[50].atts[1].size = 2;\r
- commands[50].atts[1].isList = 0;\r
- commands[50].atts[2].name = "Duration";\r
- commands[50].atts[2].size = 1;\r
- commands[50].atts[2].isList = 0;\r
- commands[50].atts[3].name = "TCSignificance";\r
- commands[50].atts[3].size = 1;\r
- commands[50].atts[3].isList = 0;\r
- commands[51].cmdName = "ZDO_MGMT_NWK_UPDATE_REQ";\r
- commands[51].cmdDesc =\r
- " This command is provided to allow updating of network configuration parameters or\n"\r
- " to request information from devices on network conditions in the local operating\n"\r
- " environment.\n";\r
- commands[51].attNum = 6;\r
- commands[51].atts[0].name = "DstAddr";\r
- commands[51].atts[0].size = 2;\r
- commands[51].atts[0].isList = 0;\r
- commands[51].atts[1].name = "DstAddrMode";\r
- commands[51].atts[1].size = 1;\r
- commands[51].atts[1].isList = 0;\r
- commands[51].atts[2].name = "ChannelMask";\r
- commands[51].atts[2].size = 4;\r
- commands[51].atts[2].isList = 0;\r
- commands[51].atts[3].name = "ScanDuration";\r
- commands[51].atts[3].size = 1;\r
- commands[51].atts[3].isList = 0;\r
- commands[51].atts[4].name = "ScanCount";\r
- commands[51].atts[4].size = 1;\r
- commands[51].atts[4].isList = 0;\r
- commands[51].atts[5].name = "NwkManagerAddr";\r
- commands[51].atts[5].size = 2;\r
- commands[51].atts[5].isList = 0;\r
- commands[52].cmdName = "ZDO_STARTUP_FROM_APP";\r
- commands[52].cmdDesc = " This command starts the device in the network.\n";\r
- commands[52].attNum = 1;\r
- commands[52].atts[0].name = "StartDelay";\r
- commands[52].atts[0].size = 2;\r
- commands[52].atts[0].isList = 0;\r
- commands[53].cmdName = "ZDO_AUTO_FIND_DESTINATION";\r
- commands[53].cmdDesc =\r
- " This function will issue a Match Description Request for the requested endpoint\n"\r
- " outputs. This message will generate a broadcast message.\n";\r
- commands[53].attNum = 1;\r
- commands[53].atts[0].name = "Endpoint";\r
- commands[53].atts[0].size = 1;\r
- commands[53].atts[0].isList = 0;\r
- commands[54].cmdName = "ZDO_SET_LINK_KEY";\r
- commands[54].cmdDesc =\r
- " This command sets the application link key for a given device.\n";\r
- commands[54].attNum = 3;\r
- commands[54].atts[0].name = "ShortAddr";\r
- commands[54].atts[0].size = 2;\r
- commands[54].atts[0].isList = 0;\r
- commands[54].atts[1].name = "IEEEaddr";\r
- commands[54].atts[1].size = 8;\r
- commands[54].atts[1].isList = 0;\r
- commands[54].atts[2].name = "LinkKeyData";\r
- commands[54].atts[2].size = 16;\r
- commands[54].atts[2].isList = 0;\r
- commands[55].cmdName = "ZDO_REMOVE_LINK_KEY";\r
- commands[55].cmdDesc =\r
- " This command removes the application link key of a given device.\n";\r
- commands[55].attNum = 1;\r
- commands[55].atts[0].name = "IEEEaddr";\r
- commands[55].atts[0].size = 8;\r
- commands[55].atts[0].isList = 0;\r
- commands[56].cmdName = "ZDO_GET_LINK_KEY";\r
- commands[56].cmdDesc =\r
- " This command retrieves the application link key of a given device.\n";\r
- commands[56].attNum = 1;\r
- commands[56].atts[0].name = "IEEEaddr";\r
- commands[56].atts[0].size = 8;\r
- commands[56].atts[0].isList = 0;\r
- commands[57].cmdName = "ZDO_NWK_DISCOVERY_REQ";\r
- commands[57].cmdDesc =\r
- " This command is used to initiate a network discovery (active scan).\n";\r
- commands[57].attNum = 2;\r
- commands[57].atts[0].name = "ScanChannels";\r
- commands[57].atts[0].size = 4;\r
- commands[57].atts[0].isList = 0;\r
- commands[57].atts[1].name = "ScanDuration";\r
- commands[57].atts[1].size = 1;\r
- commands[57].atts[1].isList = 0;\r
- commands[58].cmdName = "ZDO_JOIN_REQ";\r
- commands[58].cmdDesc =\r
- " This command is used to request the device to join itself to a parent device on\n"\r
- " a network.\n";\r
- commands[58].attNum = 6;\r
- commands[58].atts[0].name = "LogicalChannel";\r
- commands[58].atts[0].size = 1;\r
- commands[58].atts[0].isList = 0;\r
- commands[58].atts[1].name = "PanID";\r
- commands[58].atts[1].size = 2;\r
- commands[58].atts[1].isList = 0;\r
- commands[58].atts[2].name = "ExtendedPanID";\r
- commands[58].atts[2].size = 8;\r
- commands[58].atts[2].isList = 0;\r
- commands[58].atts[3].name = "ChosenParent";\r
- commands[58].atts[3].size = 2;\r
- commands[58].atts[3].isList = 0;\r
- commands[58].atts[4].name = "ParentDepth";\r
- commands[58].atts[4].size = 1;\r
- commands[58].atts[4].isList = 0;\r
- commands[58].atts[5].name = "StackProfile";\r
- commands[58].atts[5].size = 1;\r
- commands[58].atts[5].isList = 0;\r
- commands[59].cmdName = "ZDO_MSG_CB_REGISTER";\r
- commands[59].cmdDesc = " This command registers for a ZDO callback.\n";\r
- commands[59].attNum = 1;\r
- commands[59].atts[0].name = "ClusterID";\r
- commands[59].atts[0].size = 2;\r
- commands[59].atts[0].isList = 0;\r
- commands[60].cmdName = "ZDO_MSG_CB_REMOVE";\r
- commands[60].cmdDesc =\r
- " This command removes a registration for a ZDO callback\n";\r
- commands[60].attNum = 1;\r
- commands[60].atts[0].name = "ClusterID";\r
- commands[60].atts[0].size = 2;\r
- commands[60].atts[0].isList = 0;\r
- commands[61].cmdName = "ZB_SYSTEM_RESET";\r
- commands[61].cmdDesc =\r
- " This command will reset the device by using a soft reset (i.e. a jump to the reset\n"\r
- " vector) vice a hardware reset (i.e. watchdog reset.) This is especially useful in\n"\r
- " the CC2531, for instance, so that the USB host does not have to contend with the\n"\r
- " USB H/W resetting (and thus causing the USB host to re-enumerate the device which\n"\r
- " can cause an open virtual serial port to hang.)\n";\r
- commands[61].attNum = 0;\r
- commands[62].cmdName = "ZB_APP_REGISTER_REQ";\r
- commands[62].cmdDesc =\r
- " This command enables the application processor to register its application with\n"\r
- " a ZNP device.\n";\r
- commands[62].attNum = 9;\r
- commands[62].atts[0].name = "AppEndpoint";\r
- commands[62].atts[0].size = 1;\r
- commands[62].atts[0].isList = 0;\r
- commands[62].atts[1].name = "AppProfileId";\r
- commands[62].atts[1].size = 2;\r
- commands[62].atts[1].isList = 0;\r
- commands[62].atts[2].name = "DeviceId";\r
- commands[62].atts[2].size = 2;\r
- commands[62].atts[2].isList = 0;\r
- commands[62].atts[3].name = "DeviceVersion";\r
- commands[62].atts[3].size = 1;\r
- commands[62].atts[3].isList = 0;\r
- commands[62].atts[4].name = "Unused";\r
- commands[62].atts[4].size = 1;\r
- commands[62].atts[4].isList = 0;\r
- commands[62].atts[5].name = "InputCommandsNum";\r
- commands[62].atts[5].size = 1;\r
- commands[62].atts[5].isList = 0;\r
- commands[62].atts[6].name = "InputCommandsList";\r
- commands[62].atts[6].size = 2;\r
- commands[62].atts[6].isList = 255;\r
- commands[62].atts[7].name = "OutputCommandsNum";\r
- commands[62].atts[7].size = 1;\r
- commands[62].atts[7].isList = 0;\r
- commands[62].atts[8].name = "OutputCommandsList";\r
- commands[62].atts[8].size = 2;\r
- commands[62].atts[8].isList = 255;\r
- commands[63].cmdName = "ZB_START_REQ";\r
- commands[63].cmdDesc =\r
- " This command starts the ZigBee stack. When the ZigBee stack starts, the device reads\n"\r
- " configuration parameters from nonvolatile memory and the device joins its network.\n"\r
- " The ZigBee stack calls the zb_StartConfirm callback function when the startup process\n"\r
- " completes. After the start request process completes, the device is ready to send,\n"\r
- " receive, and route network traffic.\n";\r
- commands[63].attNum = 0;\r
- commands[64].cmdName = "ZB_PERMIT_JOINING_REQ";\r
- commands[64].cmdDesc =\r
- " This command is used to control the joining permissions and thus allows or disallows\n"\r
- " new devices from joining the network.\n";\r
- commands[64].attNum = 2;\r
- commands[64].atts[0].name = "Destination";\r
- commands[64].atts[0].size = 2;\r
- commands[64].atts[0].isList = 0;\r
- commands[64].atts[1].name = "Timeout";\r
- commands[64].atts[1].size = 1;\r
- commands[64].atts[1].isList = 0;\r
- commands[65].cmdName = "ZB_BIND_DEVICE";\r
- commands[65].cmdDesc =\r
- " This command establishes or removes a ‘binding’ between two devices. Once bound,\n"\r
- " an application can send messages to a device by referencing the commandId for the\n"\r
- " binding.\n";\r
- commands[65].attNum = 3;\r
- commands[65].atts[0].name = "Create";\r
- commands[65].atts[0].size = 1;\r
- commands[65].atts[0].isList = 0;\r
- commands[65].atts[1].name = "CommandId";\r
- commands[65].atts[1].size = 2;\r
- commands[65].atts[1].isList = 0;\r
- commands[65].atts[2].name = "DstIeee";\r
- commands[65].atts[2].size = 8;\r
- commands[65].atts[2].isList = 0;\r
- commands[66].cmdName = "ZB_ALLOW_BIND";\r
- commands[66].cmdDesc =\r
- " This command puts the device into the Allow Binding Mode for a given period of time.\n"\r
- " A peer device can establish a binding to a device in the Allow Binding Mode by calling\n"\r
- " zb_BindDevice with a destination address of NULL.\n";\r
- commands[66].attNum = 1;\r
- commands[66].atts[0].name = "Timeout";\r
- commands[66].atts[0].size = 1;\r
- commands[66].atts[0].isList = 0;\r
- commands[67].cmdName = "ZB_SEND_DATA_REQ";\r
- commands[67].cmdDesc =\r
- " This command initiates transmission of data to a peer device.\n";\r
- commands[67].attNum = 7;\r
- commands[67].atts[0].name = "Destination";\r
- commands[67].atts[0].size = 2;\r
- commands[67].atts[0].isList = 0;\r
- commands[67].atts[1].name = "CommandId";\r
- commands[67].atts[1].size = 2;\r
- commands[67].atts[1].isList = 0;\r
- commands[67].atts[2].name = "Handle";\r
- commands[67].atts[2].size = 1;\r
- commands[67].atts[2].isList = 0;\r
- commands[67].atts[3].name = "Ack";\r
- commands[67].atts[3].size = 1;\r
- commands[67].atts[3].isList = 0;\r
- commands[67].atts[4].name = "Radius";\r
- commands[67].atts[4].size = 1;\r
- commands[67].atts[4].isList = 0;\r
- commands[67].atts[5].name = "Len";\r
- commands[67].atts[5].size = 1;\r
- commands[67].atts[5].isList = 0;\r
- commands[67].atts[6].name = "Data";\r
- commands[67].atts[6].size = 1;\r
- commands[67].atts[6].isList = 99;\r
- commands[68].cmdName = "ZB_FIND_DEVICE_REQ";\r
- commands[68].cmdDesc =\r
- " This command is used to determine the short address for a device in the network.\n"\r
- " The device initiating a call to zbFindDeviceRequest and the device being discovered\n"\r
- " must both be a member of the same network. When the search is complete, the zbFindDeviceConfirm\n"\r
- " callback function is called.\n";\r
- commands[68].attNum = 1;\r
- commands[68].atts[0].name = "SearchKey";\r
- commands[68].atts[0].size = 8;\r
- commands[68].atts[0].isList = 0;\r
- commands[69].cmdName = "ZB_WRITE_CONFIGURATION";\r
- commands[69].cmdDesc =\r
- " This command is used to write a Configuration Property to nonvolatile memory.\n";\r
- commands[69].attNum = 3;\r
- commands[69].atts[0].name = "ConfigId";\r
- commands[69].atts[0].size = 1;\r
- commands[69].atts[0].isList = 0;\r
- commands[69].atts[1].name = "Len";\r
- commands[69].atts[1].size = 1;\r
- commands[69].atts[1].isList = 0;\r
- commands[69].atts[2].name = "Value";\r
- commands[69].atts[2].size = 1;\r
- commands[69].atts[2].isList = 128;\r
- commands[70].cmdName = "ZB_GET_DEVICE_INFO";\r
- commands[70].cmdDesc =\r
- " This command retrieves a Device Information Property.\n";\r
- commands[70].attNum = 1;\r
- commands[70].atts[0].name = "Param";\r
- commands[70].atts[0].size = 1;\r
- commands[70].atts[0].isList = 0;\r
- commands[71].cmdName = "ZB_READ_CONFIGURATION";\r
- commands[71].cmdDesc =\r
- " This command is used to get a configuration property from nonvolatile memory.\n";\r
- commands[71].attNum = 1;\r
- commands[71].atts[0].name = "ConfigId";\r
- commands[71].atts[0].size = 1;\r
- commands[71].atts[0].isList = 0;\r
-}\r
-\r
-/********************************************************************\r
- * START OF SYS CALL BACK FUNCTIONS\r
- */\r
-\r
-static uint8_t mtSysPingSrspCb(PingSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysPingSrspCb\n");\r
- consolePrint("Capabilities: 0x%04X\n", msg->Capabilities);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSysGetExtAddrSrspCb(GetExtAddrSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysGetExtAddrSrspCb\n");\r
- consolePrint("ExtAddr: 0x%016llX\n", (long long unsigned int) msg->ExtAddr);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSysRamReadSrspCb(RamReadSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysRamReadSrspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("Len: 0x%02X\n", msg->Len);\r
- uint32_t i;\r
- for (i = 0; i < msg->Len; i++)\r
- {\r
- consolePrint("Value[%d]: 0x%02X\n", i, msg->Value[i]);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("RamReadSrsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
- return msg->Status;\r
-}\r
-static uint8_t mtSysResetIndCb(ResetIndFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("ZNP Version: %d.%d.%d\n", msg->MajorRel, msg->MinorRel,\r
- msg->HwRev);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSysVersionSrspCb(VersionSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysVersionSrspCb\n");\r
- consolePrint("TransportRev: 0x%02X\n", msg->TransportRev);\r
- consolePrint("Product: 0x%02X\n", msg->Product);\r
- consolePrint("MajorRel: 0x%02X\n", msg->MajorRel);\r
- consolePrint("MinorRel: 0x%02X\n", msg->MinorRel);\r
- consolePrint("MaintRel: 0x%02X\n", msg->MaintRel);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSysOsalNvReadSrspCb(OsalNvReadSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysOsalNvReadSrspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("Len: 0x%02X\n", msg->Len);\r
- uint32_t i;\r
- for (i = 0; i < msg->Len; i++)\r
- {\r
- consolePrint("Value[%d]: 0x%02X\n", i, msg->Value[i]);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("OsalNvReadSrsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
- return msg->Status;\r
-}\r
-static uint8_t mtSysOsalNvLengthSrspCb(OsalNvLengthSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysOsalNvLengthSrspCb\n");\r
- consolePrint("ItemLen: 0x%04X\n", msg->ItemLen);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSysOsalTimerExpiredCb(OsalTimerExpiredFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysOsalTimerExpiredCb\n");\r
- consolePrint("Id: 0x%02X\n", msg->Id);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSysStackTuneSrspCb(StackTuneSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysStackTuneSrspCb\n");\r
- consolePrint("Value: 0x%02X\n", msg->Value);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSysAdcReadSrspCb(AdcReadSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysAdcReadSrspCb\n");\r
- consolePrint("Value: 0x%04X\n", msg->Value);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSysGpioSrspCb(GpioSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysGpioSrspCb\n");\r
- consolePrint("Value: 0x%02X\n", msg->Value);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSysRandomSrspCb(RandomSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysRandomSrspCb\n");\r
- consolePrint("Value: 0x%04X\n", msg->Value);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSysGetTimeSrspCb(GetTimeSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysGetTimeSrspCb\n");\r
- consolePrint("UTCTime: 0x%08X\n", msg->UTCTime);\r
- consolePrint("Hour: 0x%02X\n", msg->Hour);\r
- consolePrint("Minute: 0x%02X\n", msg->Minute);\r
- consolePrint("Second: 0x%02X\n", msg->Second);\r
- consolePrint("Month: 0x%02X\n", msg->Month);\r
- consolePrint("Day: 0x%02X\n", msg->Day);\r
- consolePrint("Year: 0x%04X\n", msg->Year);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSysSetTxPowerSrspCb(SetTxPowerSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSysSetTxPowerSrspCb\n");\r
- consolePrint("TxPower: 0x%02X\n", msg->TxPower);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-/********************************************************************\r
- * END OF SYS CALL BACK FUNCTIONS\r
- */\r
-\r
-/********************************************************************\r
- * START OF ZDO CALL BACK FUNCTIONS\r
- */\r
-\r
-/********************************************************************\r
- * @fn Callback function for ZDO State Change Indication\r
-\r
- * @brief receives the AREQ status and specifies the change ZDO state\r
- *\r
- * @param uint8 zdoState\r
- *\r
- * @return SUCCESS or FAILURE\r
- */\r
-static uint8_t mtZdoStateChangeIndCb(uint8_t newDevState)\r
-{\r
- SET_RSP_COLOR();\r
-\r
- switch ((devStates_t) newDevState)\r
- {\r
- case DEV_HOLD:\r
- dbg_print(PRINT_LEVEL_INFO,\r
- "mtZdoStateChangeIndCb: Initialized - not started automatically\n");\r
- break;\r
- case DEV_INIT:\r
- dbg_print(PRINT_LEVEL_INFO,\r
- "mtZdoStateChangeIndCb: Initialized - not connected to anything\n");\r
- break;\r
- case DEV_NWK_DISC:\r
- dbg_print(PRINT_LEVEL_INFO,\r
- "mtZdoStateChangeIndCb: Discovering PAN's to join\n");\r
- consolePrint("Network Discovering\n");\r
- break;\r
- case DEV_NWK_JOINING:\r
- dbg_print(PRINT_LEVEL_INFO, "mtZdoStateChangeIndCb: Joining a PAN\n");\r
- consolePrint("Network Joining\n");\r
- break;\r
- case DEV_NWK_REJOIN:\r
- dbg_print(PRINT_LEVEL_INFO,\r
- "mtZdoStateChangeIndCb: ReJoining a PAN, only for end devices\n");\r
- consolePrint("Network Rejoining\n");\r
- break;\r
- case DEV_END_DEVICE_UNAUTH:\r
- consolePrint("Network Authenticating\n");\r
- dbg_print(PRINT_LEVEL_INFO,\r
- "mtZdoStateChangeIndCb: Joined but not yet authenticated by trust center\n");\r
- break;\r
- case DEV_END_DEVICE:\r
- consolePrint("Network Joined\n");\r
- dbg_print(PRINT_LEVEL_INFO,\r
- "mtZdoStateChangeIndCb: Started as device after authentication\n");\r
- break;\r
- case DEV_ROUTER:\r
- consolePrint("Network Joined\n");\r
- dbg_print(PRINT_LEVEL_INFO,\r
- "mtZdoStateChangeIndCb: Device joined, authenticated and is a router\n");\r
- break;\r
- case DEV_COORD_STARTING:\r
- consolePrint("Network Starting\n");\r
- dbg_print(PRINT_LEVEL_INFO,\r
- "mtZdoStateChangeIndCb: Started as Zigbee Coordinator\n");\r
- break;\r
- case DEV_ZB_COORD:\r
- consolePrint("Network Started\n");\r
- dbg_print(PRINT_LEVEL_INFO,\r
- "mtZdoStateChangeIndCb: Started as Zigbee Coordinator\n");\r
- break;\r
- case DEV_NWK_ORPHAN:\r
- consolePrint("Network Orphaned\n");\r
- dbg_print(PRINT_LEVEL_INFO,\r
- "mtZdoStateChangeIndCb: Device has lost information about its parent\n");\r
- break;\r
- default:\r
- dbg_print(PRINT_LEVEL_INFO, "mtZdoStateChangeIndCb: unknown state");\r
- break;\r
- }\r
-\r
- devState = (devStates_t) newDevState;\r
-\r
- SET_NRM_COLOR();\r
-\r
- return SUCCESS;\r
-}\r
-\r
-static uint8_t mtZdoGetLinkKeyCb(GetLinkKeySrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
-\r
- consolePrint("mtZdoGetLinkKeyCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("IEEEAddr: 0x%016llX\n",\r
- (long long unsigned int) msg->IEEEAddr);\r
- }\r
- else\r
- {\r
- consolePrint("GetLinkKey Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoNwkAddrRspCb(NwkAddrRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoNwkAddrRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("IEEEAddr: 0x%016llX\n",\r
- (long long unsigned int) msg->IEEEAddr);\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
- consolePrint("NumAssocDev: 0x%02X\n", msg->NumAssocDev);\r
- uint32_t i;\r
- for (i = 0; i < msg->NumAssocDev; i++)\r
- {\r
- consolePrint("AssocDevList[%d]: 0x%04X\n", i, msg->AssocDevList[i]);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("NwkAddrRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoIeeeAddrRspCb(IeeeAddrRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoIeeeAddrRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("IEEEAddr: 0x%016llX\n",\r
- (long long unsigned int) msg->IEEEAddr);\r
- //consolePrint("%08X\n", msg -> IEEEAddr);\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
- consolePrint("NumAssocDev: 0x%02X\n", msg->NumAssocDev);\r
- uint32_t i;\r
- for (i = 0; i < msg->NumAssocDev; i++)\r
- {\r
- consolePrint("AssocDevList[%d]: 0x%04X\n", i, msg->AssocDevList[i]);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("IeeeAddrRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoNodeDescRspCb(NodeDescRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoNodeDescRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- consolePrint("LoTy_ComDescAv_UsrDesAv: 0x%02X\n",\r
- msg->LoTy_ComDescAv_UsrDesAv);\r
- consolePrint("APSFlg_FrqBnd: 0x%02X\n", msg->APSFlg_FrqBnd);\r
- consolePrint("MACCapFlg: 0x%02X\n", msg->MACCapFlg);\r
- consolePrint("ManufacturerCode: 0x%04X\n", msg->ManufacturerCode);\r
- consolePrint("MaxBufferSize: 0x%02X\n", msg->MaxBufferSize);\r
- consolePrint("MaxTransferSize: 0x%04X\n", msg->MaxTransferSize);\r
- consolePrint("ServerMask: 0x%04X\n", msg->ServerMask);\r
- consolePrint("MaxOutTransferSize: 0x%04X\n", msg->MaxOutTransferSize);\r
- consolePrint("DescriptorCapabilities: 0x%02X\n",\r
- msg->DescriptorCapabilities);\r
- }\r
- else\r
- {\r
- consolePrint("NodeDescRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoPowerDescRspCb(PowerDescRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoPowerDescRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- consolePrint("CurrntPwrMode_AvalPwrSrcs: 0x%02X\n",\r
- msg->CurrntPwrMode_AvalPwrSrcs);\r
- consolePrint("CurrntPwrSrc_CurrntPwrSrcLvl: 0x%02X\n",\r
- msg->CurrntPwrSrc_CurrntPwrSrcLvl);\r
- }\r
- else\r
- {\r
- consolePrint("PowerDescRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoSimpleDescRspCb(SimpleDescRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoSimpleDescRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- consolePrint("Len: 0x%02X\n", msg->Len);\r
- consolePrint("Endpoint: 0x%02X\n", msg->Endpoint);\r
- consolePrint("ProfileID: 0x%04X\n", msg->ProfileID);\r
- consolePrint("DeviceID: 0x%04X\n", msg->DeviceID);\r
- consolePrint("DeviceVersion: 0x%02X\n", msg->DeviceVersion);\r
- consolePrint("NumInClusters: 0x%02X\n", msg->NumInClusters);\r
- uint32_t i;\r
- for (i = 0; i < msg->NumInClusters; i++)\r
- {\r
- consolePrint("InClusterList[%d]: 0x%04X\n", i,\r
- msg->InClusterList[i]);\r
- }\r
- consolePrint("NumOutClusters: 0x%02X\n", msg->NumOutClusters);\r
- for (i = 0; i < msg->NumOutClusters; i++)\r
- {\r
- consolePrint("OutClusterList[%d]: 0x%04X\n", i,\r
- msg->OutClusterList[i]);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("SimpleDescRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoActiveEpRspCb(ActiveEpRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoActiveEpRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- consolePrint("ActiveEPCount: 0x%02X\n", msg->ActiveEPCount);\r
- uint32_t i;\r
- for (i = 0; i < msg->ActiveEPCount; i++)\r
- {\r
- consolePrint("ActiveEPList[%d]: 0x%02X\n", i, msg->ActiveEPList[i]);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("ActiveEpRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoMatchDescRspCb(MatchDescRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoMatchDescRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- consolePrint("MatchLength: 0x%02X\n", msg->MatchLength);\r
- uint32_t i;\r
- for (i = 0; i < msg->MatchLength; i++)\r
- {\r
- consolePrint("MatchList[%d]: 0x%02X\n", i, msg->MatchList[i]);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("MatchDescRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoComplexDescRspCb(ComplexDescRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoComplexDescRspCb\n");\r
-\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- consolePrint("ComplexLength: 0x%02X\n", msg->ComplexLength);\r
- uint32_t i;\r
- for (i = 0; i < msg->ComplexLength; i++)\r
- {\r
- consolePrint("ComplexList[%d]: 0x%02X\n", i, msg->ComplexList[i]);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoUserDescRspCb(UserDescRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoUserDescRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- consolePrint("Len: 0x%02X\n", msg->Len);\r
- uint32_t i;\r
- for (i = 0; i < msg->Len; i++)\r
- {\r
- consolePrint("CUserDescriptor[%d]: 0x%02X\n", i,\r
- msg->CUserDescriptor[i]);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("UserDescRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoUserDescConfCb(UserDescConfFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoUserDescConfCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- }\r
- else\r
- {\r
- consolePrint("UserDescConf Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoServerDiscRspCb(ServerDiscRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoServerDiscRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("ServerMask: 0x%04X\n", msg->ServerMask);\r
- }\r
- else\r
- {\r
- consolePrint("ServerDiscRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoEndDeviceBindRspCb(EndDeviceBindRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoEndDeviceBindRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- }\r
- else\r
- {\r
- consolePrint("EndDeviceBindRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoBindRspCb(BindRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoBindRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- }\r
- else\r
- {\r
- consolePrint("BindRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoUnbindRspCb(UnbindRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoUnbindRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- }\r
- else\r
- {\r
- consolePrint("UnbindRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoMgmtNwkDiscRspCb(MgmtNwkDiscRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoMgmtNwkDiscRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("NetworkCount: 0x%02X\n", msg->NetworkCount);\r
- consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
- consolePrint("NetworkListCount: 0x%02X\n", msg->NetworkListCount);\r
-\r
- uint32_t i;\r
- for (i = 0; i < msg->NetworkListCount; i++)\r
- {\r
- consolePrint("mtZdoNetworkListItems[%d]:\n", i);\r
- consolePrint("\tPanID: 0x%016llX\n",\r
- (long long unsigned int) msg->NetworkList[i].PanID);\r
- consolePrint("\tLogicalChannel: 0x%02X\n",\r
- msg->NetworkList[i].LogicalChannel);\r
- consolePrint("\tStackProf_ZigVer: 0x%02X\n",\r
- msg->NetworkList[i].StackProf_ZigVer);\r
- consolePrint("\tBeacOrd_SupFramOrd: 0x%02X\n",\r
- msg->NetworkList[i].BeacOrd_SupFramOrd);\r
- consolePrint("\tPermitJoin: 0x%02X\n\n",\r
- msg->NetworkList[i].PermitJoin);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("MgmtNwkDiscRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoMgmtLqiRspCb(MgmtLqiRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoMgmtLqiRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("NeighborTableEntries: 0x%02X\n",\r
- msg->NeighborTableEntries);\r
- consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
- consolePrint("NeighborLqiListCount: 0x%02X\n",\r
- msg->NeighborLqiListCount);\r
- uint32_t i;\r
- for (i = 0; i < msg->NeighborLqiListCount; i++)\r
- {\r
-\r
- consolePrint("mtZdoNeighborLqiListItem[%d]:\n", i);\r
-\r
- consolePrint("\tExtendedPanID: 0x%016llX\n",\r
- (long long unsigned int) msg->NeighborLqiList[i].ExtendedPanID);\r
- consolePrint("\tExtendedAddress: 0x%016llX\n",\r
- (long long unsigned int) msg->NeighborLqiList[i].ExtendedAddress);\r
- consolePrint("\tNetworkAddress: 0x%04X\n",\r
- msg->NeighborLqiList[i].NetworkAddress);\r
- consolePrint("\tDevTyp_RxOnWhenIdle_Relat: 0x%02X\n",\r
- msg->NeighborLqiList[i].DevTyp_RxOnWhenIdle_Relat);\r
- consolePrint("\tPermitJoining: 0x%02X\n",\r
- msg->NeighborLqiList[i].PermitJoining);\r
- consolePrint("\tDepth: 0x%02X\n", msg->NeighborLqiList[i].Depth);\r
- consolePrint("\tLQI: 0x%02X\n", msg->NeighborLqiList[i].LQI);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("MgmtLqiRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoMgmtRtgRspCb(MgmtRtgRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoMgmtRtgRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("RoutingTableEntries: 0x%02X\n", msg->RoutingTableEntries);\r
- consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
- consolePrint("RoutingTableListCount: 0x%02X\n",\r
- msg->RoutingTableListCount);\r
- uint32_t i;\r
- for (i = 0; i < msg->RoutingTableListCount; i++)\r
- {\r
- consolePrint("RoutingTableListItem[%d]:\n", i);\r
- consolePrint("\tDstAddr: 0x%04X\n",\r
- msg->RoutingTableList[i].DstAddr);\r
- consolePrint("\tStatus: 0x%02X\n", msg->RoutingTableList[i].Status);\r
- consolePrint("\tNextHop: 0x%04X\n",\r
- msg->RoutingTableList[i].NextHop);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("MgmtRtgRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoMgmtBindRspCb(MgmtBindRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoMgmtBindRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("BindingTableEntries: 0x%02X\n", msg->BindingTableEntries);\r
- consolePrint("StartIndex: 0x%02X\n", msg->StartIndex);\r
- consolePrint("BindingTableListCount: 0x%02X\n",\r
- msg->BindingTableListCount);\r
- uint32_t i;\r
- for (i = 0; i < msg->BindingTableListCount; i++)\r
- {\r
- consolePrint("BindingTableList[%d]:\n", i);\r
- consolePrint("SrcIEEEAddr: 0x%016llX\n",\r
- (long long unsigned int) msg->BindingTableList[i].SrcIEEEAddr);\r
- consolePrint("\tSrcEndpoint: 0x%02X\n",\r
- msg->BindingTableList[i].SrcEndpoint);\r
- consolePrint("\tClusterID: 0x%02X\n",\r
- msg->BindingTableList[i].ClusterID);\r
- consolePrint("\tDstAddrMode: 0x%02X\n",\r
- msg->BindingTableList[i].DstAddrMode);\r
- consolePrint("DstIEEEAddr: 0x%016llX\n",\r
- (long long unsigned int) msg->BindingTableList[i].DstIEEEAddr);\r
- consolePrint("\tDstEndpoint: 0x%02X\n",\r
- msg->BindingTableList[i].DstEndpoint);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("MgmtBindRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoMgmtLeaveRspCb(MgmtLeaveRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoMgmtLeaveRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- }\r
- else\r
- {\r
- consolePrint("MgmtLeaveRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoMgmtDirectJoinRspCb(MgmtDirectJoinRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoMgmtDirectJoinRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- }\r
- else\r
- {\r
- consolePrint("MgmtDirectJoinRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoMgmtPermitJoinRspCb(MgmtPermitJoinRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoMgmtPermitJoinRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- }\r
- else\r
- {\r
- consolePrint("MgmtPermitJoinRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoEndDeviceAnnceIndCb(EndDeviceAnnceIndFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoEndDeviceAnnceIndCb\n");\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- consolePrint("IEEEAddr: 0x%016llX\n",\r
- (long long unsigned int) msg->IEEEAddr);\r
- consolePrint("Capabilities: 0x%02X\n", msg->Capabilities);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtZdoMatchDescRspSentCb(MatchDescRspSentFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoMatchDescRspSentCb\n");\r
- consolePrint("NwkAddr: 0x%04X\n", msg->NwkAddr);\r
- consolePrint("NumInClusters: 0x%02X\n", msg->NumInClusters);\r
- uint32_t i;\r
- for (i = 0; i < msg->NumInClusters; i++)\r
- {\r
- consolePrint("InClusterList[%d]: 0x%04X\n", i, msg->InClusterList[i]);\r
- }\r
- consolePrint("NumOutClusters: 0x%02X\n", msg->NumOutClusters);\r
- for (i = 0; i < msg->NumOutClusters; i++)\r
- {\r
- consolePrint("OutClusterList[%d]: 0x%04X\n", i, msg->OutClusterList[i]);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return 0;\r
-}\r
-static uint8_t mtZdoStatusErrorRspCb(StatusErrorRspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoStatusErrorRspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- }\r
- else\r
- {\r
- consolePrint("StatusErrorRsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoSrcRtgIndCb(SrcRtgIndFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoSrcRtgIndCb\n");\r
- consolePrint("DstAddr: 0x%04X\n", msg->DstAddr);\r
- consolePrint("RelayCount: 0x%02X\n", msg->RelayCount);\r
- uint32_t i;\r
- for (i = 0; i < msg->RelayCount; i++)\r
- {\r
- consolePrint("RelayList[%d]: 0x%04X\n", i, msg->RelayList[i]);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return 0;\r
-}\r
-static uint8_t mtZdoBeaconNotifyIndCb(BeaconNotifyIndFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoBeaconNotifyIndCb\n");\r
- consolePrint("BeaconCount: 0x%02X\n", msg->BeaconCount);\r
- uint32_t i;\r
- for (i = 0; i < msg->BeaconCount; i++)\r
- {\r
- consolePrint("BeaconListItem[%d]:\n", i);\r
-\r
- consolePrint("\tSrcAddr: 0x%04X\n", msg->BeaconList[i].SrcAddr);\r
- consolePrint("\tPanId: 0x%04X\n", msg->BeaconList[i].PanId);\r
- consolePrint("\tLogicalChannel: 0x%02X\n",\r
- msg->BeaconList[i].LogicalChannel);\r
- consolePrint("\tPermitJoining: 0x%02X\n",\r
- msg->BeaconList[i].PermitJoining);\r
- consolePrint("\tRouterCap: 0x%02X\n", msg->BeaconList[i].RouterCap);\r
- consolePrint("\tPDevCap: 0x%02X\n", msg->BeaconList[i].DevCap);\r
- consolePrint("\tProtocolVer: 0x%02X\n", msg->BeaconList[i].ProtocolVer);\r
- consolePrint("\tStackProf: 0x%02X\n", msg->BeaconList[i].StackProf);\r
- consolePrint("\tLQI: 0x%02X\n", msg->BeaconList[i].Lqi);\r
- consolePrint("\tDepth: 0x%02X\n", msg->BeaconList[i].Depth);\r
- consolePrint("\tUpdateId: 0x%02X\n", msg->BeaconList[i].UpdateId);\r
- consolePrint("ExtendedPanID: 0x%016llX\n",\r
- (long long unsigned int) msg->BeaconList[i].ExtendedPanId);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return 0;\r
-}\r
-static uint8_t mtZdoJoinCnfCb(JoinCnfFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoJoinCnfCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("DevAddr: 0x%04X\n", msg->DevAddr);\r
- consolePrint("ParentAddr: 0x%04X\n", msg->ParentAddr);\r
- }\r
- else\r
- {\r
- consolePrint("JoinCnf Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoNwkDiscoveryCnfCb(NwkDiscoveryCnfFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoNwkDiscoveryCnfCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- }\r
- else\r
- {\r
- consolePrint("NwkDiscoveryCnf Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtZdoLeaveIndCb(LeaveIndFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtZdoLeaveIndCb\n");\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("ExtAddr: 0x%016llX\n", (long long unsigned int) msg->ExtAddr);\r
- consolePrint("Request: 0x%02X\n", msg->Request);\r
- consolePrint("Remove: 0x%02X\n", msg->Remove);\r
- consolePrint("Rejoin: 0x%02X\n", msg->Rejoin);\r
- return 0;\r
-}\r
-static uint8_t mtZdoMsgCbIncomingCb(MsgCbIncomingFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
-\r
- consolePrint("mtZdoMsgCbIncomingCb\n");\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("WasBroadcast: 0x%02X\n", msg->WasBroadcast);\r
- consolePrint("ClusterID: 0x%04X\n", msg->ClusterID);\r
- consolePrint("SecurityUse: 0x%02X\n", msg->SecurityUse);\r
- consolePrint("SeqNum: 0x%02X\n", msg->SeqNum);\r
- consolePrint("MacDstAddr: 0x%04X\n", msg->MacDstAddr);\r
- uint32_t i;\r
- for (i = 0; i < msg->MacDstAddr; i++)\r
- {\r
- consolePrint("Data[%d]: 0x%02X\n", i, msg->Data[i]);\r
- }\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-\r
-/********************************************************************\r
- * END OF ZDO CALL BACK FUNCTIONS\r
- */\r
-\r
-/********************************************************************\r
- * START OF AF CALL BACK FUNCTIONS\r
- */\r
-\r
-static uint8_t mtAfDataConfirmCb(DataConfirmFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtAfDataConfirmCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("Endpoint: 0x%02X\n", msg->Endpoint);\r
- consolePrint("TransId: 0x%02X\n", msg->TransId);\r
- }\r
- else\r
- {\r
- consolePrint("DataConfirm Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtAfIncomingMsgCb(IncomingMsgFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtAfIncomingMsgCb\n");\r
- consolePrint("GroupId: 0x%04X\n", msg->GroupId);\r
- consolePrint("ClusterId: 0x%04X\n", msg->ClusterId);\r
- consolePrint("SrcAddr: 0x%04X\n", msg->SrcAddr);\r
- consolePrint("SrcEndpoint: 0x%02X\n", msg->SrcEndpoint);\r
- consolePrint("DstEndpoint: 0x%02X\n", msg->DstEndpoint);\r
- consolePrint("WasVroadcast: 0x%02X\n", msg->WasVroadcast);\r
- consolePrint("LinkQuality: 0x%02X\n", msg->LinkQuality);\r
- consolePrint("SecurityUse: 0x%02X\n", msg->SecurityUse);\r
- consolePrint("TimeStamp: 0x%08X\n", msg->TimeStamp);\r
- consolePrint("TransSeqNum: 0x%02X\n", msg->TransSeqNum);\r
- consolePrint("Len: 0x%02X\n", msg->Len);\r
- uint32_t i;\r
- for (i = 0; i < msg->Len; i++)\r
- {\r
- consolePrint("Data[%d]: 0x%02X\n", i, msg->Data[i]);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return 0;\r
-}\r
-static uint8_t mtAfIncomingMsgExt(IncomingMsgExtFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtAfIncomingMsgExt\n");\r
- consolePrint("GroupId: 0x%04X\n", msg->GroupId);\r
- consolePrint("ClusterId: 0x%04X\n", msg->ClusterId);\r
- consolePrint("SrcAddrMode: 0x%02X\n", msg->SrcAddrMode);\r
- consolePrint("SrcAddr: 0x%016llX\n", (long long unsigned int) msg->SrcAddr);\r
- consolePrint("SrcEndpoint: 0x%02X\n", msg->SrcEndpoint);\r
- consolePrint("SrcPanId: 0x%04X\n", msg->SrcPanId);\r
- consolePrint("DstEndpoint: 0x%02X\n", msg->DstEndpoint);\r
- consolePrint("WasVroadcast: 0x%02X\n", msg->WasVroadcast);\r
- consolePrint("LinkQuality: 0x%02X\n", msg->LinkQuality);\r
- consolePrint("SecurityUse: 0x%02X\n", msg->SecurityUse);\r
- consolePrint("TimeStamp: 0x%08X\n", msg->TimeStamp);\r
- consolePrint("TransSeqNum: 0x%02X\n", msg->TransSeqNum);\r
- consolePrint("Len: 0x%02X\n", msg->Len);\r
- uint32_t i;\r
- for (i = 0; i < msg->Len; i++)\r
- {\r
- consolePrint("Data[%d]: 0x%02X\n", i, msg->Data[i]);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return 0;\r
-}\r
-static uint8_t mtAfDataRetrieveSrspCb(DataRetrieveSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtAfDataRetrieveSrspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("Length: 0x%02X\n", msg->Length);\r
- uint32_t i;\r
- for (i = 0; i < msg->Length; i++)\r
- {\r
- consolePrint("Data[%d]: 0x%02X\n", i, msg->Data[i]);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("DataRetrieveSrsp Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
-\r
- return msg->Status;\r
-}\r
-static uint8_t mtAfReflectErrorCb(ReflectErrorFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtAfReflectErrorCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("Endpoint: 0x%02X\n", msg->Endpoint);\r
- consolePrint("TransId: 0x%02X\n", msg->TransId);\r
- consolePrint("DstAddrMode: 0x%02X\n", msg->DstAddrMode);\r
- consolePrint("DstAddr: 0x%04X\n", msg->DstAddr);\r
- }\r
- else\r
- {\r
- consolePrint("ReflectError Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
-\r
- SET_NRM_COLOR();\r
- return msg->Status;\r
-}\r
-\r
-/********************************************************************\r
- * END OF AF CALL BACK FUNCTIONS\r
- */\r
-\r
-/********************************************************************\r
- * START OF SAPI CALL BACK FUNCTIONS\r
- */\r
-\r
-static uint8_t mtSapiReadConfigurationSrspCb(ReadConfigurationSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSapiReadConfigurationSrspCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- consolePrint("ConfigId: 0x%02X\n", msg->ConfigId);\r
- consolePrint("Len: 0x%02X\n", msg->Len);\r
- uint32_t i;\r
- for (i = 0; i < msg->Len; i++)\r
- {\r
- consolePrint("Value[%d]: 0x%02X\n", i, msg->Value[i]);\r
- }\r
- }\r
- else\r
- {\r
- consolePrint("ReadConfigurationSrsp Status: FAIL 0x%02X\n",\r
- msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
- return msg->Status;\r
-}\r
-static uint8_t mtSapiGetDeviceInfoSrspCb(GetDeviceInfoSrspFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSapiGetDeviceInfoSrspCb\n");\r
-\r
- switch (msg->Param)\r
- {\r
- case 0:\r
- consolePrint("Param: (0x%02X) State\n", msg->Param);\r
- consolePrint("Value: 0x%01X\n", msg->Value[0]);\r
- break;\r
- case 1:\r
- consolePrint("Param: (0x%02X) IEEE Address\n", msg->Param);\r
- consolePrint(\r
- "Value: 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X\n",\r
- (unsigned char) msg->Value[0], (unsigned char) msg->Value[1],\r
- (unsigned char) msg->Value[2], (unsigned char) msg->Value[3],\r
- (unsigned char) msg->Value[4], (unsigned char) msg->Value[5],\r
- (unsigned char) msg->Value[6], (unsigned char) msg->Value[7]);\r
- break;\r
- case 2:\r
- consolePrint("Param: (0x%02X) Short Address\n", msg->Param);\r
- consolePrint("Value: 0x%04X\n",\r
- BUILD_UINT16(msg->Value[0], msg->Value[1]));\r
- break;\r
- case 3:\r
- consolePrint("Param: (0x%02X) Parent Short Address\n", msg->Param);\r
- consolePrint("Value: 0x%04X\n",\r
- BUILD_UINT16(msg->Value[0], msg->Value[1]));\r
- break;\r
- case 4:\r
- consolePrint("Param: (0x%02X) Parent IEEE Address\n", msg->Param);\r
- consolePrint(\r
- "Value: 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X\n",\r
- (unsigned char) msg->Value[0], (unsigned char) msg->Value[1],\r
- (unsigned char) msg->Value[2], (unsigned char) msg->Value[3],\r
- (unsigned char) msg->Value[4], (unsigned char) msg->Value[5],\r
- (unsigned char) msg->Value[6], (unsigned char) msg->Value[7]);\r
- break;\r
- case 5:\r
- consolePrint("Param: (0x%02X) Channel\n", msg->Param);\r
- consolePrint("Value: 0x%01X\n", msg->Value[0]);\r
- break;\r
- case 6:\r
- consolePrint("Param: (0x%02X) PAN ID\n", msg->Param);\r
- consolePrint("Value: 0x%04X\n",\r
- BUILD_UINT16(msg->Value[0], msg->Value[1]));\r
- break;\r
- case 7:\r
- consolePrint("Param: (0x%02X) Extended PAN ID\n", msg->Param);\r
- consolePrint(\r
- "Value: 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X\n",\r
- (unsigned char) msg->Value[0], (unsigned char) msg->Value[1],\r
- (unsigned char) msg->Value[2], (unsigned char) msg->Value[3],\r
- (unsigned char) msg->Value[4], (unsigned char) msg->Value[5],\r
- (unsigned char) msg->Value[6], (unsigned char) msg->Value[7]);\r
- break;\r
-\r
- }\r
-\r
- SET_NRM_COLOR();\r
-\r
- return 0;\r
-}\r
-static uint8_t mtSapiFindDeviceCnfCb(FindDeviceCnfFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSapiFindDeviceCnfCb\n");\r
- consolePrint("SearchKey: 0x%04X\n", msg->SearchKey);\r
- consolePrint("Result: 0x%016llX\n", (long long unsigned int) msg->Result);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSapiSendDataCnfCb(SendDataCnfFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSapiSendDataCnfCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Handle: 0x%02X\n", msg->Handle);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- }\r
- else\r
- {\r
- consolePrint("SendDataCnf Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
- return msg->Status;\r
-}\r
-static uint8_t mtSapiReceiveDataIndCb(ReceiveDataIndFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSapiReceiveDataIndCb\n");\r
- consolePrint("Source: 0x%04X\n", msg->Source);\r
- consolePrint("Command: 0x%04X\n", msg->Command);\r
- consolePrint("Len: 0x%04X\n", msg->Len);\r
- uint32_t i;\r
- for (i = 0; i < msg->Len; i++)\r
- {\r
- consolePrint("Data[%d]: 0x%02X\n", i, msg->Data[i]);\r
- }\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSapiAllowBindCnfCb(AllowBindCnfFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSapiAllowBindCnfCb\n");\r
- consolePrint("Source: 0x%04X\n", msg->Source);\r
- SET_NRM_COLOR();\r
- return 0;\r
-}\r
-static uint8_t mtSapiBindCnfCb(BindCnfFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSapiBindCnfCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("CommandId: 0x%04X\n", msg->CommandId);\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- }\r
- else\r
- {\r
- consolePrint("BindCnf Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
- return msg->Status;\r
-}\r
-static uint8_t mtSapiStartCnfCb(StartCnfFormat_t *msg)\r
-{\r
- SET_RSP_COLOR();\r
- consolePrint("mtSapiStartCnfCb\n");\r
- if (msg->Status == MT_RPC_SUCCESS)\r
- {\r
- consolePrint("Status: 0x%02X\n", msg->Status);\r
- }\r
- else\r
- {\r
- consolePrint("StartCnf Status: FAIL 0x%02X\n", msg->Status);\r
- }\r
- SET_NRM_COLOR();\r
- return msg->Status;\r
-}\r
-\r
-/********************************************************************\r
- * END OF SAPI CALL BACK FUNCTIONS\r
- */\r
-\r
-// helper functions for building and sending the NV messages\r
-static uint8_t setNVStartup(uint8_t startupOption)\r
-{\r
- uint8_t status;\r
- OsalNvWriteFormat_t nvWrite;\r
-\r
- // sending startup option\r
- nvWrite.Id = ZCD_NV_STARTUP_OPTION;\r
- nvWrite.Offset = 0;\r
- nvWrite.Len = 1;\r
- nvWrite.Value[0] = startupOption;\r
- status = sysOsalNvWrite(&nvWrite);\r
-\r
- dbg_print(PRINT_LEVEL_INFO, "\n");\r
-\r
- dbg_print(PRINT_LEVEL_INFO, "NV Write Startup Option cmd sent[%d]...\n",\r
- status);\r
-\r
- return status;\r
-}\r
-\r
-static uint8_t setNVDevType(uint8_t devType)\r
-{\r
- uint8_t status;\r
- OsalNvWriteFormat_t nvWrite;\r
-\r
- nvWrite.Id = ZCD_NV_LOGICAL_TYPE;\r
- nvWrite.Offset = 0;\r
- nvWrite.Len = 1;\r
- nvWrite.Value[0] = devType;\r
- status = sysOsalNvWrite(&nvWrite);\r
-\r
- dbg_print(PRINT_LEVEL_INFO, "\n");\r
- dbg_print(PRINT_LEVEL_INFO, "NV Write Device Type cmd sent... [%d]\n",\r
- status);\r
-\r
- return status;\r
-}\r
-\r
-static uint8_t setNVPanID(uint32_t panId)\r
-{\r
- uint8_t status;\r
- OsalNvWriteFormat_t nvWrite;\r
-\r
- dbg_print(PRINT_LEVEL_INFO, "\n");\r
- dbg_print(PRINT_LEVEL_INFO, "NV Write PAN ID cmd sending...\n");\r
-\r
- nvWrite.Id = ZCD_NV_PANID;\r
- nvWrite.Offset = 0;\r
- nvWrite.Len = 2;\r
- nvWrite.Value[0] = LO_UINT16(panId);\r
- nvWrite.Value[1] = HI_UINT16(panId);\r
- status = sysOsalNvWrite(&nvWrite);\r
-\r
- dbg_print(PRINT_LEVEL_INFO, "\n");\r
- dbg_print(PRINT_LEVEL_INFO, "NV Write PAN ID cmd sent...[%d]\n", status);\r
-\r
- return status;\r
-}\r
-\r
-static uint8_t setNVChanList(uint32_t chanList)\r
-{\r
- OsalNvWriteFormat_t nvWrite;\r
- uint8_t status;\r
-\r
- // setting chanList\r
- nvWrite.Id = ZCD_NV_CHANLIST;\r
- nvWrite.Offset = 0;\r
- nvWrite.Len = 4;\r
- nvWrite.Value[0] = BREAK_UINT32(chanList, 0);\r
- nvWrite.Value[1] = BREAK_UINT32(chanList, 1);\r
- nvWrite.Value[2] = BREAK_UINT32(chanList, 2);\r
- nvWrite.Value[3] = BREAK_UINT32(chanList, 3);\r
- status = sysOsalNvWrite(&nvWrite);\r
-\r
- dbg_print(PRINT_LEVEL_INFO, "\n");\r
- dbg_print(PRINT_LEVEL_INFO, "NV Write Channel List cmd sent...[%d]\n",\r
- status);\r
-\r
- return status;\r
-}\r
-\r
-static int32_t startNetwork(void)\r
-{\r
- char cDevType;\r
- uint8_t devType;\r
- int32_t status;\r
- uint8_t newNwk = 0;\r
- char sCh[128];\r
-\r
- do\r
- {\r
- consolePrint("Do you wish to start/join a new network? (y/n)\n");\r
- consoleGetLine(sCh, 128);\r
- if (sCh[0] == 'n' || sCh[0] == 'N')\r
- {\r
- status = setNVStartup(0);\r
- }\r
- else if (sCh[0] == 'y' || sCh[0] == 'Y')\r
- {\r
- status = setNVStartup(\r
- ZCD_STARTOPT_CLEAR_STATE | ZCD_STARTOPT_CLEAR_CONFIG);\r
- newNwk = 1;\r
-\r
- }\r
- else\r
- {\r
- consolePrint("Incorrect input please type y or n\n");\r
- }\r
- } while (sCh[0] != 'y' && sCh[0] != 'Y' && sCh[0] != 'n' && sCh[0] != 'N');\r
-\r
- if (status != MT_RPC_SUCCESS)\r
- {\r
- dbg_print(PRINT_LEVEL_WARNING, "network start failed\n");\r
- return -1;\r
- }\r
- consolePrint("Resetting ZNP\n");\r
- ResetReqFormat_t resReq;\r
- resReq.Type = 1;\r
- sysResetReq(&resReq);\r
- //flush the rsp\r
- rpcWaitMqClientMsg(5000);\r
-\r
- if (newNwk)\r
- {\r
- #ifndef CC26xx\r
- consolePrint(\r
- "Enter device type c: Coordinator, r: Router, e: End Device:\n");\r
- consoleGetLine(sCh, 128);\r
- cDevType = sCh[0];\r
-\r
- switch (cDevType)\r
- {\r
- case 'c':\r
- case 'C':\r
- devType = DEVICETYPE_COORDINATOR;\r
- break;\r
- case 'r':\r
- case 'R':\r
- devType = DEVICETYPE_ROUTER;\r
- break;\r
- case 'e':\r
- case 'E':\r
- default:\r
- devType = DEVICETYPE_ENDDEVICE;\r
- break;\r
- }\r
- status = setNVDevType(devType);\r
-\r
- if (status != MT_RPC_SUCCESS)\r
- {\r
- dbg_print(PRINT_LEVEL_WARNING, "setNVDevType failed\n");\r
- return 0;\r
- }\r
-#endif // CC26xx\r
-\r
-\r
- //Select random PAN ID for Coord and join any PAN for RTR/ED\r
- status = setNVPanID(0xFFFF);\r
- if (status != MT_RPC_SUCCESS)\r
- {\r
- dbg_print(PRINT_LEVEL_WARNING, "setNVPanID failed\n");\r
- return -1;\r
- }\r
- consolePrint("Enter channel 11-26:\n");\r
- consoleGetLine(sCh, 128);\r
-\r
- status = setNVChanList(1 << atoi(sCh));\r
- if (status != MT_RPC_SUCCESS)\r
- {\r
- dbg_print(PRINT_LEVEL_INFO, "setNVPanID failed\n");\r
- return -1;\r
- }\r
-\r
- }\r
-\r
- registerAf();\r
- consolePrint("EndPoint: 1\n");\r
-\r
- status = zdoInit();\r
- if (status == NEW_NETWORK)\r
- {\r
- dbg_print(PRINT_LEVEL_INFO, "zdoInit NEW_NETWORK\n");\r
- status = MT_RPC_SUCCESS;\r
- }\r
- else if (status == RESTORED_NETWORK)\r
- {\r
- dbg_print(PRINT_LEVEL_INFO, "zdoInit RESTORED_NETWORK\n");\r
- status = MT_RPC_SUCCESS;\r
- }\r
- else\r
- {\r
- dbg_print(PRINT_LEVEL_INFO, "zdoInit failed\n");\r
- status = -1;\r
- }\r
-\r
- dbg_print(PRINT_LEVEL_INFO, "process zdoStatechange callbacks\n");\r
-\r
- //flush AREQ ZDO State Change messages\r
- while (status != -1)\r
- {\r
- status = rpcWaitMqClientMsg(5000);\r
-\r
- if (((devType == DEVICETYPE_COORDINATOR) && (devState == DEV_ZB_COORD))\r
- || ((devType == DEVICETYPE_ROUTER) && (devState == DEV_ROUTER))\r
- || ((devType == DEVICETYPE_ENDDEVICE)\r
- && (devState == DEV_END_DEVICE)))\r
- {\r
- break;\r
- }\r
- }\r
- //set startup option back to keep configuration in case of reset\r
- status = setNVStartup(0);\r
- if (devState < DEV_END_DEVICE)\r
- {\r
- //start network failed\r
- return -1;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-static int32_t registerAf(void)\r
-{\r
- int32_t status = 0;\r
- RegisterFormat_t reg;\r
-\r
- reg.EndPoint = 1;\r
- reg.AppProfId = 0x0104;\r
- reg.AppDeviceId = 0x0100;\r
- reg.AppDevVer = 1;\r
- reg.LatencyReq = 0;\r
- reg.AppNumInClusters = 1;\r
- reg.AppInClusterList[0] = 0x0006;\r
- reg.AppNumOutClusters = 0;\r
-\r
- status = afRegister(®);\r
- return status;\r
-}\r
-\r
-/*********************************************************************\r
- * INTERFACE FUNCTIONS\r
- */\r
-uint32_t appInit(void)\r
-{\r
- int32_t status = 0;\r
- uint32_t msgCnt = 0;\r
-\r
- //Flush all messages from the que\r
- while (status != -1)\r
- {\r
- status = rpcWaitMqClientMsg(10);\r
- if (status != -1)\r
- {\r
- msgCnt++;\r
- }\r
- }\r
-\r
- dbg_print(PRINT_LEVEL_INFO, "flushed %d message from msg queue\n", msgCnt);\r
-\r
- //Register Callbacks MT system callbacks\r
- sysRegisterCallbacks(mtSysCb);\r
- zdoRegisterCallbacks(mtZdoCb);\r
- afRegisterCallbacks(mtAfCb);\r
- sapiRegisterCallbacks(mtSapiCb);\r
-\r
- return 0;\r
-}\r
-/*********************************************************************\r
- * START OF COMMANDS PROCESSING\r
- */\r
-static void sendCmd(uint8_t* req, uint8_t index)\r
-{\r
- switch (index)\r
- {\r
- case 0:\r
- sysPing();\r
- break;\r
- case 1:\r
- sysSetExtAddr((SetExtAddrFormat_t*) req);\r
- break;\r
- case 2:\r
- sysGetExtAddr();\r
- break;\r
- case 3:\r
- sysRamRead((RamReadFormat_t*) req);\r
- break;\r
- case 4:\r
- sysRamWrite((RamWriteFormat_t*) req);\r
- break;\r
- case 5:\r
- sysResetReq((ResetReqFormat_t*) req);\r
- break;\r
- case 6:\r
- sysVersion();\r
- break;\r
- case 7:\r
- sysOsalNvRead((OsalNvReadFormat_t*) req);\r
- break;\r
- case 8:\r
- sysOsalNvWrite((OsalNvWriteFormat_t*) req);\r
- break;\r
- case 9:\r
- sysOsalNvItemInit((OsalNvItemInitFormat_t*) req);\r
- break;\r
- case 10:\r
- sysOsalNvDelete((OsalNvDeleteFormat_t*) req);\r
- break;\r
- case 11:\r
- sysOsalNvLength((OsalNvLengthFormat_t*) req);\r
- break;\r
- case 12:\r
- sysOsalStartTimer((OsalStartTimerFormat_t*) req);\r
- break;\r
- case 13:\r
- sysOsalStopTimer((OsalStopTimerFormat_t*) req);\r
- break;\r
- case 14:\r
- sysStackTune((StackTuneFormat_t*) req);\r
- break;\r
- case 15:\r
- sysAdcRead((AdcReadFormat_t*) req);\r
- break;\r
- case 16:\r
- sysGpio((GpioFormat_t*) req);\r
- break;\r
- case 17:\r
- sysRandom();\r
- break;\r
- case 18:\r
- sysSetTime((SetTimeFormat_t*) req);\r
- break;\r
- case 19:\r
- sysGetTime();\r
- break;\r
- case 20:\r
- sysSetTxPower((SetTxPowerFormat_t*) req);\r
- break;\r
- case 21:\r
- afRegister((RegisterFormat_t*) req);\r
- break;\r
- case 22:\r
- afDataRequest((DataRequestFormat_t*) req);\r
- break;\r
- case 23:\r
- afDataRequestExt((DataRequestExtFormat_t*) req);\r
- break;\r
- case 24:\r
- afDataRequestSrcRtg((DataRequestSrcRtgFormat_t*) req);\r
- break;\r
- case 25:\r
- afInterPanCtl((InterPanCtlFormat_t*) req);\r
- break;\r
- case 26:\r
- afDataStore((DataStoreFormat_t*) req);\r
- break;\r
- case 27:\r
- afDataRetrieve((DataRetrieveFormat_t*) req);\r
- break;\r
- case 28:\r
- afApsfConfigSet((ApsfConfigSetFormat_t*) req);\r
- break;\r
- case 29:\r
- zdoNwkAddrReq((NwkAddrReqFormat_t*) req);\r
- break;\r
- case 30:\r
- zdoIeeeAddrReq((IeeeAddrReqFormat_t*) req);\r
- break;\r
- case 31:\r
- zdoNodeDescReq((NodeDescReqFormat_t*) req);\r
- break;\r
- case 32:\r
- zdoPowerDescReq((PowerDescReqFormat_t*) req);\r
- break;\r
- case 33:\r
- zdoSimpleDescReq((SimpleDescReqFormat_t*) req);\r
- break;\r
- case 34:\r
- zdoActiveEpReq((ActiveEpReqFormat_t*) req);\r
- break;\r
- case 35:\r
- zdoMatchDescReq((MatchDescReqFormat_t*) req);\r
- break;\r
- case 36:\r
- zdoComplexDescReq((ComplexDescReqFormat_t*) req);\r
- break;\r
- case 37:\r
- zdoUserDescReq((UserDescReqFormat_t*) req);\r
- break;\r
- case 38:\r
- zdoDeviceAnnce((DeviceAnnceFormat_t*) req);\r
- break;\r
- case 39:\r
- zdoUserDescSet((UserDescSetFormat_t*) req);\r
- break;\r
- case 40:\r
- zdoServerDiscReq((ServerDiscReqFormat_t*) req);\r
- break;\r
- case 41:\r
- zdoEndDeviceBindReq((EndDeviceBindReqFormat_t*) req);\r
- break;\r
- case 42:\r
- zdoBindReq((BindReqFormat_t*) req);\r
- break;\r
- case 43:\r
- zdoUnbindReq((UnbindReqFormat_t*) req);\r
- break;\r
- case 44:\r
- zdoMgmtNwkDiscReq((MgmtNwkDiscReqFormat_t*) req);\r
- break;\r
- case 45:\r
- zdoMgmtLqiReq((MgmtLqiReqFormat_t*) req);\r
- break;\r
- case 46:\r
- zdoMgmtRtgReq((MgmtRtgReqFormat_t*) req);\r
- break;\r
- case 47:\r
- zdoMgmtBindReq((MgmtBindReqFormat_t*) req);\r
- break;\r
- case 48:\r
- zdoMgmtLeaveReq((MgmtLeaveReqFormat_t*) req);\r
- break;\r
- case 49:\r
- zdoMgmtDirectJoinReq((MgmtDirectJoinReqFormat_t*) req);\r
- break;\r
- case 50:\r
- zdoMgmtPermitJoinReq((MgmtPermitJoinReqFormat_t*) req);\r
- break;\r
- case 51:\r
- zdoMgmtNwkUpdateReq((MgmtNwkUpdateReqFormat_t*) req);\r
- break;\r
- case 52:\r
- zdoStartupFromApp((StartupFromAppFormat_t*) req);\r
- break;\r
- case 53:\r
- zdoAutoFindDestination((AutoFindDestinationFormat_t*) req);\r
- break;\r
- case 54:\r
- zdoSetLinkKey((SetLinkKeyFormat_t*) req);\r
- break;\r
- case 55:\r
- zdoRemoveLinkKey((RemoveLinkKeyFormat_t*) req);\r
- break;\r
- case 56:\r
- zdoGetLinkKey((GetLinkKeyFormat_t*) req);\r
- break;\r
- case 57:\r
- zdoNwkDiscoveryReq((NwkDiscoveryReqFormat_t*) req);\r
- break;\r
- case 58:\r
- zdoJoinReq((JoinReqFormat_t*) req);\r
- break;\r
- case 59:\r
- zdoMsgCbRegister((MsgCbRegisterFormat_t*) req);\r
- break;\r
- case 60:\r
- zdoMsgCbRemove((MsgCbRemoveFormat_t*) req);\r
- break;\r
- case 61:\r
- zbSystemReset();\r
- break;\r
- case 62:\r
- zbAppRegisterReq((AppRegisterReqFormat_t*) req);\r
- break;\r
- case 63:\r
- zbStartReq();\r
- break;\r
- case 64:\r
- zbPermitJoiningReq((PermitJoiningReqFormat_t*) req);\r
- break;\r
- case 65:\r
- zbBindDevice((BindDeviceFormat_t*) req);\r
- break;\r
- case 66:\r
- zbAllowBind((AllowBindFormat_t*) req);\r
- break;\r
- case 67:\r
- zbSendDataReq((SendDataReqFormat_t*) req);\r
- break;\r
- case 68:\r
- zbFindDeviceReq((FindDeviceReqFormat_t*) req);\r
- break;\r
- case 69:\r
- zbWriteConfiguration((WriteConfigurationFormat_t*) req);\r
- break;\r
- case 70:\r
- zbGetDeviceInfo((GetDeviceInfoFormat_t*) req);\r
- break;\r
- case 71:\r
- zbReadConfiguration((ReadConfigurationFormat_t*) req);\r
- break;\r
-\r
- }\r
-\r
-}\r
-uint8_t matchedCmds[250];\r
-uint8_t matchedLength;\r
-static void inputCmd(uint16_t index)\r
-{\r
- char value[128];\r
- char* strPos = value;\r
- uint8_t commandSize = 0;\r
- uint8_t attSize = 0;\r
- uint16_t currentPos = 0;\r
-\r
- uint8_t x;\r
- for (x = 0; x < commands[index].attNum; x++)\r
- {\r
- commandSize += commands[index].atts[x].size\r
- * (commands[index].atts[x].isList == 0 ?\r
- 1 : commands[index].atts[x].isList);\r
- commandSize += (\r
- (commands[index].atts[x].size == 2 && (commandSize % 2) != 0) ?\r
- 1 : 0);\r
- }\r
-\r
- uint8_t *input = malloc(commandSize);\r
- int tem;\r
-\r
- SET_PARAM_COLOR();\r
- consolePrint("Command: %s\n", commands[index].cmdName);\r
- SET_NRM_COLOR();\r
- for (x = 0; x < commands[index].attNum; x++)\r
- {\r
- attSize = commands[index].atts[x].size;\r
- if (commands[index].atts[x].isList == 0)\r
- {\r
- SET_PARAM_COLOR();\r
- consolePrint("Enter %s: (%dB)\n", commands[index].atts[x].name,\r
- attSize);\r
- SET_NRM_COLOR();\r
- consoleGetLine(value, 128);\r
-\r
- if (attSize == 2)\r
- {\r
- sscanf(value, "%x", &tem);\r
- sprintf(value, "%04X", tem);\r
- //strPos = value;\r
- if (currentPos % 2 != 0)\r
- {\r
- currentPos++;\r
- }\r
- }\r
- else if (attSize == 4)\r
- {\r
- sscanf(value, "%x", &tem);\r
- sprintf(value, "%08X", tem);\r
- //strPos = value;\r
- }\r
- else if (attSize == 1)\r
- {\r
- sscanf(value, "%x", &tem);\r
- sprintf(value, "%02X", tem);\r
- //strPos = value;\r
- }\r
- strPos = value;\r
- uint8_t idx;\r
- for (idx = 0; idx < attSize; idx++)\r
- {\r
- if (strlen(strPos) > 0)\r
- {\r
-\r
- sscanf(strPos, "%2hhx",\r
- &input[currentPos + attSize - 1 - idx]);\r
- strPos += (strPos[2] == ':' ? 3 : 2);\r
- }\r
- else\r
- {\r
- input[currentPos + attSize - 1 - idx] = 0;\r
- }\r
-\r
- }\r
- currentPos += attSize;\r
- }\r
- else\r
- {\r
- uint16_t tempPos = currentPos;\r
- uint8_t listLen = input[currentPos - 1];\r
- uint8_t listIdx;\r
- for (listIdx = 0; listIdx < listLen; listIdx++)\r
- {\r
- SET_PARAM_COLOR();\r
- consolePrint("Enter %s[%d]:\n", commands[index].atts[x].name,\r
- listIdx);\r
- SET_NRM_COLOR();\r
- consoleGetLine(value, 128);\r
- if (attSize == 2)\r
- {\r
- sscanf(value, "%x", &tem);\r
- sprintf(value, "%04X", tem);\r
- //strPos = value;\r
- if (tempPos % 2 != 0)\r
- {\r
- tempPos++;\r
- currentPos++;\r
- }\r
- }\r
- else if (attSize == 1)\r
- {\r
- sscanf(value, "%x", &tem);\r
- sprintf(value, "%02X", tem);\r
- //strPos = value;\r
- }\r
- strPos = value;\r
- uint8_t idx;\r
- for (idx = 0; idx < attSize; idx++)\r
- {\r
- if (strlen(strPos) > 0)\r
- {\r
- sscanf(strPos, "%2hhx",\r
- &input[tempPos + attSize - 1 - idx]);\r
- strPos += (strPos[2] == ':' ? 3 : 2);\r
- }\r
- else\r
- {\r
- input[currentPos + attSize - 1 - idx] = 0;\r
- }\r
- }\r
- tempPos += attSize;\r
- }\r
- currentPos += (attSize * commands[index].atts[x].isList);\r
- }\r
- }\r
-\r
- sendCmd(input, index);\r
- free(input);\r
-\r
-}\r
-static uint8_t getMatched(char* cmd)\r
-{\r
- uint8_t cmdLength = strlen(cmd);\r
- uint8_t tempLength = 0;\r
- uint16_t cmdMatches = 0;\r
- uint8_t matchedTemp[250];\r
- char tempcmd[200];\r
-\r
- uint16_t Idx;\r
- for (Idx = 0; Idx < COMMANDS_SIZE; Idx++)\r
- {\r
- tempLength = strlen(commands[Idx].cmdName);\r
- if (tempLength >= cmdLength)\r
- {\r
- strcpy(tempcmd, commands[Idx].cmdName);\r
- tempcmd[cmdLength] = '\0';\r
- if (strcmp(cmd, tempcmd) == 0)\r
- {\r
- if (tempLength == cmdLength)\r
- {\r
- matchedTemp[0] = Idx;\r
- cmdMatches = 1;\r
- matchedLength = 0;\r
- Idx = COMMANDS_SIZE;\r
- }\r
- else\r
- {\r
- matchedTemp[cmdMatches] = Idx;\r
- cmdMatches++;\r
- }\r
- }\r
- }\r
- }\r
- uint8_t index = strlen(cmd);\r
- if (cmdMatches > 1 && (matchedLength == cmdMatches || matchedLength == 0))\r
- {\r
-\r
- matchedLength = cmdMatches;\r
- cmd[index] = commands[matchedTemp[0]].cmdName[index];\r
- cmd[index + 1] = '\0';\r
- getMatched(cmd);\r
- matchedLength = cmdMatches;\r
- memcpy(matchedCmds, matchedTemp, cmdMatches);\r
- return 0;\r
- }\r
- memcpy(matchedCmds, matchedTemp, cmdMatches);\r
- if (matchedLength != 0)\r
- cmd[index - 1] = '\0';\r
- matchedLength = cmdMatches;\r
- return 0;\r
-\r
-}\r
-\r
-uint8_t histIdx = 0;\r
-uint8_t isHistRollOver = 0;\r
-uint32_t maxHist = 256;\r
-char hist[256][256];\r
-static uint8_t clGetCmd(void)\r
-{\r
- char ch;\r
- char tempStr[256];\r
- char tempHist[256];\r
- uint8_t cPos = 0;\r
- char cmdStr[256] =\r
- { 0 };\r
- char lastChar;\r
- uint32_t cmdStrIdx = 0;\r
- uint32_t currHist = 0;\r
- uint8_t cmdComplete = 0;\r
- uint8_t isDir;\r
- isDir = 0;\r
- cmdStr[0] = '\0';\r
- consolePrint("Enter CMD\n");\r
-\r
- while (cmdComplete == 0)\r
- {\r
- ch = consoleGetCh();\r
- switch (ch)\r
- {\r
- case '\t':\r
- consoleClearLn()\r
- ;\r
- consolePrint("\r%s", cmdStr);\r
-\r
- getMatched(cmdStr);\r
-\r
- if (matchedLength == 1) // there was only 1 match\r
- {\r
- if (lastChar == '\t') //2 tabs pressed then print command description\r
- {\r
- SET_HELP_COLOR();\r
- consolePrint("\nDescription:\n%s",\r
- commands[matchedCmds[0]].cmdDesc);\r
- SET_NRM_COLOR();\r
- consolePrint("\nEnter CMD\n");\r
- ch = ' ';\r
- }\r
- else\r
- {\r
- strcpy(cmdStr, commands[matchedCmds[0]].cmdName);\r
- }\r
- }\r
- else if (matchedLength > 1) // there was more than 1 match\r
- {\r
- if (lastChar == '\t') //2 tabs pressed then print all commands that start with\r
- {\r
- consolePrint("\n\n");\r
- uint8_t mIdx;\r
- SET_HELP_COLOR();\r
- for (mIdx = 0; mIdx < matchedLength; mIdx++)\r
- {\r
- consolePrint("%s\n",\r
- commands[matchedCmds[mIdx]].cmdName);\r
- }\r
- SET_NRM_COLOR();\r
- consolePrint("\n\nEnter CMD\n");\r
- ch = ' ';\r
- }\r
- }\r
- cmdStrIdx = strlen(cmdStr);\r
- consoleClearLn()\r
- ;\r
- consolePrint("\r%s", cmdStr);\r
- matchedLength = 0;\r
- consolePrint("%s", KNRM);\r
- break;\r
- case '\n':\r
- //enter was press\r
- getMatched(cmdStr);\r
- if ((histIdx == 0 && isHistRollOver == 0)\r
- || strcmp(hist[(maxHist + histIdx - 1) % maxHist], cmdStr)\r
- != 0)\r
- {\r
- strcpy(hist[histIdx], cmdStr);\r
- histIdx = ((histIdx + 1) % maxHist);\r
- }\r
- if (histIdx == 0)\r
- {\r
- isHistRollOver = 1;\r
- }\r
- if (matchedLength == 1)\r
- {\r
- if (strcmp(cmdStr, commands[matchedCmds[0]].cmdName) == 0)\r
- {\r
- consolePrint("\n");\r
- inputCmd(matchedCmds[0]);\r
-\r
- }\r
-\r
- }\r
- matchedLength = 0;\r
- cmdComplete = 1;\r
- break;\r
- case 127:\r
- //backspace was press\r
- //clear line\r
- if (cmdStrIdx > 0)\r
- {\r
- if (cPos < cmdStrIdx)\r
- {\r
- uint8_t x;\r
- for (x = 0; x < cPos; x++)\r
- {\r
- cmdStr[cmdStrIdx - cPos + x - 1] =\r
- tempStr[cPos - x - 1];\r
- }\r
- cmdStr[--cmdStrIdx] = '\0';\r
- }\r
-\r
- consoleClearLn();\r
- consolePrint("\r%s", cmdStr);\r
-\r
- }\r
- else\r
- {\r
- consoleClearLn();\r
- consolePrint("\r");\r
- }\r
- break;\r
- case 27:\r
- isDir = 1;\r
- if (cmdStrIdx > 0)\r
- {\r
- consoleClearLn();\r
- consolePrint("\r%s", cmdStr);\r
-\r
- }\r
- else\r
- {\r
- consoleClearLn();\r
- consolePrint("\r");\r
- }\r
-\r
- break;\r
- default:\r
- if (isDir)\r
- {\r
- if (ch == '[')\r
- {\r
- isDir = 1;\r
- }\r
- else if (ch == 'A')\r
- {\r
- if (currHist < histIdx)\r
- {\r
- cPos = 0;\r
- if (currHist)\r
- {\r
- strcpy(hist[histIdx - currHist], cmdStr);\r
- }\r
- if (currHist == 0)\r
- strcpy(tempHist, cmdStr);\r
- currHist++;\r
- strcpy(cmdStr, hist[histIdx - currHist]);\r
- cmdStrIdx = strlen(cmdStr);\r
-\r
- }\r
-\r
- isDir = 0;\r
- }\r
- else if (ch == 'B')\r
- {\r
- if (currHist)\r
- {\r
- strcpy(hist[histIdx - currHist], cmdStr);\r
- currHist--;\r
- if (currHist)\r
- {\r
- strcpy(cmdStr, hist[histIdx - currHist]);\r
- }\r
- else\r
- {\r
- strcpy(cmdStr, tempHist);\r
- }\r
- cmdStrIdx = strlen(cmdStr);\r
-\r
- }\r
- isDir = 0;\r
- }\r
- else if (ch == 'C')\r
- {\r
- if (cPos > 0)\r
- {\r
- cPos--;\r
- }\r
-\r
- isDir = 0;\r
- }\r
- else if (ch == 'D')\r
- {\r
- if (cPos < cmdStrIdx)\r
- {\r
- tempStr[cPos] = cmdStr[cmdStrIdx - cPos - 1];\r
- cPos++;\r
- }\r
- isDir = 0;\r
- }\r
- else\r
- {\r
- isDir = 0;\r
- }\r
- }\r
- else\r
- {\r
- if (cPos != 0)\r
- {\r
- cmdStr[cmdStrIdx - cPos] = ch;\r
- uint8_t x;\r
- for (x = 1; x <= cPos; x++)\r
- {\r
- cmdStr[cmdStrIdx - cPos + x] = tempStr[cPos - x];\r
- }\r
- cmdStr[++cmdStrIdx] = '\0';\r
- }\r
- else\r
- {\r
- cmdStr[cmdStrIdx++] = ch;\r
- cmdStr[cmdStrIdx] = '\0';\r
- }\r
-\r
- }\r
- consoleClearLn()\r
- ;\r
- consolePrint("\r%s", cmdStr);\r
- break;\r
- }\r
-\r
- uint8_t x;\r
- for (x = 1; x <= cPos; x++)\r
- {\r
- consolePrint("\b");\r
- }\r
- consoleFlush();\r
- lastChar = ch;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-/*********************************************************************\r
- * END OF COMMANDS PROCESSING\r
- *********************************************************************/\r
-\r
-void appProcess(void *argument)\r
-{\r
- int32_t status;\r
- InitCmds();\r
-\r
- //Flush all messages from the que\r
- do\r
- {\r
- status = rpcWaitMqClientMsg(50);\r
- } while (status != -1);\r
-\r
- //init variable\r
- devState = DEV_HOLD;\r
- gSrcEndPoint = 1;\r
- gDstEndPoint = 1;\r
-\r
- status = startNetwork();\r
- if (status != -1)\r
- {\r
- consolePrint("Network up\n\n");\r
- }\r
- else\r
- {\r
- consolePrint("Network Error\n\n");\r
- }\r
-\r
- sysGetExtAddr();\r
-\r
- OsalNvWriteFormat_t nvWrite;\r
- nvWrite.Id = ZCD_NV_ZDO_DIRECT_CB;\r
- nvWrite.Offset = 0;\r
- nvWrite.Len = 1;\r
- nvWrite.Value[0] = 1;\r
- status = sysOsalNvWrite(&nvWrite);\r
-\r
- while (1)\r
- {\r
- status = clGetCmd();\r
- while (status != -1)\r
- {\r
- status = rpcWaitMqClientMsg(1000);\r
- consolePrint("\n");\r
- }\r
- }\r
-}\r
-\r