mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
实现MQTT功能, 修改HTTP接口
This commit is contained in:
@@ -5,6 +5,87 @@
|
||||
#include "common/Fields.h"
|
||||
|
||||
class Device;
|
||||
class MqttClient;
|
||||
|
||||
struct TempHumUnit
|
||||
{
|
||||
int temp {0};
|
||||
int hum {0};
|
||||
TempHumUnit(int temp, int hum) : temp(temp), hum(hum) {};
|
||||
TempHumUnit() {}
|
||||
};
|
||||
|
||||
struct Fire40Unit
|
||||
{
|
||||
//主控数量 R uint16 1 0x0002
|
||||
//主控ID R uint16 1 0x0003
|
||||
//主控状态 R uint16 0:正常 1:预警 2:火警 0x0004
|
||||
//主控硬件版本 R uint16[2] 主控硬件版本 0x0005~0x0006
|
||||
//主控软件版本 R uint16[2] 主控软件版本 0x0007~0x0008
|
||||
//主电状态 R uint16 0:使用市电 1:使用备电 0x0009
|
||||
//备电电流 R uint32 0.1A 0x000A
|
||||
//备电电压 R uint32 0.1V 0x000C
|
||||
//可用容量 R uint32 0.01Ah 0x000E
|
||||
//可充放容量 R uint32 0.01Ah 0x0010
|
||||
//警铃是否使用 R uint16 0x0012
|
||||
//警铃状态 R uint16 0:无效 1:掉线 2:正常 3:启动 0x0013
|
||||
//瓶头阀是否使用 R uint16 0x0014
|
||||
//瓶头阀状态 R uint16 0:无效 1:掉线 2:正常 3:启动 0x0015
|
||||
//手报是否使用 R uint16 0x0016
|
||||
//手报状态 R uint16 0:无效 1:掉线 2:正常 3:启动 0x0017
|
||||
//簇控制器数量 R uint16 0x0018
|
||||
//复合探测器总数量 R uint16 0x0019
|
||||
//烟雾探测器总数量 R uint16 0x001A
|
||||
//压力探测器总数量 R uint16 0x001B
|
||||
//吸气式探测器总数量 R uint16 0x001C
|
||||
//PACK探测器总数量 R uint16 0x001D
|
||||
//电池总数量 R uint16 0x001E
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct CoolingUnit
|
||||
{
|
||||
int powerOn {0}; //开关 R uint16 0:关机,1:开机 0x1003
|
||||
int mode {0}; //采样模式 R uint16 0-出水温度 1-电芯温度 0x1004
|
||||
int cooling {0}; //制冷状态 R uint16 0:关闭, 1:启动 0x1005
|
||||
int heating {0}; //制热状态 R uint16 0:关闭, 1:启动 0x1006
|
||||
int highTemp {0}; //高温告警 R uint16 0:正常,1:告警 0x1007
|
||||
int lowTemp {0}; //低温告警 R uint16 0:正常,1:告警 0x1008
|
||||
int highPressure {0}; //高压告警 R uint16 0:正常,1:告警 0x1009
|
||||
int lowPressure {0}; //低压告警 R uint16 0:正常,1:告警 0x100A
|
||||
//进水温度传感器 R uint16 0:正常,1:告警 0x100B
|
||||
//出水温度传感器 R uint16 0:正常,1:告警 0x100C
|
||||
//进水压力传感器 R uint16 0:正常,1:告警 0x100D
|
||||
//出水压力传感器 R uint16 0:正常,1:告警 0x100E
|
||||
};
|
||||
|
||||
struct AircUnit
|
||||
{
|
||||
int powerOn {0}; //开关 R uint16 0:关机,1:开机
|
||||
int cooling {0}; //启动制冷指令 R uint16 0:关闭, 1:启动
|
||||
int airSupply {0}; //启动送风指令 R uint16 0:关闭, 1:启动
|
||||
int standby {0}; //启动待机指令 R uint16 0:关闭, 1:启动
|
||||
int heating {0}; //启动加热指令 R uint16 0:关闭, 1:启动
|
||||
int sensorAlarm {0}; //传感器故障 R uint16 0:正常,1:告警
|
||||
int voltageAlarm {0}; //高低电压告警 R uint16 0:正常,1:告警
|
||||
int tempAlarm {0}; //高低温告警 R uint16 0:正常,1:告警
|
||||
int pressureAlarm {0}; //高低压告警 R uint16 0:正常,1:告警
|
||||
int compressorAlarm {0};//压缩机告警 R uint16 0:正常,1:告警
|
||||
|
||||
//制冷点 R int16 0.1℃ 0x0003
|
||||
//制冷偏差 R int16 0.1℃ 0x0004
|
||||
//高温告警值 R int16 0.1℃ 0x0005
|
||||
//低温告警值 R int16 0.1℃ 0x0006
|
||||
//制热点 R int16 0.1℃ 0x0007
|
||||
//制热偏差 R int16 0.1℃ 0x0008
|
||||
int temp {0}; //当前温度 R int16 0.1℃ 0x0009
|
||||
int hum {0}; //当前湿度 R int16 0.1℃ 0x000A
|
||||
//除湿开启温度 R int16 0.1℃ 0x000B
|
||||
//除湿停止温度 R int16 0.1℃ 0x000C
|
||||
//除湿开启湿度 R int16 0.1℃ 0x000D
|
||||
//除湿停止湿度 R int16 0.1℃ 0x000E
|
||||
};
|
||||
|
||||
class Station
|
||||
{
|
||||
@@ -28,6 +109,7 @@ public:
|
||||
public:
|
||||
int id {};
|
||||
std::string name;
|
||||
std::string code;
|
||||
bool isConnected {false};
|
||||
|
||||
int workModeId {}; // 运行模式
|
||||
@@ -89,4 +171,17 @@ public:
|
||||
std::unordered_map<int, std::shared_ptr<Device>> mapDevice;
|
||||
|
||||
std::map<std::string, int> mapDeviceGroupNum;
|
||||
|
||||
// 温湿度信息
|
||||
std::map<int, TempHumUnit> mapTempHumUnit;
|
||||
// 消防4.0信息
|
||||
std::map<int, int> mapFire40Unit;
|
||||
// 冷机信息
|
||||
std::map<int, CoolingUnit> mapCoolingUnit;
|
||||
// 空调信息
|
||||
std::map<int, AircUnit> mapAircUnit;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// === MQTT client
|
||||
std::shared_ptr<MqttClient> mqttCli {nullptr};
|
||||
};
|
||||
Reference in New Issue
Block a user