ltkcpp_connection.h

Go to the documentation of this file.
00001 
00002 /*
00003  *****************************************************************************
00004  *                                                                           *
00005  *                 IMPINJ CONFIDENTIAL AND PROPRIETARY                       *
00006  *                                                                           *
00007  * This source code is the sole property of Impinj, Inc.  Reproduction or    *
00008  * utilization of this source code in whole or in part is forbidden without  *
00009  * the prior written consent of Impinj, Inc.                                 *
00010  *                                                                           *
00011  * (c) Copyright Impinj, Inc. 2007,2008. All rights reserved.                *
00012  *                                                                           *
00013  *****************************************************************************/
00014 
00025 namespace LLRP
00026 {
00027 
00028 /*
00029  * @brief   Forward class declaration of platform-specific socket wrapper
00030  *
00031  * The definition is in ltkcpp_connection.cpp.
00032  *
00033  * On Linux a socket is a simple type (int). On Windows it
00034  * is a pointer to a specific type defined in a WinSock
00035  * header (.h) file. Rather than make that header file a
00036  * prerequisite to every source file that includes this header
00037  * file (ltkcpp_connection.h), the following CPlatformSocket
00038  * class opaquely wraps the platform-specific socket.
00039  *
00040  * The CConnection class references it by pointer only.
00041  * The content of the CPlatformSocket is only known
00042  * within the implementation of CConnection.
00043  */
00044 class CPlatformSocket;
00045 
00075 class CConnection
00076 {
00077   public:
00078     CConnection (
00079       const CTypeRegistry *     pTypeRegistry,
00080       unsigned int              nBufferSize);
00081 
00082     ~CConnection (void);
00083 
00084     int
00085     openConnectionToReader (
00086       const char *              pReaderHostName);
00087 
00088     const char *
00089     getConnectError (void);
00090 
00091     int
00092     closeConnectionToReader (void);
00093 
00094     CMessage *
00095     transact (
00096       CMessage *                pSendMessage,
00097       int                       nMaxMS);
00098 
00099     const CErrorDetails *
00100     getTransactError (void);
00101 
00102     EResultCode
00103     sendMessage (
00104       CMessage *                pMessage);
00105 
00106     const CErrorDetails *
00107     getSendError (void);
00108 
00109     CMessage *
00110     recvMessage (
00111       int                       nMaxMS);
00112 
00113     CMessage *
00114     recvResponse (
00115       int                       nMaxMS,
00116       const CTypeDescriptor *   pResponseType,
00117       llrp_u32_t                ResponseMessageID);
00118 
00119     const CErrorDetails *
00120     getRecvError (void);
00121 
00122   private:
00124     CPlatformSocket *           m_pPlatformSocket;
00125 
00127     const char *                m_pConnectErrorStr;
00128 
00130     const CTypeRegistry *       m_pTypeRegistry;
00131 
00133     std::list<CMessage *>       m_listInputQueue;
00134 
00136     unsigned int                m_nBufferSize;
00137 
00139     struct RecvState
00140     {
00142         llrp_byte_t *       pBuffer;
00143 
00145         unsigned int        nBuffer;
00146 
00150         int                 bFrameValid;
00151 
00153         CFrameExtract       FrameExtract;
00154 
00156         CErrorDetails       ErrorDetails;
00157     }                           m_Recv;
00158 
00160     struct SendState
00161     {
00163         llrp_byte_t *       pBuffer;
00164 
00166         unsigned int        nBuffer;
00167 
00169         CErrorDetails       ErrorDetails;
00170     }                           m_Send;
00171 
00172   private:
00173     EResultCode
00174     recvAdvance (
00175       int                           nMaxMS,
00176       time_t                        timeLimit);
00177 
00178     time_t
00179     calculateTimeLimit (
00180       int                           nMaxMS);
00181 };
00182 
00183 
00184 }; /* namespace LLRP */
00185 

Generated on Wed Jun 6 11:55:49 2012 for LTKCPP-- LLRP Toolkit C Plus Plus Library by  doxygen 1.5.9