65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
/************************************************************/
|
|
/* NAME: */
|
|
/* ORGN: MIT */
|
|
/* FILE: PMtest.h */
|
|
/* DATE: */
|
|
/************************************************************/
|
|
|
|
#ifndef PMtest_HEADER
|
|
#define PMtest_HEADER
|
|
|
|
#include "MOOS/libMOOS/MOOSLib.h"
|
|
#include "json/json.h"
|
|
#include "string"
|
|
using namespace std;
|
|
//能源管理反馈的消息
|
|
#define PM_TO_DB_STATE "uPower_pmState_st"
|
|
#define PM_TO_DB_CURRENTSTATE "uPower_currentState_st"
|
|
#define PM_TO_DB_DISSTATE "uPower_disSysState_st"
|
|
#define PM_TO_DB_LIBATSTATE "uPower_liBatState_st"
|
|
#define PM_TO_DB_FCSSTATE "uPower_fcsState_st"
|
|
|
|
#define PM_TO_DB_SUBDISSTATE "uPower_secdistState_cmd"
|
|
#define PM_TO_DB_EQUIPMENTSTATE "uPower_equState_fb"
|
|
|
|
//控制消息
|
|
#define DB_TO_PM_MSCMD "uPower_sysState_cmd"
|
|
#define DB_TO_PM_EQUIPMENTCMD "uPower_equState_cmd"
|
|
#define DB_TO_PM_SUBDISSTATE "uDevice_secdistState_st"
|
|
|
|
//决策消息
|
|
#define DB_TO_PM_DEEPTH "uDevice_depth_st"
|
|
#define DB_TO_PM_MISSION "uPlan_taskStart_cmd"
|
|
#define DB_TO_PM_TASKSTOP "uPlan_planStop_st"
|
|
|
|
//外部通信消息
|
|
#define DB_TO_PM_SETOPCONDITION "uExternComm_setOpCondition_cmd"
|
|
#define DB_TO_PM_SETOPMODE "uExternComm_setOpMode_cmd"
|
|
#define DB_TO_PM_SETPMSYS "uExternComm_setPowerSystem_cmd"
|
|
#define DB_TO_PM_SETDEVSWITCH "uExternComm_setDeviceSwitch_cmd"
|
|
|
|
class PMtest : public CMOOSApp
|
|
{
|
|
public:
|
|
PMtest();
|
|
~PMtest();
|
|
|
|
protected: // Standard MOOSApp functions to overload
|
|
bool OnNewMail(MOOSMSG_LIST &NewMail);
|
|
bool Iterate();
|
|
bool OnConnectToServer();
|
|
bool OnStartUp();
|
|
protected:
|
|
void RegisterVariables();
|
|
void handleDBToPMMsgs();
|
|
int snedFlag;
|
|
|
|
private: // Configuration variables
|
|
|
|
private: // State variables
|
|
// 从文件中读取json内容
|
|
bool readJsonFromFile(string file, string& content);
|
|
};
|
|
|
|
#endif
|