// OmronLaserScanner.h: interface for the COmronLaserScanner class.
//
//////////////////////////////////////////////////////////////////////
#pragma once

#include <string>

#include "Scanner.h"

#ifdef BUILD_COMMDLL
#define COMMDLL_DLLCLASS __declspec(dllexport)
#else
#define COMMDLL_DLLCLASS __declspec(dllimport)
#endif

class COMMDLL_DLLCLASS COmronLaserScanner : public CScanner
{
public:
    bool ZeroRelease();
    std::string GetReceiveData();
    bool IsInit();
    bool Measure(double& dHeight);
    bool Zero();
    COmronLaserScanner();
    virtual ~COmronLaserScanner();

    void ReceiveComm(const char* cpcBuffer, int nSize);
    bool Init();

private:
    bool GetDecimalPointPosition();
    bool SendMsg(std::string strMsg);
    char CalBCC(const char* cpcBuffer);

    HANDLE m_hSuccess;
    bool m_bInitBefore;
    std::string m_strNodeNo;     // "00" for ZX-SF11
    std::string m_strSubAddress; // Not Used for ZX-SF11, default "00"
    std::string m_strSID;        // Service ID, 1byte
    std::string m_strMRC;        // Main Request Code, 2 bytes
    std::string m_strSRC;        // Sub Request Code, 2 bytes
    std::string m_strCommand;

    std::string m_strReadout;
    bool m_bGetDecimal;
    std::string m_strDecimal;
    int m_nDecimal;

    bool m_bWaitForBCC;
    std::string m_strSign;
};

