63 : m_Verbose(0), m_pConnectionToReader(NULL)
68 char * pReaderHostName);
71 checkConnectionStatus (
void);
74 scrubConfiguration (
void);
77 resetConfigurationToFactoryDefaults (
void);
80 deleteAllROSpecs (
void);
92 awaitAndPrintReport (
void);
99 printOneTagReportData (
103 handleReaderEventNotification (
111 handleReaderExceptionEvent (
169 CMyApplication myApp;
170 char * pReaderHostName;
179 pReaderHostName = av[1];
205 pReaderHostName = av[2];
216 rc = myApp.run(pReaderHostName);
218 printf(
"INFO: Done\n");
251 printf(
"Usage: %s [-v[v]] READERHOSTNAME\n", pProgName);
253 printf(
"Each -v increases verbosity level\n");
256 printf(
"Usage: %s [/v[v]] READERHOSTNAME\n", pProgName);
258 printf(
"Each /v increases verbosity level\n");
295 CMyApplication::run (
296 char * pReaderHostName)
306 pTypeRegistry = getTheTypeRegistry();
307 if(NULL == pTypeRegistry)
309 printf(
"ERROR: getTheTypeRegistry failed\n");
322 printf(
"ERROR: new CConnection failed\n");
331 printf(
"INFO: Connecting to %s....\n", pReaderHostName);
346 m_pConnectionToReader = pConn;
350 printf(
"INFO: Connected, checking status....\n");
359 if(0 == checkConnectionStatus())
362 if(0 == scrubConfiguration())
368 if(0 == enableROSpec())
374 for(i = 1; i <= 5; i++)
376 printf(
"INFO: Starting run %d ================\n", i);
377 if(0 != startROSpec())
382 if(0 != awaitAndPrintReport())
403 printf(
"INFO: Clean up reader configuration...\n");
405 scrubConfiguration();
411 printf(
"INFO: Finished\n");
423 delete pTypeRegistry;
464 CMyApplication::checkConnectionStatus (
void)
475 pMessage = recvMessage(10000);
491 if(&CREADER_EVENT_NOTIFICATION::s_typeDescriptor != pMessage->
m_pType)
532 printf(
"INFO: Connection status OK\n");
544 printf(
"ERROR: checkConnectionStatus failed\n");
567 CMyApplication::scrubConfiguration (
void)
569 if(0 != resetConfigurationToFactoryDefaults())
574 if(0 != deleteAllROSpecs())
604 CMyApplication::resetConfigurationToFactoryDefaults (
void)
620 pRspMsg = transact(pCmd);
645 "resetConfigurationToFactoryDefaults"))
662 printf(
"INFO: Configuration reset to factory defaults\n");
692 CMyApplication::deleteAllROSpecs (
void)
708 pRspMsg = transact(pCmd);
732 if(0 != checkLLRPStatus(pRsp->
getLLRPStatus(),
"deleteAllROSpecs"))
749 printf(
"INFO: All ROSpecs are deleted\n");
831 CMyApplication::addROSpec (
void)
880 pROReportSpec->
setN(0);
909 pRspMsg = transact(pCmd);
951 printf(
"INFO: ROSpec added\n");
979 CMyApplication::enableROSpec (
void)
995 pRspMsg = transact(pCmd);
1019 if(0 != checkLLRPStatus(pRsp->
getLLRPStatus(),
"enableROSpec"))
1036 printf(
"INFO: ROSpec enabled\n");
1064 CMyApplication::startROSpec (
void)
1080 pRspMsg = transact(pCmd);
1104 if(0 != checkLLRPStatus(pRsp->
getLLRPStatus(),
"startROSpec"))
1121 printf(
"INFO: ROSpec started\n");
1147 CMyApplication::awaitAndPrintReport (
void)
1165 pMessage = recvMessage(7000);
1166 if(NULL == pMessage)
1187 if(&CRO_ACCESS_REPORT::s_typeDescriptor == pType)
1193 printTagReportData(pNtf);
1202 else if(&CREADER_EVENT_NOTIFICATION::s_typeDescriptor == pType)
1210 if(NULL != pNtfData)
1212 handleReaderEventNotification(pNtfData);
1220 printf(
"WARNING: READER_EVENT_NOTIFICATION without data\n");
1229 printf(
"WARNING: Ignored unexpected message during monitor: %s\n",
1258 CMyApplication::printTagReportData (
1261 std::list<CTagReportData *>::iterator Cur;
1262 unsigned int nEntry = 0;
1275 printf(
"INFO: %u tag report entries\n", nEntry);
1285 printOneTagReportData(*Cur);
1300 CMyApplication::printOneTagReportData (
1304 char aBuf[100*1024];
1314 if(NULL != pEPCParameter)
1319 llrp_u8_t * pValue = NULL;
1322 pType = pEPCParameter->
m_pType;
1323 if(&CEPC_96::s_typeDescriptor == pType)
1327 pEPC_96 = (
CEPC_96 *) pEPCParameter;
1328 my_u96 = pEPC_96->
getEPC();
1332 else if(&CEPCData::s_typeDescriptor == pType)
1336 pEPCData = (
CEPCData *) pEPCParameter;
1337 my_u1v = pEPCData->
getEPC();
1339 n = (my_u1v.
m_nBit + 7u) / 8u;
1344 for(i = 0; i < n; i++)
1346 if(0 < i && i%2 == 0)
1350 sprintf(p,
"%02X", pValue[i]);
1356 strcpy(aBuf,
"---unknown-epc-data-type---");
1361 strcpy(aBuf,
"---missing-epc-data---");
1363 printf(
"%-32s", aBuf);
1386 CMyApplication::handleReaderEventNotification (
1394 if(NULL != pAntennaEvent)
1396 handleAntennaEvent(pAntennaEvent);
1401 if(NULL != pReaderExceptionEvent)
1403 handleReaderExceptionEvent(pReaderExceptionEvent);
1423 printf(
"NOTICE: Unexpected (unhandled) ReaderEvent\n");
1440 CMyApplication::handleAntennaEvent (
1444 llrp_u16_t AntennaID;
1453 pStateStr =
"disconnected";
1457 pStateStr =
"connected";
1461 pStateStr =
"?unknown-event?";
1465 printf(
"NOTICE: Antenna %d is %s\n", AntennaID, pStateStr);
1482 CMyApplication::handleReaderExceptionEvent (
1487 Message = pReaderExceptionEvent->
getMessage();
1491 printf(
"NOTICE: ReaderException '%.*s'\n",
1496 printf(
"NOTICE: ReaderException but no message\n");
1520 CMyApplication::checkLLRPStatus (
1530 if(NULL == pLLRPStatus)
1532 printf(
"ERROR: %s missing LLRP status\n", pWhatStr);
1551 printf(
"ERROR: %s failed, no error description given\n",
1556 printf(
"ERROR: %s failed, %.*s\n",
1593 CMyApplication::transact (
1605 printf(
"\n===================================\n");
1606 printf(
"INFO: Transact sending\n");
1607 printXMLMessage(pSendMsg);
1615 pRspMsg = pConn->
transact(pSendMsg, 5000);
1621 printf(
"ERROR: %s transact failed, %s\n",
1627 printf(
"ERROR: ... reference type %s\n",
1633 printf(
"ERROR: ... reference field %s\n",
1646 printf(
"\n- - - - - - - - - - - - - - - - - -\n");
1647 printf(
"INFO: Transact received response\n");
1648 printXMLMessage(pRspMsg);
1656 if(&CERROR_MESSAGE::s_typeDescriptor == pRspMsg->
m_pType)
1662 printf(
"ERROR: Received ERROR_MESSAGE instead of %s\n",
1697 CMyApplication::recvMessage (
1712 if(NULL == pMessage)
1716 printf(
"ERROR: recvMessage failed, %s\n",
1721 printf(
"ERROR: ... reference type %s\n",
1727 printf(
"ERROR: ... reference field %s\n",
1740 printf(
"\n===================================\n");
1741 printf(
"INFO: Message received\n");
1742 printXMLMessage(pMessage);
1767 CMyApplication::sendMessage (
1778 printf(
"\n===================================\n");
1779 printf(
"INFO: Sending\n");
1780 printXMLMessage(pSendMsg);
1792 printf(
"ERROR: %s sendMessage failed, %s\n",
1798 printf(
"ERROR: ... reference type %s\n",
1804 printf(
"ERROR: ... reference field %s\n",
1832 CMyApplication::printXMLMessage (
1835 char aBuf[100*1024];
Class Definition CROBoundarySpec for LLRP parameter ROBoundarySpec.
void setDurationTrigger(llrp_u32_t value)
Set accessor functions for the LLRP DurationTrigger field.
char * m_pName
String name of field (e.g. "ROSpecID")
void setAntennaIDs(llrp_u16v_t value)
Set accessor functions for the LLRP AntennaIDs field.
const CTypeDescriptor * m_pType
The type descriptor desribing this element.
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
llrp_u8_t * m_pValue
Pointer to the first array element.
Class for LLRP basic type u16v (List of unsigned 16-bit values)
EResultCode setTagReportContentSelector(CTagReportContentSelector *pValue)
Set accessor functions for the LLRP TagReportContentSelector sub-parameter.
std::list< CTagReportData * >::iterator beginTagReportData(void)
Returns the first element of the TagReportData sub-parameter list.
const CFieldDescriptor * m_pRefField
If non-NULL this is the field descriptors for the errored field.
void setROSpecID(llrp_u32_t value)
Set accessor functions for the LLRP ROSpecID field.
void setEnableFirstSeenTimestamp(llrp_u1_t value)
Set accessor functions for the LLRP EnableFirstSeenTimestamp field.
Class Definition CAISpec for LLRP parameter AISpec.
void setEnablePeakRSSI(llrp_u1_t value)
Set accessor functions for the LLRP EnablePeakRSSI field.
void setPriority(llrp_u8_t value)
Set accessor functions for the LLRP Priority field.
void usage(char *pProgName)
Print usage message and exit.
const CTypeDescriptor * m_pRefType
If non-NULL this is the type descriptors for the errored type.
Class Definition CInventoryParameterSpec for LLRP parameter InventoryParameterSpec.
Class for LLRP basic type u96 (96-bit value)
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
void setEnableAccessSpecID(llrp_u1_t value)
Set accessor functions for the LLRP EnableAccessSpecID field.
llrp_u96_t getEPC(void)
Get accessor functions for the LLRP EPC field.
Class Definition CSTART_ROSPEC for LLRP message START_ROSPEC.
void setCurrentState(EROSpecState value)
Set accessor functions for the LLRP CurrentState field.
EStatusCode getStatusCode(void)
Get accessor functions for the LLRP StatusCode field.
const char * m_pWhatStr
Descriptive printable error string.
EResultCode toXMLString(char *pBuffer, int nBuffer)
A wrapper around LLRP::toXMLString()
Class Definition CDELETE_ROSPEC for LLRP message DELETE_ROSPEC.
CReaderEventNotificationData * getReaderEventNotificationData(void)
Get accessor functions for the LLRP ReaderEventNotificationData sub-parameter.
Class Definition CROSpecStartTrigger for LLRP parameter ROSpecStartTrigger.
Class Definition CEPC_96 for LLRP parameter EPC_96.
void setEnableChannelIndex(llrp_u1_t value)
Set accessor functions for the LLRP EnableChannelIndex field.
Class Definition CENABLE_ROSPEC_RESPONSE for LLRP message ENABLE_ROSPEC_RESPONSE. ...
Class Definition CROReportSpec for LLRP parameter ROReportSpec.
Class Definition CRO_ACCESS_REPORT for LLRP message RO_ACCESS_REPORT.
llrp_u16_t m_nValue
The number of arrray elements.
int closeConnectionToReader(void)
Close connection to reader, allow reuse of instance.
EConnectionAttemptStatusType getStatus(void)
Get accessor functions for the LLRP Status field.
void setEnableROSpecID(llrp_u1_t value)
Set accessor functions for the LLRP EnableROSpecID field.
A collection of pointers to CTypeDescriptors.
Class Definition CREADER_EVENT_NOTIFICATION for LLRP message READER_EVENT_NOTIFICATION.
llrp_u16_t getAntennaID(void)
Get accessor functions for the LLRP AntennaID field.
const CErrorDetails * getTransactError(void)
Get the details that explains transact() error.
Class Definition CConnectionAttemptEvent for LLRP parameter ConnectionAttemptEvent.
Class Definition CSTART_ROSPEC_RESPONSE for LLRP message START_ROSPEC_RESPONSE.
Class Definition CReaderEventNotificationData for LLRP parameter ReaderEventNotificationData.
void setROSpecID(llrp_u32_t value)
Set accessor functions for the LLRP ROSpecID field.
Class Definition CADD_ROSPEC for LLRP message ADD_ROSPEC.
void setResetToFactoryDefault(llrp_u1_t value)
Set accessor functions for the LLRP ResetToFactoryDefault field.
CMessage * recvMessage(int nMaxMS)
Receive a message from a connection.
Class Definition CTagReportContentSelector for LLRP parameter TagReportContentSelector.
Class Definition CADD_ROSPEC_RESPONSE for LLRP message ADD_ROSPEC_RESPONSE.
Class Definition CDELETE_ROSPEC_RESPONSE for LLRP message DELETE_ROSPEC_RESPONSE. ...
void setROReportTrigger(EROReportTriggerType value)
Set accessor functions for the LLRP ROReportTrigger field.
void setDurationTriggerValue(llrp_u32_t value)
Set accessor functions for the LLRP DurationTriggerValue field.
llrp_utf8v_t getErrorDescription(void)
Get accessor functions for the LLRP ErrorDescription field.
EResultCode setROSpec(CROSpec *pValue)
Set accessor functions for the LLRP ROSpec sub-parameter.
CMessage * transact(CMessage *pSendMessage, int nMaxMS)
Transact a LLRP request and response to a connection.
Class Definition CAntennaEvent for LLRP parameter AntennaEvent.
const CErrorDetails * getRecvError(void)
Get the details that explains recvMessage() or recvResponse() error.
Class for LLRP basic type utf8v (vector of utf-8 encoded characters)
llrp_u16_t m_nBit
The number of arrray elements.
Class for LLRP basic type u1v (vector of unsigned 1-bit values)
Class Definition CENABLE_ROSPEC for LLRP message ENABLE_ROSPEC.
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
int openConnectionToReader(const char *pReaderHostName)
Open a connection to the reader over an unencrypted socket.
void setProtocolID(EAirProtocols value)
Set accessor functions for the LLRP ProtocolID field.
EResultCode addSpecParameter(CParameter *pValue)
Add a SpecParameter to the LLRP sub-parameter list.
Class Definition CLLRPStatus for LLRP parameter LLRPStatus.
void setEnableSpecIndex(llrp_u1_t value)
Set accessor functions for the LLRP EnableSpecIndex field.
const CTypeDescriptor * m_pResponseType
For messages (bIsMessage==TRUE), this is the type descriptor for the corresponding response...
void setROSpecID(llrp_u32_t value)
Set accessor functions for the LLRP ROSpecID field.
CReaderExceptionEvent * getReaderExceptionEvent(void)
Get accessor functions for the LLRP ReaderExceptionEvent sub-parameter.
void setN(llrp_u16_t value)
Set accessor functions for the LLRP N field.
EResultCode sendMessage(CMessage *pMessage)
Send a LLRP message to a connection.
CParameter * getEPCParameter(void)
Get accessor functions for the LLRP EPCParameter sub-parameter.
Class to return error details in LTKCPP operations.
Class Definition CROSpec for LLRP parameter ROSpec.
EResultCode setROBoundarySpec(CROBoundarySpec *pValue)
Set accessor functions for the LLRP ROBoundarySpec sub-parameter.
char * m_pName
String name of parameter/message type (e.g. "ROSpec")
File that includes all LLRP classes and types.
Class Definition CEPCData for LLRP parameter EPCData.
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
Class Definition CSET_READER_CONFIG for LLRP message SET_READER_CONFIG.
void setEnableAntennaID(llrp_u1_t value)
Set accessor functions for the LLRP EnableAntennaID field.
void setROSpecStopTriggerType(EROSpecStopTriggerType value)
Set accessor functions for the LLRP ROSpecStopTriggerType field.
llrp_u1v_t getEPC(void)
Get accessor functions for the LLRP EPC field.
llrp_u16_t * m_pValue
Pointer to the first array element.
EResultCode setROSpecStopTrigger(CROSpecStopTrigger *pValue)
Set accessor functions for the LLRP ROSpecStopTrigger sub-parameter.
llrp_u8_t m_aValue[12]
Simple array of basic type llrp_u8_t.
void setInventoryParameterSpecID(llrp_u16_t value)
Set accessor functions for the LLRP InventoryParameterSpecID field.
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
Base Class for All LLRP LTK Parameters.
Base Class for All LLRP LTK Messages.
EResultCode setROSpecStartTrigger(CROSpecStartTrigger *pValue)
Set accessor functions for the LLRP ROSpecStartTrigger sub-parameter.
std::list< CTagReportData * >::iterator endTagReportData(void)
Returns the last element of the TagReportData sub-parameter list.
llrp_utf8v_t getMessage(void)
Get accessor functions for the LLRP Message field.
const char * getConnectError(void)
Get the string that explains openReaderConnection() error.
Class Definition CSET_READER_CONFIG_RESPONSE for LLRP message SET_READER_CONFIG_RESPONSE.
Class Definition CReaderExceptionEvent for LLRP parameter ReaderExceptionEvent.
CAntennaEvent * getAntennaEvent(void)
Get accessor functions for the LLRP AntennaEvent sub-parameter.
void setEnableLastSeenTimestamp(llrp_u1_t value)
Set accessor functions for the LLRP EnableLastSeenTimestamp field.
void setEnableTagSeenCount(llrp_u1_t value)
Set accessor functions for the LLRP EnableTagSeenCount field.
void setROSpecID(llrp_u32_t value)
Set accessor functions for the LLRP ROSpecID field.
Class Definition CTagReportData for LLRP parameter TagReportData.
void setMessageID(llrp_u32_t MessageID)
Sets the LLRP Message ID for the Message.
void setAISpecStopTriggerType(EAISpecStopTriggerType value)
Set accessor functions for the LLRP AISpecStopTriggerType field.
Class Definition CAISpecStopTrigger for LLRP parameter AISpecStopTrigger.
EResultCode addInventoryParameterSpec(CInventoryParameterSpec *pValue)
Add a InventoryParameterSpec to the LLRP sub-parameter list.
int main(int ac, char *av[])
Command main routine.
EAntennaEventType
Global enumeration EAntennaEventType for LLRP enumerated field AntennaEventType.
EResultCode setROReportSpec(CROReportSpec *pValue)
Set accessor functions for the LLRP ROReportSpec sub-parameter.
void setEnableInventoryParameterSpecID(llrp_u1_t value)
Set accessor functions for the LLRP EnableInventoryParameterSpecID field.
CConnectionAttemptEvent * getConnectionAttemptEvent(void)
Get accessor functions for the LLRP ConnectionAttemptEvent sub-parameter.
llrp_utf8_t * m_pValue
Pointer to the first array element.
EAntennaEventType getEventType(void)
Get accessor functions for the LLRP EventType field.
EResultCode setAISpecStopTrigger(CAISpecStopTrigger *pValue)
Set accessor functions for the LLRP AISpecStopTrigger sub-parameter.
Describes a message or parameter type.
void setROSpecStartTriggerType(EROSpecStartTriggerType value)
Set accessor functions for the LLRP ROSpecStartTriggerType field.
Class Definition CROSpecStopTrigger for LLRP parameter ROSpecStopTrigger.
const CErrorDetails * getSendError(void)
Get the details that explains sendMessage() error.