每隔一段時間發送封包
void zb_HandleOsalEvent( uint16 event )
{
osal_start_timerEx( sapi_TaskID, PERIODIC_EVT, 1000 );
if( event & PERIODIC_EVT )
{
#if defined ( LOCATION_BLINDNODE )
{
static uint8 transId;
uint8 actionId = SAMPLE_APP_TOGGLE;
afAddrType_t dstAddr;
dstAddr.addrMode = afAddrBroadcast;
dstAddr.addr.shortAddr = NWK_BROADCAST_SHORTADDR_DEVALL;
dstAddr.endPoint = SAMPLE_APP_ENDPOINT;
// Control all lights within 1-hop radio range.
(void)AF_DataRequest( &dstAddr, (endPointDesc_t *)&SampleApp_epDesc,
SAMPLE_APP_ON_OFF_ID, 1, &actionId,
&transId, AF_SKIP_ROUTING, 1 );
BlindNode_FindRequest();
}
#endif
osal_start_timerEx( sapi_TaskID, PERIODIC_EVT, 1000 );
event =(event ^ PERIODIC_EVT);
}
}
-----------------------------------------------------------------------------------------------
想請問這段程式應該每秒都會傳送 AF_DataRequest 內的參數 ,可是實驗起來動作卻不如預期,想請問是因為HandleOsalEvent內不能使用還是其他原因?