116 lines
2.6 KiB
C++
116 lines
2.6 KiB
C++
|
|
/**********************************************************************************
|
|
* @file CApcIfSrv.h
|
|
* @brief 功率控制接口服务,服务框架
|
|
* @author yikenan
|
|
* @versiong 1.0
|
|
* @date
|
|
**********************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
#include "pub_utility_api/BaseService.h"
|
|
#include "sys_proc_mng_api/ProcMngInterface.h"
|
|
#include "alarm_server_api/CAlmApiForApp.h"
|
|
|
|
#include "CApcIfRedunSw.h"
|
|
|
|
namespace kbd_application
|
|
{
|
|
|
|
class CApcIfSrv :
|
|
public iot_public::CBaseService,
|
|
iot_sys::CProcessQuitInterface
|
|
{
|
|
public:
|
|
class GC
|
|
{
|
|
public:
|
|
GC();
|
|
|
|
virtual ~GC();
|
|
};
|
|
|
|
public:
|
|
static CApcIfSrv &getInstance();
|
|
|
|
virtual ~CApcIfSrv();
|
|
|
|
//< 见父类CBaseService说明
|
|
bool start(int argc, char *argv[], int &nStatus) override;
|
|
|
|
//< 见父类CBaseService说明
|
|
bool stop() override;
|
|
|
|
//< 见父类CProcessQuitInterface说明
|
|
int toQuit() override;
|
|
|
|
//< 设置进程状态
|
|
int updateProcInfo(bool bActive, bool bMaster, bool bSlave);
|
|
|
|
//< 获取域ID
|
|
int getDomainID() const;
|
|
|
|
//< 获取应用ID
|
|
int getAppID() const;
|
|
|
|
//< 获取位置ID
|
|
int getLocationID() const;
|
|
|
|
//< 获取应用名
|
|
const std::string &getAppName() const;
|
|
|
|
//< 获取节点名
|
|
const std::string &getNodeName() const;
|
|
|
|
//< 获取测点无效状态字
|
|
unsigned int getInvalidStatus_AI() const;
|
|
|
|
unsigned int getInvalidStatus_DI() const;
|
|
|
|
//< 添加报警
|
|
bool addAlarm(iot_idl::SAppAddAlm &objAlarm);
|
|
|
|
|
|
private:
|
|
CApcIfSrv(); //< 单例
|
|
|
|
bool isAlreadyRunning();
|
|
|
|
bool parseCommandLine(int argc, char *argv[]);
|
|
|
|
bool loadSysInfo();
|
|
|
|
//< 初始化测点无效状态字
|
|
bool initPntStatus();
|
|
|
|
enum enRunModel
|
|
{
|
|
RM_NORMAL = 0, //< 正常模式
|
|
RM_NO_PROC_MNG_MASTER, //< 不注册进程管理、冗余管理,主机模式
|
|
RM_NO_PROC_MNG_SLAVE, //< 不注册进程管理、冗余管理,备机模式
|
|
};
|
|
|
|
private:
|
|
enRunModel m_enRunModel;
|
|
|
|
int m_nDomainID; //< 本域ID
|
|
int m_nAppID; //< 应用ID
|
|
int m_nLocationID; //< 位置ID
|
|
|
|
//< 测点无效状态字
|
|
unsigned int m_nInvalidStatus_AI;
|
|
unsigned int m_nInvalidStatus_DI;
|
|
|
|
std::string m_strAppName; //< 应用名
|
|
std::string m_strNodeName; //< 本机节点名
|
|
|
|
CApcIfRedunSwPtr m_ptrRedunSw;
|
|
iot_sys::CProcMngInterfacePtr m_ptrProcMng;
|
|
iot_sys::CRedundantMngInterfacePtr m_ptrRedundantMng;
|
|
|
|
iot_service::CAlmApiForAppPtr m_ptrAlmApi; //< 报警服务接口
|
|
};
|
|
|
|
} //< namespace kbd_application
|