#ifndef DEVICEMANAGER_H #define DEVICEMANAGER_H #include #include #include #include #include "common/Singletonwork/singletonwork.h" //MQTT链接超时设置 #define MQTT_CONNECT_TIMEOUT 30000 // mqtt webapi的topic #define MQTTWEBNAME "LH_WEBINFO" //服务类型本地显示 #define APPTYPE "LH_EQM_ANALYSE" //数据库操作类型定义 #define DBDOTYPE_SELECT 1 #define DBDOTYPE_UPDATE 2 #define DBDOTYPE_DELETE 3 #define DBDOTYPE_INSERT 4 #define DBDOTYPE_PROCEDURE 5 #define TRANSMITTER_PT_CODE_1 955 #define TRANSMITTER_PT_CODE_2 960 #define TZ_PT_CODE_1 961 #define TZ_PT_CODE_2 963 #define ANT_PT_CODE_1 984 #define ANT_PT_CODE_2 985 struct tMPinData { int nMPID; int nDeviceID; int nFlags; int nChnID; QString strMPName; QString strDevName; QString strMaddress; tMPinData() { nMPID = 0; nDeviceID = 0; nFlags = -1; } }; Q_DECLARE_METATYPE(tMPinData); struct tDeviceData { //同轴设备 int nChnID; int nMPID; int nDeviceID; QString strChnName; QString strMPName; QString strDevName; QString strMaddress; //发射机设备 tMPinData hostTransData; tMPinData backTransData; tMPinData emergencyTransData; tDeviceData() { nChnID = 0; nMPID = 0; nDeviceID = 0; } }; Q_DECLARE_METATYPE(tDeviceData); struct tTZConfig { int mpid = 0; //同轴监测点MPID bool enable = true; //是否启用监测 bool enablemutilchannel = false;//启用多频率 没有为false QString address; //同轴设备地址 int port = 0; //同轴设备端口 int slaveid = 1; //同轴设备机器码,全部设为1即可 int hosttransmpid = 0; //同轴关联主发射机MPID int backtransmpid = 0; //同轴关联备发射机MPID int emergencympid = 0; //同轴关联应急发射机MPID,没有为0 int powerofftime = 2; //发射机关机延时 QString strhosttransName; QString strbacktransName; QString stremergencyName; bool isValid() { return (mpid == 0); } }; class DeviceManager : public QObject { Q_OBJECT public: explicit DeviceManager(QObject *parent = nullptr); bool DoLoadTranPin(); bool DoLoadDeviceData(); bool DoLoadServiceConfig(int nServiceID); bool DoSaveServiceConfig(int nServiceID); void GetDeviceConfig(int nMPID, tTZConfig& config); void SetDeviceConfig(int nMPID, tTZConfig& config); void GetMonitorByID(int nMPID, tMPinData& pin); public: //发射机设备列表 QList m_transDataList; //同轴设备列表 QList m_deviceDataList; //发射机采集服务ip QString m_transServerIP; //发射机采集服务port int m_transServerPort = 0; //同轴监测设备列表 QList m_tzConfigList; }; #endif // DEVICEMANAGER_H