void SyncClientChannel::OnTimeout() { SyncSequenceKeeper::QueueType timeout_queue = sequence_keeper_.Timeout(); if (timeout_queue.size()) { LOG_DEBUG(logger, "SyncClientChannel::Break, info:" << GetDiagnositicInfo()); BreakChannel(); } ProtocolMessage* message = timeout_queue.front(); while (message) { timeout_queue.pop_front(); MI_LOG_DEBUG(logger, "SyncClientChannel::OnTimeout, message:"); DoSendBack(message, ProtocolMessage::kStatusTimeout); message = timeout_queue.front(); } StartTimeoutTimer(); }
/** * @fn unsigned char PortEventHandler(const void * params) * * @brief This function is an extension of GPIO Port ISR. * * @param params a constant void pointer * * @return an unsigned character */ unsigned char PortEventHandler(const void * params) { // Get event parameters. EventParameters * p = (EventParameters *) params; if (p->event & __BSP_PUSHBUTTON1_EVENT) { PushButtonEventHandler(__BSP_PUSHBUTTON1, __BSP_CONFIG_PUSHBUTTON_MINIMUM_CLICK_TIME); } if (p->event & __BSP_RADIO1_GDO0_EVENT) { volatile unsigned char tempVar = 0; if(__BSP_RADIO1_GDO0_EVENT & __BSP_RADIO1_GDO0_EDGE_SELECT) // End of Packet { if(pCurrentFrameworkRadio(&appRadio[RadioLocal.currentRadio])->radioState == RADIO_TRANSMIT){ RadioLocal.FrameState = FRAME_SENT; // Update frame state //GDO0 asserted slightly before RF transmission ends, so add a little delay for(tempVar=0;tempVar<200;tempVar++){ __no_operation(); } } else if(pCurrentFrameworkRadio(&appRadio[RadioLocal.currentRadio])->radioState == RADIO_RECEIVE){ RadioLocal.FrameState = FRAME_RECEIVED; // Update frame state TimerCCRDisableInterrupt(__BSP_TIMER1, __BSP_TIMER1_CCR1); } pCurrentFrameworkRadio(&appRadio[RadioLocal.currentRadio])->radioState = RADIO_CALIBRATED; } else // SyncWord sent/received { RadioSetInterruptEdge(pCurrentFrameworkRadio(&appRadio[RadioLocal.currentRadio]), __BSP_RADIO1_INTERRUPT1, 1); RadioLocal.FrameState = WAITING_FOR_EOP; // Update frame state StartTimeoutTimer(EOP_TIMEOUT); // Load timer with timeout value. The radio should be placed in a low-power state if frame timeout occurs. } } return EVENT_WAKE_UP; }