2024-04-18 11:59:51 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "BaseClient.h"
|
|
|
|
|
#include "../Log/ScannerPowerLog.h"
|
|
|
|
|
#include "../config/bean/RunCfg.h"
|
|
|
|
|
#include "../config/bean/AlarmCfg.h"
|
|
|
|
|
#include "../config/bean/ExtCfg.h"
|
|
|
|
|
|
|
|
|
|
#pragma pack(1)
|
|
|
|
|
class ScannerPowerBean {
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ScannerPowerBean()
|
|
|
|
|
: m_Voltage(new FloatData("Voltage", u8"电压值"))
|
|
|
|
|
, m_Current(new FloatData("Current", u8"电流值"))
|
|
|
|
|
, m_VoltageAlarm(new BoolData("VoltageAlarm", u8"电压报警"))
|
|
|
|
|
{
|
|
|
|
|
m_Log = new ScannerPowerLog();
|
|
|
|
|
m_LogTick = GetTickCount64();
|
|
|
|
|
m_VoltageAlarmTick = m_LogTick;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
~ScannerPowerBean()
|
|
|
|
|
{
|
|
|
|
|
if (m_Log)delete m_Log;
|
|
|
|
|
}
|
|
|
|
|
public:
|
|
|
|
|
FloatData* m_Voltage;
|
|
|
|
|
FloatData* m_Current;
|
|
|
|
|
BoolData* m_VoltageAlarm;
|
|
|
|
|
ScannerPowerLog* m_Log;
|
|
|
|
|
uint64_t m_LogTick;
|
|
|
|
|
uint64_t m_VoltageAlarmTick;
|
|
|
|
|
};
|
|
|
|
|
#pragma pack()
|
|
|
|
|
|
|
|
|
|
class ScannerPowerClient :public TcpClient
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ScannerPowerClient(void* pconfig = nullptr);
|
|
|
|
|
~ScannerPowerClient();
|
|
|
|
|
void Init();
|
|
|
|
|
//void InitCommand();
|
|
|
|
|
//void ResetCycleCommand();
|
|
|
|
|
void GetValue(int index,ScannerPowerBean& spb) {
|
|
|
|
|
if (m_Datas.find(index) == m_Datas.end())return;
|
|
|
|
|
EnterCriticalSection(&m_ValueCS);
|
|
|
|
|
spb.m_Voltage = m_Datas[index]->m_Voltage;
|
|
|
|
|
spb.m_Current = m_Datas[index]->m_Current;
|
|
|
|
|
LeaveCriticalSection(&m_ValueCS);
|
|
|
|
|
}
|
|
|
|
|
void SetJobId(int jobid) { m_JobId = jobid; }
|
|
|
|
|
int GetValueCount() { return (int)m_Datas.size(); }
|
|
|
|
|
private:
|
|
|
|
|
//void static PorcInfo(void* pobject, Command* pcommand);
|
|
|
|
|
//void static PorcInfo2(void* pobject, Command* pcommand);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
map<unsigned char, ScannerPowerBean*> m_Datas;
|
|
|
|
|
AlarmCfg* m_VoltageAlarmCfg;
|
|
|
|
|
int m_JobId;
|
|
|
|
|
RunCfg* m_RunCfg;
|
2024-05-06 10:49:15 +08:00
|
|
|
|
ExtCfgNew* m_ExtCfg;
|
2024-04-18 11:59:51 +08:00
|
|
|
|
};
|
|
|
|
|
|