143 lines
3.0 KiB
C++
143 lines
3.0 KiB
C++
#ifndef CODECXYCKDIGITAL_H
|
|
#define CODECXYCKDIGITAL_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
#include <QByteArray>
|
|
#include <QDebug>
|
|
#include "XYComFunc_global.h"
|
|
#include "CommomFunc/datacheck.h"
|
|
#include "commonStruct.h"
|
|
|
|
class XYCOMFUNC_EXPORT CODECXyckDigital : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
CODECXyckDigital();
|
|
/**
|
|
* @brief 轮询请求
|
|
* @return
|
|
*/
|
|
QByteArray reqGetInfo();
|
|
|
|
/**
|
|
* @brief 控制请求,控制灯亮状态
|
|
* @return
|
|
*/
|
|
QByteArray reqControl(int iChannel,LightState lightstate);
|
|
/**
|
|
* @brief 预调节请求
|
|
* @return
|
|
*/
|
|
QByteArray reqPreconditioning(int iChannel,ModeState modestate);
|
|
/**
|
|
* @brief 关机指令响应
|
|
* @param powstate
|
|
* @return
|
|
*/
|
|
QByteArray resqPowoff(PowState powstate);
|
|
/**
|
|
* @brief 处理串口类收到的数据帧
|
|
* @param buffer
|
|
*/
|
|
void dealFrame(QByteArray buffer);
|
|
|
|
QByteArray reqUpdateA(int iChannel,int AValue);
|
|
|
|
QByteArray reqPowOn(ModeState state);
|
|
|
|
//以下方法仅仅用于测试
|
|
QByteArray respDigitalInfo(DigitalInfo *di);
|
|
|
|
|
|
|
|
private:
|
|
/**
|
|
* @brief 处理状态请求应答
|
|
* @param buffer
|
|
*/
|
|
void respGetInfo(QByteArray buffer);
|
|
/**
|
|
* @brief 处理控制请求应答
|
|
* @param buffer
|
|
*/
|
|
void respControl(QByteArray buffer);
|
|
/**
|
|
* @brief 处理预调节请求应答
|
|
* @param buffer
|
|
*/
|
|
void resqPreconditioning(QByteArray buffer);
|
|
/**
|
|
* @brief 处理关机请求
|
|
*/
|
|
void reqPowoff();
|
|
/**
|
|
* @brief 处理异常应答
|
|
* @param buffer
|
|
*/
|
|
void resqError(QByteArray buffer);
|
|
void resqUpdateA(QByteArray buffer);
|
|
void resqPowOn(QByteArray buffer);
|
|
/**
|
|
* @brief 生成完整的数据帧
|
|
* @param 数据位
|
|
* @return
|
|
*/
|
|
QByteArray createFrame(QByteArray dataBuffer);
|
|
/**
|
|
* @brief 创建异常信息应答
|
|
* @param iFuncCode
|
|
* @param iChannel
|
|
* @param errcode
|
|
* @return
|
|
*/
|
|
QByteArray createError(int iFuncCode,int iChannel,ErrorCode errcode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signals:
|
|
void commandSendError(int iChannel,ErrorCode errorcode,int iFunctionCode);
|
|
/**
|
|
* @brief 帧数据解析异常
|
|
* @param errorcode
|
|
* @param errBuffer
|
|
*/
|
|
void frameError(ErrorCode errorcode,QByteArray errBuffer=nullptr);
|
|
/**
|
|
* @brief 数字板信息接收信号
|
|
* @param di
|
|
*/
|
|
void digitalInfoRev(DigitalInfo *di);
|
|
/**
|
|
* @brief 关机指令接收信号
|
|
*/
|
|
void powOffCommandRev();
|
|
/**
|
|
* @brief 控制响应接收信号
|
|
* @param iChannel
|
|
* @param lightstate
|
|
*/
|
|
void controlRespond(int iChannel,LightState lightstate);
|
|
/**
|
|
* @brief 预调节响应接收信号
|
|
* @param iChannel
|
|
* @param modestate
|
|
*/
|
|
void preconditioningRespond(int iChannel,ModeState modestate);
|
|
void AUpdated(int iChannel,int AValue);
|
|
void PowOn(ModeState powOnState);
|
|
|
|
public slots:
|
|
|
|
|
|
};
|
|
|
|
#endif // CODECXYCKDIGITAL_H
|