Hi,
Time synchronization has been discussed for proprietary physical layer in this page, but it seems more challenging in 15.4 stack with FH enabled.
My plan is to piggy back on MAC data poll. Upon receiving data poll indication, collector sends out some sort of instruction to tell the current time on collector. In theory this should work. The part I am not sure are:
1) What if there are asynchronous data request pending? Will collector push the time synchronization instruction to queue?
2) Is the pollIndCB() and processDataRetry() in collector example code right place to add time synchronization instruction?
Thanks in advance.
ZL
/*! * @brief Process the MAC Poll Indication Callback * * @param pPollInd - poll indication */ static void pollIndCB(ApiMac_mlmePollInd_t *pPollInd) { ApiMac_sAddr_t addr; addr.addrMode = ApiMac_addrType_short; if (pPollInd->srcAddr.addrMode == ApiMac_addrType_short) { addr.addr.shortAddr = pPollInd->srcAddr.addr.shortAddr; } else { addr.addr.shortAddr = Csf_getDeviceShort( &pPollInd->srcAddr.addr.extAddr); } processDataRetry(&addr); } /*! * @brief Process retries for config and tracking messages * * @param addr - MAC address structure */ static void processDataRetry(ApiMac_sAddr_t *pAddr) { if(pAddr->addr.shortAddr != CSF_INVALID_SHORT_ADDR) { Cllc_associated_devices_t *pItem; pItem = findDevice(pAddr); if(pItem) { /* Set device status to alive */ pItem->status |= CLLC_ASSOC_STATUS_ALIVE; /* Check to see if we need to send it a config */ if((pItem->status & (ASSOC_CONFIG_RSP | ASSOC_CONFIG_SENT)) == 0) { processConfigRetry(); } /* Check to see if we need to send it a tracking message */ if((pItem->status & (ASSOC_TRACKING_SENT| ASSOC_TRACKING_RETRY)) == 0) { /* Make sure we aren't already doing a tracking message */ if(((Collector_events & COLLECTOR_TRACKING_TIMEOUT_EVT) == 0) && (Csf_isTrackingTimerActive() == false) && (findDeviceStatusBit(ASSOC_TRACKING_MASK, ASSOC_TRACKING_SENT) == NULL)) { /* Setup for next tracking */ Csf_setTrackingClock(TRACKING_DELAY_TIME); } }
// Add data request for time synchronization here?
} } }