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

📄 mt_zdo.s51

📁 CC2430上开关控制灯和温度传感器采集两个例子
💻 S51
📖 第 1 页 / 共 5 页
字号:
// 1146   len = 2 + 1 + 1 + 1 + 1 + (ZDP_RTG_DISCRIPTOR_SIZE * ZDO_MAX_RTG_ITEMS);
// 1147       //  SrcAddr + Status + RtgCount + StartIndex + RtgListCount
// 1148       //     + (maximum entries * size of struct)
// 1149 
// 1150   msgPtr = osal_mem_alloc( len );
// 1151 
// 1152   if ( msgPtr )
// 1153   {
// 1154     msg = msgPtr;
// 1155 
// 1156     //Fill up the data bytes
// 1157     *msg++ = HI_UINT16( SrcAddr );
// 1158     *msg++ = LO_UINT16( SrcAddr );
// 1159     *msg++ = Status;
// 1160     *msg++ = RtgCount;
// 1161     *msg++ = StartIndex;
// 1162     *msg++ = RtgListCount;
// 1163 
// 1164     osal_memset( msg, 0, (ZDP_RTG_DISCRIPTOR_SIZE * ZDO_MAX_RTG_ITEMS) );
// 1165 
// 1166     for ( x = 0; x < ZDO_MAX_RTG_ITEMS; x++ )
// 1167     {
// 1168       if ( x < RtgListCount )
// 1169       {
// 1170         *msg++ = HI_UINT16( pList->dstAddress );
// 1171         *msg++ = LO_UINT16( pList->dstAddress );
// 1172         *msg++ = HI_UINT16( pList->nextHopAddress );
// 1173         *msg++ = LO_UINT16( pList->nextHopAddress );
// 1174         *msg++ = pList->status;
// 1175         pList++;
// 1176       }
// 1177     }
// 1178 
// 1179     MT_BuildAndSendZToolCB( SPI_CB_ZDO_MGMT_RTG_RSP, len, msgPtr );
// 1180 
// 1181     osal_mem_free( msgPtr );
// 1182   }
// 1183 }
// 1184 #endif // ZDO_MGMT_RTG_REQUEST
// 1185 
// 1186 #if defined ( ZDO_MGMT_BIND_REQUEST )
// 1187 /*********************************************************************
// 1188  * @fn      zdo_MTCB_MgmtBindRspCB()
// 1189  *
// 1190  * @brief
// 1191  *
// 1192  *   Called to send MT callback response for Management Network
// 1193  *   Discover response
// 1194  *
// 1195  * @param  SrcAddr  - Source address
// 1196  * @param  Status - response status
// 1197  *
// 1198  * @return  none
// 1199  */
// 1200 void zdo_MTCB_MgmtBindRspCB( uint16 SrcAddr, byte Status,
// 1201                         byte BindCount, byte StartIndex,
// 1202                         byte BindListCount, apsBindingItem_t *pList )
// 1203 {
// 1204   byte *msgPtr;
// 1205   byte *msg;
// 1206   byte len;       
// 1207   byte x;
// 1208   uint8 protoVer = NLME_GetProtocolVersion();
// 1209   
// 1210   /*Allocate a message of size equivalent to the corresponding SPI message
// 1211   (plus a couple of bytes for MT use)so that the same buffer can be sent by
// 1212   MT to the test tool by simply setting the header bytes.*/
// 1213 
// 1214   /*In order to allocate the message , we need to know the length and this
// 1215   has to be calculated before we allocate the message*/
// 1216   
// 1217 
// 1218   // One more byte for clusterID and DstAddrMode 
// 1219   len = 2 + 1 + 1 + 1 + 1 + ( ( ZDP_BIND_DISCRIPTOR_SIZE + 1 + 1 ) * ZDO_MAX_BIND_ITEMS);
// 1220       //  SrcAddr + Status + BindCount + StartIndex + BindListCount
// 1221       //     + (maximum entries * size of struct)
// 1222 
// 1223   msgPtr = osal_mem_alloc( len );
// 1224 
// 1225   if ( msgPtr )
// 1226   {
// 1227     msg = msgPtr;
// 1228 
// 1229     //Fill up the data bytes
// 1230     *msg++ = HI_UINT16( SrcAddr );
// 1231     *msg++ = LO_UINT16( SrcAddr );
// 1232     *msg++ = Status;
// 1233     *msg++ = BindCount;
// 1234     *msg++ = StartIndex;
// 1235     *msg++ = BindListCount;
// 1236 
// 1237     osal_memset( msg, 0, ( ( ZDP_BIND_DISCRIPTOR_SIZE + 1 + 1)  * ZDO_MAX_BIND_ITEMS) );
// 1238     
// 1239     
// 1240     for ( x = 0; x < ZDO_MAX_BIND_ITEMS; x++ )
// 1241     {
// 1242       if ( x < BindListCount )
// 1243       {
// 1244         msg = zdo_MT_CopyRevExtAddr( msg, pList->srcAddr );
// 1245         *msg++ = pList->srcEP;
// 1246         
// 1247         if ( protoVer == ZB_PROT_V1_0 ) 
// 1248         {         
// 1249           *msg++ = LO_UINT16( pList->clusterID);
// 1250           msg = zdo_MT_CopyRevExtAddr( msg, pList->dstAddr.addr.extAddr );    
// 1251           *msg++ = pList->dstEP;
// 1252         }
// 1253         else
// 1254         {
// 1255           *msg++ = HI_UINT16( pList->clusterID);
// 1256           *msg++ = LO_UINT16( pList->clusterID);
// 1257           *msg++ = pList->dstAddr.addrMode;
// 1258         
// 1259           if ( pList->dstAddr.addrMode == Addr64Bit )
// 1260           {         
// 1261             msg = zdo_MT_CopyRevExtAddr( msg, pList->dstAddr.addr.extAddr );
// 1262             *msg++ = pList->dstEP;           
// 1263           }
// 1264           else
// 1265           {
// 1266             *msg++ = HI_UINT16( pList->dstAddr.addr.shortAddr );
// 1267             *msg++ = LO_UINT16( pList->dstAddr.addr.shortAddr );
// 1268             // DstEndpoint will not present if DstAddrMode is not 64-bit extAddr
// 1269           }
// 1270         }
// 1271         
// 1272         pList++;
// 1273       }
// 1274     }
// 1275 
// 1276     MT_BuildAndSendZToolCB( SPI_CB_ZDO_MGMT_BIND_RSP, len, msgPtr );
// 1277 
// 1278     osal_mem_free( msgPtr );
// 1279   }
// 1280 }
// 1281 #endif // ZDO_MGMT_RTG_REQUEST
// 1282 
// 1283 #if defined ( ZDO_MGMT_JOINDIRECT_REQUEST )
// 1284 /*********************************************************************
// 1285  * @fn      zdo_MTCB_MgmtDirectJoinRspCB()
// 1286  *
// 1287  * @brief
// 1288  *
// 1289  *   Called to send MT callback response for Management Direct Join
// 1290  *   responses
// 1291  *
// 1292  * @param  SrcAddr  - Source address
// 1293  * @param  Status - response status
// 1294  *
// 1295  * @return  none
// 1296  */
// 1297 void zdo_MTCB_MgmtDirectJoinRspCB( uint16 SrcAddr, byte Status, byte SecurityUse )
// 1298 {
// 1299   byte buf[3];
// 1300 
// 1301   buf[0] = HI_UINT16( SrcAddr );
// 1302   buf[1] = LO_UINT16( SrcAddr );
// 1303   buf[2] = Status;
// 1304 
// 1305   MT_BuildAndSendZToolCB( SPI_CB_ZDO_MGMT_DIRECT_JOIN_RSP, 3, buf );
// 1306 }
// 1307 #endif // ZDO_MGMT_JOINDIRECT_REQUEST
// 1308 
// 1309 #if defined ( ZDO_MGMT_LEAVE_REQUEST )
// 1310 /*********************************************************************
// 1311  * @fn      zdo_MTCB_MgmtLeaveRspCB()
// 1312  *
// 1313  * @brief
// 1314  *
// 1315  *   Called to send MT callback response for Management Leave
// 1316  *   responses
// 1317  *
// 1318  * @param  SrcAddr  - Source address
// 1319  * @param  Status - response status
// 1320  *
// 1321  * @return  none
// 1322  */
// 1323 void zdo_MTCB_MgmtLeaveRspCB( uint16 SrcAddr, byte Status, byte SecurityUse )
// 1324 {
// 1325   byte buf[3];
// 1326 
// 1327   buf[0] = Status;
// 1328   buf[1] = HI_UINT16( SrcAddr );
// 1329   buf[2] = LO_UINT16( SrcAddr );
// 1330 
// 1331   MT_BuildAndSendZToolCB( SPI_CB_ZDO_MGMT_LEAVE_RSP, 3, buf );
// 1332 }
// 1333 #endif // ZDO_MGMT_LEAVE_REQUEST
// 1334 
// 1335 #if defined ( ZDO_MGMT_PERMIT_JOIN_REQUEST )
// 1336 /*********************************************************************
// 1337  * @fn      zdo_MTCB_MgmtPermitJoinRspCB()
// 1338  *
// 1339  * @brief
// 1340  *
// 1341  *   Called to send MT callback response for Management Permit Join
// 1342  *   responses
// 1343  *
// 1344  * @param  SrcAddr  - Source address
// 1345  * @param  Status - response status
// 1346  *
// 1347  * @return  none
// 1348  */
// 1349 void zdo_MTCB_MgmtPermitJoinRspCB( uint16 SrcAddr, byte Status, byte SecurityUse )
// 1350 {
// 1351   byte buf[3];
// 1352 
// 1353   buf[0] = Status;
// 1354   buf[1] = HI_UINT16( SrcAddr );
// 1355   buf[2] = LO_UINT16( SrcAddr );
// 1356 
// 1357   MT_BuildAndSendZToolCB( SPI_CB_ZDO_MGMT_PERMIT_JOIN_RSP, 3, buf );
// 1358 }
// 1359 #endif // ZDO_MGMT_PERMIT_JOIN_REQUEST
// 1360 
// 1361 #if defined ( ZDO_USERDESC_REQUEST )
// 1362 #define USER_DESC_CB_LEN  22
// 1363 /*********************************************************************
// 1364  * @fn      zdo_MTCB_UserDescRspCB()
// 1365  *
// 1366  * @brief
// 1367  *
// 1368  *   Called to send MT callback response for User Descriptor
// 1369  *   responses
// 1370  *
// 1371  * @param  SrcAddr  - Source address
// 1372  * @param  Status - response status
// 1373  * @param  nwkAddrOfInterest -
// 1374  * @param  userDescLen -
// 1375  * @param  userDesc -
// 1376  * @param  SecurityUse -
// 1377  *
// 1378  * @return  none
// 1379  */
// 1380 void zdo_MTCB_UserDescRspCB( uint16 SrcAddr, byte status, uint16 nwkAddrOfInterest,
// 1381                           byte userDescLen, byte *userDesc, byte SecurityUse )
// 1382 {
// 1383   byte *msgPtr;
// 1384   byte *msg;
// 1385   msgPtr = osal_mem_alloc( USER_DESC_CB_LEN );
// 1386   osal_memset( msgPtr, 0, USER_DESC_CB_LEN );
// 1387   
// 1388   msg = msgPtr;
// 1389   *msg++ = status;
// 1390   *msg++ = HI_UINT16( SrcAddr );
// 1391   *msg++ = LO_UINT16( SrcAddr );
// 1392   *msg++ = HI_UINT16( nwkAddrOfInterest );
// 1393   *msg++ = LO_UINT16( nwkAddrOfInterest );
// 1394   *msg++ = userDescLen;
// 1395   osal_memcpy( msg, userDesc, userDescLen ); 
// 1396   MT_BuildAndSendZToolCB( SPI_CB_ZDO_USER_DESC_RSP, USER_DESC_CB_LEN, msgPtr );
// 1397   
// 1398   osal_mem_free( msgPtr );
// 1399 }
// 1400 #endif // ZDO_USERDESC_REQUEST
// 1401 
// 1402 #if defined ( ZDO_USERDESCSET_REQUEST )
// 1403 /*********************************************************************
// 1404  * @fn      zdo_MTCB_UserDescConfCB()
// 1405  *
// 1406  * @brief
// 1407  *
// 1408  *   Called to send MT callback response for User Descriptor
// 1409  *   confirm
// 1410  *
// 1411  * @param  SrcAddr  - Source address
// 1412  * @param  Status - response status
// 1413  * @param  SecurityUse -
// 1414  *
// 1415  * @return  none
// 1416  */
// 1417 void zdo_MTCB_UserDescConfCB( uint16 SrcAddr, byte status, byte SecurityUse )
// 1418 {
// 1419   byte buf[3];
// 1420 
// 1421   buf[0] = status;
// 1422   buf[1] = HI_UINT16( SrcAddr );
// 1423   buf[2] = LO_UINT16( SrcAddr );
// 1424 
// 1425   MT_BuildAndSendZToolCB( SPI_CB_ZDO_USER_DESC_CNF, 3, buf );
// 1426 }
// 1427 #endif // ZDO_USERDESCSET_REQUEST
// 1428 
// 1429 #if defined ( ZDO_SERVERDISC_REQUEST )
// 1430 /*********************************************************************
// 1431  * @fn     zdo_MTCB_ServerDiscRspCB()
// 1432  *
// 1433  * @brief  Called to send MT callback response for Server_Discovery_rsp responses.
// 1434  *
// 1435  * @param  srcAddr - Source address.
// 1436  * @param  status - Response status.
// 1437  * @param  aoi - Network Address of Interest.
// 1438  * @param  serverMask - Bit mask of services that match request.
// 1439  * @param  SecurityUse -
// 1440  *
// 1441  * @return  none
// 1442  */
// 1443 void zdo_MTCB_ServerDiscRspCB( uint16 srcAddr, byte status, 
// 1444                                uint16 serverMask, byte SecurityUse )
// 1445 {
// 1446   byte buf[5];
// 1447   byte *pBuf = buf;
// 1448 
// 1449   *pBuf++ = status;
// 1450   *pBuf++ = HI_UINT16( srcAddr );
// 1451   *pBuf++ = LO_UINT16( srcAddr );
// 1452   *pBuf++ = HI_UINT16( serverMask );
// 1453   *pBuf++ = LO_UINT16( serverMask );
// 1454 
// 1455   MT_BuildAndSendZToolCB( SPI_CB_ZDO_SERVERDISC_RSP, 5, buf );
// 1456 #define CB_ID_ZDO_SERVERDISC_RSP             0x00080000
// 1457 }
// 1458 #endif
// 1459 
// 1460 /*********************************************************************
// 1461 *********************************************************************/
// 1462 
// 1463 #endif   /*ZDO Command Processing in MT*/
// 
// 
// 0 bytes of memory
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

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