For xenomatix, about the 5G modem:
Chrome
- 192.168.1.1
- admin
- password
Applying message service in CTrack
First I turned back the modifs made to GetReceivePackage, these were made to handle warnings, but will be replaced by the message based communication
At this moment the proposal for implementation is
- keep the MessageRouter class as interface
- Derive CCommunicationInterface from it
- Do the check and execute of responders in CCommunicationInterface::GetReceivePackage
- Check if the is really needed in GetReceivePackage, I hope not, the only place the code is used is in DeviceiGPS, so yes, it can be removed
The main incoming point of communication for both UI and engine is CStateManager::TcpReceiveRespond :
void CStateManager::TCPReceiveRespond()
{
std::unique_ptr<CTCPGram> Telegram;
bool bAvailable = m_TCP.GetReceivePackage(Telegram);
while (bAvailable)
{
unsigned short Code = Telegram->GetCode();
switch (Code)
{
case TCPGRAM_CODE_STRING:
{
std::string ReceivedString;
if (Telegram->GetString(ReceivedString))
PrintInfo(ReceivedString);
else
PrintError("Error receiving string");
};
break;
case TCPGRAM_CODE_DOUBLES:
{
CConfiguration *pConfiguration = GetConfigurationLive();
if (pConfiguration)
pConfiguration->LiveReceive(Telegram);
};
break;
case TCPGRAM_CODE_COMMAND:
{
std::unique_ptr<TiXmlElement> XML = Telegram->GetXML();
CNode *pNode = GetNodeFactory()->CreateNodeFromXML(XML.get(), true);
if (pNode)
{
CommandExecute(pNode);
}
else
PrintError("Failed converting the node from XML");
};
break;
case TCPGRAM_CODE_STATUS: // state changing is only allowed by the server, so normally we do not receive states here
{
std::unique_ptr<TiXmlElement> XML = Telegram->GetXML();
assert(XML.get() != NULL);
CString StateName = StripName(XML->Value());
StateUpdate(StateName, XML);
if (m_bTCPServer) // reflect our state change immediate if we are server, probably a client is resetting an error state
TCPSendStatus(true);
};
break;
}
// next message
bAvailable = m_TCP.GetReceivePackage(Telegram);
}
}
orange needs to go
So we only keep the data coming in
Responders will be handled inside GetReceivepackage
The first one to test is a message with ID "warning"