重构了与DB的交互逻辑,以及与任务\上位机指令的消息,使用新的loguru库进行日志管理
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
/************************************************************/
|
||||
/* 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"
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user