2024-04-15 10:08:28 +08:00
|
|
|
|
#pragma once
|
2024-03-19 17:45:12 +08:00
|
|
|
|
#include "BaseClient.h"
|
|
|
|
|
//#include "../config/ConfigManager.h"
|
|
|
|
|
#include <map>
|
|
|
|
|
#include "../config/bean/ExtCfg.h"
|
2024-04-15 10:08:28 +08:00
|
|
|
|
|
|
|
|
|
#pragma pack(1)
|
2024-03-19 17:45:12 +08:00
|
|
|
|
class Oxygenstat
|
|
|
|
|
{
|
|
|
|
|
public:
|
2024-04-15 10:08:28 +08:00
|
|
|
|
explicit Oxygenstat()
|
|
|
|
|
: concentrationValue(new FloatData("concentrationValue",u8"浓度值"))
|
|
|
|
|
, valueUnit(new StrData("valueUnit",u8"浓度单位"))
|
|
|
|
|
, scale(new IntData("scale",u8"数值放大倍数"))
|
|
|
|
|
, tempValue(new FloatData("tempValue",u8"温度值"))
|
|
|
|
|
, humidityValue(new FloatData("humidityValue",u8"湿度值"))
|
|
|
|
|
, concentrationAgValue(new FloatData("concentrationAgValue",u8"模拟量"))
|
|
|
|
|
{
|
|
|
|
|
//concentrationValue = 0.0f;
|
|
|
|
|
//valueUnit = "";
|
|
|
|
|
//scale = 1;
|
|
|
|
|
//tempValue = 0.0f;
|
|
|
|
|
//humidityValue = 0.0f;
|
|
|
|
|
//concentrationAgValue = 0.0f;
|
2024-03-19 17:45:12 +08:00
|
|
|
|
}
|
|
|
|
|
public:
|
|
|
|
|
BaseStat baseStat;
|
2024-04-15 10:08:28 +08:00
|
|
|
|
|
|
|
|
|
char m_startFlag;
|
|
|
|
|
FloatData* concentrationValue; //浓度值
|
|
|
|
|
StrData* valueUnit; //浓度单位
|
|
|
|
|
IntData* scale; //数值放大倍数
|
|
|
|
|
FloatData* tempValue; //温度值
|
|
|
|
|
FloatData* humidityValue; //湿度值
|
|
|
|
|
FloatData* concentrationAgValue; //模拟量
|
|
|
|
|
char m_endFlag;
|
2024-03-19 17:45:12 +08:00
|
|
|
|
};
|
2024-04-15 10:08:28 +08:00
|
|
|
|
#pragma pack()
|
2024-03-19 17:45:12 +08:00
|
|
|
|
|
|
|
|
|
class OxygenClient :public TcpClient
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
OxygenClient(CommunicationCfg* pconfig);
|
|
|
|
|
~OxygenClient();
|
|
|
|
|
void GetOxygenStat(unsigned char addr, Oxygenstat& stat);
|
|
|
|
|
void GetOxygenStat(Oxygenstat& stat1, Oxygenstat& stat2, Oxygenstat& stat3);
|
|
|
|
|
void InitCommand();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void ServerDisconnectProc();
|
|
|
|
|
virtual void WriteSuccessProc(int wlength, unsigned char* buffer, Command* pcommand);
|
|
|
|
|
virtual void WriteTimeoutProc(Command* pcommand);
|
|
|
|
|
virtual void ReadTimeoutProc(Command* pcommand);
|
|
|
|
|
virtual void ReadSuccessProc(int rlength, unsigned char* buffer, Command* pcommand);
|
|
|
|
|
|
2024-04-15 10:08:28 +08:00
|
|
|
|
void AddToBaseMp(int i, Oxygenstat* stat);
|
2024-03-19 17:45:12 +08:00
|
|
|
|
private:
|
|
|
|
|
void static PorcOxygenValue(void* pobject, Command* pcommand);
|
|
|
|
|
void static ProcPointInfo(void* pobject, Command* pcommand);
|
|
|
|
|
void static PorcConcentrationValue(void* pobject, Command* pcommand);
|
|
|
|
|
void static ProcTempInfo(void* pobject, Command* pcommand);
|
|
|
|
|
void static ProcNewVersion(void* pobject, Command* pcommand);
|
|
|
|
|
private:
|
|
|
|
|
map<unsigned char, Oxygenstat*> m_Oxygens;
|
|
|
|
|
ExtCfg* m_ExtCfg;
|
|
|
|
|
//vector<Command*> m_PurifierOxygenCommands;
|
|
|
|
|
//map<unsigned char, double> m_Oxygens;
|
|
|
|
|
};
|
|
|
|
|
|