#ifndef _CDISTANCEMETER_HL_H_
#define _CDISTANCEMETER_HL_H_
#include "cmeasheaddriver.h"
#include <memory>
/**
 * @brief. 测距传感器控制类
 * @details. 测距传感器控制类 松下hl-c2_c
 */
class CDistanceMeterDriver_HL :
    public CMeasHeadDriver {
public:
    CDistanceMeterDriver_HL(const QString& name, int32_t id);
    virtual int32_t freshresult(int32_t chid) override;
public:
    virtual int32_t init_driver() override;
    virtual int32_t exit_driver() override;
    virtual QDomElement WriteConfig(QDomDocument& doc, QDomElement& root) override;
    virtual int ReadConfig(QDomElement& root) override;
protected:
    virtual void SendCommand(const char* pCommand, std::string& pResponse);
    void MakeSendCheckComm(const char* pSendData, std::string& sResponse);
    /**
     * \brief. 命令打包
     *
     * \param pSendData
     * \code "%EE#RMD3" Return "%EE#RMD36EC"  CMD + BCC + Finish    BCCH=6 BCC＝E　FINISHCODE = C
     * \return
     */
    std::string PackageCommand(const char* pSendData);
    void CheckResponse(std::string& sResponse);
private:
    std::unique_ptr<CMSerialPort> m_pSerialPort = nullptr;
};
#endif //CDISTANCEMETER_HL_H

