#ifndef DEVICE_CTRL_GENERAL_DECODER_H
#define DEVICE_CTRL_GENERAL_DECODER_H
#include "loadometer_decoder.h"

namespace zsy
{
    /**
     * 通用地磅协议解析
     */
    class GeneralLoadometerDecoder : public LoadometerDecoder
    {
        // 02 2B 30 30 32 30 30 30 32 31 42 03
        static std::tuple<bool, int32_t> resolve(const std::vector<uint8_t> &buf);

    public:
        static constexpr uint8_t StartByte = 0x02;
        static constexpr uint8_t StopByte = 0x03;
        static constexpr uint8_t FrameLen = 12;

        std::tuple<bool, uint32_t, int32_t> decode(const std::vector<uint8_t> &buf) override;

        virtual ~GeneralLoadometerDecoder() = default;
    };
} // zsy

#endif // DEVICE_CTRL_GENERAL_DECODER_H