// OmronLaserScanner.h: interface for the COmronLaserScanner class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_OMRONLASERSCANNER_H__412AC82C_6138_4264_B306_FE6EF8FFF07E__INCLUDED_)
#define AFX_OMRONLASERSCANNER_H__412AC82C_6138_4264_B306_FE6EF8FFF07E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#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();
    CString 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(CString csMsg);
    char CalBCC(const char *cpcBuffer);

    HANDLE  m_hSuccess;
    bool    m_bInitBefore;
    CString m_csNodeNo;     // "00" for ZX-SF11
    CString m_csSubAddress; // Not Used for ZX-SF11, default "00"
    CString m_csSID;        // Service ID, 1byte
    CString m_csMRC;        // Main Request Code, 2 bytes
    CString m_csSRC;        // Sub Request Code, 2 bytes
    CString m_csCommand;

    CString m_csReadout;
    bool    m_bGetDecimal;
    CString m_csDecimal;
    int     m_nDecimal;

    bool    m_bWaitForBCC;
    CString m_csSign;
};

#endif // !defined(AFX_OMRONLASERSCANNER_H__412AC82C_6138_4264_B306_FE6EF8FFF07E__INCLUDED_)
