//***************************************************************************** void tActisenseReader::ParseMessages() { tN2kMsg N2kMsg; while (GetMessageFromStream(N2kMsg)) { if (MsgHandler!=0) MsgHandler(N2kMsg); } }
//***************************************************************************** void tNMEA0183::ParseMessages() { tNMEA0183Msg NMEA0183Msg; while (GetMessage(NMEA0183Msg)) { if (MsgHandler!=0) MsgHandler(NMEA0183Msg); } }
// This is the first stop for gui alerts where the log is updated and the // correct window is shown bool MsgAlert(bool yes_no, int Style, const char* format, ...) { // Read message and write it to the log char buffer[2048]; static const char *captions[] = { "Information", "Question", "Warning", "Critical" }; const char *caption = captions[Style]; va_list args; va_start(args, format); CharArrayFromFormatV(buffer, sizeof(buffer)-1, format, args); va_end(args); ERROR_LOG(MASTER_LOG, "%s: %s", caption, buffer); // Don't ignore questions, especially AskYesNo, PanicYesNo could be ignored if (AlertEnabled || Style == QUESTION || Style == CRITICAL) return MsgHandler(caption, buffer, yes_no, Style); return true; }
void CServer::msgProc() { TS_PEER_MESSAGE pmsg; memset(&pmsg, 0, sizeof(TS_PEER_MESSAGE)); while (isRunning()) { memset(&pmsg, 0, sizeof(TS_PEER_MESSAGE)); ReadIn(pmsg); MsgHandler(pmsg); } cout << "msg thread exit" << endl; }
void CClientNet::msgProc() { TS_PEER_MESSAGE *pmsg = new TS_PEER_MESSAGE(); memset(pmsg, 0, sizeof(TS_PEER_MESSAGE)); while (isRunning()) { memset(pmsg, 0, sizeof(TS_PEER_MESSAGE)); ReadIn(*pmsg); MsgHandler(*pmsg); } delete pmsg; }
extern void Serial_Processes(void) /******************************************************************************* * ABSTRACT: Called by main.c during idle time. Processes any waiting serial * characters coming in or going out both serial ports. * * INPUT: None * OUTPUT: None * RETURN: None */ { if (intail != inhead) // If there are incoming bytes pending { if (++intail == BUF_SIZE) intail = 0; // Advance and wrap pointer MsgHandler(inbuf[intail]); // And pass it to a handler } return; } // End Serial_Processes(void)
// 注册处理协议的函数 int CModule::registerProtocol(ServiceType srcSrvType, unsigned short protocolId, ProtocolHandler handler, CHandler* instance) { if (srcSrvType >= MaxServiceType || protocolId == MaxProtocolIDCount || handler == NULL) return InvalidParam; if (instance == NULL) instance = this; MsgHandler* msgHandler = NULL; if (protocolId < MaxProtocolIDCount) { msgHandler = &(m_protocolHanders[srcSrvType][protocolId]); } else { m_serviceProtocolHandler[protocolId] = MsgHandler(); msgHandler = &(m_serviceProtocolHandler[protocolId]); } msgHandler->instance = instance; msgHandler->handler = handler; return Success; }