#ifndef TIMESWITCHERPROTOCOLBM_H
#define TIMESWITCHERPROTOCOLBM_H

#include <QObject>
#include <QList>

#include "protocol/DeviceStatusProtocolBase.h"
#include "protocol/dto/TimeSwitcherInterfaceDto.h"
#include "protocol/dto/TimeSwitcherStatusDto.h"

class TimeSwitcherProtocolBM : public DeviceStatusProtocolBase
{
    Q_OBJECT
public:
    explicit TimeSwitcherProtocolBM(QObject *parent = nullptr);
    ~TimeSwitcherProtocolBM();

    // 解析数据
    bool parseDeviceFrameData(QByteArray rawData, DeviceFrameBaseDto * frameData, int frameType);
    DeviceFrameBaseDto * frameFactory(int frameType);

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

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

    enum TIME_SWITCHER_FRAME_TYPE
    {
        UNKNOW_FRAME = 0,
        INTERFACE_FRAME = 1,
        STATUS_FRAME = 2,
        NETWORK_FRAME = 3
    };
};

#endif // TIMESWITCHERPROTOCOLBM_H
