增加了通信协议解析的功能

This commit is contained in:
zjk
2024-11-19 09:58:31 +08:00
parent 590662d7a5
commit 4693ce2619
15 changed files with 924 additions and 169 deletions
+8 -6
View File
@@ -181,6 +181,7 @@ bool PowerManger::ListenLoopCCU()
{
unsigned char Buff[MAX_UDP_PKT_SIZE];
cout << "------------------" << endl;
cout << "SIZEOF" << sizeof(msg_CcuStateFbMsg) << endl;
while(!m_ListenThread.IsQuitRequested())
{
int nRead = m_pCcuUdpComm->iRecieveMessage(Buff,sizeof(Buff));
@@ -201,16 +202,17 @@ bool PowerManger::ListenLoopCCU()
//处理消息
switch (id)
{
case 0x0051: //CCU_STATE_FB 0x0051
case CCU_STATE_FB_ID: //CCU_STATE_FB 0x0051
msg_CcuStateFbMsg s;
if(m_udpComm.getCcuState((char *)Buff,s))
{
cout << "------------------" << endl;
cout << "id:" << s.header.id << endl;
// cout << "id:" << s.header.id << endl;
cout << "currentWorkCondition:" << (double)s.currentWorkCondition << endl;
cout << "fcuState:" << s.fcuState << endl;
cout << "fcuFaultLeve:" << s.fcuFaultLeve << endl;
cout << "powerLimit:" << s.powerLimit << endl;
cout << "fcuState:" << (double)s.fcuState << endl;
cout << "fcuFaultLeve:" << (double)s.fcuFaultLeve << endl;
cout << "powerLimit:" << (double)s.powerLimit << endl;
cout << "checkCode:" << (double)s.checkCode << endl;
}
else
{
@@ -219,7 +221,7 @@ bool PowerManger::ListenLoopCCU()
m_udpComm.sError.clear();
}
break;
case 0x0040: //CCU_SET_PARM_FB 0x0040
case CCU_SET_PARM_FB_ID: //CCU_SET_PARM_FB 0x0040
msg_CcuSetParmFbMsg p;
if(m_udpComm.getCcuSetParmFb((char *)Buff,p))
{