2024-11-25 17:15:44 +08:00

60 lines
1.4 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef CCOMMUNICATEAPI_H
#define CCOMMUNICATEAPI_H
#include <QObject>
#include "dataformate.h"
class CCommunicationInterface;
class CCommunicateAPI : public QObject
{
Q_OBJECT
public:
static CCommunicateAPI *getInstance();
void sendData(QByteArray);
/************************************
*说明:发送数据函数【重载函数】
*参数:
*@uint8_t seq包的序号,默认为0当发送的数据需要拆包时才会使用
*@uint8_t id 自身设备ID号
*@uint8_t cmdID协议ID号
*@QByteArray arrayData有效数据
*返回值:无
***********************************/
void sendData(uint16_t cmdID,QByteArray arrayData);
//故障复位
void resetFault();
//心跳开关
void sendHeartBeat();
/****测试函数****/
//启动前参数
void sendBicycleParam(const ST_BicycleParam&);
//实时调节参数
void sendRealTimeParam(E_REALTIMECMD,quint8 value);
//退出当前状态
void SetquitCmd();
void setConfigParam();
signals:
//接收到实际数据
void signalReadyRead(QByteArray);
void signalCommunicateChanged(QString);
private:
explicit CCommunicateAPI(QObject *parent = nullptr);
~CCommunicateAPI();
void init();
private:
static CCommunicateAPI *m_API;
int commuType;
CCommunicationInterface *m_interface;
};
#endif // CCOMMUNICATEAPI_H