#ifndef SIGNALGENERATORPROTOCOLBM_H
#define SIGNALGENERATORPROTOCOLBM_H

#include <QObject>
#include <QList>

#include "protocol/DeviceStatusProtocolBase.h"
#include "dto/SignalGeneratorInterfaceDto.h"
#include "dto/SignalGeneratorStatusDto.h"
#include "dto/SignalGeneratorMJDTimeDto.h"
#include "dto/SignalGeneratorZDATimeDto.h"

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

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

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

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

    enum SIGNAL_GENERATOR_FRAME_TYPE
    {
        UNKNOW_FRAME = 0,
        INTERFACE_FRAME = 1,
        STATUS_FRAME = 2,
        ZDA_FRAME = 3,
        MJD_FRAME = 4,
        NETWORK_FRAME = 5
    };
};

#endif // SIGNALGENERATORPROTOCOLBM_H
