#ifndef TIMEREPLICATORPROTOCOLBM_H
#define TIMEREPLICATORPROTOCOLBM_H

#include <QObject>

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

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

    // 解析数据
    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 TIME_REPLICATOR_FRAME_TYPE
    {
        UNKNOW_FRAME = 0,
        STATUS_FRAME = 1,
        CMDREP_FRAME = 2
    };
};

#endif // TIMEREPLICATORPROTOCOLBM_H
