优化udp通信代码,增加配电系统通信解析,增加能源系统状态定义

This commit is contained in:
zjk
2024-11-20 18:38:45 +08:00
parent 4693ce2619
commit eb2877f03f
9 changed files with 1123 additions and 153 deletions
+21 -12
View File
@@ -19,22 +19,25 @@
#define PowerManger_HEADER
#define UNIX
#include <queue>
#include "MOOS/libMOOS/Thirdparty/AppCasting/AppCastingMOOSApp.h"
#include "MOOS/libMOOS/Utils/MOOSThread.h"
#include "MOOS/libMOOS/Comms/XPCUdpSocket.h"
#include "ccuUdpMsg.h"
#include "json/json.h"
#include "udpComm.h"
#include "pmSysvariable.h"
#define IPORT 5000
#define MAX_UDP_PKT_SIZE 65535
class PowerManger : public AppCastingMOOSApp
{
public:
PowerManger();
~PowerManger();
public:
bool ListenLoopCCU();
bool ListenLoopUDP();
protected: // Standard MOOSApp functions to overload
bool OnNewMail(MOOSMSG_LIST &NewMail);
@@ -47,24 +50,30 @@ class PowerManger : public AppCastingMOOSApp
protected: // app function
// bool _ListenCB();
XPCUdpSocket* setUdpScoket(long lPort);
//
bool buildStateReport();
bool updatePmState();
bool buildEquipmentReport();
bool buildDisributionReport();
bool buildSubDistributionReport();
bool buildPredictionReport();
bool buildPredictionReport();
protected: // app variables
long m_lPort;
unsigned int m_nReceiveBufferSizeKB;
unsigned int m_nSendBufferSizeKB;
udpComm m_udpComm;
XPCUdpSocket *m_pCcuUdpComm;
pmState m_pmCurrentState;
msg_CcuStateFbMsg m_CcuCurrentState;
msg_disHighVolBusFbMsg m_disHighVolBusCurrentState;
msg_disHighAVolBusFbMsg m_disHighAVolBusCurrentState;
msg_disHighBVolBusFbMsg m_disHighBVolBusCurrentState;
msg_disLowBusFbMsg m_disLowBusState;
private: // Configuration variables
CMOOSThread m_ListenThread;
udpComm m_udpComm;
XPCUdpSocket *m_pCcuUdpComm;
CMOOSThread m_ListenThread;
long m_lPort;
unsigned int m_nReceiveBufferSizeKB;
unsigned int m_nSendBufferSizeKB;
// CMOOSThread m_SendThread;
private: // State variables
};