#include <ltkcpp_connection.h>
Public Member Functions | |
CConnection (const CTypeRegistry *pTypeRegistry, unsigned int nBufferSize) | |
Construct a new LLRP connection instance. | |
~CConnection (void) | |
Destruct a LLRP connection instance. | |
int | openConnectionToReader (const char *pReaderHostName) |
Open the connection to the reader. | |
const char * | getConnectError (void) |
Get the string that explains openReaderConnection() error. | |
int | closeConnectionToReader (void) |
Close connection to reader, allow reuse of instance. | |
CMessage * | transact (CMessage *pSendMessage, int nMaxMS) |
Transact a LLRP request and response to a connection. | |
const CErrorDetails * | getTransactError (void) |
Get the details that explains transact() error. | |
EResultCode | sendMessage (CMessage *pMessage) |
Send a LLRP message to a connection. | |
const CErrorDetails * | getSendError (void) |
Get the details that explains sendMessage() error. | |
CMessage * | recvMessage (int nMaxMS) |
Receive a message from a connection. | |
CMessage * | recvResponse (int nMaxMS, const CTypeDescriptor *pResponseType, llrp_u32_t ResponseMessageID) |
Receive a specific message from a connection. | |
const CErrorDetails * | getRecvError (void) |
Get the details that explains recvMessage() or recvResponse() error. |
An LLRP connection consists of:
Definition at line 81 of file ltkcpp_connection.h.
|
Construct a new LLRP connection instance.
Definition at line 138 of file ltkcpp_connection.cpp. |
|
Close connection to reader, allow reuse of instance.
Definition at line 405 of file ltkcpp_connection.cpp. Referenced by ~CConnection(). |
|
Get the string that explains openReaderConnection() error.
Definition at line 388 of file ltkcpp_connection.cpp. |
|
Get the details that explains recvMessage() or recvResponse() error.
Definition at line 718 of file ltkcpp_connection.cpp. Referenced by getTransactError(). |
|
Get the details that explains sendMessage() error.
Definition at line 633 of file ltkcpp_connection.cpp. Referenced by getTransactError(). |
|
Get the details that explains transact() error. This is not 100% reliable. It looks at the send error and if that seems OK it uses the recv error. Uses of sendMessage(), recvMessage() or recvResponse() since transact() will distort the error.
Definition at line 514 of file ltkcpp_connection.cpp. References getRecvError(), getSendError(), LLRP::CErrorDetails::m_eResultCode, and LLRP::RC_OK. |
|
Open the connection to the reader. The steps:
Definition at line 261 of file ltkcpp_connection.cpp. |
|
Receive a message from a connection. The message could have already arrived and be pending on the input queue.
Definition at line 660 of file ltkcpp_connection.cpp. References LLRP::EResultCode, LLRP::RC_MiscError, and LLRP::CErrorDetails::resultCodeAndWhatStr(). |
|
Receive a specific message from a connection. The message is identified by type and message ID. This is used to receive a response to a request, but could be used for other things, too. A message matches and is returned if the type matches AND if the message ID matches. Either or both can be wildcards. The sought message could have already arrived and be pending on the input queue. While we are looking for the response notifications might arrive. They are held in the input queue while we continue to look for the sought message. About timeLimit.... The timeLimit is the last time() we'll try to receive the sought message and prevents "spinning". It is conceivable that a steady stream of messages other than the one sought could arrive, and the time between those messages could be smaller the nMaxMS. When that happens, recvAdvance() would not time out during its poll/select. It could "spin". The time out must be detected by other means and that's the purpose of timeLimit.
Definition at line 771 of file ltkcpp_connection.cpp. References LLRP::EResultCode, LLRP::CMessage::getMessageID(), LLRP::CTypeRegistry::lookupMessage(), LLRP::CElement::m_pType, LLRP::RC_MiscError, and LLRP::CErrorDetails::resultCodeAndWhatStr(). Referenced by transact(). |
|
Send a LLRP message to a connection.
Definition at line 544 of file ltkcpp_connection.cpp. References LLRP::CErrorDetails::clear(), LLRP::CErrorDetails::m_eResultCode, LLRP::RC_MiscError, LLRP::RC_OK, LLRP::RC_SendIOError, and LLRP::CErrorDetails::resultCodeAndWhatStr(). Referenced by transact(). |
|
Transact a LLRP request and response to a connection. This is a combination of sendMessage() and recvResponse(). The MessageID is taken from the outgoing messages. It's best to not use MessageID 0.
Definition at line 451 of file ltkcpp_connection.cpp. References LLRP::CErrorDetails::clear(), LLRP::EResultCode, LLRP::CMessage::getMessageID(), LLRP::CTypeDescriptor::m_pResponseType, LLRP::CElement::m_pType, LLRP::RC_MissingResponseType, LLRP::RC_OK, recvResponse(), LLRP::CErrorDetails::resultCodeAndWhatStr(), and sendMessage(). |