LTKCPP-- LLRP Toolkit C Plus Plus Library
docsample3.cpp
Go to the documentation of this file.
1 
2 /*
3  *****************************************************************************
4  * *
5  * IMPINJ CONFIDENTIAL AND PROPRIETARY *
6  * *
7  * This source code is the sole property of Impinj, Inc. Reproduction or *
8  * utilization of this source code in whole or in part is forbidden without *
9  * the prior written consent of Impinj, Inc. *
10  * *
11  * (c) Copyright Impinj, Inc. 2007,2009. All rights reserved. *
12  * *
13  *****************************************************************************/
14 
50 #include <stdio.h>
51 #include "ltkcpp.h"
52 #include "impinj_ltkcpp.h"
53 #include "time.h"
54 
55 using namespace LLRP;
56 
57 /*
58 ** Sorry, we use this linux safe method
59 ** to print buffers. WIndows has the same
60 ** method, but by a different name
61 */
62 #if (WIN32)
63 #define snprintf _snprintf
64 #endif
65 
66 class CMyApplication
67 {
68 private:
69 
70  unsigned int m_PowerLevelIndex;
71  unsigned int m_messageID;
72 
73  public:
75  int m_Verbose;
76 
78  CConnection * m_pConnectionToReader;
79 
80  inline
81  CMyApplication (void)
82  : m_Verbose(0), m_pConnectionToReader(NULL)
83  {
84  m_messageID = 0;
85  }
86 
87  int
88  run (
89  char * pReaderHostName);
90 
91  int
92  checkConnectionStatus (void);
93 
94  int
95  enableImpinjExtensions (void);
96 
97  int
98  resetConfigurationToFactoryDefaults (void);
99 
100  int
101  getReaderCapabilities(void);
102 
103  int
104  setImpinjReaderConfig(void);
105 
106  int
107  addROSpec (void);
108 
109  int
110  enableROSpec (void);
111 
112  int
113  startROSpec (void);
114 
115  int
116  stopROSpec (void);
117 
118  int
119  addAccessSpec(void);
120 
121  int
122  enableAccessSpec(void);
123 
124  int
125  awaitAndPrintReport (int timeoutSec);
126 
127  void
128  printTagReportData (
129  CRO_ACCESS_REPORT * pRO_ACCESS_REPORT);
130 
131  void
132  printOneTagReportData (
133  CTagReportData * pTagReportData);
134 
135  void
136  formatOneEPC (
137  CParameter * pEpcParameter,
138  char * buf,
139  int buflen);
140 
141  void
142  formatOneReadResult (
143  CParameter * pEpcParameter,
144  char * buf,
145  int buflen);
146 
147  void
148  handleReaderEventNotification (
149  CReaderEventNotificationData *pNtfData);
150 
151  void
152  handleAntennaEvent (
153  CAntennaEvent * pAntennaEvent);
154 
155  void
156  handleReaderExceptionEvent (
157  CReaderExceptionEvent * pReaderExceptionEvent);
158 
159  int
160  checkLLRPStatus (
161  CLLRPStatus * pLLRPStatus,
162  char * pWhatStr);
163 
164  CMessage *
165  transact (
166  CMessage * pSendMsg);
167 
168  CMessage *
169  recvMessage (
170  int nMaxMS);
171 
172  int
173  sendMessage (
174  CMessage * pSendMsg);
175 
176  void
177  printXMLMessage (
178  CMessage * pMessage);
179 };
180 
181 
182 /* BEGIN forward declarations */
183 int
184 main (
185  int ac,
186  char * av[]);
187 
188 void
189 usage (
190  char * pProgName);
191 /* END forward declarations */
192 
193 
209 int
211  int ac,
212  char * av[])
213 {
214  CMyApplication myApp;
215  char * pReaderHostName;
216  int rc;
217 
218  /*
219  * Process comand arguments, determine reader name
220  * and verbosity level.
221  */
222  if(ac == 2)
223  {
224  pReaderHostName = av[1];
225  }
226  else if(ac == 3)
227  {
228  char * p = av[1];
229 
230  while(*p)
231  {
232  switch(*p++)
233  {
234  case '-': /* linux conventional option warn char */
235  case '/': /* Windows/DOS conventional option warn char */
236  break;
237 
238  case 'v':
239  case 'V':
240  myApp.m_Verbose++;
241  break;
242 
243  default:
244  usage(av[0]);
245  /* no return */
246  break;
247  }
248  }
249 
250  pReaderHostName = av[2];
251  }
252  else
253  {
254  usage(av[0]);
255  /* no return */
256  }
257 
258  /*
259  * Run application, capture return value for exit status
260  */
261  rc = myApp.run(pReaderHostName);
262 
263  printf("INFO: Done\n");
264 
265  /*
266  * Exit with the right status.
267  */
268  if(0 == rc)
269  {
270  exit(0);
271  }
272  else
273  {
274  exit(2);
275  }
276  /*NOTREACHED*/
277 }
278 
279 
291 void
293  char * pProgName)
294 {
295 #ifdef linux
296  printf("Usage: %s [-v[v]] READERHOSTNAME\n", pProgName);
297  printf("\n");
298  printf("Each -v increases verbosity level\n");
299 #endif /* linux */
300 #ifdef WIN32
301  printf("Usage: %s [/v[v]] READERHOSTNAME\n", pProgName);
302  printf("\n");
303  printf("Each /v increases verbosity level\n");
304 #endif /* WIN32 */
305  exit(1);
306 }
307 
308 
353 int
354 CMyApplication::run (
355  char * pReaderHostName)
356 {
357  CTypeRegistry * pTypeRegistry;
358  CConnection * pConn;
359  int rc;
360 
361  /*
362  * Allocate the type registry. This is needed
363  * by the connection to decode.
364  */
365  pTypeRegistry = getTheTypeRegistry();
366  if(NULL == pTypeRegistry)
367  {
368  printf("ERROR: getTheTypeRegistry failed\n");
369  return -1;
370  }
371 
372  /*
373  * Enroll impinj extension types into the
374  * type registry, in preparation for using
375  * Impinj extension params.
376  */
378 
379  /*
380  * Construct a connection (LLRP::CConnection).
381  * Using a 32kb max frame size for send/recv.
382  * The connection object is ready for business
383  * but not actually connected to the reader yet.
384  */
385  pConn = new CConnection(pTypeRegistry, 32u*1024u);
386  if(NULL == pConn)
387  {
388  printf("ERROR: new CConnection failed\n");
389  return -2;
390  }
391 
392  /*
393  * Open the connection to the reader
394  */
395  if(m_Verbose)
396  {
397  printf("INFO: Connecting to %s....\n", pReaderHostName);
398  }
399 
400  rc = pConn->openConnectionToReader(pReaderHostName);
401  if(0 != rc)
402  {
403  printf("ERROR: connect: %s (%d)\n", pConn->getConnectError(), rc);
404  delete pConn;
405  return -3;
406  }
407 
408  /*
409  * Record the pointer to the connection object so other
410  * routines can use it.
411  */
412  m_pConnectionToReader = pConn;
413 
414  if(m_Verbose)
415  {
416  printf("INFO: Connected, checking status....\n");
417  }
418 
419  /*
420  * Commence the sequence and check for errors as we go.
421  * See comments for each routine for details.
422  * Each routine prints messages.
423  */
424  rc = 1;
425  if(0 == checkConnectionStatus())
426  {
427  rc = 2;
428  if(0 == enableImpinjExtensions())
429  {
430  rc = 3;
431  if(0 == resetConfigurationToFactoryDefaults())
432  {
433  rc = 4;
434  if(0 == getReaderCapabilities())
435  {
436  rc = 5;
437  if(0 == setImpinjReaderConfig())
438  {
439  rc = 6;
440  if(0 == addROSpec())
441  {
442  rc = 7;
443  if(0 == addAccessSpec())
444  {
445  rc = 8;
446  if(0 == enableAccessSpec())
447  {
448  rc = 9;
449  if(0 == enableROSpec())
450  {
451  rc = 10;
452  if(0 == startROSpec())
453  {
454  rc = 11;
455  if(0 == awaitAndPrintReport(60))
456  {
457  rc = 12;
458  if(0 == stopROSpec())
459  {
460  rc = 0;
461  }
462  }
463  }
464  }
465  }
466  }
467  }
468  }
469  }
470  }
471 
472  /*
473  * After we're done, try to leave the reader
474  * in a clean state for next use. This is best
475  * effort and no checking of the result is done.
476  */
477  if(m_Verbose)
478  {
479  printf("INFO: Clean up reader configuration...\n");
480  }
481  resetConfigurationToFactoryDefaults();
482  }
483  }
484 
485  if(m_Verbose)
486  {
487  printf("INFO: Finished\n");
488  }
489 
490  /*
491  * Close the connection and release its resources
492  */
493  pConn->closeConnectionToReader();
494  delete pConn;
495 
496  /*
497  * Done with the registry.
498  */
499  delete pTypeRegistry;
500 
501  /*
502  * When we get here all allocated memory should have been deallocated.
503  */
504 
505  return rc;
506 }
507 
508 
539 int
540 CMyApplication::checkConnectionStatus (void)
541 {
542  CMessage * pMessage;
545  CConnectionAttemptEvent * pEvent;
546 
547  /*
548  * Expect the notification within 10 seconds.
549  * It is suppose to be the very first message sent.
550  */
551  pMessage = recvMessage(10000);
552 
553  /*
554  * recvMessage() returns NULL if something went wrong.
555  */
556  if(NULL == pMessage)
557  {
558  /* recvMessage already tattled */
559  goto fail;
560  }
561 
562  /*
563  * Check to make sure the message is of the right type.
564  * The type label (pointer) in the message should be
565  * the type descriptor for READER_EVENT_NOTIFICATION.
566  */
567  if(&CREADER_EVENT_NOTIFICATION::s_typeDescriptor != pMessage->m_pType)
568  {
569  goto fail;
570  }
571 
572  /*
573  * Now that we are sure it is a READER_EVENT_NOTIFICATION,
574  * traverse to the ReaderEventNotificationData parameter.
575  */
576  pNtf = (CREADER_EVENT_NOTIFICATION *) pMessage;
577  pNtfData = pNtf->getReaderEventNotificationData();
578  if(NULL == pNtfData)
579  {
580  goto fail;
581  }
582 
583  /*
584  * The ConnectionAttemptEvent parameter must be present.
585  */
586  pEvent = pNtfData->getConnectionAttemptEvent();
587  if(NULL == pEvent)
588  {
589  goto fail;
590  }
591 
592  /*
593  * The status in the ConnectionAttemptEvent parameter
594  * must indicate connection success.
595  */
596  if(ConnectionAttemptStatusType_Success != pEvent->getStatus())
597  {
598  goto fail;
599  }
600 
601  /*
602  * Done with the message
603  */
604  delete pMessage;
605 
606  if(m_Verbose)
607  {
608  printf("INFO: Connection status OK\n");
609  }
610 
611  /*
612  * Victory.
613  */
614  return 0;
615 
616  fail:
617  /*
618  * Something went wrong. Tattle. Clean up. Return error.
619  */
620  printf("ERROR: checkConnectionStatus failed\n");
621  delete pMessage;
622  return -1;
623 }
624 
642 int
643 CMyApplication::enableImpinjExtensions (void)
644 {
646  CMessage * pRspMsg;
648 
649  /*
650  * Compose the command message
651  */
652  pCmd = new CIMPINJ_ENABLE_EXTENSIONS();
653  pCmd->setMessageID(m_messageID++);
654  /*
655  * Send the message, expect the response of certain type
656  */
657  pRspMsg = transact(pCmd);
658 
659  /*
660  * Done with the command message
661  */
662  delete pCmd;
663 
664  /*
665  * transact() returns NULL if something went wrong.
666  */
667  if(NULL == pRspMsg)
668  {
669  /* transact already tattled */
670  return -1;
671  }
672 
673  /*
674  * Cast to a CIMPINJ_ENABLE_EXTENSIONS_RESPONSE message.
675  */
676  pRsp = (CIMPINJ_ENABLE_EXTENSIONS_RESPONSE *) pRspMsg;
677 
678  /*
679  * Check the LLRPStatus parameter.
680  */
681  if(0 != checkLLRPStatus(pRsp->getLLRPStatus(),
682  "enableImpinjExtensions"))
683  {
684  /* checkLLRPStatus already tattled */
685  delete pRspMsg;
686  return -1;
687  }
688 
689  /*
690  * Done with the response message.
691  */
692  delete pRspMsg;
693 
694  /*
695  * Tattle progress, maybe
696  */
697  if(m_Verbose)
698  {
699  printf("INFO: Impinj Extensions are enabled\n");
700  }
701 
702  /*
703  * Victory.
704  */
705  return 0;
706 }
707 
728 int
729 CMyApplication::resetConfigurationToFactoryDefaults (void)
730 {
731  CSET_READER_CONFIG * pCmd;
732  CMessage * pRspMsg;
734 
735  /*
736  * Compose the command message
737  */
738  pCmd = new CSET_READER_CONFIG();
739  pCmd->setMessageID(m_messageID++);
740  pCmd->setResetToFactoryDefault(1);
741 
742  /*
743  * Send the message, expect the response of certain type
744  */
745  pRspMsg = transact(pCmd);
746 
747  /*
748  * Done with the command message
749  */
750  delete pCmd;
751 
752  /*
753  * transact() returns NULL if something went wrong.
754  */
755  if(NULL == pRspMsg)
756  {
757  /* transact already tattled */
758  return -1;
759  }
760 
761  /*
762  * Cast to a SET_READER_CONFIG_RESPONSE message.
763  */
764  pRsp = (CSET_READER_CONFIG_RESPONSE *) pRspMsg;
765 
766  /*
767  * Check the LLRPStatus parameter.
768  */
769  if(0 != checkLLRPStatus(pRsp->getLLRPStatus(),
770  "resetConfigurationToFactoryDefaults"))
771  {
772  /* checkLLRPStatus already tattled */
773  delete pRspMsg;
774  return -1;
775  }
776 
777  /*
778  * Done with the response message.
779  */
780  delete pRspMsg;
781 
782  /*
783  * Tattle progress, maybe
784  */
785  if(m_Verbose)
786  {
787  printf("INFO: Configuration reset to factory defaults\n");
788  }
789 
790  /*
791  * Victory.
792  */
793  return 0;
794 }
795 
796 
810 int
811 CMyApplication::getReaderCapabilities(void)
812 {
814  CMessage * pRspMsg;
817 
818 
819  /*
820  * Compose the command message
821  */
822  pCmd = new CGET_READER_CAPABILITIES();
823  pCmd->setMessageID(m_messageID++);
824  pCmd->setRequestedData(GetReaderCapabilitiesRequestedData_All);
825 
826  /*
827  * Send the message, expect the response of certain type
828  */
829  pRspMsg = transact(pCmd);
830 
831  /*
832  * Done with the command message
833  */
834  delete pCmd;
835 
836  /*
837  * transact() returns NULL if something went wrong.
838  */
839  if(NULL == pRspMsg)
840  {
841  /* transact already tattled */
842  return -1;
843  }
844 
845  /*
846  * Cast to a CGET_READER_CAPABILITIES_RESPONSE message.
847  */
848  pRsp = (CGET_READER_CAPABILITIES_RESPONSE *) pRspMsg;
849 
850  /*
851  * Check the LLRPStatus parameter.
852  */
853  if(0 != checkLLRPStatus(pRsp->getLLRPStatus(),
854  "getReaderCapabilities"))
855  {
856  /* checkLLRPStatus already tattled */
857  delete pRspMsg;
858  return -1;
859  }
860 
861  /*
862  ** Get out the general device capabilities
863  */
864  if(NULL == (pDevCap = pRsp->getGeneralDeviceCapabilities()))
865  {
866  delete pRspMsg;
867  return -1;
868  }
869  /* if this parameter is missing, or if this is not an Impinj
870  ** reader, we can't determine its capabilities so we exit
871  ** Impinj Private Enterprise NUmber is 25882 */
872  if( (NULL == (pDevCap = pRsp->getGeneralDeviceCapabilities())) ||
873  (25882 != pDevCap->getDeviceManufacturerName()))
874  {
875  delete pRspMsg;
876  return -1;
877  }
878 
879  /*
880  * Done with the response message.
881  */
882  delete pRspMsg;
883 
884  /*
885  * Tattle progress, maybe
886  */
887  if(m_Verbose)
888  {
889  printf("INFO: Found LLRP Capabilities \n");
890  }
891 
892  /*
893  * Victory.
894  */
895  return 0;
896 }
897 
898 
975 int
976 CMyApplication::setImpinjReaderConfig(void)
977 {
978  CSET_READER_CONFIG *pCmd;
979  CMessage * pRspMsg;
981 
982  /*
983  * Compose the command message
984  */
985  pCmd = new CSET_READER_CONFIG();
986  pCmd->setMessageID(m_messageID++);
987 
989 
990  /*
991  ** Apply this configuration to all antennas
992  */
993  pAnt->setAntennaID(0);
994 
995  /*
996  ** Create the container Inventory command to hold all the parameters
997  */
999 
1000  /*
1001  ** set the Impinj Low Duty Cycle mode as per the use case
1002  */
1003  CImpinjLowDutyCycle *pImpLdc = new CImpinjLowDutyCycle();
1004  pImpLdc->setEmptyFieldTimeout(10000);
1005  pImpLdc->setFieldPingInterval(200);
1006  pImpLdc->setLowDutyCycleMode(ImpinjLowDutyCycleMode_Enabled);
1007  pC1G2Inv->addCustom(pImpLdc);
1008 
1009  /*
1010  ** Don't forget to add the InventoryCommand to the antenna
1011  ** configuration, and then add the antenna configuration to the
1012  ** config message
1013  */
1015  pCmd->addAntennaConfiguration(pAnt);
1016 
1017  /*
1018  ** Don't generate reports automatically, wait until the host
1019  ** asks for a report
1020  */
1021  CROReportSpec *pROrs = new CROReportSpec();
1022  pROrs->setROReportTrigger(ROReportTriggerType_None);
1023  pROrs->setN(0);
1024 
1025  /*
1026  ** Turn off off report data that we don't need since our use
1027  ** case suggests we are bandwidth constrained
1028  */
1030  pROcontent->setEnableAccessSpecID(false);
1031  pROcontent->setEnableAntennaID(false);
1032  pROcontent->setEnableChannelIndex(false);
1033  pROcontent->setEnableFirstSeenTimestamp(true);
1034  pROcontent->setEnableInventoryParameterSpecID(false);
1035  pROcontent->setEnableLastSeenTimestamp(false);
1036  pROcontent->setEnablePeakRSSI(false);
1037  pROcontent->setEnableROSpecID(false);
1038  pROcontent->setEnableSpecIndex(false);
1039  pROcontent->setEnableTagSeenCount(false);
1041  pC1G2Mem->setEnableCRC(false);
1042  pC1G2Mem->setEnablePCBits(false);
1043  pROcontent->addAirProtocolEPCMemorySelector(pC1G2Mem);
1044 
1045  pROrs->setTagReportContentSelector(pROcontent);
1046  pCmd->setROReportSpec(pROrs);
1047 
1048  /*
1049  * Send the message, expect the response of certain type
1050  */
1051  pRspMsg = transact(pCmd);
1052 
1053  /*
1054  * Done with the command message
1055  */
1056  delete pCmd;
1057 
1058  /*
1059  * transact() returns NULL if something went wrong.
1060  */
1061  if(NULL == pRspMsg)
1062  {
1063  /* transact already tattled */
1064  return -1;
1065  }
1066 
1067  /*
1068  * Cast to a CSET_READER_CONFIG_RESPONSE message.
1069  */
1070  pRsp = (CSET_READER_CONFIG_RESPONSE *) pRspMsg;
1071 
1072  /*
1073  * Check the LLRPStatus parameter.
1074  */
1075  if(0 != checkLLRPStatus(pRsp->getLLRPStatus(),
1076  "setImpinjReaderConfig"))
1077  {
1078  /* checkLLRPStatus already tattled */
1079  delete pRspMsg;
1080  return -1;
1081  }
1082 
1083  /*
1084  * Done with the response message.
1085  */
1086  delete pRspMsg;
1087 
1088  /*
1089  * Tattle progress, maybe
1090  */
1091  if(m_Verbose)
1092  {
1093  printf("INFO: Set Impinj Reader Configuration \n");
1094  }
1095 
1096  /*
1097  * Victory.
1098  */
1099  return 0;
1100 }
1101 
1179 int
1180 CMyApplication::addROSpec (void)
1181 {
1182  CROSpecStartTrigger * pROSpecStartTrigger =
1183  new CROSpecStartTrigger();
1184  pROSpecStartTrigger->setROSpecStartTriggerType(
1185  ROSpecStartTriggerType_Null);
1186 
1187  CROSpecStopTrigger * pROSpecStopTrigger = new CROSpecStopTrigger();
1188  pROSpecStopTrigger->setROSpecStopTriggerType(ROSpecStopTriggerType_Null);
1189  pROSpecStopTrigger->setDurationTriggerValue(0); /* n/a */
1190 
1191  CROBoundarySpec * pROBoundarySpec = new CROBoundarySpec();
1192  pROBoundarySpec->setROSpecStartTrigger(pROSpecStartTrigger);
1193  pROBoundarySpec->setROSpecStopTrigger(pROSpecStopTrigger);
1194 
1195  CAISpecStopTrigger * pAISpecStopTrigger = new CAISpecStopTrigger();
1196  pAISpecStopTrigger->setAISpecStopTriggerType(
1197  AISpecStopTriggerType_Null);
1198  pAISpecStopTrigger->setDurationTrigger(0);
1199 
1200  CInventoryParameterSpec * pInventoryParameterSpec =
1202  pInventoryParameterSpec->setInventoryParameterSpecID(1234);
1203  pInventoryParameterSpec->setProtocolID(AirProtocols_EPCGlobalClass1Gen2);
1204 
1205  /* make the bit pattern for the GID mask */
1206  llrp_u1v_t gidMask = llrp_u1v_t(8);
1207  gidMask.m_nBit = 8;
1208  gidMask.m_pValue[0] = 0x33;
1209 
1210  /* build the mask for the GID */
1212  pMaskGID->setMB(1);
1213  pMaskGID->setPointer(32);
1214  pMaskGID->setTagMask(gidMask);
1215 
1216  /* build the inventory action for the GID filter */
1219  pActionGID->setAction(C1G2StateUnawareAction_Select_Unselect);
1220 
1221  /* Build the filter for the GID */
1222  CC1G2Filter *pFilterGID = new CC1G2Filter();
1223  pFilterGID->setC1G2TagInventoryStateUnawareFilterAction(pActionGID);
1224  pFilterGID->setC1G2TagInventoryMask(pMaskGID);
1225  pFilterGID->setT(C1G2TruncateAction_Do_Not_Truncate);
1226 
1227  /* make the bit pattern for the GRAI mask */
1228  llrp_u1v_t graiMask = llrp_u1v_t(8);
1229  graiMask.m_nBit = 8;
1230  graiMask.m_pValue[0] = 0x35;
1231 
1232  /* build the mask for the GRAI */
1233  CC1G2TagInventoryMask *pMaskGRAI = new(CC1G2TagInventoryMask);
1234  pMaskGRAI->setMB(1);
1235  pMaskGRAI->setPointer(32);
1236  pMaskGRAI->setTagMask(graiMask);
1237 
1238  /* build the inventory action for the FRAI filter */
1241  pActionGRAI->setAction(C1G2StateUnawareAction_Select_DoNothing);
1242 
1243  /* Build the filter for the GRAI */
1244  CC1G2Filter *pFilterGRAI = new CC1G2Filter();
1245  pFilterGRAI->setC1G2TagInventoryStateUnawareFilterAction(pActionGRAI);
1246  pFilterGRAI->setC1G2TagInventoryMask(pMaskGRAI);
1247  pFilterGRAI->setT(C1G2TruncateAction_Do_Not_Truncate);
1248 
1249  /* build the inventory command and add both filters */
1251  pInvCmd->setTagInventoryStateAware(false);
1252  pInvCmd->addC1G2Filter(pFilterGID);
1253  pInvCmd->addC1G2Filter(pFilterGRAI);
1254 
1255  /* Build the antennaConfiguration to Contain this */
1256  CAntennaConfiguration * pAntennaConfiguration =
1257  new CAntennaConfiguration();
1258  pAntennaConfiguration->setAntennaID(0);
1259  pAntennaConfiguration->addAirProtocolInventoryCommandSettings(pInvCmd);
1260 
1261  /* don't forget to add this to the INventory Parameter Spec above */
1262  pInventoryParameterSpec->addAntennaConfiguration(pAntennaConfiguration);
1263 
1264  /*
1265  ** Use all Antennas
1266  */
1267  llrp_u16v_t AntennaIDs = llrp_u16v_t(1);
1268  AntennaIDs.m_pValue[0] = 0;
1269 
1270  CAISpec * pAISpec = new CAISpec();
1271  pAISpec->setAntennaIDs(AntennaIDs);
1272  pAISpec->setAISpecStopTrigger(pAISpecStopTrigger);
1273  pAISpec->addInventoryParameterSpec(pInventoryParameterSpec);
1274 
1275  CROSpec * pROSpec = new CROSpec();
1276  pROSpec->setROSpecID(1111);
1277  pROSpec->setPriority(0);
1278  pROSpec->setCurrentState(ROSpecState_Disabled);
1279  pROSpec->setROBoundarySpec(pROBoundarySpec);
1280  pROSpec->addSpecParameter(pAISpec);
1281 
1282  CADD_ROSPEC * pCmd;
1283  CMessage * pRspMsg;
1284  CADD_ROSPEC_RESPONSE * pRsp;
1285 
1286  /*
1287  * Compose the command message.
1288  * N.B.: After the message is composed, all the parameters
1289  * constructed, immediately above, are considered "owned"
1290  * by the command message. When it is destructed so
1291  * too will the parameters be.
1292  */
1293  pCmd = new CADD_ROSPEC();
1294  pCmd->setMessageID(m_messageID++);
1295  pCmd->setROSpec(pROSpec);
1296 
1297  /*
1298  * Send the message, expect the response of certain type
1299  */
1300  pRspMsg = transact(pCmd);
1301 
1302  /*
1303  * Done with the command message.
1304  * N.B.: And the parameters
1305  */
1306  delete pCmd;
1307 
1308  /*
1309  * transact() returns NULL if something went wrong.
1310  */
1311  if(NULL == pRspMsg)
1312  {
1313  /* transact already tattled */
1314  return -1;
1315  }
1316 
1317  /*
1318  * Cast to a ADD_ROSPEC_RESPONSE message.
1319  */
1320  pRsp = (CADD_ROSPEC_RESPONSE *) pRspMsg;
1321 
1322  /*
1323  * Check the LLRPStatus parameter.
1324  */
1325  if(0 != checkLLRPStatus(pRsp->getLLRPStatus(), "addROSpec"))
1326  {
1327  /* checkLLRPStatus already tattled */
1328  delete pRspMsg;
1329  return -1;
1330  }
1331 
1332  /*
1333  * Done with the response message.
1334  */
1335  delete pRspMsg;
1336 
1337  /*
1338  * Tattle progress, maybe
1339  */
1340  if(m_Verbose)
1341  {
1342  printf("INFO: ROSpec added\n");
1343  }
1344 
1345  /*
1346  * Victory.
1347  */
1348  return 0;
1349 }
1350 
1351 
1369 int
1370 CMyApplication::enableROSpec (void)
1371 {
1372  CENABLE_ROSPEC * pCmd;
1373  CMessage * pRspMsg;
1374  CENABLE_ROSPEC_RESPONSE * pRsp;
1375 
1376  /*
1377  * Compose the command message
1378  */
1379  pCmd = new CENABLE_ROSPEC();
1380  pCmd->setMessageID(m_messageID++);
1381  pCmd->setROSpecID(1111);
1382 
1383  /*
1384  * Send the message, expect the response of certain type
1385  */
1386  pRspMsg = transact(pCmd);
1387 
1388  /*
1389  * Done with the command message
1390  */
1391  delete pCmd;
1392 
1393  /*
1394  * transact() returns NULL if something went wrong.
1395  */
1396  if(NULL == pRspMsg)
1397  {
1398  /* transact already tattled */
1399  return -1;
1400  }
1401 
1402  /*
1403  * Cast to a ENABLE_ROSPEC_RESPONSE message.
1404  */
1405  pRsp = (CENABLE_ROSPEC_RESPONSE *) pRspMsg;
1406 
1407  /*
1408  * Check the LLRPStatus parameter.
1409  */
1410  if(0 != checkLLRPStatus(pRsp->getLLRPStatus(), "enableROSpec"))
1411  {
1412  /* checkLLRPStatus already tattled */
1413  delete pRspMsg;
1414  return -1;
1415  }
1416 
1417  /*
1418  * Done with the response message.
1419  */
1420  delete pRspMsg;
1421 
1422  /*
1423  * Tattle progress, maybe
1424  */
1425  if(m_Verbose)
1426  {
1427  printf("INFO: ROSpec enabled\n");
1428  }
1429 
1430  /*
1431  * Victory.
1432  */
1433  return 0;
1434 }
1435 
1436 
1454 int
1455 CMyApplication::startROSpec (void)
1456 {
1457  CSTART_ROSPEC * pCmd;
1458  CMessage * pRspMsg;
1459  CSTART_ROSPEC_RESPONSE * pRsp;
1460 
1461  /*
1462  * Compose the command message
1463  */
1464  pCmd = new CSTART_ROSPEC();
1465  pCmd->setMessageID(m_messageID++);
1466  pCmd->setROSpecID(1111);
1467 
1468  /*
1469  * Send the message, expect the response of certain type
1470  */
1471  pRspMsg = transact(pCmd);
1472 
1473  /*
1474  * Done with the command message
1475  */
1476  delete pCmd;
1477 
1478  /*
1479  * transact() returns NULL if something went wrong.
1480  */
1481  if(NULL == pRspMsg)
1482  {
1483  /* transact already tattled */
1484  return -1;
1485  }
1486 
1487  /*
1488  * Cast to a START_ROSPEC_RESPONSE message.
1489  */
1490  pRsp = (CSTART_ROSPEC_RESPONSE *) pRspMsg;
1491 
1492  /*
1493  * Check the LLRPStatus parameter.
1494  */
1495  if(0 != checkLLRPStatus(pRsp->getLLRPStatus(), "startROSpec"))
1496  {
1497  /* checkLLRPStatus already tattled */
1498  delete pRspMsg;
1499  return -1;
1500  }
1501 
1502  /*
1503  * Done with the response message.
1504  */
1505  delete pRspMsg;
1506 
1507  /*
1508  * Tattle progress
1509  */
1510  if(m_Verbose)
1511  {
1512  printf("INFO: ROSpec started\n");
1513  }
1514 
1515  /*
1516  * Victory.
1517  */
1518  return 0;
1519 }
1520 
1538 int
1539 CMyApplication::stopROSpec (void)
1540 {
1541  CSTOP_ROSPEC * pCmd;
1542  CMessage * pRspMsg;
1543  CSTOP_ROSPEC_RESPONSE * pRsp;
1544 
1545  /*
1546  * Compose the command message
1547  */
1548  pCmd = new CSTOP_ROSPEC();
1549  pCmd->setMessageID(m_messageID++);
1550  pCmd->setROSpecID(1111);
1551 
1552  /*
1553  * Send the message, expect the response of certain type
1554  */
1555  pRspMsg = transact(pCmd);
1556 
1557  /*
1558  * Done with the command message
1559  */
1560  delete pCmd;
1561 
1562  /*
1563  * transact() returns NULL if something went wrong.
1564  */
1565  if(NULL == pRspMsg)
1566  {
1567  /* transact already tattled */
1568  return -1;
1569  }
1570 
1571  /*
1572  * Cast to a STOP_ROSPEC_RESPONSE message.
1573  */
1574  pRsp = (CSTOP_ROSPEC_RESPONSE *) pRspMsg;
1575 
1576  /*
1577  * Check the LLRPStatus parameter.
1578  */
1579  if(0 != checkLLRPStatus(pRsp->getLLRPStatus(), "stopROSpec"))
1580  {
1581  /* checkLLRPStatus already tattled */
1582  delete pRspMsg;
1583  return -1;
1584  }
1585 
1586  /*
1587  * Done with the response message.
1588  */
1589  delete pRspMsg;
1590 
1591  /*
1592  * Tattle progress
1593  */
1594  if(m_Verbose)
1595  {
1596  printf("INFO: ROSpec stopped\n");
1597  }
1598 
1599  /*
1600  * Victory.
1601  */
1602  return 0;
1603 }
1604 
1660 int
1661 CMyApplication::addAccessSpec (void)
1662 {
1663  CADD_ACCESSSPEC * pCmd;
1664  CMessage * pRspMsg;
1665  CADD_ACCESSSPEC_RESPONSE * pRsp;
1666 
1667  pCmd = new CADD_ACCESSSPEC();
1668  pCmd->setMessageID(m_messageID++);
1669 
1670  /* build the C1G2Target Tag with the AccessSpec filter */
1671  CC1G2TargetTag *ptargetTag = new CC1G2TargetTag();
1672  ptargetTag->setMatch(true);
1673  ptargetTag->setMB(1);
1674  ptargetTag->setPointer(16);
1675 
1676  llrp_u1v_t tagData = llrp_u1v_t(24);
1677  tagData.m_nBit = 24;
1678  tagData.m_pValue[0] = 0x30;
1679  tagData.m_pValue[1] = 0x00;
1680  tagData.m_pValue[2] = 0x35;
1681  ptargetTag->setTagData(tagData);
1682 
1683  llrp_u1v_t tagMask = llrp_u1v_t(24);
1684  tagMask.m_nBit = 24;
1685  tagMask.m_pValue[0] = 0xf8;
1686  tagMask.m_pValue[1] = 0x00;
1687  tagMask.m_pValue[2] = 0xff;
1688  ptargetTag->setTagMask(tagMask);
1689 
1690  /* build the AirProtocolTagSpec Add the filter */
1691  CC1G2TagSpec *ptagSpec = new CC1G2TagSpec();
1692  ptagSpec->addC1G2TargetTag(ptargetTag);
1693 
1694  /* Build the read Op Spec */
1695  CC1G2Read *pread = new CC1G2Read();
1696  pread->setAccessPassword(0);
1697  pread->setMB(3);
1698  pread->setOpSpecID(1);
1699  pread->setWordCount(2);
1700  pread->setWordPointer(0);
1701 
1702  /* Create the AccessCommand. Add the TagSpec and the OpSpec */
1703  CAccessCommand *pAccessCommand = new CAccessCommand();
1704  pAccessCommand->setAirProtocolTagSpec(ptagSpec);
1705  pAccessCommand->addAccessCommandOpSpec(pread);
1706 
1707  /* set up the Access Report Spec rule to report only with ROSpecs */
1708  CAccessReportSpec *pAccessReportSpec = new CAccessReportSpec();
1709  pAccessReportSpec->setAccessReportTrigger(
1710  AccessReportTriggerType_Whenever_ROReport_Is_Generated);
1711 
1712  /* set up the stop trigger for the access spec. Do not stop */
1713  CAccessSpecStopTrigger *pAccessStopTrigger = new CAccessSpecStopTrigger();
1714  pAccessStopTrigger->setAccessSpecStopTrigger(
1715  AccessSpecStopTriggerType_Null);
1716  pAccessStopTrigger->setOperationCountValue(0); /* ignored */
1717 
1718  /* Create and configure the AccessSpec */
1719  CAccessSpec *pAccessSpec = new CAccessSpec();
1720  pAccessSpec->setAccessSpecID(23);
1721  pAccessSpec->setAntennaID(0); /* valid for all antennas */
1722  pAccessSpec->setCurrentState(AccessSpecState_Disabled);
1723  pAccessSpec->setProtocolID(AirProtocols_EPCGlobalClass1Gen2);
1724  pAccessSpec->setROSpecID(0); /* valid for All RoSpecs */
1725  pAccessSpec->setAccessSpecStopTrigger(pAccessStopTrigger);
1726  pAccessSpec->setAccessReportSpec(pAccessReportSpec);
1727  pAccessSpec->setAccessCommand(pAccessCommand);
1728 
1729  /* Add the AccessSpec to the ADD_ACCESS_SPEC message */
1730  pCmd->setAccessSpec(pAccessSpec);
1731 
1732  /*
1733  * Send the message, expect the response of certain type
1734  */
1735  pRspMsg = transact(pCmd);
1736 
1737  /*
1738  * Done with the command message
1739  */
1740  delete pCmd;
1741 
1742  /*
1743  * transact() returns NULL if something went wrong.
1744  */
1745  if(NULL == pRspMsg)
1746  {
1747  /* transact already tattled */
1748  return -1;
1749  }
1750 
1751  /*
1752  * Cast to a ADD_ACCESSSPEC_RESPONSE message.
1753  */
1754  pRsp = (CADD_ACCESSSPEC_RESPONSE *) pRspMsg;
1755 
1756  /*
1757  * Check the LLRPStatus parameter.
1758  */
1759  if(0 != checkLLRPStatus(pRsp->getLLRPStatus(), "addAccessSpec"))
1760  {
1761  /* checkLLRPStatus already tattled */
1762  delete pRspMsg;
1763  return -1;
1764  }
1765 
1766  /*
1767  * Done with the response message.
1768  */
1769  delete pRspMsg;
1770 
1771  /*
1772  * Tattle progress, maybe
1773  */
1774  if(m_Verbose)
1775  {
1776  printf("INFO: AccessSpec added\n");
1777  }
1778 
1779  /*
1780  * Victory.
1781  */
1782  return 0;
1783 }
1784 
1785 
1799 int
1800 CMyApplication::enableAccessSpec (void)
1801 {
1802  CENABLE_ACCESSSPEC * pCmd;
1803  CMessage * pRspMsg;
1805 
1806  /*
1807  * Compose the command message
1808  */
1809  pCmd = new CENABLE_ACCESSSPEC();
1810  pCmd->setMessageID(m_messageID++);
1811  pCmd->setAccessSpecID(23);
1812 
1813  /*
1814  * Send the message, expect the response of certain type
1815  */
1816  pRspMsg = transact(pCmd);
1817 
1818  /*
1819  * Done with the command message
1820  */
1821  delete pCmd;
1822 
1823  /*
1824  * transact() returns NULL if something went wrong.
1825  */
1826  if(NULL == pRspMsg)
1827  {
1828  /* transact already tattled */
1829  return -1;
1830  }
1831 
1832  /*
1833  * Cast to a ENABLE_ACCESSSPEC_RESPONSE message.
1834  */
1835  pRsp = (CENABLE_ACCESSSPEC_RESPONSE *) pRspMsg;
1836 
1837  /*
1838  * Check the LLRPStatus parameter.
1839  */
1840  if(0 != checkLLRPStatus(pRsp->getLLRPStatus(), "enableAccessSpec"))
1841  {
1842  /* checkLLRPStatus already tattled */
1843  delete pRspMsg;
1844  return -1;
1845  }
1846 
1847  /*
1848  * Done with the response message.
1849  */
1850  delete pRspMsg;
1851 
1852  /*
1853  * Tattle progress, maybe
1854  */
1855  if(m_Verbose)
1856  {
1857  printf("INFO: AccessSpec enabled\n");
1858  }
1859 
1860  /*
1861  * Victory.
1862  */
1863  return 0;
1864 }
1865 
1866 
1886 int
1887 CMyApplication::awaitAndPrintReport (int timeout)
1888 {
1889  int bDone = 0;
1890  int retVal = 0;
1891  time_t startTime = time(NULL);
1892  time_t tempTime;
1893  time_t pollTime = time(NULL);
1894  /*
1895  * Keep receiving messages until done or until
1896  * something bad happens.
1897  */
1898  while(!bDone)
1899  {
1900  CMessage * pMessage;
1901  const CTypeDescriptor * pType;
1902 
1903  /*
1904  * Wait up to 1 second for a report. Check
1905  * That way, we can check the timestamp even if
1906  * there are no reports coming in
1907  */
1908  pMessage = recvMessage(1000);
1909 
1910  /* validate the timestamp */
1911  tempTime = time(NULL);
1912  if(difftime(tempTime, startTime) > timeout)
1913  {
1914  bDone=1;
1915  }
1916 
1917  if(difftime(tempTime, pollTime) > 10)
1918  {
1919  /* poll the reader for its report data */
1920  CGET_REPORT *preport = new CGET_REPORT();
1921  sendMessage(preport);
1922  delete preport;
1923  pollTime = tempTime;
1924  }
1925 
1926  if(NULL == pMessage)
1927  {
1928  continue;
1929  }
1930 
1931  /*
1932  * What happens depends on what kind of message
1933  * received. Use the type label (m_pType) to
1934  * discriminate message types.
1935  */
1936  pType = pMessage->m_pType;
1937 
1938  /*
1939  * Is it a tag report? If so, print it out.
1940  */
1941  if(&CRO_ACCESS_REPORT::s_typeDescriptor == pType)
1942  {
1943  CRO_ACCESS_REPORT * pNtf;
1944 
1945  pNtf = (CRO_ACCESS_REPORT *) pMessage;
1946 
1947  printTagReportData(pNtf);
1948  }
1949 
1950  /*
1951  * Is it a reader event? This example only recognizes
1952  * AntennaEvents.
1953  */
1954  else if(&CREADER_EVENT_NOTIFICATION::s_typeDescriptor == pType)
1955  {
1957  CReaderEventNotificationData *pNtfData;
1958 
1959  pNtf = (CREADER_EVENT_NOTIFICATION *) pMessage;
1960 
1961  pNtfData = pNtf->getReaderEventNotificationData();
1962  if(NULL != pNtfData)
1963  {
1964  handleReaderEventNotification(pNtfData);
1965  }
1966  else
1967  {
1968  /*
1969  * This should never happen. Using continue
1970  * to keep indent depth down.
1971  */
1972  printf("WARNING: READER_EVENT_NOTIFICATION without data\n");
1973  }
1974  }
1975 
1976  /*
1977  * Hmmm. Something unexpected. Just tattle and keep going.
1978  */
1979  else
1980  {
1981  printf("WARNING: Ignored unexpected message during monitor: %s\n",
1982  pType->m_pName);
1983  }
1984 
1985  /*
1986  * Done with the received message
1987  */
1988  delete pMessage;
1989  }
1990 
1991  return retVal;
1992 }
1993 
1994 
2009 void
2010 CMyApplication::printTagReportData (
2011  CRO_ACCESS_REPORT * pRO_ACCESS_REPORT)
2012 {
2013  std::list<CTagReportData *>::iterator Cur;
2014 
2015  unsigned int nEntry = 0;
2016 
2017  /*
2018  * Loop through and count the number of entries
2019  */
2020  for(
2021  Cur = pRO_ACCESS_REPORT->beginTagReportData();
2022  Cur != pRO_ACCESS_REPORT->endTagReportData();
2023  Cur++)
2024  {
2025  nEntry++;
2026  }
2027 
2028  if(m_Verbose)
2029  {
2030  printf("INFO: %u tag report entries\n", nEntry);
2031  }
2032 
2033  /*
2034  * Loop through again and print each entry.
2035  */
2036  for(
2037  Cur = pRO_ACCESS_REPORT->beginTagReportData();
2038  Cur != pRO_ACCESS_REPORT->endTagReportData();
2039  Cur++)
2040  {
2041  printOneTagReportData(*Cur);
2042  }
2043 }
2044 
2045 
2054 void
2055 CMyApplication::formatOneEPC (
2056  CParameter *pEPCParameter,
2057  char *buf,
2058  int buflen)
2059 {
2060  char * p = buf;
2061  int bufsize = buflen;
2062  int written = 0;
2063 
2064  if(NULL != pEPCParameter)
2065  {
2066  const CTypeDescriptor * pType;
2067  llrp_u96_t my_u96;
2068  llrp_u1v_t my_u1v;
2069  llrp_u8_t * pValue = NULL;
2070  unsigned int n, i;
2071 
2072  pType = pEPCParameter->m_pType;
2073  if(&CEPC_96::s_typeDescriptor == pType)
2074  {
2075  CEPC_96 *pEPC_96;
2076 
2077  pEPC_96 = (CEPC_96 *) pEPCParameter;
2078  my_u96 = pEPC_96->getEPC();
2079  pValue = my_u96.m_aValue;
2080  n = 12u;
2081  }
2082  else if(&CEPCData::s_typeDescriptor == pType)
2083  {
2084  CEPCData * pEPCData;
2085 
2086  pEPCData = (CEPCData *) pEPCParameter;
2087  my_u1v = pEPCData->getEPC();
2088  pValue = my_u1v.m_pValue;
2089  n = (my_u1v.m_nBit + 7u) / 8u;
2090  }
2091 
2092  if(NULL != pValue)
2093  {
2094  for(i = 0; i < n; i++)
2095  {
2096  if(0 < i && i%2 == 0 && 1 < bufsize)
2097  {
2098  *p++ = '-';
2099  bufsize--;
2100  }
2101  if(bufsize > 2)
2102  {
2103  written = snprintf(p, bufsize, "%02X", pValue[i]);
2104  bufsize -= written;
2105  p+= written;
2106  }
2107  }
2108  }
2109  else
2110  {
2111  written = snprintf(p, bufsize, "%s", "---unknown-epc-data-type---");
2112  bufsize -= written;
2113  p += written;
2114  }
2115  }
2116  else
2117  {
2118  written = snprintf(p, bufsize, "%s", "--null epc---");
2119  bufsize -= written;
2120  p += written;
2121  }
2122 
2123  // null terminate this for good practice
2124  buf[buflen-1] = '\0';
2125 }
2126 
2127 
2136 void
2137 CMyApplication::formatOneReadResult (
2138  CParameter *pOpSpecReadResult,
2139  char *buf,
2140  int buflen)
2141 {
2142  EC1G2ReadResultType result;
2143  char * p = buf;
2144  int written = 0;
2145  int bufsize = buflen;
2146  int i;
2147  llrp_u16v_t readData;
2148  CC1G2ReadOpSpecResult *pread = (CC1G2ReadOpSpecResult*) pOpSpecReadResult;
2149 
2150  result = pread->getResult();
2151 
2152  written = snprintf(p, bufsize, "ReadResult %d", result);
2153  p+= written;
2154  bufsize -= written;
2155 
2156  if(result == C1G2ReadResultType_Success)
2157  {
2158  readData = pread->getReadData();
2159 
2160  written = snprintf(p, bufsize, ": Data ");
2161  p+= written;
2162  bufsize -= written;
2163 
2164  for(i = 0; i < readData.m_nValue - 1 ; i++)
2165  {
2166  written =snprintf(p, bufsize, "%04x-", readData.m_pValue[i]);
2167  p+= written;
2168  bufsize -= written;
2169  }
2170  if(readData.m_nValue)
2171  {
2172  written =snprintf(p, bufsize, "%04x", readData.m_pValue[i]);
2173  p+= written;
2174  bufsize -= written;
2175  }
2176  }
2177  buf[buflen-1] = '\0';
2178 }
2179 
2188 void
2189 CMyApplication::printOneTagReportData (
2190  CTagReportData * pTagReportData)
2191 {
2192  char aBuf[64];
2193  char bBuf[64];
2194  std::list<CParameter *>::iterator OpSpecResults;
2195 
2196  /*
2197  * Print the EPC. It could be an 96-bit EPC_96 parameter
2198  * or an variable length EPCData parameter.
2199  */
2200 
2201  CParameter * pEPCParameter =
2202  pTagReportData->getEPCParameter();
2203 
2204  formatOneEPC(pEPCParameter, aBuf, 64);
2205 
2206  /*
2207  ** This section only handles ReadResults. It can be extended in a
2208  ** similar fashion to handle all OpSpecResults
2209  */
2210  bBuf[0] = '\0';
2211  for (
2212  OpSpecResults = pTagReportData->beginAccessCommandOpSpecResult();
2213  OpSpecResults != pTagReportData->endAccessCommandOpSpecResult();
2214  OpSpecResults++)
2215  {
2216  if( (*OpSpecResults)->m_pType == &CC1G2ReadOpSpecResult::s_typeDescriptor)
2217  {
2218  formatOneReadResult(*OpSpecResults, bBuf, 64);
2219  }
2220  }
2221 
2222  /*
2223  * End of line
2224  */
2225  printf("EPC: %s %s\n", aBuf, bBuf);
2226 }
2227 
2228 
2242 void
2243 CMyApplication::handleReaderEventNotification (
2244  CReaderEventNotificationData *pNtfData)
2245 {
2246  CAntennaEvent * pAntennaEvent;
2247  CReaderExceptionEvent * pReaderExceptionEvent;
2248  int nReported = 0;
2249 
2250  pAntennaEvent = pNtfData->getAntennaEvent();
2251  if(NULL != pAntennaEvent)
2252  {
2253  handleAntennaEvent(pAntennaEvent);
2254  nReported++;
2255  }
2256 
2257  pReaderExceptionEvent = pNtfData->getReaderExceptionEvent();
2258  if(NULL != pReaderExceptionEvent)
2259  {
2260  handleReaderExceptionEvent(pReaderExceptionEvent);
2261  nReported++;
2262  }
2263 
2264  /*
2265  * Similarly handle other events here:
2266  * HoppingEvent
2267  * GPIEvent
2268  * ROSpecEvent
2269  * ReportBufferLevelWarningEvent
2270  * ReportBufferOverflowErrorEvent
2271  * RFSurveyEvent
2272  * AISpecEvent
2273  * ConnectionAttemptEvent
2274  * ConnectionCloseEvent
2275  * Custom
2276  */
2277 
2278  if(0 == nReported)
2279  {
2280  printf("NOTICE: Unexpected (unhandled) ReaderEvent\n");
2281  }
2282 }
2283 
2284 
2296 void
2297 CMyApplication::handleAntennaEvent (
2298  CAntennaEvent * pAntennaEvent)
2299 {
2300  EAntennaEventType eEventType;
2301  llrp_u16_t AntennaID;
2302  char * pStateStr;
2303 
2304  eEventType = pAntennaEvent->getEventType();
2305  AntennaID = pAntennaEvent->getAntennaID();
2306 
2307  switch(eEventType)
2308  {
2309  case AntennaEventType_Antenna_Disconnected:
2310  pStateStr = "disconnected";
2311  break;
2312 
2313  case AntennaEventType_Antenna_Connected:
2314  pStateStr = "connected";
2315  break;
2316 
2317  default:
2318  pStateStr = "?unknown-event?";
2319  break;
2320  }
2321 
2322  printf("NOTICE: Antenna %d is %s\n", AntennaID, pStateStr);
2323 }
2324 
2325 
2338 void
2339 CMyApplication::handleReaderExceptionEvent (
2340  CReaderExceptionEvent * pReaderExceptionEvent)
2341 {
2342  llrp_utf8v_t Message;
2343 
2344  Message = pReaderExceptionEvent->getMessage();
2345 
2346  if(0 < Message.m_nValue && NULL != Message.m_pValue)
2347  {
2348  printf("NOTICE: ReaderException '%.*s'\n",
2349  Message.m_nValue, Message.m_pValue);
2350  }
2351  else
2352  {
2353  printf("NOTICE: ReaderException but no message\n");
2354  }
2355 }
2356 
2357 
2376 int
2377 CMyApplication::checkLLRPStatus (
2378  CLLRPStatus * pLLRPStatus,
2379  char * pWhatStr)
2380 {
2381  /*
2382  * The LLRPStatus parameter is mandatory in all responses.
2383  * If it is missing there should have been a decode error.
2384  * This just makes sure (remember, this program is a
2385  * diagnostic and suppose to catch LTKC mistakes).
2386  */
2387  if(NULL == pLLRPStatus)
2388  {
2389  printf("ERROR: %s missing LLRP status\n", pWhatStr);
2390  return -1;
2391  }
2392 
2393  /*
2394  * Make sure the status is M_Success.
2395  * If it isn't, print the error string if one.
2396  * This does not try to pretty-print the status
2397  * code. To get that, run this program with -vv
2398  * and examine the XML output.
2399  */
2400  if(StatusCode_M_Success != pLLRPStatus->getStatusCode())
2401  {
2402  llrp_utf8v_t ErrorDesc;
2403 
2404  ErrorDesc = pLLRPStatus->getErrorDescription();
2405 
2406  if(0 == ErrorDesc.m_nValue)
2407  {
2408  printf("ERROR: %s failed, no error description given\n",
2409  pWhatStr);
2410  }
2411  else
2412  {
2413  printf("ERROR: %s failed, %.*s\n",
2414  pWhatStr, ErrorDesc.m_nValue, ErrorDesc.m_pValue);
2415  }
2416  return -2;
2417  }
2418 
2419  /*
2420  * Victory. Everything is fine.
2421  */
2422  return 0;
2423 }
2424 
2425 
2449 CMessage *
2450 CMyApplication::transact (
2451  CMessage * pSendMsg)
2452 {
2453  CConnection * pConn = m_pConnectionToReader;
2454  CMessage * pRspMsg;
2455 
2456  /*
2457  * Print the XML text for the outbound message if
2458  * verbosity is 2 or higher.
2459  */
2460  if(1 < m_Verbose)
2461  {
2462  printf("\n===================================\n");
2463  printf("INFO: Transact sending\n");
2464  printXMLMessage(pSendMsg);
2465  }
2466 
2467  /*
2468  * Send the message, expect the response of certain type.
2469  * If LLRP::CConnection::transact() returns NULL then there was
2470  * an error. In that case we try to print the error details.
2471  */
2472  pRspMsg = pConn->transact(pSendMsg, 5000);
2473 
2474  if(NULL == pRspMsg)
2475  {
2476  const CErrorDetails * pError = pConn->getTransactError();
2477 
2478  printf("ERROR: %s transact failed, %s\n",
2479  pSendMsg->m_pType->m_pName,
2480  pError->m_pWhatStr ? pError->m_pWhatStr : "no reason given");
2481 
2482  if(NULL != pError->m_pRefType)
2483  {
2484  printf("ERROR: ... reference type %s\n",
2485  pError->m_pRefType->m_pName);
2486  }
2487 
2488  if(NULL != pError->m_pRefField)
2489  {
2490  printf("ERROR: ... reference field %s\n",
2491  pError->m_pRefField->m_pName);
2492  }
2493 
2494  return NULL;
2495  }
2496 
2497  /*
2498  * Print the XML text for the inbound message if
2499  * verbosity is 2 or higher.
2500  */
2501  if(1 < m_Verbose)
2502  {
2503  printf("\n- - - - - - - - - - - - - - - - - -\n");
2504  printf("INFO: Transact received response\n");
2505  printXMLMessage(pRspMsg);
2506  }
2507 
2508  /*
2509  * If it is an ERROR_MESSAGE (response from reader
2510  * when it can't understand the request), tattle
2511  * and declare defeat.
2512  */
2513  if(&CERROR_MESSAGE::s_typeDescriptor == pRspMsg->m_pType)
2514  {
2515  const CTypeDescriptor * pResponseType;
2516 
2517  pResponseType = pSendMsg->m_pType->m_pResponseType;
2518 
2519  printf("ERROR: Received ERROR_MESSAGE instead of %s\n",
2520  pResponseType->m_pName);
2521  delete pRspMsg;
2522  pRspMsg = NULL;
2523  }
2524 
2525  return pRspMsg;
2526 }
2527 
2528 
2553 CMessage *
2554 CMyApplication::recvMessage (
2555  int nMaxMS)
2556 {
2557  CConnection * pConn = m_pConnectionToReader;
2558  CMessage * pMessage;
2559 
2560  /*
2561  * Receive the message subject to a time limit
2562  */
2563  pMessage = pConn->recvMessage(nMaxMS);
2564 
2565  /*
2566  * If LLRP::CConnection::recvMessage() returns NULL then there was
2567  * an error. In that case we try to print the error details.
2568  */
2569  if(NULL == pMessage)
2570  {
2571  const CErrorDetails * pError = pConn->getRecvError();
2572 
2573  /* don't warn on timeout since this is a polling example */
2574  if(pError->m_eResultCode != RC_RecvTimeout)
2575  {
2576  printf("ERROR: recvMessage failed, %s\n",
2577  pError->m_pWhatStr ? pError->m_pWhatStr : "no reason given");
2578  }
2579 
2580  if(NULL != pError->m_pRefType)
2581  {
2582  printf("ERROR: ... reference type %s\n",
2583  pError->m_pRefType->m_pName);
2584  }
2585 
2586  if(NULL != pError->m_pRefField)
2587  {
2588  printf("ERROR: ... reference field %s\n",
2589  pError->m_pRefField->m_pName);
2590  }
2591 
2592  return NULL;
2593  }
2594 
2595  /*
2596  * Print the XML text for the inbound message if
2597  * verbosity is 2 or higher.
2598  */
2599  if(1 < m_Verbose)
2600  {
2601  printf("\n===================================\n");
2602  printf("INFO: Message received\n");
2603  printXMLMessage(pMessage);
2604  }
2605 
2606  return pMessage;
2607 }
2608 
2609 
2627 int
2628 CMyApplication::sendMessage (
2629  CMessage * pSendMsg)
2630 {
2631  CConnection * pConn = m_pConnectionToReader;
2632 
2633  /*
2634  * Print the XML text for the outbound message if
2635  * verbosity is 2 or higher.
2636  */
2637  if(1 < m_Verbose)
2638  {
2639  printf("\n===================================\n");
2640  printf("INFO: Sending\n");
2641  printXMLMessage(pSendMsg);
2642  }
2643 
2644  /*
2645  * If LLRP::CConnection::sendMessage() returns other than RC_OK
2646  * then there was an error. In that case we try to print
2647  * the error details.
2648  */
2649  if(RC_OK != pConn->sendMessage(pSendMsg))
2650  {
2651  const CErrorDetails * pError = pConn->getSendError();
2652 
2653  printf("ERROR: %s sendMessage failed, %s\n",
2654  pSendMsg->m_pType->m_pName,
2655  pError->m_pWhatStr ? pError->m_pWhatStr : "no reason given");
2656 
2657  if(NULL != pError->m_pRefType)
2658  {
2659  printf("ERROR: ... reference type %s\n",
2660  pError->m_pRefType->m_pName);
2661  }
2662 
2663  if(NULL != pError->m_pRefField)
2664  {
2665  printf("ERROR: ... reference field %s\n",
2666  pError->m_pRefField->m_pName);
2667  }
2668 
2669  return -1;
2670  }
2671 
2672  /*
2673  * Victory
2674  */
2675  return 0;
2676 }
2677 
2678 
2692 void
2693 CMyApplication::printXMLMessage (
2694  CMessage * pMessage)
2695 {
2696  char aBuf[100*1024];
2697 
2698  /*
2699  * Convert the message to an XML string.
2700  * This fills the buffer with either the XML string
2701  * or an error message. The return value could
2702  * be checked.
2703  */
2704 
2705  pMessage->toXMLString(aBuf, sizeof aBuf);
2706 
2707  /*
2708  * Print the XML Text to the standard output.
2709  */
2710  printf("%s", aBuf);
2711 }
void setEnableFirstSeenTimestamp(llrp_u1_t value)
Set accessor functions for the LLRP EnableFirstSeenTimestamp field.
llrp_utf8v_t getMessage(void)
Get accessor functions for the LLRP Message field.
void setAccessSpecID(llrp_u32_t value)
Set accessor functions for the LLRP AccessSpecID field.
void setROSpecID(llrp_u32_t value)
Set accessor functions for the LLRP ROSpecID field.
Class Definition CConnectionAttemptEvent for LLRP parameter ConnectionAttemptEvent.
void setEnableCRC(llrp_u1_t value)
Set accessor functions for the LLRP EnableCRC field.
Class Definition CADD_ACCESSSPEC_RESPONSE for LLRP message ADD_ACCESSSPEC_RESPONSE.
void setAccessSpecID(llrp_u32_t value)
Set accessor functions for the LLRP AccessSpecID field.
void setAccessPassword(llrp_u32_t value)
Set accessor functions for the LLRP AccessPassword field.
EResultCode addCustom(CParameter *pValue)
Add a Custom to the LLRP sub-parameter list.
char * m_pName
String name of field (e.g. "ROSpecID")
Definition: ltkcpp_base.h:840
const CTypeDescriptor * m_pType
The type descriptor desribing this element.
Definition: ltkcpp_base.h:972
void setWordPointer(llrp_u16_t value)
Set accessor functions for the LLRP WordPointer field.
Class Definition CEPC_96 for LLRP parameter EPC_96.
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
llrp_u8_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:443
Class for LLRP basic type u16v (List of unsigned 16-bit values)
Definition: ltkcpp_base.h:179
Class Definition CIMPINJ_ENABLE_EXTENSIONS_RESPONSE for LLRP message IMPINJ_ENABLE_EXTENSIONS_RESPONS...
void setDurationTrigger(llrp_u32_t value)
Set accessor functions for the LLRP DurationTrigger field.
void setEnablePeakRSSI(llrp_u1_t value)
Set accessor functions for the LLRP EnablePeakRSSI field.
Class Definition CSTART_ROSPEC_RESPONSE for LLRP message START_ROSPEC_RESPONSE.
Class Definition CAccessCommand for LLRP parameter AccessCommand.
const CFieldDescriptor * m_pRefField
If non-NULL this is the field descriptors for the errored field.
Definition: ltkcpp_base.h:641
void setMatch(llrp_u1_t value)
Set accessor functions for the LLRP Match field.
void setDurationTriggerValue(llrp_u32_t value)
Set accessor functions for the LLRP DurationTriggerValue field.
Class Definition CENABLE_ROSPEC for LLRP message ENABLE_ROSPEC.
void setEnableLastSeenTimestamp(llrp_u1_t value)
Set accessor functions for the LLRP EnableLastSeenTimestamp field.
const CTypeDescriptor * m_pRefType
If non-NULL this is the type descriptors for the errored type.
Definition: ltkcpp_base.h:639
Class Definition CC1G2TagInventoryMask for LLRP parameter C1G2TagInventoryMask.
std::list< CParameter * >::iterator endAccessCommandOpSpecResult(void)
Returns the last element of the AccessCommandOpSpecResult sub-parameter list.
void setTagData(llrp_u1v_t value)
Set accessor functions for the LLRP TagData field.
void setROReportTrigger(EROReportTriggerType value)
Set accessor functions for the LLRP ROReportTrigger field.
void setProtocolID(EAirProtocols value)
Set accessor functions for the LLRP ProtocolID field.
EResultCode addAirProtocolEPCMemorySelector(CParameter *pValue)
Add a AirProtocolEPCMemorySelector to the LLRP sub-parameter list.
void setFieldPingInterval(llrp_u16_t value)
Set accessor functions for the LLRP FieldPingInterval field.
CParameter * getEPCParameter(void)
Get accessor functions for the LLRP EPCParameter sub-parameter.
EResultCode m_eResultCode
Result code from operation.
Definition: ltkcpp_base.h:635
Class for LLRP basic type u96 (96-bit value)
Definition: ltkcpp_base.h:566
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
Class Definition CAntennaEvent for LLRP parameter AntennaEvent.
Class Definition CENABLE_ACCESSSPEC for LLRP message ENABLE_ACCESSSPEC.
Class Definition CSTOP_ROSPEC_RESPONSE for LLRP message STOP_ROSPEC_RESPONSE.
void setAISpecStopTriggerType(EAISpecStopTriggerType value)
Set accessor functions for the LLRP AISpecStopTriggerType field.
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
void setAction(EC1G2StateUnawareAction value)
Set accessor functions for the LLRP Action field.
void setPointer(llrp_u16_t value)
Set accessor functions for the LLRP Pointer field.
void enrollImpinjTypesIntoRegistry(CTypeRegistry *pTypeRegistry)
Enrolls the types for Impinj into the LTKCPP registry.
void usage(char *pProgName)
Print usage message and exit.
Definition: docsample3.cpp:292
llrp_u96_t getEPC(void)
Get accessor functions for the LLRP EPC field.
void setAccessReportTrigger(EAccessReportTriggerType value)
Set accessor functions for the LLRP AccessReportTrigger field.
const char * m_pWhatStr
Descriptive printable error string.
Definition: ltkcpp_base.h:637
void setWordCount(llrp_u16_t value)
Set accessor functions for the LLRP WordCount field.
EResultCode toXMLString(char *pBuffer, int nBuffer)
A wrapper around LLRP::toXMLString()
Class Definition CGeneralDeviceCapabilities for LLRP parameter GeneralDeviceCapabilities.
void setROSpecID(llrp_u32_t value)
Set accessor functions for the LLRP ROSpecID field.
Class Definition CImpinjLowDutyCycle for LLRP parameter ImpinjLowDutyCycle.
void setCurrentState(EAccessSpecState value)
Set accessor functions for the LLRP CurrentState field.
Class Definition CROReportSpec for LLRP parameter ROReportSpec.
EStatusCode getStatusCode(void)
Get accessor functions for the LLRP StatusCode field.
void setRequestedData(EGetReaderCapabilitiesRequestedData value)
Set accessor functions for the LLRP RequestedData field.
Class Definition CC1G2TagInventoryStateUnawareFilterAction for LLRP parameter C1G2TagInventoryStateUn...
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:484
void setPointer(llrp_u16_t value)
Set accessor functions for the LLRP Pointer field.
Class Definition CAccessSpecStopTrigger for LLRP parameter AccessSpecStopTrigger. ...
int closeConnectionToReader(void)
Close connection to reader, allow reuse of instance.
CGeneralDeviceCapabilities * getGeneralDeviceCapabilities(void)
Get accessor functions for the LLRP GeneralDeviceCapabilities sub-parameter.
Class Definition CROSpecStartTrigger for LLRP parameter ROSpecStartTrigger.
EAntennaEventType getEventType(void)
Get accessor functions for the LLRP EventType field.
void setOperationCountValue(llrp_u16_t value)
Set accessor functions for the LLRP OperationCountValue field.
A collection of pointers to CTypeDescriptors.
Definition: ltkcpp_base.h:885
CAntennaEvent * getAntennaEvent(void)
Get accessor functions for the LLRP AntennaEvent sub-parameter.
llrp_u32_t getDeviceManufacturerName(void)
Get accessor functions for the LLRP DeviceManufacturerName field.
const CErrorDetails * getTransactError(void)
Get the details that explains transact() error.
EResultCode setROBoundarySpec(CROBoundarySpec *pValue)
Set accessor functions for the LLRP ROBoundarySpec sub-parameter.
void setLowDutyCycleMode(EImpinjLowDutyCycleMode value)
Set accessor functions for the LLRP LowDutyCycleMode field.
Class Definition CRO_ACCESS_REPORT for LLRP message RO_ACCESS_REPORT.
Class Definition CC1G2ReadOpSpecResult for LLRP parameter C1G2ReadOpSpecResult.
void setEnableAccessSpecID(llrp_u1_t value)
Set accessor functions for the LLRP EnableAccessSpecID field.
Class Definition CAISpec for LLRP parameter AISpec.
Class Definition CROSpec for LLRP parameter ROSpec.
void setROSpecID(llrp_u32_t value)
Set accessor functions for the LLRP ROSpecID field.
Class Definition CInventoryParameterSpec for LLRP parameter InventoryParameterSpec.
EResultCode setC1G2TagInventoryStateUnawareFilterAction(CC1G2TagInventoryStateUnawareFilterAction *pValue)
Set accessor functions for the LLRP C1G2TagInventoryStateUnawareFilterAction sub-parameter.
Class Definition CSET_READER_CONFIG_RESPONSE for LLRP message SET_READER_CONFIG_RESPONSE.
void setEnableTagSeenCount(llrp_u1_t value)
Set accessor functions for the LLRP EnableTagSeenCount field.
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
EResultCode setAccessSpec(CAccessSpec *pValue)
Set accessor functions for the LLRP AccessSpec sub-parameter.
CReaderExceptionEvent * getReaderExceptionEvent(void)
Get accessor functions for the LLRP ReaderExceptionEvent sub-parameter.
Class Definition CReaderExceptionEvent for LLRP parameter ReaderExceptionEvent.
Class Definition CLLRPStatus for LLRP parameter LLRPStatus.
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
EResultCode addSpecParameter(CParameter *pValue)
Add a SpecParameter to the LLRP sub-parameter list.
Class Definition CEPCData for LLRP parameter EPCData.
Class Definition CREADER_EVENT_NOTIFICATION for LLRP message READER_EVENT_NOTIFICATION.
Class Definition CAccessSpec for LLRP parameter AccessSpec.
CMessage * recvMessage(int nMaxMS)
Receive a message from a connection.
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:183
std::list< CTagReportData * >::iterator beginTagReportData(void)
Returns the first element of the TagReportData sub-parameter list.
void setTagInventoryStateAware(llrp_u1_t value)
Set accessor functions for the LLRP TagInventoryStateAware field.
EResultCode setAISpecStopTrigger(CAISpecStopTrigger *pValue)
Set accessor functions for the LLRP AISpecStopTrigger sub-parameter.
EResultCode setTagReportContentSelector(CTagReportContentSelector *pValue)
Set accessor functions for the LLRP TagReportContentSelector sub-parameter.
File that includes all Impinj Custom extension classes and types.
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
Class Definition CADD_ACCESSSPEC for LLRP message ADD_ACCESSSPEC.
void setEnableChannelIndex(llrp_u1_t value)
Set accessor functions for the LLRP EnableChannelIndex field.
void setROSpecStartTriggerType(EROSpecStartTriggerType value)
Set accessor functions for the LLRP ROSpecStartTriggerType field.
llrp_u1v_t getEPC(void)
Get accessor functions for the LLRP EPC field.
Class Definition CSET_READER_CONFIG for LLRP message SET_READER_CONFIG.
CMessage * transact(CMessage *pSendMessage, int nMaxMS)
Transact a LLRP request and response to a connection.
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
Class Definition CAccessReportSpec for LLRP parameter AccessReportSpec.
void setEnablePCBits(llrp_u1_t value)
Set accessor functions for the LLRP EnablePCBits field.
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)
Definition: ltkcpp_base.h:480
llrp_u16_t m_nBit
The number of arrray elements.
Definition: ltkcpp_base.h:441
void setTagMask(llrp_u1v_t value)
Set accessor functions for the LLRP TagMask field.
Class for LLRP basic type u1v (vector of unsigned 1-bit values)
Definition: ltkcpp_base.h:437
void setAntennaIDs(llrp_u16v_t value)
Set accessor functions for the LLRP AntennaIDs field.
EResultCode addAntennaConfiguration(CAntennaConfiguration *pValue)
Add a AntennaConfiguration to the LLRP sub-parameter list.
int openConnectionToReader(const char *pReaderHostName)
Open a connection to the reader over an unencrypted socket.
void setT(EC1G2TruncateAction value)
Set accessor functions for the LLRP T field.
Class Definition CENABLE_ROSPEC_RESPONSE for LLRP message ENABLE_ROSPEC_RESPONSE. ...
EResultCode addC1G2TargetTag(CC1G2TargetTag *pValue)
Add a C1G2TargetTag to the LLRP sub-parameter list.
Class Definition CGET_READER_CAPABILITIES for LLRP message GET_READER_CAPABILITIES.
Class Definition CC1G2Read for LLRP parameter C1G2Read.
const CTypeDescriptor * m_pResponseType
For messages (bIsMessage==TRUE), this is the type descriptor for the corresponding response...
Definition: ltkcpp_base.h:776
void setProtocolID(EAirProtocols value)
Set accessor functions for the LLRP ProtocolID field.
void setMB(llrp_u2_t value)
Set accessor functions for the LLRP MB field.
void setMB(llrp_u2_t value)
Set accessor functions for the LLRP MB field.
EResultCode sendMessage(CMessage *pMessage)
Send a LLRP message to a connection.
std::list< CTagReportData * >::iterator endTagReportData(void)
Returns the last element of the TagReportData sub-parameter list.
Class to return error details in LTKCPP operations.
Definition: ltkcpp_base.h:631
void setN(llrp_u16_t value)
Set accessor functions for the LLRP N field.
void setMB(llrp_u2_t value)
Set accessor functions for the LLRP MB field.
Class Definition CTagReportData for LLRP parameter TagReportData.
char * m_pName
String name of parameter/message type (e.g. "ROSpec")
Definition: ltkcpp_base.h:762
EResultCode setROSpec(CROSpec *pValue)
Set accessor functions for the LLRP ROSpec sub-parameter.
EResultCode setAccessSpecStopTrigger(CAccessSpecStopTrigger *pValue)
Set accessor functions for the LLRP AccessSpecStopTrigger sub-parameter.
void setAccessSpecStopTrigger(EAccessSpecStopTriggerType value)
Set accessor functions for the LLRP AccessSpecStopTrigger field.
llrp_u16_t getAntennaID(void)
Get accessor functions for the LLRP AntennaID field.
File that includes all LLRP classes and types.
Class Definition CC1G2InventoryCommand for LLRP parameter C1G2InventoryCommand.
Class Definition CADD_ROSPEC for LLRP message ADD_ROSPEC.
void setAntennaID(llrp_u16_t value)
Set accessor functions for the LLRP AntennaID field.
Class Definition CSTART_ROSPEC for LLRP message START_ROSPEC.
void setROSpecStopTriggerType(EROSpecStopTriggerType value)
Set accessor functions for the LLRP ROSpecStopTriggerType field.
Class Definition CIMPINJ_ENABLE_EXTENSIONS for LLRP message IMPINJ_ENABLE_EXTENSIONS.
EResultCode setROSpecStopTrigger(CROSpecStopTrigger *pValue)
Set accessor functions for the LLRP ROSpecStopTrigger sub-parameter.
int main(int ac, char *av[])
Command main routine.
Definition: docsample3.cpp:210
Class Definition CAntennaConfiguration for LLRP parameter AntennaConfiguration.
Class Definition CROSpecStopTrigger for LLRP parameter ROSpecStopTrigger.
EResultCode addC1G2Filter(CC1G2Filter *pValue)
Add a C1G2Filter to the LLRP sub-parameter list.
void setInventoryParameterSpecID(llrp_u16_t value)
Set accessor functions for the LLRP InventoryParameterSpecID field.
llrp_u16_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:185
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
llrp_u8_t m_aValue[12]
Simple array of basic type llrp_u8_t.
Definition: ltkcpp_base.h:570
Class Definition CC1G2TargetTag for LLRP parameter C1G2TargetTag.
Base Class for All LLRP LTK Parameters.
Definition: ltkcpp_base.h:1125
Base Class for All LLRP LTK Messages.
Definition: ltkcpp_base.h:1088
void setOpSpecID(llrp_u16_t value)
Set accessor functions for the LLRP OpSpecID field.
EResultCode setROReportSpec(CROReportSpec *pValue)
Set accessor functions for the LLRP ROReportSpec sub-parameter.
CLLRPStatus * getLLRPStatus(void)
Get accessor functions for the LLRP LLRPStatus sub-parameter.
Class Definition CADD_ROSPEC_RESPONSE for LLRP message ADD_ROSPEC_RESPONSE.
EResultCode addAirProtocolInventoryCommandSettings(CParameter *pValue)
Add a AirProtocolInventoryCommandSettings to the LLRP sub-parameter list.
Class Definition CAISpecStopTrigger for LLRP parameter AISpecStopTrigger.
const char * getConnectError(void)
Get the string that explains openReaderConnection() error.
void setEnableInventoryParameterSpecID(llrp_u1_t value)
Set accessor functions for the LLRP EnableInventoryParameterSpecID field.
void setROSpecID(llrp_u32_t value)
Set accessor functions for the LLRP ROSpecID field.
void setEnableAntennaID(llrp_u1_t value)
Set accessor functions for the LLRP EnableAntennaID field.
CReaderEventNotificationData * getReaderEventNotificationData(void)
Get accessor functions for the LLRP ReaderEventNotificationData sub-parameter.
void setResetToFactoryDefault(llrp_u1_t value)
Set accessor functions for the LLRP ResetToFactoryDefault field.
Definition: ltkcpp.h:45
EResultCode addAccessCommandOpSpec(CParameter *pValue)
Add a AccessCommandOpSpec to the LLRP sub-parameter list.
void setTagMask(llrp_u1v_t value)
Set accessor functions for the LLRP TagMask field.
void setAntennaID(llrp_u16_t value)
Set accessor functions for the LLRP AntennaID field.
EResultCode setROSpecStartTrigger(CROSpecStartTrigger *pValue)
Set accessor functions for the LLRP ROSpecStartTrigger sub-parameter.
EResultCode addAntennaConfiguration(CAntennaConfiguration *pValue)
Add a AntennaConfiguration to the LLRP sub-parameter list.
llrp_u16v_t getReadData(void)
Get accessor functions for the LLRP ReadData field.
Class Definition CC1G2EPCMemorySelector for LLRP parameter C1G2EPCMemorySelector. ...
void setEnableSpecIndex(llrp_u1_t value)
Set accessor functions for the LLRP EnableSpecIndex field.
EResultCode setC1G2TagInventoryMask(CC1G2TagInventoryMask *pValue)
Set accessor functions for the LLRP C1G2TagInventoryMask sub-parameter.
EResultCode setAirProtocolTagSpec(CParameter *pValue)
Set accessor functions for the LLRP AirProtocolTagSpec sub-parameter.
Class Definition CGET_READER_CAPABILITIES_RESPONSE for LLRP message GET_READER_CAPABILITIES_RESPONSE...
EResultCode setAccessCommand(CAccessCommand *pValue)
Set accessor functions for the LLRP AccessCommand sub-parameter.
llrp_utf8v_t getErrorDescription(void)
Get accessor functions for the LLRP ErrorDescription field.
Class Definition CTagReportContentSelector for LLRP parameter TagReportContentSelector.
Class Definition CENABLE_ACCESSSPEC_RESPONSE for LLRP message ENABLE_ACCESSSPEC_RESPONSE.
EC1G2ReadResultType getResult(void)
Get accessor functions for the LLRP Result field.
Class Definition CSTOP_ROSPEC for LLRP message STOP_ROSPEC.
EResultCode setAccessReportSpec(CAccessReportSpec *pValue)
Set accessor functions for the LLRP AccessReportSpec sub-parameter.
LLRP connection class.
std::list< CParameter * >::iterator beginAccessCommandOpSpecResult(void)
Returns the first element of the AccessCommandOpSpecResult sub-parameter list.
void setCurrentState(EROSpecState value)
Set accessor functions for the LLRP CurrentState field.
Class Definition CC1G2Filter for LLRP parameter C1G2Filter.
void setEnableROSpecID(llrp_u1_t value)
Set accessor functions for the LLRP EnableROSpecID field.
llrp_utf8_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:486
Class Definition CGET_REPORT for LLRP message GET_REPORT.
EResultCode addInventoryParameterSpec(CInventoryParameterSpec *pValue)
Add a InventoryParameterSpec to the LLRP sub-parameter list.
void setROSpecID(llrp_u32_t value)
Set accessor functions for the LLRP ROSpecID field.
void setPriority(llrp_u8_t value)
Set accessor functions for the LLRP Priority field.
Class Definition CROBoundarySpec for LLRP parameter ROBoundarySpec.
void setEmptyFieldTimeout(llrp_u16_t value)
Set accessor functions for the LLRP EmptyFieldTimeout field.
CConnectionAttemptEvent * getConnectionAttemptEvent(void)
Get accessor functions for the LLRP ConnectionAttemptEvent sub-parameter.
Describes a message or parameter type.
Definition: ltkcpp_base.h:755
const CErrorDetails * getSendError(void)
Get the details that explains sendMessage() error.
EConnectionAttemptStatusType getStatus(void)
Get accessor functions for the LLRP Status field.
Class Definition CC1G2TagSpec for LLRP parameter C1G2TagSpec.
Class Definition CReaderEventNotificationData for LLRP parameter ReaderEventNotificationData.