GrpcPrint/PrintS/Communication/OxygenClient.h
2024-03-19 17:45:12 +08:00

57 lines
1.6 KiB
C++

#pragma once
#include "BaseClient.h"
//#include "../config/ConfigManager.h"
#include <map>
#include "../config/bean/ExtCfg.h"
class Oxygenstat
{
public:
explicit Oxygenstat() {
concentrationValue = 0.0f;
valueUnit = "";
scale = 1;
tempValue = 0.0f;
humidityValue = 0.0f;
concentrationAgValue = 0.0f;
}
public:
BaseStat baseStat;
float concentrationValue; //浓度值
string valueUnit; //浓度单位
int scale; //数值放大倍数
float tempValue; //温度值
float humidityValue; //湿度值
float concentrationAgValue; //模拟量
};
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);
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;
};