#ifndef BCODETERMINALPROTOCOLBM_H
#define BCODETERMINALPROTOCOLBM_H

#include <QObject>

#include "common/utils/QByteUtil.h"
#include "DeviceProtocolBase.h"
#include "dto/BCodeTerminalStatusDto.h"
#include "dto/CommandReplyDto.h"

class BCodeTerminalProtocolBM : public DeviceProtocolBase
{
    Q_OBJECT
public:
    explicit BCodeTerminalProtocolBM(QObject *parent = nullptr);
    ~BCodeTerminalProtocolBM();

    // 解析数据
    bool parseDeviceFrameData(QByteArray rawData, DeviceFrameBaseDto * frameData, int frameType);
    QByteArray generateSettingCommand(QString devCode, QString commandType, QString valueSet);
    DeviceFrameBaseDto * frameFactory(int frameType);

    //
    QList<QByteArray> extractFrameList(QByteArray rawData);

    // 检测帧格式，帧头帧尾
    int checkFrame(QByteArray rawData);

    enum BCODE_TERMINAL_FRAME_TYPE
    {
        UNKNOW_FRAME = 0,
        STATUS_FRAME = 1,
        CMDREP_FRAME = 2
    };
};

#endif // BCODETERMINALPROTOCOLBM_H
