// OMRON600.h: interface for the RfID_Omron600 class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_OMRON600_H__171653B4_2BE8_4C09_B705_E2DCC061ACE6__INCLUDED_) #define AFX_OMRON600_H__171653B4_2BE8_4C09_B705_E2DCC061ACE6__INCLUDED_ #pragma once #include "utility.h" #include "RfId.h" #include "RfIdFactory.h" enum RFID_FORMAT { RFID_ASCII, RFID_HEX, }; #pragma warning(push) #pragma warning(disable:4481) // nonstandard extension used: override specifier 'override' class RfID_Omron600 : public RfIdBase { public: explicit RfID_Omron600(int id); virtual ~RfID_Omron600(); bool WriteID(const CString &strID) override; bool ReadID(CString *pResult) override; bool TestComm() override; void OnReceiveComm(const char *cpcBuffer, int nSize); CString GetErrorMessage() const override; private: bool Send(const CString &data); bool ReadID(int unit, int head, CString *pResult); bool WriteID(int unit, int head, const CString &strID); private: CString m_strMsg; /**< String containing error message */ CMutex m_portMutex; /**< Mutex to prevent multiple readers from accessing serialport at the same time */ CEvent m_responseReceived; /**< Set when a response is received */ CString m_strReceived; /**< String containing the response received */ DWORD m_nTimeOut; /**< Timeout for waiting for reply */ int m_head; /**< Read head configuration [1..2] */ int m_unit; /**< Unit number [0..31] */ int m_nDataLength; /**< Data length of RFID, currently fixed at 16 [16 or 32] */ enum RFID_FORMAT m_eDataFormat; /**< Data Format, Hex or ASCII */ CString RestrictStringLength(const CString& strData); CString CalculateFCSAndFinalizeCmd(const CString& strCmd); CString GetRFIDErrorCodeString(const CString &strErrorCode); bool IsReplyError(const CString &strCmd, const CString &strReply); }; #pragma warning (pop) #endif // !defined(AFX_OMRON600_H__171653B4_2BE8_4C09_B705_E2DCC061ACE6__INCLUDED_)