⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mt_zdo.s51

📁 CC2430上开关控制灯和温度传感器采集两个例子
💻 S51
📖 第 1 页 / 共 5 页
字号:
//  821     *msg++ = Status;
//  822     *msg++ = HI_UINT16( SrcAddr->addr.shortAddr );
//  823     *msg++ = LO_UINT16( SrcAddr->addr.shortAddr );
//  824     *msg++ = HI_UINT16( nwkAddr );
//  825     *msg++ = LO_UINT16( nwkAddr );
//  826 
//  827     *msg++ = EPIntf;
//  828 
//  829     *msg++ = HI_UINT16( pSimpleDesc->AppProfId );
//  830     *msg++ = LO_UINT16( pSimpleDesc->AppProfId );
//  831     *msg++ = HI_UINT16( pSimpleDesc->AppDeviceId );
//  832     *msg++ = LO_UINT16( pSimpleDesc->AppDeviceId );
//  833 
//  834     *msg++ = pSimpleDesc->AppDevVer;
//  835     *msg++ = pSimpleDesc->Reserved;
//  836 
//  837     *msg++ = pSimpleDesc->AppNumInClusters;
//  838     // ZTool supports 16 bits the code has taken it into account      
//  839     for ( x = 0; x < 16; x++ )
//  840     {
//  841       if ( x < pSimpleDesc->AppNumInClusters )
//  842       {
//  843         *msg++ = HI_UINT16( pSimpleDesc->pAppInClusterList[x]);
//  844         *msg++ = LO_UINT16( pSimpleDesc->pAppInClusterList[x]);
//  845       }
//  846       else
//  847       {
//  848         *msg++ = 0;
//  849         *msg++ = 0;
//  850       }
//  851     }
//  852     *msg++ = pSimpleDesc->AppNumOutClusters;
//  853 
//  854     for ( x = 0; x < 16; x++ )
//  855     {
//  856       if ( x < pSimpleDesc->AppNumOutClusters )
//  857       {
//  858         *msg++ = HI_UINT16( pSimpleDesc->pAppOutClusterList[x]);
//  859         *msg++ = LO_UINT16( pSimpleDesc->pAppOutClusterList[x]);
//  860       }
//  861       else
//  862       {
//  863         *msg++ = 0;
//  864         *msg++ = 0;
//  865       }
//  866     }
//  867 
//  868     MT_BuildAndSendZToolCB( SPI_CB_ZDO_SIMPLE_DESC_RSP, ZDO_SIMPLE_DESC_CB_LEN, msgPtr );
//  869 
//  870     osal_mem_free( msgPtr );
//  871   }
//  872 }
//  873 #endif // ZDO_SIMPLEDESC_REQUEST
//  874 
//  875 #if defined ( ZDO_ACTIVEEP_REQUEST ) || defined ( ZDO_MATCH_REQUEST )
//  876 /*********************************************************************
//  877  * @fn      zdo_MTCB_ActiveEPRspCB()
//  878  *
//  879  * @brief
//  880  *
//  881  *   Called by ZDO when a Active_EP_rsp or Match_Desc_rsp message is received.
//  882  *
//  883  * @param  SrcAddr  - Source address
//  884  * @param  Status - response status
//  885  * @param  nwkAddr - Device's short address that this response describes
//  886  * @param  epIntfCnt - number of epIntfList items
//  887  * @param  epIntfList - array of active endpoint/interfaces.
//  888  *
//  889  * @return  none
//  890  */
//  891 void zdo_MTCB_MatchActiveEPRspCB( uint16 type, zAddrType_t *SrcAddr, byte Status,
//  892                   uint16 nwkAddr, byte epIntfCnt, byte *epIntfList )
//  893 {
//  894   byte buf[22];
//  895   byte *msg;
//  896   byte x;
//  897 
//  898   msg = buf;
//  899 
//  900   //Fill up the data bytes
//  901   *msg++ = Status;
//  902   *msg++ = HI_UINT16( SrcAddr->addr.shortAddr );
//  903   *msg++ = LO_UINT16( SrcAddr->addr.shortAddr );
//  904   *msg++ = HI_UINT16( nwkAddr );
//  905   *msg++ = LO_UINT16( nwkAddr );
//  906 
//  907   *msg++ = epIntfCnt;
//  908 
//  909   for ( x = 0; x < 16; x++ )
//  910   {
//  911     if ( x < epIntfCnt )
//  912       *msg++ = *epIntfList++;
//  913     else
//  914       *msg++ = 0;
//  915   }
//  916 
//  917   MT_BuildAndSendZToolCB( type, 22, buf );
//  918 }
//  919 #endif // ZDO_ACTIVEEP_REQUEST || ZDO_MATCH_REQUEST
//  920 
//  921 #if defined ( ZDO_BIND_UNBIND_REQUEST ) || defined ( ZDO_ENDDEVICEBIND_REQUEST )
//  922 /*********************************************************************
//  923  * @fn      zdo_MTCB_BindRspCB()
//  924  *
//  925  * @brief
//  926  *
//  927  *   Called to send MT callback response for binding responses
//  928  *
//  929  * @param  type - binding type (end device, bind, unbind)
//  930  * @param  SrcAddr  - Source address
//  931  * @param  Status - response status
//  932  *
//  933  * @return  none
//  934  */
//  935 void zdo_MTCB_BindRspCB( uint16 type, zAddrType_t *SrcAddr, byte Status )
//  936 {
//  937   byte buf[3];
//  938   buf[0] = Status;
//  939   buf[1] = HI_UINT16( SrcAddr->addr.shortAddr );
//  940   buf[2] = LO_UINT16( SrcAddr->addr.shortAddr );
//  941   MT_BuildAndSendZToolCB( type, 3, buf );
//  942 }
//  943 #endif // ZDO_BIND_UNBIND_REQUEST || ZDO_ENDDEVICEBIND_REQUEST
//  944 
//  945 #if defined ( ZDO_MGMT_LQI_REQUEST )
//  946 /*********************************************************************
//  947  * @fn      zdo_MTCB_MgmtLqiRspCB()
//  948  *
//  949  * @brief
//  950  *
//  951  *   Called to send MT callback response for Management LQI response
//  952  *
//  953  * @param  type - binding type (end device, bind, unbind)
//  954  * @param  SrcAddr  - Source address
//  955  * @param  Status - response status
//  956  *
//  957  * @return  none
//  958  */
//  959 void zdo_MTCB_MgmtLqiRspCB( uint16 SrcAddr, byte Status, byte NeighborLqiEntries,
//  960                             byte StartIndex, byte NeighborLqiCount,
//  961                             neighborLqiItem_t *pList )
//  962 {
//  963   byte *msgPtr;
//  964   byte *msg;
//  965   byte len;
//  966   byte x;
//  967   byte proVer = NLME_GetProtocolVersion();  
//  968   
//  969   /*Allocate a message of size equivalent to the corresponding SPI message
//  970   (plus a couple of bytes for MT use)so that the same buffer can be sent by
//  971   MT to the test tool by simply setting the header bytes.*/
//  972 
//  973   /*In order to allocate the message , we need to know the length and this
//  974   has to be calculated before we allocate the message*/
//  975 
//  976   len = 2 + 1 + 1 + 1 + 1 + (ZDP_NEIGHBORLQI_SIZE * ZDO_MAX_LQI_ITEMS );
//  977     //  SrcAddr + Status + NeighborLqiEntries + StartIndex + NeighborLqiCount
//  978     //     + (maximum entries * size of struct)
//  979  
//  980   msgPtr = osal_mem_alloc( len );
//  981 
//  982   if ( msgPtr )
//  983   {
//  984     msg = msgPtr;
//  985 
//  986     //Fill up the data bytes
//  987     
//  988     *msg++ = HI_UINT16( SrcAddr );
//  989     *msg++ = LO_UINT16( SrcAddr );    
//  990     *msg++ = Status;
//  991     *msg++ = NeighborLqiEntries;
//  992     *msg++ = StartIndex;
//  993     *msg++ = NeighborLqiCount;
//  994 
//  995     osal_memset( msg, 0, (ZDP_NEIGHBORLQI_SIZE * ZDO_MAX_LQI_ITEMS) );
//  996 
//  997     for ( x = 0; x < ZDO_MAX_LQI_ITEMS; x++ )
//  998     {
//  999       if ( x < NeighborLqiCount )
// 1000       {
// 1001         if ( proVer == ZB_PROT_V1_0 )
// 1002         {
// 1003           *msg++ = HI_UINT16( pList->PANId );
// 1004           *msg++ = LO_UINT16( pList->PANId );
// 1005         }
// 1006         else 
// 1007         {
// 1008           osal_cpyExtAddr(msg, pList->extPANId);
// 1009           msg += Z_EXTADDR_LEN;
// 1010         }
// 1011         *msg++ = HI_UINT16( pList->nwkAddr );
// 1012         *msg++ = LO_UINT16( pList->nwkAddr );
// 1013         *msg++ = pList->rxLqi;
// 1014         *msg++ = pList->txQuality;
// 1015         pList++;
// 1016       }
// 1017     }
// 1018 
// 1019     MT_BuildAndSendZToolCB( SPI_CB_ZDO_MGMT_LQI_RSP, len, msgPtr );
// 1020 
// 1021     osal_mem_free( msgPtr );
// 1022   }
// 1023 }
// 1024 #endif // ZDO_MGMT_LQI_REQUEST
// 1025 
// 1026 #if defined ( ZDO_MGMT_NWKDISC_REQUEST )
// 1027 /*********************************************************************
// 1028  * @fn      zdo_MTCB_MgmtNwkDiscRspCB()
// 1029  *
// 1030  * @brief
// 1031  *
// 1032  *   Called to send MT callback response for Management Network
// 1033  *   Discover response
// 1034  *
// 1035  * @param  SrcAddr  - Source address
// 1036  * @param  Status - response status
// 1037  *
// 1038  * @return  none
// 1039  */
// 1040 void zdo_MTCB_MgmtNwkDiscRspCB( uint16 SrcAddr, byte Status,
// 1041                         byte NetworkCount, byte StartIndex,
// 1042                         byte networkListCount, mgmtNwkDiscItem_t *pList )
// 1043 {
// 1044   byte *msgPtr;
// 1045   byte *msg;
// 1046   byte len;
// 1047   byte x;
// 1048   byte proVer = NLME_GetProtocolVersion();  
// 1049    
// 1050 
// 1051   /*Allocate a message of size equivalent to the corresponding SPI message
// 1052   (plus a couple of bytes for MT use)so that the same buffer can be sent by
// 1053   MT to the test tool by simply setting the header bytes.*/
// 1054 
// 1055   /*In order to allocate the message , we need to know the length and this
// 1056   has to be calculated before we allocate the message*/
// 1057   if ( proVer == ZB_PROT_V1_0 )
// 1058   {
// 1059     len = 2 + 1 + 1 + 1 + 1 + (ZDP_NETWORK_DISCRIPTOR_SIZE * ZDO_MAX_NWKDISC_ITEMS);
// 1060       //  SrcAddr + Status + NetworkCount + StartIndex + networkListCount
// 1061       //     + (maximum entries * size of struct)
// 1062   }
// 1063   else
// 1064   {
// 1065     len = 2 + 1 + 1 + 1 + 1 + (ZDP_NETWORK_EXTENDED_DISCRIPTOR_SIZE * ZDO_MAX_NWKDISC_ITEMS);
// 1066  
// 1067   }
// 1068 
// 1069   msgPtr = osal_mem_alloc( len );
// 1070 
// 1071   if ( msgPtr )
// 1072   {
// 1073     msg = msgPtr;
// 1074 
// 1075     //Fill up the data bytes
// 1076     *msg++ = HI_UINT16( SrcAddr );
// 1077     *msg++ = LO_UINT16( SrcAddr );
// 1078     *msg++ = Status;
// 1079     *msg++ = NetworkCount;
// 1080     *msg++ = StartIndex;
// 1081     *msg++ = networkListCount;
// 1082 
// 1083     osal_memset( msg, 0, (ZDP_NETWORK_DISCRIPTOR_SIZE * ZDO_MAX_NWKDISC_ITEMS) );
// 1084 
// 1085     for ( x = 0; x < ZDO_MAX_NWKDISC_ITEMS; x++ )
// 1086     {
// 1087       if ( x < networkListCount )
// 1088       {
// 1089         if ( proVer == ZB_PROT_V1_0 )
// 1090         {
// 1091           *msg++ = HI_UINT16( pList->PANId );
// 1092           *msg++ = LO_UINT16( pList->PANId );
// 1093         }
// 1094         else
// 1095         {
// 1096           osal_cpyExtAddr( msg, pList->extendedPANID );
// 1097           msg += Z_EXTADDR_LEN;
// 1098         }
// 1099         *msg++ = pList->logicalChannel;
// 1100         *msg++ = pList->stackProfile;
// 1101         *msg++ = pList->version;
// 1102         *msg++ = pList->beaconOrder;
// 1103         *msg++ = pList->superFrameOrder;
// 1104         *msg++ = pList->permitJoining;
// 1105         pList++;
// 1106       }
// 1107     }
// 1108 
// 1109     MT_BuildAndSendZToolCB( SPI_CB_ZDO_MGMT_NWKDISC_RSP, len, msgPtr );
// 1110 
// 1111     osal_mem_free( msgPtr );
// 1112   }
// 1113 }
// 1114 #endif // ZDO_MGMT_NWKDISC_REQUEST
// 1115 
// 1116 #if defined ( ZDO_MGMT_RTG_REQUEST )
// 1117 /*********************************************************************
// 1118  * @fn      zdo_MTCB_MgmtRtgRspCB()
// 1119  *
// 1120  * @brief
// 1121  *
// 1122  *   Called to send MT callback response for Management Network
// 1123  *   Discover response
// 1124  *
// 1125  * @param  SrcAddr  - Source address
// 1126  * @param  Status - response status
// 1127  *
// 1128  * @return  none
// 1129  */
// 1130 void zdo_MTCB_MgmtRtgRspCB( uint16 SrcAddr, byte Status,
// 1131                         byte RtgCount, byte StartIndex,
// 1132                         byte RtgListCount, rtgItem_t *pList )
// 1133 {
// 1134   byte *msgPtr;
// 1135   byte *msg;
// 1136   byte len;
// 1137   byte x;
// 1138 
// 1139   /*Allocate a message of size equivalent to the corresponding SPI message
// 1140   (plus a couple of bytes for MT use)so that the same buffer can be sent by
// 1141   MT to the test tool by simply setting the header bytes.*/
// 1142 
// 1143   /*In order to allocate the message , we need to know the length and this
// 1144   has to be calculated before we allocate the message*/
// 1145 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -