⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readerinterface.h

📁 an example of programming philips pegoda reader
💻 H
字号:
/*
*         Copyright (c), Philips Semiconductors Gratkorn / Austria
*
*                     (C)PHILIPS Electronics N.V.2000
*       All rights are reserved. Reproduction in whole or in part is 
*      prohibited without the written consent of the copyright owner.
*  Philips reserves the right to make changes without notice at any time.
* Philips makes no warranty, expressed, implied or statutory, including but
* not limited to any implied warranty of merchantability or fitness for any
*particular purpose, or that the use will not infringe any third party patent,
* copyright or trademark. Philips must not be liable for any loss or damage
*                          arising from its use.
*/

/*! \file ReaderInterface.h
*
* Projekt: Host RF Reader Communication
*
* $Workfile:: ReaderInterface.h                                         $ 
* $Modtime:: 2.07.01 7:57                                               $ 
* $Author:: Hb                                                          $
* $Revision:: 16                                                        $
*
*/
#ifndef READER_INTERFACE_H
#define READER_INTERFACE_H

#ifdef __cplusplus
extern "C" {
#endif

//----------------------------------------------------------------------------
// INCLUDES
//----------------------------------------------------------------------------
#include <windows.h>
#include <OsDefs.h>

//----------------------------------------------------------------------------
// PROTOTYPE DECLARATIONS
//----------------------------------------------------------------------------
class CommandObject;
class ProtocolBase;

/// Reader Interface Object
/*!
* \ingroup hostrdcom
* Base class for 'interface properties classes' (e.g. RS232,IrDA, ...).
*/
class DLLEXP_IMP ReaderInterface
{
//----------------------------------------------------------------------------
// Member Functions
//----------------------------------------------------------------------------
public:
   //------------------------------------------------------------------------
   /*!
   * \return none
   * Default constructor
   */
   ReaderInterface();
   //! Destructor
   virtual ~ReaderInterface();  // NOTE: Do NOT make virtual, otherwise program will
                        //       crash while trying to delete an object!!

   /*! \name Pure Virtual Member Functions
       This member functions must be redefined in every derived class.
   */
   //@{

   /*!
   * \param  none
   * \return none
   *
   * The overloaded functions (e.g. RS232::OpenInterface()) open
   * the according interface to communicate with the reader
   */
   virtual short OpenInterface(void) = 0;

   /*!
   * \param  none
   * \return depending on the current interface type
   *
   * The overloaded functions (e.g. RS232::CloseInterface()) close
   * the according interface
   */
   virtual short CloseInterface(void) = 0;

   /*!
   * \param  none
   * \return depending on the current interface type
   *
   * ResetInterface - closes the open interface and reopens it
   */
   virtual short ResetInterface() = 0;
  
   /*!
   * \param  none
   * \return depending on the current interface type
   *
   * purge all remaining data and initialize internal structures 
   */
   virtual short ClearInternalBuffers() = 0;

   /*!
   * \param data           byte data stream
   * \param datalen        number of bytes to write
   * \param dwBytesWritten number of bytes written
   * \param Timeout        timeout periode for write operations
   * \return depending on the current interface type
   *
   * Send a specified number of bytes to the interface. This 
   * function returns, if either the bytes are sent, or the timeout
   * period expired.
   */
   virtual short WriteBytesUnblocked(unsigned char* data, 
                                     unsigned long datalen,
                                     unsigned long &dwBytesWritten,
                                     unsigned long Timeout) = 0;
   /*!
   * \param data           byte data stream
   * \param datalen        number of bytes to read
   * \param dwBytesRead    number of bytes read
   * \param Timeout        timeout periode for read operations
   * \return depending on the current interface type
   *
   * Read a specified number of bytes from the interface. This 
   * function returns, if either the bytes are read, or the timeout
   * period expired.
   */
   virtual short ReadBytesUnblocked(unsigned char* ch, 
                                    unsigned long datalen,
                                    unsigned long &dwBytesRead,
                                    unsigned long Timeout) = 0;
   //@}

private:
    //! Copy constructor should never be called outside
    ReaderInterface(const ReaderInterface& readerinterface) {};

    //! Assignment operator should never be used outside
    ReaderInterface& operator= (const ReaderInterface& readerinterface) 
      { return *this; };
protected:

    // Structure for Read Event, gets signalled, when a character is received
    OVERLAPPED m_osReader;
    // Structure for Write Event, gets signalled, when a character is sent 
    OVERLAPPED m_osWriter;

};

#ifdef __cplusplus
}
#endif

#endif // READER_INTERFACE_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -