00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <stdlib.h>
00031 #include <stdio.h>
00032 #include <string.h>
00033
00034 #include "tm_reader.h"
00035 #include "serial_reader_imp.h"
00036 #include "tmr_utils.h"
00037 #include "osdep.h"
00038
00039 #define HASPORT(mask, port) ((1 << ((port)-1)) & (mask))
00040 #define TMR_MAX_PROTOCOLS (32)
00041
00042 #ifdef TMR_ENABLE_SERIAL_READER
00043
00044 static TMR_Status
00045 initTxRxMapFromPorts(TMR_Reader *reader)
00046 {
00047 TMR_Status ret;
00048 TMR_SR_PortDetect ports[TMR_SR_MAX_ANTENNA_PORTS];
00049 uint8_t i, numPorts;
00050 TMR_SR_SerialReader *sr;
00051
00052 numPorts = numberof(ports);
00053 sr = &reader->u.serialReader;
00054
00055
00056 ret = TMR_SR_cmdAntennaDetect(reader, &numPorts, ports);
00057 if (TMR_SUCCESS != ret)
00058 {
00059 return ret;
00060 }
00061 sr->portMask = 0;
00062
00063
00064 switch (sr->productId)
00065 {
00066 case 0x0001:
00067 {
00068
00069 TMR_AntennaMap newMap[] = {{1,2,2}, {2,5,5}, {3,1,1}};
00070 numPorts = 3;
00071
00072 for (i = 0; i < numPorts; i++)
00073 {
00074 sr->portMask |= 1 << (newMap[i].antenna - 1);
00075 sr->staticTxRxMapData[i].antenna = newMap[i].antenna;
00076 sr->staticTxRxMapData[i].rxPort = newMap[i].rxPort;
00077 sr->staticTxRxMapData[i].txPort = newMap[i].txPort;
00078
00079 if (0 == reader->tagOpParams.antenna && ports[i].detected)
00080 {
00081 reader->tagOpParams.antenna = ports[i].port;
00082 }
00083 }
00084 break;
00085 }
00086
00087 case 0x0002:
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 if ((TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]) &&
00098 (sr->versionInfo.hardware[3] == TMR_SR_MODEL_M6E_MICRO_USB))
00099 {
00100 numPorts = 1;
00101
00102
00103 for (i = 0; i < numPorts; i++)
00104 {
00105 sr->portMask |= 1 << (ports[i].port - 1);
00106 sr->staticTxRxMapData[i].antenna = ports[i].port;
00107 sr->staticTxRxMapData[i].txPort = ports[i].port;
00108 sr->staticTxRxMapData[i].rxPort = ports[i].port;
00109
00110 if (0 == reader->tagOpParams.antenna && ports[i].detected)
00111 {
00112 reader->tagOpParams.antenna = ports[i].port;
00113 }
00114 }
00115 break;
00116 }
00117 default:
00118 {
00119 for (i = 0; i < numPorts; i++)
00120 {
00121 sr->portMask |= 1 << (ports[i].port - 1);
00122 sr->staticTxRxMapData[i].antenna = ports[i].port;
00123 sr->staticTxRxMapData[i].txPort = ports[i].port;
00124 sr->staticTxRxMapData[i].rxPort = ports[i].port;
00125
00126 if (0 == reader->tagOpParams.antenna && ports[i].detected)
00127 {
00128 reader->tagOpParams.antenna = ports[i].port;
00129 }
00130 }
00131 break;
00132 }
00133 }
00134
00135 sr->staticTxRxMap.max = TMR_SR_MAX_ANTENNA_PORTS;
00136 sr->staticTxRxMap.len = numPorts;
00137 sr->staticTxRxMap.list = sr->staticTxRxMapData;
00138 sr->txRxMap = &sr->staticTxRxMap;
00139
00140 return TMR_SUCCESS;
00141 }
00142
00143 static TMR_Status
00144 TMR_SR_configPreamble(TMR_SR_SerialReader *sr)
00145 {
00146 TMR_Status ret = TMR_SUCCESS;
00147 bool value;
00148
00149
00150 switch (sr->versionInfo.hardware[0])
00151 {
00152 case TMR_SR_MODEL_M6E:
00153 case TMR_SR_MODEL_MICRO:
00154 case TMR_SR_MODEL_M6E_I:
00155 value = true;
00156 break;
00157 case TMR_SR_MODEL_M6E_NANO:
00158 value = false;
00159 break;
00160 default:
00161 value = false;
00162 break;
00163 }
00164 sr->supportsPreamble = value;
00165
00166 return ret;
00167 }
00168
00169 static TMR_Status
00170 TMR_SR_boot(TMR_Reader *reader, uint32_t currentBaudRate)
00171 {
00172 TMR_Status ret;
00173 uint8_t program;
00174 bool boolval;
00175 TMR_SR_SerialReader *sr;
00176 TMR_SR_SerialTransport *transport;
00177 int i;
00178 bool value;
00179
00180 ret = TMR_SUCCESS;
00181 sr = &reader->u.serialReader;
00182 transport = &sr->transport;
00183
00184
00185 ret = TMR_SR_cmdGetCurrentProgram(reader, &program);
00186 if (TMR_SUCCESS != ret)
00187 {
00188 return ret;
00189 }
00190
00191
00192 if ((program & 0x3) == 1)
00193 {
00194 ret = TMR_SR_cmdBootFirmware(reader);
00195 if (TMR_SUCCESS != ret)
00196 {
00197 return ret;
00198 }
00199 }
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210 ret = TMR_SR_configPreamble(sr);
00211 if (TMR_SUCCESS != ret)
00212 {
00213 return ret;
00214 }
00215
00216
00217
00218
00219
00220
00221 if (sr->powerMode == TMR_SR_POWER_MODE_INVALID)
00222 {
00223 ret = TMR_paramGet(reader, TMR_PARAM_POWERMODE, &sr->powerMode);
00224 if (TMR_SUCCESS != ret)
00225 {
00226 return ret;
00227 }
00228 }
00229
00233 if ((TMR_SR_MODEL_M6E == reader->u.serialReader.versionInfo.hardware[0]) ||
00234 (TMR_SR_MODEL_M6E_I == reader->u.serialReader.versionInfo.hardware[0]) ||
00235 (TMR_SR_MODEL_M6E_NANO == reader->u.serialReader.versionInfo.hardware[0]) ||
00236 (TMR_SR_MODEL_MICRO == reader->u.serialReader.versionInfo.hardware[0]))
00237 {
00241 ret = TMR_SR_cmdGetReaderConfiguration(reader, TMR_SR_CONFIGURATION_CURRENT_MSG_TRANSPORT, &reader->u.serialReader.transportType);
00242 if (TMR_SUCCESS != ret)
00243 {
00244 return ret;
00245 }
00249 if (TMR_SR_MSG_SOURCE_USB == reader->u.serialReader.transportType)
00250 {
00251 value = false;
00252 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_SEND_CRC, &value);
00253 if (TMR_SUCCESS == ret)
00254 {
00255 reader->u.serialReader.crcEnabled = false;
00256 }
00257 else
00258 {
00262 }
00263 }
00264 }
00265
00266 if (sr->baudRate != currentBaudRate)
00267 {
00268 if (NULL != transport->setBaudRate)
00269 {
00276
00277 ret = TMR_SR_cmdSetBaudRate(reader, sr->baudRate);
00278 if (TMR_SUCCESS != ret)
00279 {
00280 return ret;
00281 }
00282
00283 ret = transport->setBaudRate(transport, sr->baudRate);
00284 if (TMR_SUCCESS != ret)
00285 {
00286 return ret;
00287 }
00288 }
00289 }
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299 sr->gpioDirections = -1;
00300 reader->continuousReading = ((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) ||
00301 (TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]) ||
00302 (TMR_SR_MODEL_M6E_NANO == reader->u.serialReader.versionInfo.hardware[0]) ||
00303 (TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]));
00304 reader->continuousReading = false;
00305
00311 if (
00312 (((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) || (TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]))
00313 && compareVersion(reader, 1, 21, 1, 2))
00314 || ((TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]) && compareVersion(reader, 1, 3, 0, 20))
00315 || ((TMR_SR_MODEL_M6E_NANO == sr->versionInfo.hardware[0]) && compareVersion(reader, 1, 3, 2, 74))
00316 )
00317 {
00318 reader->_storeSupportsResetStats = true;
00319 reader->pSupportsResetStats = &(reader->_storeSupportsResetStats);
00320 }
00321 else
00322 {
00323 reader->_storeSupportsResetStats = false;
00324 reader->pSupportsResetStats = &(reader->_storeSupportsResetStats);
00325 }
00326
00327
00328
00329
00330
00331
00332 for (i = 0 ; i < TMR_PARAMWORDS; i++)
00333 {
00334 sr->paramPresent[i] = 0;
00335 }
00336
00337 BITSET(sr->paramPresent, TMR_PARAM_BAUDRATE);
00338 BITSET(sr->paramPresent, TMR_PARAM_PROBEBAUDRATES);
00339 BITSET(sr->paramPresent, TMR_PARAM_COMMANDTIMEOUT);
00340 BITSET(sr->paramPresent, TMR_PARAM_TRANSPORTTIMEOUT);
00341 BITSET(sr->paramPresent, TMR_PARAM_POWERMODE);
00342 BITSET(sr->paramPresent, TMR_PARAM_USERMODE);
00343 BITSET(sr->paramPresent, TMR_PARAM_ANTENNA_CHECKPORT);
00344 BITSET(sr->paramPresent, TMR_PARAM_ANTENNA_PORTLIST);
00345 BITSET(sr->paramPresent, TMR_PARAM_ANTENNA_CONNECTEDPORTLIST);
00346 BITSET(sr->paramPresent, TMR_PARAM_ANTENNA_PORTSWITCHGPOS);
00347 BITSET(sr->paramPresent, TMR_PARAM_ANTENNA_SETTLINGTIMELIST);
00348 BITSET(sr->paramPresent, TMR_PARAM_ANTENNA_RETURNLOSS);
00349 BITSET(sr->paramPresent, TMR_PARAM_ANTENNA_TXRXMAP);
00350 BITSET(sr->paramPresent, TMR_PARAM_GPIO_INPUTLIST);
00351 BITSET(sr->paramPresent, TMR_PARAM_GPIO_OUTPUTLIST);
00352 BITSET(sr->paramPresent, TMR_PARAM_GEN2_ACCESSPASSWORD);
00353 BITSET(sr->paramPresent, TMR_PARAM_GEN2_Q);
00354 BITSET(sr->paramPresent, TMR_PARAM_GEN2_BAP);
00355 BITSET(sr->paramPresent, TMR_PARAM_GEN2_TAGENCODING);
00356 BITSET(sr->paramPresent, TMR_PARAM_GEN2_SESSION);
00357 BITSET(sr->paramPresent, TMR_PARAM_GEN2_TARGET);
00358 BITSET(sr->paramPresent, TMR_PARAM_GEN2_PROTOCOLEXTENSION);
00359 BITSET(sr->paramPresent, TMR_PARAM_READ_ASYNCOFFTIME);
00360 BITSET(sr->paramPresent, TMR_PARAM_READ_ASYNCONTIME);
00361 BITSET(sr->paramPresent, TMR_PARAM_READ_PLAN);
00362 BITSET(sr->paramPresent, TMR_PARAM_RADIO_ENABLEPOWERSAVE);
00363 BITSET(sr->paramPresent, TMR_PARAM_RADIO_POWERMAX);
00364 BITSET(sr->paramPresent, TMR_PARAM_RADIO_POWERMIN);
00365 BITSET(sr->paramPresent, TMR_PARAM_RADIO_PORTREADPOWERLIST);
00366 BITSET(sr->paramPresent, TMR_PARAM_RADIO_PORTWRITEPOWERLIST);
00367 BITSET(sr->paramPresent, TMR_PARAM_RADIO_READPOWER);
00368 BITSET(sr->paramPresent, TMR_PARAM_RADIO_WRITEPOWER);
00369 BITSET(sr->paramPresent, TMR_PARAM_RADIO_TEMPERATURE);
00370 BITSET(sr->paramPresent, TMR_PARAM_TAGREADDATA_RECORDHIGHESTRSSI);
00371 BITSET(sr->paramPresent, TMR_PARAM_TAGREADDATA_REPORTRSSIINDBM);
00372 BITSET(sr->paramPresent, TMR_PARAM_TAGREADDATA_UNIQUEBYANTENNA);
00373 BITSET(sr->paramPresent, TMR_PARAM_TAGREADDATA_UNIQUEBYDATA);
00374 BITSET(sr->paramPresent, TMR_PARAM_TAGOP_ANTENNA);
00375 BITSET(sr->paramPresent, TMR_PARAM_TAGOP_PROTOCOL);
00376 BITSET(sr->paramPresent, TMR_PARAM_VERSION_HARDWARE);
00377 BITSET(sr->paramPresent, TMR_PARAM_VERSION_MODEL);
00378 BITSET(sr->paramPresent, TMR_PARAM_VERSION_SOFTWARE);
00379 BITSET(sr->paramPresent, TMR_PARAM_VERSION_SERIAL);
00380 BITSET(sr->paramPresent, TMR_PARAM_VERSION_SUPPORTEDPROTOCOLS);
00381 BITSET(sr->paramPresent, TMR_PARAM_REGION_ID);
00382 BITSET(sr->paramPresent, TMR_PARAM_REGION_SUPPORTEDREGIONS);
00383 BITSET(sr->paramPresent, TMR_PARAM_REGION_HOPTABLE);
00384 BITSET(sr->paramPresent, TMR_PARAM_REGION_HOPTIME);
00385 BITSET(sr->paramPresent, TMR_PARAM_REGION_LBT_ENABLE);
00386 BITSET(sr->paramPresent, TMR_PARAM_EXTENDEDEPC);
00387 BITSET(sr->paramPresent, TMR_PARAM_READER_STATS);
00388 BITSET(sr->paramPresent, TMR_PARAM_READER_STATISTICS);
00389 BITSET(sr->paramPresent, TMR_PARAM_URI);
00390 BITSET(sr->paramPresent, TMR_PARAM_PRODUCT_GROUP_ID);
00391 BITSET(sr->paramPresent, TMR_PARAM_PRODUCT_GROUP);
00392 BITSET(sr->paramPresent, TMR_PARAM_PRODUCT_ID);
00393 BITSET(sr->paramPresent, TMR_PARAM_TAGREADATA_TAGOPSUCCESSCOUNT);
00394 BITSET(sr->paramPresent, TMR_PARAM_TAGREADATA_TAGOPFAILURECOUNT);
00395 BITSET(sr->paramPresent, TMR_PARAM_TAGREADDATA_ENABLEREADFILTER);
00396 BITSET(sr->paramPresent, TMR_PARAM_READER_WRITE_REPLY_TIMEOUT);
00397 BITSET(sr->paramPresent, TMR_PARAM_READER_WRITE_EARLY_EXIT);
00398 BITSET(sr->paramPresent, TMR_PARAM_ISO180006B_DELIMITER);
00399 BITSET(sr->paramPresent, TMR_PARAM_ISO180006B_MODULATION_DEPTH);
00400 BITSET(sr->paramPresent, TMR_PARAM_READER_STATS_ENABLE);
00401 BITSET(sr->paramPresent, TMR_PARAM_TRIGGER_READ_GPI);
00402 if ((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) ||
00403 (TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]) ||
00404 (TMR_SR_MODEL_M6E_NANO == reader->u.serialReader.versionInfo.hardware[0]) ||
00405 (TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]))
00406
00407 {
00408 BITSET(sr->paramPresent, TMR_PARAM_LICENSE_KEY);
00409 BITSET(sr->paramPresent, TMR_PARAM_USER_CONFIG);
00410 BITSET(sr->paramPresent, TMR_PARAM_RADIO_ENABLESJC);
00411 BITSET(sr->paramPresent, TMR_PARAM_TAGREADDATA_READFILTERTIMEOUT);
00412 BITSET(sr->paramPresent, TMR_PARAM_TAGREADDATA_UNIQUEBYPROTOCOL);
00413 }
00414
00415 for (i = 0 ; i < TMR_PARAMWORDS; i++)
00416 {
00417 sr->paramConfirmed[i] = sr->paramPresent[i];
00418 }
00419
00420
00421 {
00422 ret = TMR_SR_cmdGetReaderConfiguration(reader, TMR_SR_CONFIGURATION_PRODUCT_GROUP_ID, &sr->productId);
00423 if (TMR_SUCCESS != ret)
00424 {
00425 if (TMR_ERROR_MSG_INVALID_PARAMETER_VALUE == ret)
00426 {
00427
00428
00429
00430
00431 sr->productId = 0xFFFF;
00432 }
00433 else
00434 {
00435 return ret;
00436 }
00437 }
00438
00439
00440
00441
00442 if (1 == sr->productId)
00443 {
00444 uint8_t pin = 1;
00445 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_ANTENNA_CONTROL_GPIO, &pin);
00446 if (TMR_SUCCESS != ret)
00447 {
00448 return ret;
00449 }
00450 }
00451 }
00452
00453 if (TMR_REGION_NONE != sr->regionId)
00454 {
00455 ret = TMR_SR_cmdSetRegion(reader, sr->regionId);
00456 if (TMR_SUCCESS != ret)
00457 {
00458 return ret;
00459 }
00460 }
00461
00462 ret = TMR_SR_cmdGetCurrentProtocol(reader, &sr->currentProtocol);
00463 if (TMR_SUCCESS != ret)
00464 {
00465 return ret;
00466 }
00467 if (TMR_TAG_PROTOCOL_NONE == sr->currentProtocol)
00468 {
00469 TMR_TagProtocolList protocolList;
00470 TMR_TagProtocol protocols[TMR_MAX_PROTOCOLS];
00471 uint8_t index;
00472 protocolList.list = &protocols[0];
00473 protocolList.max = TMR_MAX_PROTOCOLS;
00474
00475
00476
00477
00478 ret = TMR_SR_cmdGetAvailableProtocols(reader, &protocolList);
00479 for(index = 0; index < protocolList.len; index++)
00480 {
00481 if(TMR_TAG_PROTOCOL_GEN2 == protocolList.list[index])
00482 {
00483 ret = TMR_SR_cmdSetProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
00484 if (TMR_SUCCESS != ret)
00485 {
00486 return ret;
00487 }
00488 sr->currentProtocol = TMR_TAG_PROTOCOL_GEN2;
00489 break;
00490 }
00491 }
00492 }
00493 reader->tagOpParams.protocol = sr->currentProtocol;
00494
00495 reader->tagOpParams.antenna = 0;
00496 ret = initTxRxMapFromPorts(reader);
00497
00502 if ((TMR_SR_MODEL_M6E != sr->versionInfo.hardware[0]) &&
00503 (TMR_SR_MODEL_MICRO != sr->versionInfo.hardware[0]) &&
00504 (TMR_SR_MODEL_M6E_NANO != sr->versionInfo.hardware[0]) &&
00505 (TMR_SR_MODEL_M6E_I != sr->versionInfo.hardware[0]))
00506 {
00507
00508 boolval = true;
00509 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_EXTENDED_EPC, &boolval);
00510 if (TMR_SUCCESS != ret)
00511 {
00512 return ret;
00513 }
00514 reader->u.serialReader.extendedEPC = boolval;
00515 }
00516
00517 if ((TMR_SR_MODEL_M6E != sr->versionInfo.hardware[0]) &&
00518 (TMR_SR_MODEL_MICRO != sr->versionInfo.hardware[0]) &&
00519 (TMR_SR_MODEL_M6E_NANO != sr->versionInfo.hardware[0]) &&
00520 (TMR_SR_MODEL_M6E_I != sr->versionInfo.hardware[0]))
00521 {
00522
00523 boolval = true;
00524 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_RSSI_IN_DBM, &boolval);
00525 if (TMR_SUCCESS != ret)
00526 {
00527 return ret;
00528 }
00529 }
00530 else
00531 {
00532 int32_t timeout = 0;
00533
00534
00535 ret = TMR_SR_cmdGetReaderConfiguration(reader, TMR_SR_CONFIGURATION_ENABLE_READ_FILTER, &reader->u.serialReader.enableReadFiltering);
00536 if (TMR_SUCCESS != ret)
00537 {
00538 return ret;
00539 }
00540
00541
00542 ret = TMR_SR_cmdGetReaderConfiguration(reader, TMR_SR_CONFIGURATION_READ_FILTER_TIMEOUT, &timeout);
00543 if (TMR_SUCCESS != ret)
00544 {
00545 return ret;
00546 }
00547 reader->u.serialReader.readFilterTimeout = (0 == timeout) ? TMR_DEFAULT_READ_FILTER_TIMEOUT : timeout;
00548
00549 }
00550
00551
00552 return ret;
00553 }
00554
00561 TMR_Status
00562 TMR_SR_cmdProbeBaudRate(TMR_Reader *reader, uint32_t *currentBaudRate)
00563 {
00564 TMR_Status ret;
00565 TMR_SR_SerialReader *sr;
00566 TMR_SR_SerialTransport *transport;
00567 uint32_t rate = 0x00;
00568 int i,count = 2;
00569
00570 ret = TMR_SUCCESS;
00571 sr = &reader->u.serialReader;
00572 transport = &reader->u.serialReader.transport;
00573
00574 for (i = 0; (uint32_t)i < sr->probeBaudRates.len; i++)
00575 {
00576 if (i <= 1 && count)
00577 {
00578 rate = sr->baudRate;
00579
00580
00581
00582 count--;
00583
00584
00585
00586 i--;
00587 }
00588 else
00589 {
00590 rate = sr->probeBaudRates.list[i];
00591 if (rate == sr->baudRate)
00592 continue;
00593 }
00594
00595 if (NULL != transport->setBaudRate)
00596 {
00602 ret = transport->setBaudRate(transport, rate);
00603 if (TMR_SUCCESS != ret)
00604 {
00605 return ret;
00606 }
00607 }
00608
00609 ret = transport->flush(transport);
00610 if ((TMR_SUCCESS != ret) && (TMR_ERROR_UNIMPLEMENTED != ret))
00611 {
00612 return ret;
00613 }
00614 contact:
00615 ret = TMR_SR_cmdVersion(reader, &(reader->u.serialReader.versionInfo));
00616 if (TMR_SUCCESS == ret)
00617 {
00618
00619 break;
00620 }
00621
00622
00623
00624
00625 else if (TMR_ERROR_TIMEOUT != ret)
00626 {
00627 if (TMR_ERROR_COMM(ret))
00628 {
00629 ret = verifySearchStatus(reader);
00630 if (TMR_SUCCESS == ret)
00631 {
00632 goto contact;
00633 }
00634 else
00635 {
00636 return ret;
00637 }
00638 }
00639 else
00640 {
00641 return ret;
00642 }
00643 }
00644 }
00645 if (i == sr->probeBaudRates.len)
00646 {
00647 return TMR_ERROR_TIMEOUT;
00648 }
00649
00650
00651 *currentBaudRate = rate;
00652 return ret;
00653 }
00654
00655 TMR_Status
00656 TMR_SR_connect(TMR_Reader *reader)
00657 {
00658 TMR_Status ret;
00659 uint32_t rate;
00660 TMR_SR_SerialReader *sr;
00661 TMR_SR_SerialTransport *transport;
00662
00663 ret = TMR_SUCCESS;
00664 sr = &reader->u.serialReader;
00665 transport = &reader->u.serialReader.transport;
00666
00667 ret = transport->open(transport);
00668 if (TMR_SUCCESS != ret)
00669 {
00670 return ret;
00671 }
00672 rate = sr->probeBaudRates.list[0];
00673 ret = TMR_SR_cmdProbeBaudRate(reader, &rate);
00674 if (TMR_SUCCESS != ret)
00675 {
00676 return ret;
00677 }
00678 reader->connected = true;
00679
00680
00681 ret = TMR_SR_boot(reader, rate);
00682
00683 if(ret !=TMR_SUCCESS)
00684 {
00685 if(ret == TMR_ERROR_AUTOREAD_ENABLED)
00686 {
00687 ret = verifySearchStatus(reader);
00688 if (TMR_SUCCESS != ret)
00689 {
00690 return ret;
00691 }
00692 ret = TMR_SR_boot(reader, rate);
00693 }
00694 }
00695
00696 return ret;
00697 }
00698
00699 TMR_Status
00700 TMR_SR_destroy(TMR_Reader *reader)
00701 {
00702 TMR_SR_SerialTransport *transport;
00703 reader->hasContinuousReadStarted = false;
00704
00705 transport = &reader->u.serialReader.transport;
00706
00710 if (false == reader->u.serialReader.crcEnabled)
00711 {
00712 reader->u.serialReader.crcEnabled = true;
00713 TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_SEND_CRC, &reader->u.serialReader.crcEnabled);
00714 }
00715
00716 transport->shutdown(transport);
00717 reader->connected = false;
00718
00719 #ifdef TMR_ENABLE_BACKGROUND_READS
00720
00721 cleanup_background_threads(reader);
00722 #endif
00723
00724 return TMR_SUCCESS;
00725 }
00726
00727 static TMR_Status
00728 autoDetectAntennaList(struct TMR_Reader *reader)
00729 {
00730 TMR_Status ret;
00731 TMR_SR_PortDetect ports[TMR_SR_MAX_ANTENNA_PORTS];
00732 TMR_SR_PortPair searchList[TMR_SR_MAX_ANTENNA_PORTS];
00733 uint8_t i, listLen, numPorts;
00734 uint16_t j;
00735 TMR_AntennaMapList *map;
00736
00737 ret = TMR_SUCCESS;
00738 map = reader->u.serialReader.txRxMap;
00739
00740
00741 numPorts = TMR_SR_MAX_ANTENNA_PORTS;
00742 ret = TMR_SR_cmdAntennaDetect(reader, &numPorts, ports);
00743 if (TMR_SUCCESS != ret)
00744 {
00745 return ret;
00746 }
00747
00748
00749
00750
00751
00752 for (i = 0, listLen = 0; i < numPorts; i++)
00753 {
00754 if (ports[i].detected)
00755 {
00756
00757 for (j = 0; j < map->len; j++)
00758 if (ports[i].port == map->list[j].txPort)
00759 {
00760 searchList[listLen].txPort = map->list[j].txPort;
00761 searchList[listLen].rxPort = map->list[j].rxPort;
00762 listLen++;
00763 break;
00764 }
00765 }
00766 }
00767 if (0 == listLen)
00768 {
00769 return TMR_ERROR_NO_ANTENNA;
00770 }
00771 ret = TMR_SR_cmdSetAntennaSearchList(reader, listLen, searchList);
00772
00773 return ret;
00774 }
00775
00776 static TMR_Status
00777 setAntennaList(struct TMR_Reader *reader, TMR_uint8List *antennas)
00778 {
00779 TMR_SR_PortPair searchList[16];
00780 uint16_t i, j, listLen;
00781 TMR_AntennaMapList *map;
00782
00783 map = reader->u.serialReader.txRxMap;
00784
00786 listLen = 0;
00787 for (i = 0; i < antennas->len ; i++)
00788 {
00789 for (j = 0; j < map->len; j++)
00790 {
00791 if (antennas->list[i] == map->list[j].antenna)
00792 {
00793 searchList[listLen].txPort = map->list[j].txPort;
00794 searchList[listLen].rxPort = map->list[j].rxPort;
00795 listLen++;
00796 break;
00797 }
00798 }
00799 }
00800 return TMR_SR_cmdSetAntennaSearchList(reader,(uint8_t)listLen, searchList);
00801 }
00802
00803 static TMR_Status
00804 setProtocol(struct TMR_Reader *reader, TMR_TagProtocol protocol)
00805 {
00806 TMR_Status ret;
00807
00808 if(reader->u.serialReader.currentProtocol != protocol)
00809 {
00810 ret = TMR_SR_cmdSetProtocol(reader, protocol);
00811 if (TMR_SUCCESS != ret)
00812 {
00813 return ret;
00814 }
00815
00816
00817 if (reader->u.serialReader.extendedEPC)
00818 {
00819 bool boolval;
00820 boolval = true;
00821 ret = TMR_SR_cmdSetReaderConfiguration(reader,
00822 TMR_SR_CONFIGURATION_EXTENDED_EPC,
00823 &boolval);
00824 if (TMR_SUCCESS != ret)
00825 {
00826 return ret;
00827 }
00828 }
00829 reader->u.serialReader.currentProtocol = protocol;
00830
00831
00832 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_ENABLE_READ_FILTER, &reader->u.serialReader.enableReadFiltering);
00833 if (TMR_SUCCESS != ret)
00834 {
00835 return ret;
00836 }
00837
00838 {
00839
00840 uint32_t moduleValue = (TMR_DEFAULT_READ_FILTER_TIMEOUT == reader->u.serialReader.readFilterTimeout) ?
00841 0 : reader->u.serialReader.readFilterTimeout;
00842 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_READ_FILTER_TIMEOUT, &moduleValue);
00843 if (TMR_SUCCESS != ret)
00844 {
00845 return ret;
00846 }
00847 reader->u.serialReader.readFilterTimeout = moduleValue;
00848 }
00849 }
00850
00851 return TMR_SUCCESS;
00852 }
00853
00858 bool
00859 compareVersion(TMR_Reader *reader, uint8_t firstByte, uint8_t secondByte, uint8_t thirdByte, uint8_t fourthByte)
00860 {
00861 TMR_SR_SerialReader *sr = &reader->u.serialReader;
00862 uint8_t temp;
00863
00864
00865 temp = sr->versionInfo.fwVersion[0];
00866 if (temp > firstByte)
00867 {
00868
00869 return true;
00870 }
00871 else if (temp < firstByte)
00872 {
00873
00874 return false;
00875 }
00876 else
00877 {
00878
00879 temp = sr->versionInfo.fwVersion[1];
00880 if (temp > secondByte)
00881 {
00882
00883 return true;
00884 }
00885 else if (temp < secondByte)
00886 {
00887
00888 return false;
00889 }
00890 else
00891 {
00892
00893 temp = sr->versionInfo.fwVersion[2];
00894 if (temp > thirdByte)
00895 {
00896
00897 return true;
00898 }
00899 else if (temp < thirdByte)
00900 {
00901
00902 return false;
00903 }
00904 else
00905 {
00906
00907 temp = sr->versionInfo.fwVersion[3];
00908 if (temp > fourthByte)
00909 {
00910 return true;
00911 }
00912 else if (temp < fourthByte)
00913 {
00914
00915 return false;
00916 }
00917 else
00918 {
00919
00920 return true;
00921 }
00922 }
00923 }
00924 }
00925 }
00926
00931 bool
00932 compareAntennas(TMR_MultiReadPlan *multi)
00933 {
00934 TMR_ReadPlan *plan1, *plan2;
00935
00936 uint8_t allAntennasNull = 0;
00937 uint8_t matchingPlanCount = 0;
00938 uint8_t i;
00939 bool status = false;
00940
00941 for (i = 0; i < multi->planCount; i++)
00942 {
00943 plan1 = multi->plans[0];
00944 plan2 = multi->plans[i];
00945
00946 if ((0 != plan1->u.simple.antennas.len) && (0 != plan2->u.simple.antennas.len))
00947 {
00948 uint8_t j;
00949
00950 if (plan1->u.simple.antennas.len == plan2->u.simple.antennas.len)
00951 {
00952 for (j = 0; j < plan1->u.simple.antennas.len; j++)
00953 {
00954 if (plan1->u.simple.antennas.list[j] != plan2->u.simple.antennas.list[j])
00955 {
00956 status = false;
00957 break;
00958 }
00959 }
00960 if (j == plan1->u.simple.antennas.len)
00961 {
00962 matchingPlanCount++;
00963 }
00964 }
00965 }
00966 else if ((0 == plan1->u.simple.antennas.len) && (0 == plan2->u.simple.antennas.len))
00967 {
00968 allAntennasNull++;
00969 }
00970 else
00971 {
00972 status = false;
00973 break;
00974 }
00975 }
00976
00977 if ((matchingPlanCount == multi->planCount) || (allAntennasNull == multi->planCount))
00978 {
00979 status = true;
00980 }
00981
00982 return status;
00983 }
00984
00985 TMR_Status
00986 prepForSearch(TMR_Reader *reader, TMR_uint8List *antennaList)
00987 {
00988 TMR_Status ret;
00989 if (antennaList->len == 0)
00990 {
00991 ret = autoDetectAntennaList(reader);
00992 }
00993 else
00994 {
00995 ret = setAntennaList(reader, antennaList);
00996 }
00997 return ret;
00998 }
00999
01000 static TMR_Status
01001 prepEmbReadTagMultiple(TMR_Reader *reader, uint8_t *msg, uint8_t *i,
01002 uint16_t timeout, TMR_SR_SearchFlag searchFlag,
01003 const TMR_TagFilter *filter, TMR_TagProtocol protocol,
01004 TMR_GEN2_Password accessPassword, uint8_t *lenbyte)
01005 {
01006 TMR_Status ret;
01007
01008 ret = TMR_SR_msgSetupReadTagMultiple(reader,
01009 msg, i, (uint16_t)timeout, searchFlag, filter, protocol, accessPassword);
01010
01011
01012 SETU8(msg, *i, 1);
01013 *lenbyte = (*i)++;
01014 return ret;
01015 }
01016
01017 static TMR_Status
01018 TMR_SR_read_internal(struct TMR_Reader *reader, uint32_t timeoutMs,
01019 int32_t *tagCount, TMR_ReadPlan *rp)
01020 {
01021 TMR_Status ret = TMR_SUCCESS;
01022 TMR_SR_SerialReader *sr;
01023 TMR_SR_MultipleStatus multipleStatus = {0};
01024 uint32_t count, elapsed, elapsed_tagop;
01025 uint32_t readTimeMs, starttimeLow, starttimeHigh;
01026 TMR_uint8List *antennaList = NULL;
01027
01028 sr = &reader->u.serialReader;
01029
01030 if (TMR_READ_PLAN_TYPE_MULTI == rp->type)
01031 {
01032 int i;
01033 TMR_TagProtocolList p;
01034 TMR_TagProtocolList *protocolList = &p;
01035 TMR_TagFilter *filters[TMR_MAX_SERIAL_MULTIPROTOCOL_LENGTH];
01036 TMR_TagProtocol protocols[TMR_MAX_SERIAL_MULTIPROTOCOL_LENGTH];
01037
01038
01039 if (TMR_MAX_SERIAL_MULTIPROTOCOL_LENGTH < rp->u.multi.planCount)
01040 {
01041 return TMR_ERROR_TOO_BIG ;
01042 }
01043
01044 protocolList->len = rp->u.multi.planCount;
01045 protocolList->max = rp->u.multi.planCount;
01046
01047
01048 protocolList->list = protocols;
01049
01050 for (i = 0; i < rp->u.multi.planCount; i++)
01051 {
01052 protocolList->list[i] = rp->u.multi.plans[i]->u.simple.protocol;
01053 filters[i]= rp->u.multi.plans[i]->u.simple.filter;
01054 }
01055
01056 if (
01057 ((0 < rp->u.multi.planCount) &&
01058 (rp->u.multi.plans[0]->type == TMR_READ_PLAN_TYPE_SIMPLE) &&
01059 (compareAntennas(&rp->u.multi)) &&
01060 ((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) ||
01061 (TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]) ||
01062 (TMR_SR_MODEL_M6E_NANO == sr->versionInfo.hardware[0]) ||
01063 (TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0])))
01064 || (true == reader->continuousReading)
01065 )
01066 {
01067 TMR_SR_SearchFlag antennas = TMR_SR_SEARCH_FLAG_CONFIGURED_LIST;
01068 antennas |= ((reader->continuousReading)? TMR_SR_SEARCH_FLAG_TAG_STREAMING : 0);
01069 antennaList = &(rp->u.multi.plans[0]->u.simple.antennas);
01070 ret = prepForSearch(reader, antennaList);
01071 if (TMR_SUCCESS != ret)
01072 {
01073 return ret;
01074 }
01075
01080 if (!reader->continuousReading)
01081 {
01082
01083 tm_gettime_consistent(&starttimeHigh, &starttimeLow);
01084 sr->readTimeHigh = starttimeHigh;
01085 sr->readTimeLow = starttimeLow;
01086 sr->lastSentTagTimestampHigh = starttimeHigh;
01087 sr->lastSentTagTimestampLow = starttimeLow;
01088 }
01089
01090 if (reader->continuousReading)
01091 {
01092 bool value = false;
01093 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_ENABLE_READ_FILTER, &value);
01094 if (TMR_SUCCESS != ret)
01095 {
01096 return ret;
01097 }
01098 }
01099
01100 ret = TMR_SR_cmdMultipleProtocolSearch(reader,
01101 TMR_SR_OPCODE_READ_TAG_ID_MULTIPLE,
01102 protocolList, reader->userMetadataFlag,
01103 antennas,
01104 filters,
01105 (uint16_t)timeoutMs, &count);
01106
01107 if (NULL != tagCount)
01108 {
01109 *tagCount += count;
01110 }
01111 return ret;
01112 }
01113
01114 }
01115
01116 if (TMR_READ_PLAN_TYPE_SIMPLE == rp->type)
01117 {
01118 antennaList = &rp->u.simple.antennas;
01119 reader->fastSearch = rp->u.simple.useFastSearch;
01120 reader->triggerRead = rp->u.simple.triggerRead.enable;
01121 if (!reader->continuousReading)
01122 {
01123
01124 reader->isStopNTags = rp->u.simple.stopOnCount.stopNTriggerStatus;
01125 reader->numberOfTagsToRead = rp->u.simple.stopOnCount.noOfTags;
01126 }
01127 }
01128 else if (TMR_READ_PLAN_TYPE_MULTI == rp->type)
01129 {
01130 uint32_t subTimeout;
01131 int i;
01132
01133 subTimeout = 0;
01134 if (0 == rp->u.multi.totalWeight)
01135 {
01136 subTimeout = timeoutMs / rp->u.multi.planCount;
01137 }
01138
01139 for (i = 0; i < rp->u.multi.planCount; i++)
01140 {
01141 if (rp->u.multi.totalWeight)
01142 {
01143 subTimeout = rp->u.multi.plans[i]->weight * timeoutMs
01144 / rp->u.multi.totalWeight;
01145 }
01146 ret = TMR_SR_read_internal(reader, subTimeout, tagCount,
01147 rp->u.multi.plans[i]);
01148 if (TMR_SUCCESS != ret && TMR_ERROR_NO_TAGS_FOUND != ret)
01149 {
01150 return ret;
01151 }
01152 }
01153 return ret;
01154 }
01155 else
01156 {
01157 return TMR_ERROR_INVALID;
01158 }
01159
01160
01161 ret = prepForSearch(reader, antennaList);
01162 if (TMR_SUCCESS != ret)
01163 {
01164 return ret;
01165 }
01166
01167
01168 ret = setProtocol(reader, rp->u.simple.protocol);
01169 if (TMR_SUCCESS != ret)
01170 {
01171 return ret;
01172 }
01173
01174 if (reader->continuousReading)
01175 {
01176 bool value = false;
01177 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_ENABLE_READ_FILTER, &value);
01178 if (TMR_SUCCESS != ret)
01179 {
01180 return ret;
01181 }
01182 }
01183
01184
01185 tm_gettime_consistent(&starttimeHigh, &starttimeLow);
01186 sr->readTimeHigh = starttimeHigh;
01187 sr->readTimeLow = starttimeLow;
01188 sr->lastSentTagTimestampHigh = starttimeHigh;
01189 sr->lastSentTagTimestampLow = starttimeLow;
01190
01191
01192 sr->searchTimeoutMs = timeoutMs;
01193
01194 elapsed = tm_time_subtract(tmr_gettime_low(), starttimeLow);
01195 elapsed_tagop = elapsed;
01196
01201 if ((reader->continuousReading) && (0 != timeoutMs))
01202 {
01203 elapsed = timeoutMs - 1;
01204 }
01205
01206 while (elapsed <= timeoutMs)
01207 {
01208 readTimeMs = timeoutMs - elapsed;
01209 if (readTimeMs > 65535)
01210 {
01211 readTimeMs = 65535;
01212 }
01213
01214 if (NULL == rp->u.simple.tagop)
01215 {
01216 if(reader->continuousReading)
01217 {
01218 TMR_TagProtocolList p;
01219 TMR_TagProtocolList *protocolList = &p;
01220 TMR_TagFilter *filters[TMR_MAX_SERIAL_MULTIPROTOCOL_LENGTH];
01221 TMR_TagProtocol protocols[TMR_MAX_SERIAL_MULTIPROTOCOL_LENGTH];
01222 TMR_SR_SearchFlag antennas;
01223
01224 protocolList->len = 1;
01225 protocolList->max = 1;
01226 protocolList->list = protocols;
01227
01228 protocolList->list[0] = rp->u.simple.protocol;
01229 filters[0]= rp->u.simple.filter;
01230
01231 antennas = TMR_SR_SEARCH_FLAG_CONFIGURED_LIST;
01232 antennas |= ((reader->continuousReading)? TMR_SR_SEARCH_FLAG_TAG_STREAMING : 0);
01233 antennaList = &(rp->u.simple.antennas);
01234 ret = TMR_SR_cmdMultipleProtocolSearch(reader,
01235 TMR_SR_OPCODE_READ_TAG_ID_MULTIPLE,
01236 protocolList, reader->userMetadataFlag,
01237 antennas,
01238 filters,
01239 (uint16_t)timeoutMs, &count);
01240 }
01241 else
01242 {
01243 ret = TMR_SR_cmdReadTagMultiple(reader,(uint16_t)readTimeMs,
01244 (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
01245 rp->u.simple.filter,
01246 rp->u.simple.protocol,
01247 &count);
01248 }
01249 }
01250 else
01251 {
01252 uint8_t msg[256];
01253 uint8_t i, lenbyte;
01254
01255
01256
01257
01258 readTimeMs = timeoutMs - elapsed_tagop;
01259 if (readTimeMs > 65535)
01260 {
01261 readTimeMs = 65535;
01262 }
01263
01264 i = 2;
01265
01269 ret = TMR_SR_addTagOp(reader, rp->u.simple.tagop, rp, msg, &i, readTimeMs, &lenbyte);
01270 if (TMR_SUCCESS != ret)
01271 {
01272 return ret;
01273 }
01274
01275 msg[lenbyte] = i - (lenbyte + 2);
01276 msg[1] = i - 3;
01277 ret = TMR_SR_executeEmbeddedRead(reader, msg, (uint16_t)timeoutMs, &multipleStatus);
01278 count = multipleStatus.tagsFound;
01279
01280
01281
01282 reader->u.serialReader.tagopSuccessCount += multipleStatus.successCount;
01283 reader->u.serialReader.tagopFailureCount += multipleStatus.failureCount;
01284 }
01285
01286 if (TMR_ERROR_NO_TAGS_FOUND == ret)
01287 {
01288 count = 0;
01289 ret = TMR_SUCCESS;
01290 }
01291 else if (TMR_ERROR_TM_ASSERT_FAILED == ret)
01292 {
01293 return ret;
01294 }
01295 else if (TMR_ERROR_TIMEOUT == ret)
01296 {
01297 return ret;
01298 }
01299 else if (TMR_SUCCESS != ret)
01300 {
01301 uint16_t remainingTagsCount;
01302 TMR_Status ret1;
01303 reader->isStopNTags = false;
01304
01305
01306 ret1 = TMR_SR_cmdGetTagsRemaining(reader, &remainingTagsCount);
01307 if (TMR_SUCCESS != ret1)
01308 {
01309 return ret1;
01310 }
01311 sr->tagsRemaining += remainingTagsCount;
01312 if (NULL != tagCount)
01313 {
01314 *tagCount += remainingTagsCount;
01315 }
01316 return ret;
01317 }
01318
01319 sr->tagsRemaining += count;
01320 if (NULL != tagCount)
01321 {
01322 *tagCount += count;
01323 }
01324
01325 if (reader->continuousReading)
01326 {
01327 sr->tagsRemaining = 1;
01328 break;
01329 }
01330 else if (reader->isStopNTags && !reader->continuousReading)
01331 {
01335 break;
01336 }
01337 else
01338 {
01339 elapsed = tm_time_subtract(tmr_gettime_low(), starttimeLow);
01340 }
01341 }
01342
01343 return ret;
01344 }
01345
01346
01347
01348 static
01349 TMR_Status
01350 _resetReaderStats(TMR_Reader *reader, TMR_Reader_StatsFlag statFlags)
01351 {
01352 TMR_Status ret;
01353
01354 if ((NULL != reader->pSupportsResetStats) && (false == *(reader->pSupportsResetStats)))
01355 {
01356
01357 ret = TMR_SUCCESS;
01358 }
01359 else
01360 {
01361 ret = TMR_SR_cmdResetReaderStats(reader, statFlags);
01362
01363
01364 if (NULL == reader->pSupportsResetStats)
01365 {
01366 switch (ret)
01367 {
01368 case TMR_SUCCESS:
01369 reader->_storeSupportsResetStats = true;
01370 reader->pSupportsResetStats = &(reader->_storeSupportsResetStats);
01371 break;
01372 case TMR_ERROR_MSG_WRONG_NUMBER_OF_DATA:
01373 case TMR_ERROR_INVALID_OPCODE:
01374 case TMR_ERROR_UNIMPLEMENTED_OPCODE:
01375 case TMR_ERROR_UNIMPLEMENTED_FEATURE:
01376 case TMR_ERROR_INVALID:
01377 case TMR_ERROR_UNIMPLEMENTED:
01378 case TMR_ERROR_UNSUPPORTED:
01379 case TMR_ERROR_UNSUPPORTED_READER_TYPE:
01380
01381
01382 reader->_storeSupportsResetStats = false;
01383 reader->pSupportsResetStats = &(reader->_storeSupportsResetStats);
01384 ret = TMR_SUCCESS;
01385 break;
01386 }
01387 }
01388 }
01389 return ret;
01390 }
01391
01392 TMR_Status
01393 TMR_SR_read(struct TMR_Reader *reader, uint32_t timeoutMs, int32_t *tagCount)
01394 {
01395 TMR_Status ret;
01396 TMR_ReadPlan *rp;
01397
01403 ret = _resetReaderStats(reader, TMR_READER_STATS_FLAG_ALL);
01404 if (TMR_SUCCESS != ret)
01405 {
01406 return ret;
01407 }
01408
01409 if (!reader->continuousReading)
01410 {
01415 ret = TMR_SR_cmdClearTagBuffer(reader);
01416 if (TMR_SUCCESS != ret)
01417 {
01418 return ret;
01419 }
01420 }
01421
01422 reader->u.serialReader.tagsRemaining = 0;
01423
01424 #ifdef TMR_ENABLE_BACKGROUND_READS
01425 if (false == reader->backgroundEnabled)
01431 #endif
01432 {
01433
01434 reader->u.serialReader.tagopSuccessCount = 0;
01435 reader->u.serialReader.tagopFailureCount = 0;
01436 }
01437 rp = reader->readParams.readPlan;
01438
01439 if (tagCount)
01440 {
01441 *tagCount = 0;
01442 }
01443
01444 ret = TMR_SR_read_internal(reader, timeoutMs, tagCount, rp);
01445 if (ret != TMR_SUCCESS)
01446 {
01447 return ret;
01448 }
01449 if (reader->continuousReading)
01450 reader->hasContinuousReadStarted = true;
01451 return ret;
01452 }
01453
01454 TMR_Status
01455 verifySearchStatus(TMR_Reader *reader)
01456 {
01457 TMR_SR_SerialReader *sr;
01458 TMR_Status ret;
01459 uint8_t *msg;
01460 uint32_t timeoutMs;
01461 bool crcEnable;
01462
01463 sr = &reader->u.serialReader;
01464 msg = sr->bufResponse;
01465 timeoutMs = sr->searchTimeoutMs;
01466
01467 reader->u.serialReader.crcEnabled = false;
01468 TMR_SR_cmdStopReading(reader);
01469
01470 while(true)
01471 {
01472 ret = TMR_SR_receiveMessage(reader, msg, TMR_SR_OPCODE_READ_TAG_ID_MULTIPLE, timeoutMs);
01473
01474 if(TMR_SUCCESS == ret || TMR_ERROR_DEVICE_RESET == ret)
01475 {
01476 if ((0x2F == msg[2]) && (0x02 == msg[5]))
01477 {
01483 if (TMR_SR_MSG_SOURCE_USB == reader->u.serialReader.transportType)
01484 {
01485 crcEnable = false;
01486 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_SEND_CRC, &crcEnable);
01487 if (TMR_SUCCESS == ret)
01488 reader->u.serialReader.crcEnabled = false;
01489 else
01490 reader->u.serialReader.crcEnabled = true;
01491 }
01492 else
01493 {
01494 reader->u.serialReader.crcEnabled = true;
01495 }
01496 return TMR_SUCCESS;
01497 }
01498 else if ((0x2F == msg[2]) && (0x01 == msg[3] && (0x00 == msg[4])))
01499 {
01504 return TMR_SUCCESS;
01505 }
01506 }
01507 else
01508 {
01513 if (TMR_ERROR_CRC_ERROR == ret)
01514 {
01519 continue;
01520 }
01521 if (TMR_ERROR_TIMEOUT == ret)
01522 {
01523 return ret;
01524 }
01525 }
01526 }
01527 }
01528
01529 TMR_Status
01530 TMR_SR_hasMoreTags(struct TMR_Reader *reader)
01531 {
01532 TMR_SR_SerialReader* sr;
01533 TMR_Status ret;
01534
01535 sr = &reader->u.serialReader;
01536
01537
01538 if ((reader->continuousReading) && (0 == sr->tagsRemainingInBuffer))
01539 {
01540 uint8_t *msg;
01541 uint32_t timeoutMs;
01542 uint8_t response_type_pos;
01543 uint8_t response_type;
01544
01545 msg = sr->bufResponse;
01546 timeoutMs = sr->searchTimeoutMs;
01547
01548 ret = TMR_SR_receiveMessage(reader, msg, TMR_SR_OPCODE_READ_TAG_ID_MULTIPLE, timeoutMs);
01549
01550 if (TMR_ERROR_TAG_ID_BUFFER_AUTH_REQUEST == ret)
01551 {
01552
01553
01554
01555 uint16_t flags = 0;
01556 uint8_t bufptr;
01557 TMR_TagReadData trd;
01558 TMR_TagAuthentication tauth;
01559
01560 TMR_TRD_init(&trd);
01561
01562
01563 bufptr = 8;
01564 flags = GETU16AT(msg, bufptr);
01565 bufptr += 2;
01566 bufptr++;
01567 TMR_SR_parseMetadataFromMessage(reader, &trd, flags, &bufptr, msg);
01568 TMR_SR_postprocessReaderSpecificMetadata(&trd, sr);
01569 trd.reader = reader;
01570
01571 #ifndef BARE_METAL
01572
01573
01574 {
01575 notify_authreq_listeners(reader, &trd, &tauth);
01576 }
01577 #endif
01578
01579
01580 reader->hasContinuousReadStarted = false;
01581 ret = TMR_SR_cmdAuthReqResponse(reader, &tauth);
01582 if (reader->continuousReading)
01583 reader->hasContinuousReadStarted = true;
01584 if (TMR_SUCCESS != ret)
01585 {
01586 return ret;
01587 }
01588 else
01589 {
01590 return TMR_ERROR_TAG_ID_BUFFER_AUTH_REQUEST;
01591 }
01592 }
01593
01594 if ((TMR_SUCCESS != ret) && (TMR_ERROR_TAG_ID_BUFFER_FULL != ret)
01595 && ((TMR_ERROR_NO_TAGS_FOUND != ret)
01596 || ((TMR_ERROR_NO_TAGS_FOUND == ret) && (0 == msg[1]))))
01597 {
01598 if (msg[5] != 0x04 || msg[2] != 0x2f)
01599 {
01600 reader->u.serialReader.isBasetimeUpdated = false;
01601 return ret;
01602 }
01603 }
01604
01605 ret = (0 == GETU16AT(msg, 3)) ? TMR_SUCCESS : TMR_ERROR_CODE(GETU16AT(msg, 3));
01606 if ((TMR_SUCCESS == ret) && (0 == msg[1]))
01607 {
01615 return TMR_ERROR_NO_TAGS_FOUND;
01616 }
01617 if (((0x2F == msg[2]) && (TMR_ERROR_TAG_ID_BUFFER_FULL == ret))
01618 ||((0x22 == msg[2]) && (TMR_ERROR_TAG_ID_BUFFER_FULL == ret)))
01619 {
01620 return ret;
01621 }
01622
01623 if (0x2F == msg[2])
01624 {
01625 if (0x02 == msg[5])
01626 {
01632 reader->finishedReading = true;
01633 reader->u.serialReader.isBasetimeUpdated = false;
01634 return TMR_ERROR_END_OF_READING;
01635 }
01636 else if (0x03 == msg[5])
01637 {
01641 return TMR_ERROR_TAG_ID_BUFFER_AUTH_REQUEST;
01642 }
01643 else if (0x04 == msg[5])
01644 {
01645 memcpy(&reader->paramMessage[0], msg, (msg[1] + 5) * sizeof(uint8_t));
01646 reader->paramWait = false;
01647 }
01652 return TMR_ERROR_NO_TAGS;
01653 }
01654 else if (msg[1] < 6)
01655 {
01656 return TMR_ERROR_PARSE;
01657 }
01658
01659 response_type_pos = (0x10 == (msg[5] & 0x10)) ? 10 : 8;
01660
01661 response_type = msg[response_type_pos];
01662 switch (response_type)
01663 {
01664 case 0x02:
01665
01666 reader->isStatusResponse = true;
01667 sr->bufPointer = 9;
01668 return TMR_SUCCESS;
01669 case 0x01:
01670
01671 reader->isStatusResponse = false;
01672 sr->tagsRemainingInBuffer = 1;
01673 sr->bufPointer = 11;
01674 return TMR_SUCCESS;
01675 case 0x00:
01676
01677
01678 reader->u.serialReader.isBasetimeUpdated = false;
01679
01680 sr->tagsRemaining = 0;
01681
01682 if (sr->oldQ.type != TMR_SR_GEN2_Q_INVALID)
01683 {
01684 ret = TMR_paramSet(reader, TMR_PARAM_GEN2_Q, &(sr->oldQ));
01685 if (TMR_SUCCESS != ret)
01686 {
01687 return ret;
01688 }
01689 sr->oldQ.type = TMR_SR_GEN2_Q_INVALID;
01690 }
01691
01692 if (NULL != reader->readParams.readPlan->u.simple.tagop)
01693 {
01694 response_type_pos += 7;
01695 sr->tagopSuccessCount += GETU16(msg, response_type_pos);
01696 sr->tagopFailureCount += GETU16(msg, response_type_pos);
01697 }
01698 if (TMR_SUCCESS == ret)
01699 {
01700 return TMR_ERROR_NO_TAGS;
01701 }
01702
01703 return ret;
01704 default:
01705
01706 return TMR_ERROR_PARSE;
01707 }
01708 }
01709 else
01710
01711 {
01717 ret = (sr->tagsRemaining > 0) ? TMR_SUCCESS : TMR_ERROR_NO_TAGS;
01718 return ret;
01719 }
01720 }
01721
01722 TMR_Status
01723 TMR_SR_getNextTag(struct TMR_Reader *reader, TMR_TagReadData *read)
01724 {
01725 TMR_SR_SerialReader *sr;
01726 TMR_Status ret;
01727 uint8_t *msg;
01728 uint8_t i;
01729 uint16_t flags = 0;
01730 uint32_t timeoutMs;
01731 uint8_t subResponseLen = 0;
01732 uint8_t crclen = 2 ;
01733 uint8_t epclen = 0;
01734
01735 sr = &reader->u.serialReader;
01736 timeoutMs = sr->searchTimeoutMs;
01737
01738 {
01739 msg = sr->bufResponse;
01740
01741 if (sr->tagsRemaining == 0)
01742 {
01743 return TMR_ERROR_NO_TAGS;
01744 }
01745
01746 if (sr->tagsRemainingInBuffer == 0)
01747 {
01748
01749 if (reader->continuousReading)
01750 {
01751 ret = TMR_SR_hasMoreTags(reader);
01752 if (TMR_SUCCESS != ret)
01753 {
01754 return ret;
01755 }
01756 }
01757 else
01758 {
01759 if (reader->u.serialReader.opCode == TMR_SR_OPCODE_READ_TAG_ID_MULTIPLE)
01760 {
01761 i = 2;
01762 SETU8(msg, i, TMR_SR_OPCODE_GET_TAG_ID_BUFFER);
01763 SETU16(msg, i, reader->userMetadataFlag);
01764 SETU8(msg, i, 0);
01765 msg[1] = i-3;
01766 ret = TMR_SR_send(reader, msg);
01767 if (TMR_SUCCESS != ret)
01768 {
01769 return ret;
01770 }
01771 sr->tagsRemainingInBuffer = msg[8];
01772 sr->bufPointer = 9;
01773 }
01774 else if (reader->u.serialReader.opCode == TMR_SR_OPCODE_READ_TAG_ID_SINGLE)
01775 {
01776 TMR_SR_receiveMessage(reader, msg, reader->u.serialReader.opCode, timeoutMs);
01777 sr->tagsRemainingInBuffer = (uint8_t)GETU32AT(msg , 9);
01778 sr->tagsRemaining = sr->tagsRemainingInBuffer;
01779 sr->bufPointer = 13 ;
01780 }
01781 else
01782 {
01783 return TMR_ERROR_INVALID_OPCODE;
01784 }
01785 }
01786 }
01787
01788 i = sr->bufPointer;
01789 if (reader->u.serialReader.opCode == TMR_SR_OPCODE_READ_TAG_ID_MULTIPLE)
01790 {
01791 flags = GETU16AT(msg, reader->continuousReading ? 8 : 5);
01792 TMR_SR_parseMetadataFromMessage(reader, read, flags, &i, msg);
01793
01794 }
01795 if (reader->u.serialReader.opCode == TMR_SR_OPCODE_READ_TAG_ID_SINGLE)
01796 {
01797 flags = GETU16AT(msg, i + 6);
01798 subResponseLen = msg[i+1];
01799 i += 7;
01800 TMR_SR_parseMetadataOnly(reader, read, flags, &i, msg);
01801 epclen = subResponseLen + 4 - (i - sr->bufPointer) - crclen;
01802 read->tag.epcByteCount=epclen;
01803 memcpy(&(read->tag.epc), &msg[i], read->tag.epcByteCount);
01804 i+=epclen;
01805 read->tag.crc = GETU16(msg, i);
01806 }
01807 sr->bufPointer = i;
01808
01809
01810 TMR_SR_postprocessReaderSpecificMetadata(read, sr);
01811
01812 sr->tagsRemainingInBuffer--;
01813
01814 if (false == reader->continuousReading)
01815 {
01816 sr->tagsRemaining--;
01817 }
01818 read->reader = reader;
01819
01820 return TMR_SUCCESS;
01821 }
01822 }
01823
01824 TMR_Status
01825 TMR_SR_writeTag(struct TMR_Reader *reader, const TMR_TagFilter *filter,
01826 const TMR_TagData *data)
01827 {
01828 TMR_Status ret;
01829 TMR_SR_SerialReader *sr;
01830
01831 sr = &reader->u.serialReader;
01832
01833 ret = setProtocol(reader, reader->tagOpParams.protocol);
01834 if (TMR_SUCCESS != ret)
01835 {
01836 return ret;
01837 }
01838
01839 if (TMR_TAG_PROTOCOL_GEN2 == reader->tagOpParams.protocol)
01840 {
01841 return TMR_SR_cmdWriteGen2TagEpc(reader, filter, sr->gen2AccessPassword, (uint16_t)(sr->commandTimeout),
01842 data->epcByteCount, data->epc, 0);
01843 }
01844 else
01845 {
01846 return TMR_ERROR_UNIMPLEMENTED;
01847 }
01848 }
01849
01850
01851 TMR_Status
01852 TMR_SR_readTagMemWords(TMR_Reader *reader, const TMR_TagFilter *target,
01853 uint32_t bank, uint32_t wordAddress,
01854 uint16_t wordCount, uint16_t data[])
01855 {
01856 TMR_Status ret;
01857
01858 ret = TMR_SR_readTagMemBytes(reader, target, bank, wordAddress * 2,
01859 wordCount * 2, (uint8_t *)data);
01860 if (TMR_SUCCESS != ret)
01861 {
01862 return ret;
01863 }
01864
01865 #ifndef TMR_BIG_ENDIAN_HOST
01866 {
01867 uint16_t i;
01868 uint8_t *data8;
01869
01870
01871
01872
01873 data8 = (uint8_t *)data;
01874 for (i = 0; i < wordCount; i++)
01875 {
01876 data[i] = (data8[2*i] << 8) | data8[2*i + 1];
01877 }
01878 }
01879 #endif
01880
01881 return TMR_SUCCESS;
01882 }
01883
01884
01885 static TMR_Status
01886 TMR_SR_readTagMemBytesUnaligned(TMR_Reader *reader,
01887 const TMR_TagFilter *target,
01888 uint32_t bank, uint32_t byteAddress,
01889 uint16_t byteCount, uint8_t data[])
01890 {
01891 TMR_Status ret;
01892 TMR_TagReadData read;
01893 uint16_t wordCount;
01894 uint8_t buf[254];
01895 TMR_SR_SerialReader *sr;
01896
01897 sr = &reader->u.serialReader;
01898
01899 wordCount = (uint16_t)((byteCount + 1 + (byteAddress & 1) ) / 2);
01900 read.data.max = 254;
01901 read.data.list = buf;
01902 read.metadataFlags = 0;
01903
01904 ret = TMR_SR_cmdGEN2ReadTagData(reader, (uint16_t)(sr->commandTimeout),
01905 (TMR_GEN2_Bank)bank, byteAddress / 2, (uint8_t)wordCount,
01906 sr->gen2AccessPassword, target, &read);
01907 if (TMR_SUCCESS != ret)
01908 {
01909 return ret;
01910 }
01911
01912 memcpy(data, buf + (byteAddress & 1), byteCount);
01913
01914 return TMR_SUCCESS;
01915 }
01916
01917
01918 TMR_Status
01919 TMR_SR_readTagMemBytes(TMR_Reader *reader, const TMR_TagFilter *target,
01920 uint32_t bank, uint32_t byteAddress,
01921 uint16_t byteCount, uint8_t data[])
01922 {
01923 TMR_Status ret;
01924 TMR_TagReadData read;
01925 TMR_SR_SerialReader *sr;
01926
01927 sr = &reader->u.serialReader;
01928
01929 ret = setProtocol(reader, reader->tagOpParams.protocol);
01930 if (TMR_SUCCESS != ret)
01931 {
01932 return ret;
01933 }
01934
01935 read.data.max = byteCount;
01936 read.data.list = (uint8_t *)data;
01937 read.metadataFlags = 0;
01938
01939 if (TMR_TAG_PROTOCOL_GEN2 == reader->tagOpParams.protocol)
01940 {
01941
01942
01943
01944
01945 if ((byteAddress & 1) || (byteCount & 1))
01946 {
01947 return TMR_SR_readTagMemBytesUnaligned(reader, target, bank, byteAddress,
01948 byteCount, data);
01949 }
01950
01951 return TMR_SR_cmdGEN2ReadTagData(reader, (uint16_t)(sr->commandTimeout),
01952 (TMR_GEN2_Bank)bank, byteAddress / 2, byteCount / 2,
01953 sr->gen2AccessPassword, target, &read);
01954 }
01955 #ifdef TMR_ENABLE_ISO180006B
01956 else if (TMR_TAG_PROTOCOL_ISO180006B == reader->tagOpParams.protocol)
01957 {
01958 return TMR_SR_cmdISO180006BReadTagData(reader,(uint16_t)(sr->commandTimeout),
01959 (uint8_t)byteAddress, (uint8_t)byteCount, target,
01960 &read);
01961 }
01962 #endif
01963 else
01964 {
01965 return TMR_ERROR_UNIMPLEMENTED;
01966 }
01967 }
01968
01969 TMR_Status
01970 TMR_SR_modifyFlash(TMR_Reader *reader, uint8_t sector, uint32_t address,
01971 uint32_t password, uint8_t length, const uint8_t data[],
01972 uint32_t offset)
01973 {
01978 if ((TMR_SR_MODEL_M6E == reader->u.serialReader.versionInfo.hardware[0])||
01979 (TMR_SR_MODEL_MICRO == reader->u.serialReader.versionInfo.hardware[0]) ||
01980 (TMR_SR_MODEL_M6E_NANO == reader->u.serialReader.versionInfo.hardware[0]) ||
01981 (TMR_SR_MODEL_M6E_I == reader->u.serialReader.versionInfo.hardware[0]))
01982 {
01983 return TMR_SR_cmdModifyFlashSector(reader, sector, address, password, length,
01984 data, offset);
01985 }
01986 else
01987 return TMR_ERROR_UNSUPPORTED;
01988 }
01989 TMR_Status
01990 TMR_SR_writeTagMemWords(struct TMR_Reader *reader, const TMR_TagFilter *filter,
01991 uint32_t bank, uint32_t address,
01992 uint16_t count, const uint16_t data[])
01993 {
01994 const uint8_t *dataPtr;
01995 #ifndef TMR_BIG_ENDIAN_HOST
01996 uint8_t buf[254];
01997 int i;
01998
01999 for (i = 0 ; i < count ; i++)
02000 {
02001 buf[2*i ] = data[i] >> 8;
02002 buf[2*i + 1] = data[i] & 0xff;
02003 }
02004 dataPtr = buf;
02005 #else
02006 dataPtr = (const uint8_t *)data;
02007 #endif
02008
02009 return TMR_SR_writeTagMemBytes(reader, filter, bank, address * 2, count * 2,
02010 dataPtr);
02011 }
02012
02013 TMR_Status
02014 TMR_SR_writeTagMemBytes(struct TMR_Reader *reader, const TMR_TagFilter *filter,
02015 uint32_t bank, uint32_t address,
02016 uint16_t count, const uint8_t data[])
02017 {
02018 TMR_Status ret;
02019 TMR_SR_SerialReader *sr;
02020 TMR_GEN2_WriteMode mode;
02021 TMR_GEN2_WriteMode *value = &mode;
02022
02023 sr = &reader->u.serialReader;
02024 TMR_paramGet(reader, TMR_PARAM_GEN2_WRITEMODE, value);
02025
02026 ret = setProtocol(reader, reader->tagOpParams.protocol);
02027 if (TMR_SUCCESS != ret)
02028 {
02029 return ret;
02030 }
02031
02032 if (TMR_TAG_PROTOCOL_GEN2 == reader->tagOpParams.protocol)
02033 {
02034
02035
02036
02037
02038
02039 uint16_t data16[TMR_SR_MAX_PACKET_SIZE/2];
02040 uint16_t wordCount;
02041 uint16_t iWord;
02042
02043
02044 if ((address & 1) || (count & 1))
02045 {
02046 return TMR_ERROR_INVALID;
02047 }
02048
02049 wordCount = count/2;
02050 for (iWord=0; iWord<wordCount; iWord++)
02051 {
02052 data16[iWord] = 0;
02053 data16[iWord] |= data[(2*iWord)+0];
02054 data16[iWord] <<= 8;
02055 data16[iWord] |= data[(2*iWord)+1];
02056 }
02057
02058 switch (mode)
02059 {
02060 case TMR_GEN2_WORD_ONLY:
02061 return TMR_SR_cmdGEN2WriteTagData(reader, (uint16_t)(sr->commandTimeout),
02062 (TMR_GEN2_Bank)bank, address / 2, (uint8_t)count, data,
02063 sr->gen2AccessPassword, filter);
02064 case TMR_GEN2_BLOCK_ONLY:
02065 return TMR_SR_cmdBlockWrite(reader,(uint16_t)sr->commandTimeout, (TMR_GEN2_Bank)bank, address / 2, (uint8_t)(count/2), data16, sr->gen2AccessPassword, filter);
02066 case TMR_GEN2_BLOCK_FALLBACK:
02067
02068 ret = TMR_SR_cmdBlockWrite(reader,(uint16_t)sr->commandTimeout, (TMR_GEN2_Bank)bank, address / 2, (uint8_t)(count/2), data16, sr->gen2AccessPassword, filter);
02069 if (TMR_SUCCESS == ret)
02070 {
02071 return ret;
02072 }
02073 else
02074 {
02075 return TMR_SR_cmdGEN2WriteTagData(reader, (uint16_t)(sr->commandTimeout),
02076 (TMR_GEN2_Bank)bank, address / 2, (uint8_t)count, data,
02077 sr->gen2AccessPassword, filter);
02078
02079 }
02080 default:
02081 return TMR_ERROR_INVALID_WRITE_MODE;
02082 }
02083
02084
02085 }
02086 #ifdef TMR_ENABLE_ISO180006B
02087 else if (TMR_TAG_PROTOCOL_ISO180006B == reader->tagOpParams.protocol)
02088 {
02089 if (count != 1)
02090 {
02091 return TMR_ERROR_INVALID;
02092 }
02093 return TMR_SR_cmdISO180006BWriteTagData(reader, (uint16_t)(sr->commandTimeout),
02094 (uint8_t)address, 1, data, filter);
02095 }
02096 #endif
02097 else
02098 {
02099 return TMR_ERROR_INVALID;
02100 }
02101 }
02102
02103
02104 TMR_Status
02105 TMR_SR_lockTag(struct TMR_Reader *reader, const TMR_TagFilter *filter,
02106 TMR_TagLockAction *action)
02107 {
02108 TMR_Status ret;
02109 TMR_SR_SerialReader *sr;
02110
02111 sr = &reader->u.serialReader;
02112
02113 ret = setProtocol(reader, reader->tagOpParams.protocol);
02114 if (TMR_SUCCESS != ret)
02115 {
02116 return ret;
02117 }
02118
02119 if (TMR_TAG_PROTOCOL_GEN2 == reader->tagOpParams.protocol)
02120 {
02121 if (TMR_LOCK_ACTION_TYPE_GEN2_LOCK_ACTION != action->type)
02122 {
02123
02124 return TMR_ERROR_INVALID;
02125 }
02126 return TMR_SR_cmdGEN2LockTag(reader, (uint16_t)sr->commandTimeout,
02127 action->u.gen2LockAction.mask,
02128 action->u.gen2LockAction.action,
02129 sr->gen2AccessPassword,
02130 filter);
02131 }
02132 #ifdef TMR_ENABLE_ISO180006B
02133 else if (TMR_TAG_PROTOCOL_ISO180006B == reader->tagOpParams.protocol)
02134 {
02135 if (TMR_LOCK_ACTION_TYPE_ISO180006B_LOCK_ACTION != action->type)
02136 {
02137
02138 return TMR_ERROR_INVALID;
02139 }
02140 return TMR_SR_cmdISO180006BLockTag(reader, (uint16_t)(sr->commandTimeout),
02141 action->u.iso180006bLockAction.address,
02142 filter);
02143 }
02144 #endif
02145 else
02146 {
02147 return TMR_ERROR_UNIMPLEMENTED;
02148 }
02149 }
02150
02151 TMR_Status
02152 TMR_SR_reboot(TMR_Reader *reader)
02153 {
02154 TMR_Status ret;
02155
02156 ret = TMR_SR_cmdrebootReader(reader);
02157
02158 return ret;
02159 }
02160
02161 TMR_Status
02162 TMR_SR_killTag(struct TMR_Reader *reader, const TMR_TagFilter *filter,
02163 const TMR_TagAuthentication *auth)
02164 {
02165 TMR_Status ret;
02166 TMR_SR_SerialReader *sr;
02167
02168 sr = &reader->u.serialReader;
02169
02170 ret = setProtocol(reader, reader->tagOpParams.protocol);
02171 if (TMR_SUCCESS != ret)
02172 {
02173 return ret;
02174 }
02175
02176 if (TMR_TAG_PROTOCOL_GEN2 == reader->tagOpParams.protocol)
02177 {
02178 if (TMR_AUTH_TYPE_GEN2_PASSWORD != auth->type)
02179 {
02180
02181 return TMR_ERROR_INVALID;
02182 }
02183
02184 return TMR_SR_cmdKillTag(reader,
02185 (uint16_t)(sr->commandTimeout),
02186 auth->u.gen2Password,
02187 filter);
02188 }
02189 else
02190 {
02191 return TMR_ERROR_UNIMPLEMENTED;
02192 }
02193 }
02194
02195 TMR_Status
02196 TMR_SR_gpoSet(struct TMR_Reader *reader, uint8_t count,
02197 const TMR_GpioPin state[])
02198 {
02199 TMR_Status ret;
02200 int i;
02201
02202 for (i = 0; i < count; i++)
02203 {
02204 ret = TMR_SR_cmdSetGPIO(reader, state[i].id, state[i].high);
02205 if (TMR_SUCCESS != ret)
02206 return ret;
02207 }
02208
02209 return TMR_SUCCESS;
02210 }
02211
02212 TMR_Status TMR_SR_gpiGet(struct TMR_Reader *reader, uint8_t *count,
02213 TMR_GpioPin state[])
02214 {
02215 TMR_Status ret;
02216 TMR_GpioPin pinStates[4];
02217 uint8_t i,j, numPins;
02218
02219 numPins = numberof(pinStates);
02220 ret = TMR_SR_cmdGetGPIO(reader, &numPins, pinStates);
02221 if (TMR_SUCCESS != ret)
02222 {
02223 return ret;
02224 }
02225
02226 if (numPins > *count)
02227 {
02228 numPins = *count;
02229 }
02230
02231 *count = 0;
02232 j = 0;
02233 for (i = 0 ; i < numPins ; i++)
02234 {
02235 if (!pinStates[i].output)
02236 {
02237
02238 state[j].id = pinStates[i].id;
02239 state[j].high = pinStates[i].high;
02240 state[j].output = pinStates[i].output;
02241 (*count)++;
02242 j ++;
02243 }
02244 }
02245
02246 return TMR_SUCCESS;
02247 }
02248
02249 #ifdef TMR_ENABLE_STDIO
02250 TMR_Status
02251 TMR_SR_firmwareLoad(struct TMR_Reader *reader, void *cookie,
02252 TMR_FirmwareDataProvider provider)
02253 {
02254 static const uint8_t magic[] =
02255 { 0x54, 0x4D, 0x2D, 0x53, 0x50, 0x61, 0x69, 0x6B, 0x00, 0x00, 0x00, 0x02 };
02256
02257 TMR_Status ret;
02258 uint8_t buf[256];
02259 uint16_t packetLen, packetRemaining, size, offset;
02260 uint32_t len, rate, address, remaining;
02261 TMR_SR_SerialReader *sr;
02262 TMR_SR_SerialTransport *transport;
02263
02264 sr = &reader->u.serialReader;
02265 transport = &sr->transport;
02266
02267 remaining = numberof(magic) + 4;
02268 offset = 0;
02269
02270 while (remaining > 0)
02271 {
02272 size = (uint16_t)remaining;
02273 if (false == provider(cookie, &size, buf + offset))
02274 {
02275 return TMR_ERROR_FIRMWARE_FORMAT;
02276 }
02277
02278 remaining -= size;
02279 offset += size;
02280 }
02281
02282 if (0 != memcmp(buf, magic, numberof(magic)))
02283 {
02284 return TMR_ERROR_FIRMWARE_FORMAT;
02285 }
02286
02287 len = GETU32AT(buf, 12);
02288
02289
02290
02291
02292
02293
02294
02295
02296 if (NULL != transport->setBaudRate)
02297 {
02304 ret = TMR_SR_cmdSetBaudRate(reader, 9600);
02305 if (TMR_SUCCESS != ret)
02306 {
02307 return ret;
02308 }
02309 ret = transport->setBaudRate(transport, 9600);
02310 if (TMR_SUCCESS != ret)
02311 {
02312 return ret;
02313 }
02314 }
02315 ret = TMR_SR_cmdBootBootloader(reader);
02316 if ((TMR_SUCCESS != ret)
02317
02318 && (TMR_ERROR_INVALID_OPCODE != ret))
02319 {
02320 return ret;
02321 }
02322
02323
02324
02325
02326 tmr_sleep(200);
02327
02328
02329 sr->supportsPreamble = false;
02330
02331
02332 rate = sr->baudRate;
02333 if (rate > 115200)
02334 {
02335 rate = 115200;
02336 }
02337
02338 if (NULL != transport->setBaudRate)
02339 {
02346 ret = TMR_SR_cmdSetBaudRate(reader, rate);
02347 if (TMR_SUCCESS != ret)
02348 {
02349 return ret;
02350 }
02351 ret = transport->setBaudRate(transport, rate);
02352 if (TMR_SUCCESS != ret)
02353 {
02354 return ret;
02355 }
02356 }
02357 ret = TMR_SR_cmdEraseFlash(reader, 2, 0x08959121);
02358 if (TMR_SUCCESS != ret)
02359 {
02360 return ret;
02361 }
02362
02363 address = 0;
02364 remaining = len;
02365 while (remaining > 0)
02366 {
02367 packetLen = 240;
02368 if (packetLen > remaining)
02369 {
02370 packetLen = (uint16_t)remaining;
02371 }
02372 offset = 0;
02373 packetRemaining = packetLen;
02374 while (packetRemaining > 0)
02375 {
02376 size = packetRemaining;
02377 if (false == provider(cookie, &size, buf + offset))
02378 {
02379 return TMR_ERROR_FIRMWARE_FORMAT;
02380 }
02381 packetRemaining -= size;
02382 offset += size;
02383 }
02384 ret = TMR_SR_cmdWriteFlashSector(reader, 2, address, 0x02254410,(uint8_t) packetLen,
02385 buf, 0);
02386 if (TMR_SUCCESS != ret)
02387 {
02388 return ret;
02389 }
02390 address += packetLen;
02391 remaining -= packetLen;
02392 }
02393
02394 ret = TMR_SR_boot(reader, rate);
02395 if(ret != TMR_SUCCESS)
02396 {
02397 if(ret == TMR_ERROR_AUTOREAD_ENABLED)
02398 {
02399 ret = TMR_ERROR_FIRMWARE_UPDATE_ON_AUTOREAD;
02400 return ret;
02401 }
02402 }
02403 return ret;
02404 }
02405 #endif
02406
02407 static TMR_Status
02408 getHardwareInfo(struct TMR_Reader *reader, void *value)
02409 {
02410
02411
02412 char tmp[255];
02413
02414 TMR_SR_VersionInfo *info;
02415
02416 info = &reader->u.serialReader.versionInfo;
02417
02418 TMR_hexDottedQuad(info->hardware, tmp);
02422
02423
02424
02425
02426
02427
02428
02429
02430
02431
02432
02433
02434 TMR_stringCopy(value, tmp, (int)strlen(tmp));
02435
02436 return TMR_SUCCESS;
02437 }
02438
02439 static TMR_Status
02440 getSerialNumber(struct TMR_Reader *reader, void *value)
02441 {
02442
02443 TMR_Status ret;
02444 uint8_t buf[127];
02445 uint8_t count;
02446 char tmp[127];
02447 int tmplen;
02448
02449 count = 127;
02450 tmplen = 0;
02451 ret = TMR_SR_cmdGetHardwareVersion(reader, 0, 0x40, &count, buf);
02452 if (TMR_SUCCESS != ret)
02453 {
02454 count = 0;
02455 }
02456 else
02457 {
02458 int idx;
02459 uint8_t len;
02460
02461 idx = 3;
02462 len = buf[idx++];
02463 if (len > (count-3))
02464 {
02465 ret = TMR_ERROR_UNIMPLEMENTED;
02466 }
02467 else
02468 {
02469 for (tmplen=0; tmplen<len; tmplen++)
02470 {
02471 tmp[tmplen] = (char)buf[idx+tmplen];
02472 }
02473 }
02474 }
02475 if (0 == count)
02476 {
02477 TMR_String *serial = (TMR_String *)value;
02483 serial->value[0] = '\0';
02484 return TMR_SUCCESS;
02485 }
02486 TMR_stringCopy(value, tmp, tmplen);
02487 return ret;
02488 }
02489
02490
02491
02492
02493
02494
02495
02496
02497 static TMR_Status
02498 setPortValues(struct TMR_Reader *reader, const TMR_PortValueList *list,
02499 int offset)
02500 {
02501 TMR_Status ret;
02502 TMR_SR_PortPowerAndSettlingTime ports[TMR_SR_MAX_ANTENNA_PORTS];
02503 uint8_t count;
02504 uint16_t i, j;
02505
02506 count = numberof(ports);
02507
02508 ret = TMR_SR_cmdGetAntennaPortPowersAndSettlingTime(reader, &count, ports);
02509 if (TMR_SUCCESS != ret)
02510 {
02511 return ret;
02512 }
02513
02514
02515
02516
02517
02518
02519
02520
02521
02522
02523
02524 for (i = 0; i < list->len; i++)
02525 {
02526 for (j = 0 ; j < count ; j++)
02527 {
02528 if (list->list[i].port == ports[j].port)
02529 {
02530 break;
02531 }
02532 }
02533 if (j == count)
02534 {
02535 if (count == TMR_SR_MAX_ANTENNA_PORTS)
02536 {
02537 return TMR_ERROR_TOO_BIG;
02538 }
02539 ports[j].port = list->list[i].port;
02540 ports[j].readPower = 0;
02541 ports[j].writePower = 0;
02542 ports[j].settlingTime = 0;
02543 count++;
02544 }
02545
02546 if (list->list[i].value > 32767 || list->list[i].value < -32768)
02547 {
02548 return TMR_ERROR_ILLEGAL_VALUE;
02549 }
02550 *(&ports[j].readPower + offset) = (int16_t)(list->list[i].value);
02551 }
02552 return TMR_SR_cmdSetAntennaPortPowersAndSettlingTime(reader, count, ports);
02553 }
02554
02555
02556 static TMR_Status
02557 getPortValues(struct TMR_Reader *reader, TMR_PortValueList *list, int offset)
02558 {
02559 TMR_Status ret;
02560 TMR_SR_PortPowerAndSettlingTime ports[TMR_SR_MAX_ANTENNA_PORTS];
02561 uint8_t count;
02562 uint16_t i, j;
02563
02564 count = numberof(ports);
02565
02566 ret = TMR_SR_cmdGetAntennaPortPowersAndSettlingTime(reader, &count, ports);
02567 if (TMR_SUCCESS != ret)
02568 {
02569 return ret;
02570 }
02571
02572 for (i = 0, j = 0; i < count; i++)
02573 {
02574 if ((0 == *(&ports[i].readPower + offset) && ((TMR_SR_MODEL_MICRO != reader->u.serialReader.versionInfo.hardware[0])
02575 || (TMR_SR_MODEL_M6E_NANO != reader->u.serialReader.versionInfo.hardware[0])))
02576 || (((TMR_SR_MODEL_MICRO == reader->u.serialReader.versionInfo.hardware[0]) ||
02577 (TMR_SR_MODEL_M6E_NANO == reader->u.serialReader.versionInfo.hardware[0]))
02578 && (-32768 == *(&ports[i].readPower + offset))))
02579 {
02580 continue;
02581 }
02582 if (j < list->max)
02583 {
02584 list->list[j].port = ports[i].port;
02585 list->list[j].value = (int32_t)*(&ports[i].readPower + offset);
02586 }
02587 j++;
02588 }
02589 list->len = (uint8_t)j;
02590
02591 return TMR_SUCCESS;
02592 }
02593
02594 static TMR_Status
02595 TMR_SR_paramSet(struct TMR_Reader *reader, TMR_Param key, const void *value)
02596 {
02597 TMR_Status ret;
02598 TMR_SR_Configuration readerkey;
02599 TMR_SR_ProtocolConfiguration protokey;
02600 TMR_SR_SerialReader *sr;
02601 TMR_SR_SerialTransport *transport;
02602
02603 ret = TMR_SUCCESS;
02604 sr = &reader->u.serialReader;
02605 readerkey = TMR_SR_CONFIGURATION_TRANSMIT_POWER_SAVE;
02606 protokey.protocol = TMR_TAG_PROTOCOL_GEN2;
02607
02608 if (0 == BITGET(sr->paramConfirmed, key))
02609 {
02610 TMR_paramProbe(reader, key);
02611 }
02612
02613 if (BITGET(sr->paramConfirmed, key) && (0 == BITGET(sr->paramPresent, key)))
02614 {
02615 return TMR_ERROR_NOT_FOUND;
02616 }
02617
02618 switch (key)
02619 {
02620 case TMR_PARAM_REGION_ID:
02621 sr->regionId = *(TMR_Region*)value;
02622 if (reader->connected)
02623 {
02624 ret = TMR_SR_cmdSetRegion(reader, sr->regionId);
02625 }
02626 break;
02627
02628 case TMR_PARAM_URI:
02629 case TMR_PARAM_PRODUCT_GROUP_ID:
02630 case TMR_PARAM_PRODUCT_GROUP:
02631 case TMR_PARAM_PRODUCT_ID:
02632 case TMR_PARAM_TAGREADATA_TAGOPSUCCESSCOUNT:
02633 case TMR_PARAM_TAGREADATA_TAGOPFAILURECOUNT:
02634 {
02635 ret = TMR_ERROR_READONLY;
02636 break;
02637 }
02638
02639 case TMR_PARAM_STATUS_ENABLE_ANTENNAREPORT:
02640 {
02641 *(bool *)value ? (reader->streamStats |= TMR_SR_STATUS_ANTENNA) :
02642 (reader->streamStats &= ~TMR_SR_STATUS_ANTENNA) ;
02643 break;
02644 }
02645 case TMR_PARAM_STATUS_ENABLE_FREQUENCYREPORT:
02646 {
02647 *(bool *)value ? (reader->streamStats |= TMR_SR_STATUS_FREQUENCY) :
02648 (reader->streamStats &= ~TMR_SR_STATUS_FREQUENCY) ;
02649 break;
02650 }
02651 case TMR_PARAM_STATUS_ENABLE_TEMPERATUREREPORT:
02652 {
02653 *(bool *)value ? (reader->streamStats |= TMR_SR_STATUS_TEMPERATURE) :
02654 (reader->streamStats &= ~TMR_SR_STATUS_TEMPERATURE) ;
02655 break;
02656 }
02657
02658 case TMR_PARAM_BAUDRATE:
02659 {
02660 uint32_t rate;
02661
02662 transport = &sr->transport;
02663 rate = *(uint32_t *)value;
02664
02665 if (reader->connected)
02666 {
02667 if (NULL != transport->setBaudRate)
02668 {
02674 ret = TMR_SR_cmdSetBaudRate(reader, rate);
02675 if (TMR_SUCCESS != ret)
02676 {
02677 break;
02678 }
02679 sr->baudRate = rate;
02680 transport->setBaudRate(transport, sr->baudRate);
02681 }
02682 }
02683 else
02684 {
02685 sr->baudRate = rate;
02686 }
02687 break;
02688 }
02689
02690 case TMR_PARAM_PROBEBAUDRATES:
02691 {
02692 const TMR_uint32List *u32List;
02693 uint8_t i;
02694 u32List = value;
02695
02696 if (u32List->len > sr->probeBaudRates.max)
02697 {
02698 ret = TMR_ERROR_TOO_BIG;
02699 break;
02700 }
02701
02702 for(i = 0; i < u32List->len; i++)
02703 {
02704 sr->probeBaudRates.list[i] = u32List->list[i];
02705 }
02706
02707 sr->probeBaudRates.len = u32List->len;
02708 break;
02709 }
02710
02711 case TMR_PARAM_COMMANDTIMEOUT:
02712 {
02713 uint32_t val = *(uint32_t*)value;
02714 if (((uint32_t)1<<31) & val)
02715 {
02716 ret = TMR_ERROR_ILLEGAL_VALUE;
02717 }
02718 else
02719 {
02720 sr->commandTimeout = *(uint32_t *)value;
02721 }
02722 }
02723 break;
02724 case TMR_PARAM_TRANSPORTTIMEOUT:
02725 {
02726 uint32_t val = *(uint32_t*)value;
02727 if (((uint32_t)1<<31) & val)
02728 {
02729 ret = TMR_ERROR_ILLEGAL_VALUE;
02730 }
02731 else
02732 {
02737 sr->transportTimeout = *(uint32_t *)value;
02738 sr->usrTimeoutEnable = true;
02739 }
02740 }
02741 break;
02742 case TMR_PARAM_RADIO_ENABLEPOWERSAVE:
02743 readerkey = TMR_SR_CONFIGURATION_TRANSMIT_POWER_SAVE;
02744 break;
02745 case TMR_PARAM_RADIO_ENABLESJC:
02746 readerkey = TMR_SR_CONFIGURATION_SELF_JAMMER_CANCELLATION;
02747 break;
02748 case TMR_PARAM_EXTENDEDEPC:
02749 readerkey = TMR_SR_CONFIGURATION_EXTENDED_EPC;
02750 break;
02751
02752 case TMR_PARAM_TAGREADDATA_UNIQUEBYPROTOCOL:
02753 if ((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) ||
02754 (TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]) ||
02755 (TMR_SR_MODEL_M6E_NANO == sr->versionInfo.hardware[0]) ||
02756 (TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]))
02757 {
02758 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_UNIQUE_BY_PROTOCOL, value);
02759 }
02760 else
02761 {
02762 ret = TMR_ERROR_NOT_FOUND;
02763 }
02764 break;
02765
02766 case TMR_PARAM_TAGREADDATA_READFILTERTIMEOUT:
02767 if ((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) ||
02768 (TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]) ||
02769 (TMR_SR_MODEL_M6E_NANO == sr->versionInfo.hardware[0]) ||
02770 (TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]))
02771 {
02772 int32_t timeout = (TMR_DEFAULT_READ_FILTER_TIMEOUT == *(int32_t *)value) ? 0 : *(int32_t *)value;
02773 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_READ_FILTER_TIMEOUT, &timeout);
02774 if (TMR_SUCCESS == ret)
02775 {
02776 reader->u.serialReader.readFilterTimeout = timeout;
02777 }
02778 }
02779 else
02780 {
02781 ret = TMR_ERROR_NOT_FOUND;
02782 }
02783 break;
02784
02785 case TMR_PARAM_TAGREADDATA_ENABLEREADFILTER:
02786 if ((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) || (TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]) ||
02787 (TMR_SR_MODEL_M6E_NANO == sr->versionInfo.hardware[0]) ||(TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]))
02788 {
02789 ret = TMR_SR_cmdSetReaderConfiguration(reader, TMR_SR_CONFIGURATION_ENABLE_READ_FILTER, value);
02790 if (TMR_SUCCESS == ret)
02791 {
02792 reader->u.serialReader.enableReadFiltering = *(bool *)value;
02793 }
02794 }
02795 else
02796 {
02797 ret = TMR_ERROR_READONLY;
02798 }
02799 break;
02800
02801 case TMR_PARAM_RADIO_READPOWER:
02802 ret = TMR_SR_cmdSetReadTxPower(reader, *(int32_t *)value);
02803 break;
02804 case TMR_PARAM_RADIO_WRITEPOWER:
02805 ret = TMR_SR_cmdSetWriteTxPower(reader, *(int32_t *)value);
02806 break;
02807
02808 case TMR_PARAM_RADIO_PORTREADPOWERLIST:
02809 ret = setPortValues(reader, value, 0);
02810 break;
02811
02812 case TMR_PARAM_RADIO_PORTWRITEPOWERLIST:
02813 ret = setPortValues(reader, value, 1);
02814 break;
02815
02816 case TMR_PARAM_ANTENNA_SETTLINGTIMELIST:
02817 ret = setPortValues(reader, value, 2);
02818 break;
02819
02820 case TMR_PARAM_ANTENNA_CHECKPORT:
02821 readerkey = TMR_SR_CONFIGURATION_SAFETY_ANTENNA_CHECK;
02822 break;
02823
02824 case TMR_PARAM_TAGREADDATA_RECORDHIGHESTRSSI:
02825 readerkey = TMR_SR_CONFIGURATION_RECORD_HIGHEST_RSSI;
02826 break;
02827
02828 case TMR_PARAM_TAGREADDATA_REPORTRSSIINDBM:
02829 readerkey = TMR_SR_CONFIGURATION_RSSI_IN_DBM;
02830 break;
02831
02832 case TMR_PARAM_TAGREADDATA_UNIQUEBYANTENNA:
02833 readerkey = TMR_SR_CONFIGURATION_UNIQUE_BY_ANTENNA;
02834 break;
02835
02836 case TMR_PARAM_TAGREADDATA_UNIQUEBYDATA:
02837 readerkey = TMR_SR_CONFIGURATION_UNIQUE_BY_DATA;
02838 break;
02839
02840 case TMR_PARAM_ANTENNA_PORTSWITCHGPOS:
02841 {
02842 const TMR_uint8List *u8list;
02843 uint16_t i;
02844
02845 u8list = value;
02846 reader->portmask = 0;
02847 for (i = 0 ; i < u8list->len && i < u8list->max ; i++)
02848 {
02849 reader->portmask |= 1 << (u8list->list[i] - 1);
02850 }
02851
02852 ret = TMR_SR_cmdSetReaderConfiguration(
02853 reader, TMR_SR_CONFIGURATION_ANTENNA_CONTROL_GPIO, &reader->portmask);
02854
02855 if (TMR_SUCCESS != ret)
02856 {
02857 break;
02858 }
02859 ret = initTxRxMapFromPorts(reader);
02860
02861 break;
02862 }
02863
02864 case TMR_PARAM_TRIGGER_READ_GPI:
02865 {
02866 uint8_t portmask;
02867 const TMR_uint8List *u8list;
02868 uint16_t i;
02869
02870 u8list = value;
02871 portmask = 0;
02872 for (i = 0 ; i < u8list->len && i < u8list->max ; i++)
02873 {
02874 portmask |= 1 << (u8list->list[i] - 1);
02875 }
02876
02877 ret = TMR_SR_cmdSetReaderConfiguration(
02878 reader, TMR_SR_CONFIGURATION_TRIGGER_READ_GPIO, &portmask);
02879 break;
02880 }
02881
02882 case TMR_PARAM_ANTENNA_TXRXMAP:
02883 {
02884 const TMR_AntennaMapList *map;
02885 TMR_AntennaMapList *mymap;
02886 uint8_t len;
02887 uint16_t i, j;
02888
02889 map = value;
02890 mymap = sr->txRxMap;
02891
02892 if (map->len > mymap->max)
02893 {
02894 ret = TMR_ERROR_TOO_BIG;
02895 break;
02896 }
02897
02898 len = 0;
02899
02900 for (i = 0 ; i < map->len ; i++)
02901 {
02902 if (!HASPORT(sr->portMask, map->list[i].txPort) ||
02903 !HASPORT(sr->portMask, map->list[i].rxPort))
02904 {
02905 return TMR_ERROR_NO_ANTENNA;
02906 }
02907
02908
02909 for (j = i+1; j < map->len; j++)
02910 {
02911 if (map->list[i].antenna == map->list[j].antenna)
02912 {
02913 return TMR_ERROR_INVALID_ANTENNA_CONFIG;
02914 }
02915 }
02916
02917 len = i+1;
02918 }
02919
02920 for (i = 0; i < len; i ++)
02921 {
02922 mymap->list[i] = map->list[i];
02923 }
02924 mymap->len = len;
02925 break;
02926 }
02927
02928 case TMR_PARAM_REGION_HOPTABLE:
02929 {
02930 const TMR_uint32List *u32list;
02931
02932 u32list = value;
02933
02934 ret = TMR_SR_cmdSetFrequencyHopTable(reader, (uint8_t)u32list->len, u32list->list);
02935 break;
02936 }
02937
02938 case TMR_PARAM_REGION_HOPTIME:
02939 ret = TMR_SR_cmdSetFrequencyHopTime(reader, *(uint32_t *)value);
02940 break;
02941
02942 case TMR_PARAM_REGION_LBT_ENABLE:
02943 {
02944 uint32_t hopTable[64];
02945 uint8_t count;
02946
02947 count = numberof(hopTable);
02948 ret = TMR_SR_cmdGetFrequencyHopTable(reader, &count, hopTable);
02949 if (TMR_SUCCESS != ret)
02950 {
02951 break;
02952 }
02953
02954 ret = TMR_SR_cmdSetRegionLbt(reader, sr->regionId, *(bool *)value);
02955 if (TMR_SUCCESS != ret)
02956 {
02957 break;
02958 }
02959
02960 ret = TMR_SR_cmdSetFrequencyHopTable(reader, count, hopTable);
02961 break;
02962 }
02963
02964 case TMR_PARAM_TAGOP_ANTENNA:
02965 {
02966 uint16_t i;
02967 TMR_AntennaMapList *map;
02968 uint8_t antenna;
02969 uint8_t txPort, rxPort;
02970
02971 map = sr->txRxMap;
02972 antenna = *(uint8_t *)value;
02973
02974 txPort = rxPort = 0;
02975 for (i = 0; i < map->len && i < map->max; i++)
02976 {
02977 if (map->list[i].antenna == antenna)
02978 {
02979 txPort = map->list[i].txPort;
02980 rxPort = map->list[i].rxPort;
02981 reader->tagOpParams.antenna = antenna;
02982 break;
02983 }
02984 }
02985 if (txPort == 0)
02986 {
02987 ret = TMR_ERROR_NO_ANTENNA;
02988 }
02989 else
02990 {
02991 ret = TMR_SR_cmdSetTxRxPorts(reader, txPort, rxPort);
02992 }
02993 break;
02994 }
02995
02996 case TMR_PARAM_TAGOP_PROTOCOL:
02997 if (0 == ((1 << (*(TMR_TagProtocol *)value - 1)) &
02998 sr->versionInfo.protocols))
02999 {
03000 ret = TMR_ERROR_UNSUPPORTED;
03001 }
03002 else
03003 {
03004 reader->tagOpParams.protocol = *(TMR_TagProtocol *)value;
03005 if (reader->connected)
03006 {
03007 ret = setProtocol(reader, reader->tagOpParams.protocol);
03008 if (TMR_SUCCESS == ret)
03009 {
03010 reader->u.serialReader.currentProtocol = reader->tagOpParams.protocol;
03011 }
03012 }
03013 }
03014 break;
03015
03016 case TMR_PARAM_READ_PLAN:
03017 {
03018 const TMR_ReadPlan *plan;
03019 TMR_ReadPlan tmpPlan;
03020
03021 plan = value;
03022 tmpPlan = *plan;
03023
03024 ret = validateReadPlan(reader, &tmpPlan,
03025 sr->txRxMap, sr->versionInfo.protocols);
03026 if (TMR_SUCCESS != ret)
03027 {
03028 return ret;
03029 }
03030
03031 *reader->readParams.readPlan = tmpPlan;
03032 break;
03033 }
03034
03035 case TMR_PARAM_GPIO_INPUTLIST:
03036 case TMR_PARAM_GPIO_OUTPUTLIST:
03037 if ((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) ||
03038 (TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]) ||
03039 (TMR_SR_MODEL_M6E_NANO == sr->versionInfo.hardware[0]) ||
03040 (TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]))
03041 {
03042 const TMR_uint8List *u8list;
03043 int bit, i, newDirections, pin;
03044
03045 u8list = value;
03046
03047 if (key == TMR_PARAM_GPIO_OUTPUTLIST)
03048 {
03049 newDirections = 0;
03050 }
03051 else
03052 {
03053 newDirections = 0x1e;
03054 }
03055
03056 for (i = 0 ; i < u8list->len && i < u8list->max ; i++)
03057 {
03058 if (key == TMR_PARAM_GPIO_OUTPUTLIST)
03059 {
03060 newDirections |= (1 << u8list->list[i]);
03061 }
03062 else
03063 {
03064 newDirections &= ~(1 << u8list->list[i]);
03065 }
03066 }
03067
03068 for (pin = 0 ; pin < u8list->len ; pin++)
03069 {
03070 bit = 1 << (u8list->list[pin]);
03071
03072 ret = TMR_SR_cmdSetGPIODirection(reader, u8list->list[pin],
03073 (newDirections & bit) != 0);
03074 if (TMR_SUCCESS != ret)
03075 {
03076 return ret;
03077 }
03078
03079 }
03080 break;
03081 }
03082 case TMR_PARAM_RADIO_POWERMAX:
03083 case TMR_PARAM_RADIO_POWERMIN:
03084 case TMR_PARAM_REGION_SUPPORTEDREGIONS:
03085 case TMR_PARAM_ANTENNA_PORTLIST:
03086 case TMR_PARAM_ANTENNA_CONNECTEDPORTLIST:
03087 case TMR_PARAM_VERSION_SUPPORTEDPROTOCOLS:
03088 case TMR_PARAM_RADIO_TEMPERATURE:
03089 case TMR_PARAM_VERSION_HARDWARE:
03090 case TMR_PARAM_VERSION_MODEL:
03091 case TMR_PARAM_VERSION_SOFTWARE:
03092 case TMR_PARAM_ANTENNA_RETURNLOSS:
03093 case TMR_PARAM_GEN2_PROTOCOLEXTENSION:
03094 ret = TMR_ERROR_READONLY;
03095 break;
03096
03097 case TMR_PARAM_POWERMODE:
03098 if (reader->connected)
03099 {
03100 ret = TMR_SR_cmdSetPowerMode(reader, *(TMR_SR_PowerMode *)value);
03101 if (TMR_SUCCESS == ret)
03102 {
03103 sr->powerMode = *(TMR_SR_PowerMode *)value;
03104 }
03105 }
03106 else
03107 {
03108 sr->powerMode = *(TMR_SR_PowerMode *)value;
03109 }
03110 break;
03111
03112 case TMR_PARAM_USERMODE:
03113 ret = TMR_SR_cmdSetUserMode(reader, *(TMR_SR_UserMode *)value);
03114 break;
03115
03116 case TMR_PARAM_GEN2_Q:
03117 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_Q;
03118 break;
03119
03120 case TMR_PARAM_GEN2_TAGENCODING:
03121 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_TAGENCODING;
03122 break;
03123
03124 case TMR_PARAM_GEN2_SESSION:
03125 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_SESSION;
03126 break;
03127
03128 case TMR_PARAM_GEN2_TARGET:
03129 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_TARGET;
03130 break;
03131
03132 case TMR_PARAM_GEN2_BLF:
03133 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_LINKFREQUENCY;
03134 break;
03135
03136 case TMR_PARAM_GEN2_TARI:
03137 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_TARI;
03138 break;
03139
03140 case TMR_PARAM_GEN2_WRITEMODE:
03141 sr->writeMode = *(TMR_GEN2_WriteMode *)value;
03142 break;
03143
03144 case TMR_PARAM_GEN2_BAP:
03145 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_BAP;
03146 break;
03147
03148 #ifdef TMR_ENABLE_ISO180006B
03149 case TMR_PARAM_ISO180006B_BLF:
03150 protokey.protocol = TMR_TAG_PROTOCOL_ISO180006B;
03151 protokey.u.iso180006b = TMR_SR_ISO180006B_CONFIGURATION_LINKFREQUENCY;
03152 break;
03153 case TMR_PARAM_ISO180006B_MODULATION_DEPTH:
03154 {
03155 protokey.protocol = TMR_TAG_PROTOCOL_ISO180006B;
03156 protokey.u.iso180006b = TMR_SR_ISO180006B_CONFIGURATION_MODULATION_DEPTH;
03157 break;
03158 }
03159 case TMR_PARAM_ISO180006B_DELIMITER:
03160 {
03161 protokey.protocol = TMR_TAG_PROTOCOL_ISO180006B;
03162 protokey.u.iso180006b = TMR_SR_ISO180006B_CONFIGURATION_DELIMITER;
03163 break;
03164 }
03165 #endif
03166
03167 case TMR_PARAM_GEN2_ACCESSPASSWORD:
03168 sr->gen2AccessPassword = *(TMR_GEN2_Password *)value;
03169 break;
03170
03171 case TMR_PARAM_LICENSE_KEY:
03172 {
03173 uint32_t supportedProtocols;
03174 TMR_uint8List *license = (TMR_uint8List *)value;
03175
03176 ret = TMR_SR_cmdSetProtocolLicenseKey(reader, TMR_SR_SET_LICENSE_KEY, license->list, license->len, &supportedProtocols);
03177 }
03178 break;
03179
03180 case TMR_PARAM_USER_CONFIG:
03181 {
03182 TMR_SR_UserConfigOp *config = (TMR_SR_UserConfigOp *)value;
03183
03184 switch(config->op)
03185 {
03186 case TMR_USERCONFIG_SAVE:
03187
03188 ret = TMR_SR_cmdSetUserProfile(reader, TMR_USERCONFIG_SAVE, config->category, TMR_SR_CUSTOM_CONFIGURATION);
03189 break;
03190
03191 case TMR_USERCONFIG_RESTORE:
03192
03193 ret = TMR_SR_cmdSetUserProfile(reader, TMR_USERCONFIG_RESTORE, config->category, TMR_SR_CUSTOM_CONFIGURATION);
03194 break;
03195
03196 case TMR_USERCONFIG_CLEAR:
03197
03198 ret = TMR_SR_cmdSetUserProfile(reader, TMR_USERCONFIG_CLEAR, config->category, TMR_SR_CUSTOM_CONFIGURATION);
03199 break;
03200
03201 case TMR_USERCONFIG_VERIFY:
03202 ret = TMR_SR_cmdSetUserProfile(reader, TMR_USERCONFIG_VERIFY, config->category, TMR_SR_CUSTOM_CONFIGURATION);
03203 break;
03204
03205 case TMR_USERCONFIG_SAVE_WITH_READPLAN:
03206
03207 ret = TMR_SR_cmdSetUserProfile(reader, TMR_USERCONFIG_SAVE_WITH_READPLAN, config->category, TMR_SR_CUSTOM_CONFIGURATION);
03208 break;
03209
03210 default:
03211 ret = TMR_ERROR_NOT_FOUND;
03212 }
03213
03214 }
03215 break;
03216
03217 case TMR_PARAM_READER_STATISTICS:
03218
03219 ret = TMR_SR_cmdResetReaderStatistics(reader, TMR_SR_READER_STATS_ALL);
03220 break;
03221
03222 case TMR_PARAM_READER_STATS:
03223 {
03224 if ((NULL != reader->pSupportsResetStats) && (false == *(reader->pSupportsResetStats)))
03225 {
03226
03227 return TMR_ERROR_UNSUPPORTED;
03228 }
03229
03230
03231 ret = TMR_SR_cmdResetReaderStats(reader, TMR_READER_STATS_FLAG_ALL);
03232 break;
03233 }
03234
03235 case TMR_PARAM_READER_STATS_ENABLE:
03236 {
03237 if ((NULL != reader->pSupportsResetStats) && (false == *(reader->pSupportsResetStats)))
03238 {
03239
03240 return TMR_ERROR_UNSUPPORTED;
03241 }
03242
03243
03244 reader->statsFlag = *(TMR_Reader_StatsFlag *)value;
03245 break;
03246 }
03247
03248 case TMR_PARAM_READER_WRITE_REPLY_TIMEOUT:
03249 case TMR_PARAM_READER_WRITE_EARLY_EXIT:
03250 {
03251 TMR_SR_Gen2ReaderWriteTimeOut timeout;
03252
03253
03254 switch (key)
03255 {
03256 case TMR_PARAM_READER_WRITE_REPLY_TIMEOUT:
03257 {
03258 if ( *(uint16_t *)value < 1000 || *(uint16_t *)value > 21000)
03259 return TMR_ERROR_MSG_INVALID_PARAMETER_VALUE;
03260 break;
03261 }
03262 default:
03263 ;
03264 }
03265
03266
03267 ret = TMR_SR_cmdGetReaderWriteTimeOut(reader, protokey.protocol, &timeout);
03268 if (TMR_SUCCESS != ret)
03269 {
03270 break;
03271 }
03272
03273
03274 switch (key)
03275 {
03276 case TMR_PARAM_READER_WRITE_REPLY_TIMEOUT:
03277 {
03278 timeout.writetimeout = *(uint16_t *)value;
03279 break;
03280 }
03281 case TMR_PARAM_READER_WRITE_EARLY_EXIT:
03282 {
03283 timeout.earlyexit = !(*(bool *)value);
03284 break;
03285 }
03286 default:
03287 ret = TMR_ERROR_NOT_FOUND;
03288 }
03289
03290
03291 ret = TMR_SR_cmdSetReaderWriteTimeOut (reader,protokey.protocol, &timeout);
03292 break;
03293 }
03294 case TMR_PARAM_METADATAFLAG:
03295 {
03296 if (*(TMR_TRD_MetadataFlag *)value & TMR_TRD_METADATA_FLAG_PROTOCOL)
03297 reader->userMetadataFlag = *(TMR_TRD_MetadataFlag *)value;
03298 else
03299 ret = TMR_ERROR_MSG_INVALID_PARAMETER_VALUE;
03300 break;
03301 }
03302
03303 default:
03304 ret = TMR_ERROR_NOT_FOUND;
03305 }
03306
03307 switch (key)
03308 {
03309 case TMR_PARAM_ANTENNA_CHECKPORT:
03310 case TMR_PARAM_RADIO_ENABLEPOWERSAVE:
03311 case TMR_PARAM_RADIO_ENABLESJC:
03312 case TMR_PARAM_TAGREADDATA_RECORDHIGHESTRSSI:
03313 case TMR_PARAM_TAGREADDATA_REPORTRSSIINDBM:
03314 case TMR_PARAM_TAGREADDATA_UNIQUEBYANTENNA:
03315 case TMR_PARAM_TAGREADDATA_UNIQUEBYDATA:
03316 ret = TMR_SR_cmdSetReaderConfiguration(reader, readerkey, value);
03317 break;
03318
03319 case TMR_PARAM_EXTENDEDEPC:
03320 {
03321 if ((TMR_SR_MODEL_M6E == reader->u.serialReader.versionInfo.hardware[0])||
03322 (TMR_SR_MODEL_MICRO == reader->u.serialReader.versionInfo.hardware[0])||
03323 (TMR_SR_MODEL_M6E_NANO == reader->u.serialReader.versionInfo.hardware[0])||
03324 (TMR_SR_MODEL_M6E_I == reader->u.serialReader.versionInfo.hardware[0]))
03325 {
03326 ret = TMR_ERROR_UNSUPPORTED;
03327 }
03328 else
03329 {
03330 ret = TMR_SR_cmdSetReaderConfiguration(reader, readerkey, value);
03331 if(TMR_SUCCESS == ret)
03332 {
03333
03334 reader->u.serialReader.extendedEPC = *(bool *)value;
03335 }
03336 }
03337 }
03338 break;
03339
03340 case TMR_PARAM_GEN2_BAP:
03341 {
03342 TMR_GEN2_Bap *bap;
03343 bap = (TMR_GEN2_Bap *)value;
03344
03345 if (NULL == (TMR_GEN2_Bap *)value)
03346 {
03350 sr->isBapEnabled = false;
03351 break;
03352 }
03353 else if ((-1 > bap->powerUpDelayUs) || (-1 > bap->freqHopOfftimeUs))
03354 {
03355
03356
03357
03358
03359 return TMR_ERROR_ILLEGAL_VALUE;
03360 }
03361 else if ((-1 == bap->powerUpDelayUs) && (-1 == bap->freqHopOfftimeUs))
03362 {
03367 sr->isBapEnabled = true;
03368 break;
03369 }
03370 else
03371 {
03372
03373
03374
03375
03376
03377 TMR_GEN2_Bap getBapParams;
03378
03379 ret = TMR_SR_cmdGetProtocolConfiguration(reader, protokey.protocol,
03380 protokey, &getBapParams);
03381
03382 if (TMR_SUCCESS != ret)
03383 {
03384
03385 break;
03386 }
03387 else
03388 {
03389
03390
03391
03392 sr->isBapEnabled = true;
03393
03394 if (-1 == bap->powerUpDelayUs)
03395 {
03396 bap->powerUpDelayUs = getBapParams.powerUpDelayUs;
03397 }
03398 if (-1 == bap->freqHopOfftimeUs)
03399 {
03400 bap->freqHopOfftimeUs = getBapParams.freqHopOfftimeUs;
03401 }
03402 }
03403 }
03404
03405 }
03406
03407 case TMR_PARAM_GEN2_Q:
03408 case TMR_PARAM_GEN2_TAGENCODING:
03409 case TMR_PARAM_GEN2_SESSION:
03410 case TMR_PARAM_GEN2_TARGET:
03411 case TMR_PARAM_GEN2_BLF:
03412 case TMR_PARAM_GEN2_TARI:
03413 #ifdef TMR_ENABLE_ISO180006B
03414 case TMR_PARAM_ISO180006B_BLF:
03415 case TMR_PARAM_ISO180006B_MODULATION_DEPTH:
03416 case TMR_PARAM_ISO180006B_DELIMITER:
03417 #endif
03418 ret = TMR_SR_cmdSetProtocolConfiguration(reader, protokey.protocol,
03419 protokey, value);
03420 break;
03421
03422 default:
03423 ;
03424 }
03425 return ret;
03426 }
03427
03428 static TMR_Status
03429 TMR_SR_paramGet(struct TMR_Reader *reader, TMR_Param key, void *value)
03430 {
03431 TMR_Status ret;
03432 TMR_SR_Configuration readerkey;
03433 TMR_SR_ProtocolConfiguration protokey;
03434 TMR_SR_SerialReader *sr;
03435
03436 ret = TMR_SUCCESS;
03437 sr = &reader->u.serialReader;
03438 readerkey = TMR_SR_CONFIGURATION_TRANSMIT_POWER_SAVE;
03439 protokey.protocol = TMR_TAG_PROTOCOL_GEN2;
03440
03441 if (BITGET(sr->paramConfirmed, key) && 0 == BITGET(sr->paramPresent, key))
03442 {
03443 return TMR_ERROR_NOT_FOUND;
03444 }
03445
03446 switch (key)
03447 {
03448 case TMR_PARAM_BAUDRATE:
03449 *(uint32_t *)value = sr->baudRate;
03450 break;
03451
03452 case TMR_PARAM_PROBEBAUDRATES:
03453 {
03454 TMR_uint32List *uint32List;
03455 uint8_t i;
03456
03457 uint32List = value;
03458
03459 if (sr->probeBaudRates.len > uint32List->max)
03460 {
03461 sr->probeBaudRates.len = uint32List->max;
03462 }
03463
03464 if (sr->probeBaudRates.len)
03465 {
03466 for(i = 0; i < sr->probeBaudRates.len; i++)
03467 {
03468 uint32List->list[i] = sr->probeBaudRates.list[i];
03469 }
03470 uint32List->len = sr->probeBaudRates.len;
03471 }
03472 else
03473 {
03474
03475 }
03476 break;
03477 }
03478
03479 case TMR_PARAM_URI:
03480 if (NULL != value)
03481 {
03482 TMR_stringCopy((TMR_String *)value, reader->uri, (int)strlen(reader->uri));
03483 }
03484 else
03485 {
03486 ret = TMR_ERROR_ILLEGAL_VALUE;
03487 }
03488 break;
03489
03490 case TMR_PARAM_COMMANDTIMEOUT:
03491 *(uint32_t *)value = sr->commandTimeout;
03492 break;
03493
03494 case TMR_PARAM_TRANSPORTTIMEOUT:
03495 *(uint32_t *)value = sr->transportTimeout;
03496 break;
03497
03498 case TMR_PARAM_REGION_ID:
03499 {
03500 if ((TMR_REGION_NONE == sr->regionId) && (reader->connected))
03501 {
03502 ret = TMR_SR_cmdGetRegion(reader, &sr->regionId);
03503 }
03504 *(TMR_Region *)value = sr->regionId;
03505 }
03506 break;
03507
03508 case TMR_PARAM_RADIO_ENABLEPOWERSAVE:
03509 readerkey = TMR_SR_CONFIGURATION_TRANSMIT_POWER_SAVE;
03510 break;
03511
03512 case TMR_PARAM_RADIO_ENABLESJC:
03513 readerkey = TMR_SR_CONFIGURATION_SELF_JAMMER_CANCELLATION;
03514 break;
03515
03516 case TMR_PARAM_TAGREADDATA_READFILTERTIMEOUT:
03517 if ((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) ||
03518 (TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]) ||
03519 (TMR_SR_MODEL_M6E_NANO == sr->versionInfo.hardware[0]) ||
03520 (TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]))
03521 {
03522 *(int32_t *)value = sr->readFilterTimeout;
03523 }
03524 else
03525 {
03526 ret = TMR_ERROR_NOT_FOUND;
03527 }
03528 break;
03529
03530 case TMR_PARAM_TAGREADDATA_ENABLEREADFILTER:
03531 *(bool *)value = sr->enableReadFiltering;
03532 break;
03533
03534 case TMR_PARAM_EXTENDEDEPC:
03535 readerkey = TMR_SR_CONFIGURATION_EXTENDED_EPC;
03536 break;
03537
03538 case TMR_PARAM_RADIO_POWERMAX:
03539 {
03540 TMR_SR_PowerWithLimits power;
03541
03542 ret = TMR_SR_cmdGetReadTxPowerWithLimits(reader, &power);
03543 if (TMR_SUCCESS != ret)
03544 {
03545 break;
03546 }
03547 *(int16_t *)value = power.maxPower;
03548 break;
03549 }
03550
03551 case TMR_PARAM_RADIO_POWERMIN:
03552 {
03553 TMR_SR_PowerWithLimits power;
03554
03555 ret = TMR_SR_cmdGetReadTxPowerWithLimits(reader, &power);
03556 if (TMR_SUCCESS != ret)
03557 break;
03558 *(int16_t *)value = power.minPower;
03559 break;
03560 }
03561
03562 case TMR_PARAM_RADIO_READPOWER:
03563 ret = TMR_SR_cmdGetReadTxPower(reader, (int32_t *)value);
03564 break;
03565
03566 case TMR_PARAM_RADIO_WRITEPOWER:
03567 ret = TMR_SR_cmdGetWriteTxPower(reader, (int32_t *)value);
03568 break;
03569
03570
03571 case TMR_PARAM_ANTENNA_CHECKPORT:
03572 readerkey = TMR_SR_CONFIGURATION_SAFETY_ANTENNA_CHECK;
03573 break;
03574
03575 case TMR_PARAM_TAGREADDATA_RECORDHIGHESTRSSI:
03576 readerkey = TMR_SR_CONFIGURATION_RECORD_HIGHEST_RSSI;
03577 break;
03578
03579 case TMR_PARAM_TAGREADDATA_REPORTRSSIINDBM:
03580 readerkey = TMR_SR_CONFIGURATION_RSSI_IN_DBM;
03581 break;
03582
03583 case TMR_PARAM_TAGREADDATA_UNIQUEBYANTENNA:
03584 readerkey = TMR_SR_CONFIGURATION_UNIQUE_BY_ANTENNA;
03585 break;
03586
03587 case TMR_PARAM_TAGREADDATA_UNIQUEBYDATA:
03588 readerkey = TMR_SR_CONFIGURATION_UNIQUE_BY_DATA;
03589 break;
03590
03591 case TMR_PARAM_TAGREADDATA_UNIQUEBYPROTOCOL:
03592 if ((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) ||
03593 (TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]) ||
03594 (TMR_SR_MODEL_M6E_NANO == sr->versionInfo.hardware[0]) ||
03595 (TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]))
03596 {
03597 ret = TMR_SR_cmdGetReaderConfiguration(reader, TMR_SR_CONFIGURATION_UNIQUE_BY_PROTOCOL, value);
03598 }
03599 else
03600 {
03601 ret = TMR_ERROR_NOT_FOUND;
03602 }
03603 break;
03604
03605 case TMR_PARAM_PRODUCT_GROUP_ID:
03606 readerkey = TMR_SR_CONFIGURATION_PRODUCT_GROUP_ID;
03607 break;
03608
03609 case TMR_PARAM_PRODUCT_ID:
03610 readerkey = TMR_SR_CONFIGURATION_PRODUCT_ID;
03611 break;
03612
03613 case TMR_PARAM_STATUS_ENABLE_ANTENNAREPORT:
03614 *(bool *)value = (reader->streamStats & TMR_SR_STATUS_ANTENNA) ? true : false;
03615 break;
03616 case TMR_PARAM_STATUS_ENABLE_FREQUENCYREPORT:
03617 *(bool *)value = (reader->streamStats & TMR_SR_STATUS_FREQUENCY) ? true : false;
03618 break;
03619 case TMR_PARAM_STATUS_ENABLE_TEMPERATUREREPORT:
03620 *(bool *)value = (reader->streamStats & TMR_SR_STATUS_TEMPERATURE) ? true : false;
03621 break;
03622
03623 case TMR_PARAM_ANTENNA_PORTSWITCHGPOS:
03624 {
03625 TMR_uint8List *u8list;
03626 u8list = value;
03627
03628 ret = TMR_SR_cmdGetReaderConfiguration(
03629 reader, TMR_SR_CONFIGURATION_ANTENNA_CONTROL_GPIO, &reader->portmask);
03630 if (TMR_SUCCESS != ret)
03631 {
03632 break;
03633 }
03634 u8list->len = 0;
03635 if (reader->portmask & 1)
03636 {
03637 LISTAPPEND(u8list, 1);
03638 }
03639 if (reader->portmask & 2)
03640 {
03641 LISTAPPEND(u8list, 2);
03642 }
03643 if (reader->portmask & 3)
03644 {
03645 LISTAPPEND(u8list, 3);
03646 }
03647 break;
03648 }
03649
03650 case TMR_PARAM_TRIGGER_READ_GPI:
03651 {
03652 uint8_t portmask;
03653 TMR_uint8List *u8list;
03654
03655 u8list = value;
03656
03657 ret = TMR_SR_cmdGetReaderConfiguration(
03658 reader, TMR_SR_CONFIGURATION_TRIGGER_READ_GPIO, &portmask);
03659 if (TMR_SUCCESS != ret)
03660 {
03661 break;
03662 }
03663 u8list->len = 0;
03664 if (portmask & 1)
03665 {
03666 LISTAPPEND(u8list, 1);
03667 }
03668 if (portmask & 2)
03669 {
03670 LISTAPPEND(u8list, 2);
03671 }
03672 break;
03673 }
03674
03675 case TMR_PARAM_ANTENNA_SETTLINGTIMELIST:
03676 ret = getPortValues(reader, value, 2);
03677 break;
03678
03679 case TMR_PARAM_RADIO_PORTREADPOWERLIST:
03680 ret = getPortValues(reader, value, 0);
03681 break;
03682
03683 case TMR_PARAM_RADIO_PORTWRITEPOWERLIST:
03684 ret = getPortValues(reader, value, 1);
03685 break;
03686
03687 case TMR_PARAM_ANTENNA_RETURNLOSS:
03688 ret = TMR_SR_cmdGetAntennaReturnLoss(reader, value);
03689 break;
03690
03691 case TMR_PARAM_GPIO_INPUTLIST:
03692 case TMR_PARAM_GPIO_OUTPUTLIST:
03693 {
03694 TMR_uint8List *u8list;
03695
03696 u8list = value;
03697
03698 u8list->len = 0;
03699 if ((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) ||
03700 (TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]) ||
03701 (TMR_SR_MODEL_M6E_NANO == sr->versionInfo.hardware[0]) ||
03702 (TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]))
03703 {
03704 int pin, wantout;
03705 bool out;
03706 TMR_GpioPin pinStates[16];
03707 uint8_t numPins;
03708
03709 sr->gpioDirections = -1;
03710 numPins = numberof(pinStates);
03711 ret = TMR_SR_cmdGetGPIO(reader, &numPins, pinStates);
03712 if (TMR_SUCCESS != ret)
03713 {
03714 return ret;
03715 }
03716
03717 wantout = (key == TMR_PARAM_GPIO_OUTPUTLIST) ? 1 : 0;
03718 if (-1 == sr->gpioDirections)
03719 {
03720
03721 sr->gpioDirections = 0;
03722 for (pin = 1; pin <= numPins ; pin++)
03723 {
03724 ret = TMR_SR_cmdGetGPIODirection(reader, pin, &out);
03725 if (TMR_SUCCESS != ret)
03726 {
03727 return ret;
03728 }
03729 if (out)
03730 {
03731 sr->gpioDirections |= 1 << pin;
03732 }
03733 }
03734 }
03735 for (pin = 1; pin <= numPins ; pin++)
03736 {
03737 if (wantout == ((sr->gpioDirections >> pin) & 1))
03738 {
03739 LISTAPPEND(u8list, pin);
03740 }
03741 }
03742 }
03743 else
03744 {
03745 LISTAPPEND(u8list, 1);
03746 LISTAPPEND(u8list, 2);
03747 }
03748 break;
03749 }
03750
03751 case TMR_PARAM_ANTENNA_PORTLIST:
03752 {
03753 uint8_t i;
03754 TMR_uint8List *u8list;
03755
03756 u8list = value;
03757
03758 u8list->len = 0;
03759 for (i = 0; i < reader->u.serialReader.txRxMap->len; i++)
03760 {
03761 LISTAPPEND(u8list, reader->u.serialReader.txRxMap->list[i].antenna);
03762 }
03763 break;
03764 }
03765
03766 case TMR_PARAM_ANTENNA_CONNECTEDPORTLIST:
03767 {
03768
03769 bool detected[TMR_SR_MAX_ANTENNA_PORTS+1];
03770 uint8_t i;
03771 TMR_uint8List *u8list;
03772
03773 for (i=0; i<TMR_SR_MAX_ANTENNA_PORTS; i++)
03774 {
03775 detected[i] = false;
03776 }
03777 u8list = value;
03778
03779 {
03780 TMR_SR_PortDetect ports[TMR_SR_MAX_ANTENNA_PORTS];
03781 uint8_t numPorts;
03782
03783 numPorts = numberof(ports);
03784 ret = TMR_SR_cmdAntennaDetect(reader, &numPorts, ports);
03785 if (TMR_SUCCESS != ret)
03786 {
03787 break;
03788 }
03789 for (i=0; i<numPorts; i++)
03790 {
03791 detected[ports[i].port] = ports[i].detected;
03792 }
03793 }
03794
03795 u8list->len = 0;
03796 for (i=0; i<reader->u.serialReader.txRxMap->len; i++)
03797 {
03798 int ant = reader->u.serialReader.txRxMap->list[i].antenna;
03799 int tx = reader->u.serialReader.txRxMap->list[i].txPort;
03800 int rx = reader->u.serialReader.txRxMap->list[i].rxPort;
03801
03802 if (detected[tx] && detected[rx])
03803 {
03804 LISTAPPEND(u8list, ant);
03805 }
03806 }
03807 break;
03808 }
03809
03810 case TMR_PARAM_ANTENNA_TXRXMAP:
03811 {
03812 TMR_AntennaMapList *map, *mymap;
03813 uint16_t i;
03814
03815 map = value;
03816 mymap = sr->txRxMap;
03817
03818 for (i = 0 ; i < mymap->len && i < map->max ; i++)
03819 map->list[i] = mymap->list[i];
03820 map->len = mymap->len;
03821 break;
03822 }
03823
03824 case TMR_PARAM_REGION_HOPTABLE:
03825 {
03826 TMR_uint32List *u32List;
03827 uint8_t count;
03828
03829 u32List = value;
03830
03831 count = (uint8_t)u32List->max;
03832 ret = TMR_SR_cmdGetFrequencyHopTable(reader,&count, u32List->list);
03833 if (TMR_SUCCESS != ret)
03834 {
03835 break;
03836 }
03837 u32List->len = count;
03838 break;
03839 }
03840
03841 case TMR_PARAM_REGION_HOPTIME:
03842 ret = TMR_SR_cmdGetFrequencyHopTime(reader, value);
03843 break;
03844
03845 case TMR_PARAM_REGION_LBT_ENABLE:
03846 ret = TMR_SR_cmdGetRegionConfiguration(reader,
03847 TMR_SR_REGION_CONFIGURATION_LBT_ENABLED, value);
03848 if (TMR_SUCCESS != ret && TMR_ERROR_IS_CODE(ret))
03849 {
03850 *(bool *)value = false;
03851 ret = TMR_SUCCESS;
03852 }
03853 break;
03854
03855 case TMR_PARAM_TAGOP_ANTENNA:
03856 *(uint8_t *)value = reader->tagOpParams.antenna;
03857 break;
03858
03859 case TMR_PARAM_TAGOP_PROTOCOL:
03860 *(TMR_TagProtocol *)value = reader->tagOpParams.protocol;
03861 break;
03862
03863 case TMR_PARAM_POWERMODE:
03864 if (reader->connected)
03865 {
03866 TMR_SR_PowerMode pm;
03867 ret = TMR_SR_cmdGetPowerMode(reader, &pm);
03868 if (TMR_SUCCESS == ret)
03869 {
03870 sr->powerMode = pm;
03871 }
03872 }
03873 *(TMR_SR_PowerMode*)value = sr->powerMode;
03874 break;
03875
03876 case TMR_PARAM_USERMODE:
03877 ret = TMR_SR_cmdGetUserMode(reader, value);
03878 break;
03879
03880 case TMR_PARAM_GEN2_Q:
03881 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_Q;
03882 break;
03883
03884 case TMR_PARAM_GEN2_TAGENCODING:
03885 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_TAGENCODING;
03886 break;
03887
03888 case TMR_PARAM_GEN2_SESSION:
03889 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_SESSION;
03890 break;
03891
03892 case TMR_PARAM_GEN2_TARGET:
03893 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_TARGET;
03894 break;
03895
03896 case TMR_PARAM_GEN2_BLF:
03897 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_LINKFREQUENCY;
03898 break;
03899
03900 case TMR_PARAM_GEN2_TARI:
03901 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_TARI;
03902 break;
03903
03904 case TMR_PARAM_GEN2_BAP:
03905 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_BAP;
03906 break;
03907
03908 case TMR_PARAM_GEN2_WRITEMODE:
03909 *(TMR_GEN2_WriteMode *)value = sr->writeMode;
03910 break;
03911
03912 case TMR_PARAM_GEN2_PROTOCOLEXTENSION:
03913 protokey.u.gen2 = TMR_SR_GEN2_CONFIGURATION_PROTCOLEXTENSION;
03914 break;
03915
03916 #ifdef TMR_ENABLE_ISO180006B
03917 case TMR_PARAM_ISO180006B_BLF:
03918 protokey.protocol = TMR_TAG_PROTOCOL_ISO180006B;
03919 protokey.u.iso180006b = TMR_SR_ISO180006B_CONFIGURATION_LINKFREQUENCY;
03920 break;
03921 case TMR_PARAM_ISO180006B_MODULATION_DEPTH:
03922 {
03923 protokey.protocol = TMR_TAG_PROTOCOL_ISO180006B;
03924 protokey.u.iso180006b = TMR_SR_ISO180006B_CONFIGURATION_MODULATION_DEPTH;
03925 break;
03926 }
03927 case TMR_PARAM_ISO180006B_DELIMITER:
03928 {
03929 protokey.protocol = TMR_TAG_PROTOCOL_ISO180006B;
03930 protokey.u.iso180006b = TMR_SR_ISO180006B_CONFIGURATION_DELIMITER;
03931 break;
03932 }
03933 #endif
03934
03935 case TMR_PARAM_GEN2_ACCESSPASSWORD:
03936 *(TMR_GEN2_Password *)value = sr->gen2AccessPassword;
03937 break;
03938
03939 case TMR_PARAM_REGION_SUPPORTEDREGIONS:
03940 ret = TMR_SR_cmdGetAvailableRegions(reader, value);
03941 break;
03942
03943 case TMR_PARAM_VERSION_SUPPORTEDPROTOCOLS:
03944 ret = TMR_SR_cmdGetAvailableProtocols(reader, value);
03945 break;
03946
03947 case TMR_PARAM_RADIO_TEMPERATURE:
03948 ret = TMR_SR_cmdGetTemperature(reader, value);
03949 break;
03950
03951 case TMR_PARAM_VERSION_HARDWARE:
03952 ret = getHardwareInfo(reader, value);
03953 break;
03954
03955 case TMR_PARAM_VERSION_SERIAL:
03956 ret = getSerialNumber(reader, value);
03957 break;
03958
03959 case TMR_PARAM_VERSION_MODEL:
03960 {
03961 const char *model = NULL;
03962
03963 switch (sr->versionInfo.hardware[0])
03964 {
03965 case TMR_SR_MODEL_M5E:
03966 model = "M5e";
03967 break;
03968 case TMR_SR_MODEL_M5E_COMPACT:
03969 model = "M5e Compact";
03970 break;
03971 case TMR_SR_MODEL_M5E_I:
03972 {
03976 switch (sr->versionInfo.hardware[3])
03977 {
03978 case TMR_SR_MODEL_M5E_I_REV_EU:
03979 model = "M5e EU";
03980 break;
03981 case TMR_SR_MODEL_M5E_I_REV_NA:
03982 model = "M5e NA";
03983 break;
03984 case TMR_SR_MODEL_M5E_I_REV_JP:
03985 model = "M5E JP";
03986 break;
03987 case TMR_SR_MODEL_M5E_I_REV_PRC:
03988 model = "M5e PRC";
03989 break;
03990 default:
03991 model = "Unknown";
03992 break;
03993 }
03994 break;
03995 }
03996 case TMR_SR_MODEL_M4E:
03997 model = "M4e";
03998 break;
03999 case TMR_SR_MODEL_M6E:
04000 model = "M6e";
04001 break;
04002 case TMR_SR_MODEL_M6E_I:
04003 {
04007 switch (sr->versionInfo.hardware[3])
04008 {
04009 case TMR_SR_MODEL_M6E_I_PRC:
04010 model = "M6e PRC";
04011 break;
04012 case TMR_SR_MODEL_M6E_I_JIC:
04013 model = "M6e JIC";
04014 break;
04015 default:
04016 model = "Unknown";
04017 }
04018 }
04019 break;
04020 case TMR_SR_MODEL_MICRO:
04021 {
04025 switch (sr->versionInfo.hardware[3])
04026 {
04027 case TMR_SR_MODEL_M6E_MICRO:
04028 model = "M6e Micro";
04029 break;
04030 case TMR_SR_MODEL_M6E_MICRO_USB:
04031 model = "M6e Micro USB";
04032 break;
04033 case TMR_SR_MODEL_M6E_MICRO_USB_PRO:
04034 model = "M6e Micro USBPro";
04035 break;
04036 }
04037 }
04038 break;
04039 case TMR_SR_MODEL_M6E_NANO:
04040 model = "M6e Nano";
04041 break;
04042 default:
04043 model = "Unknown";
04044 }
04045 TMR_stringCopy(value, model, (int)strlen(model));
04046 break;
04047 }
04048
04049 case TMR_PARAM_VERSION_SOFTWARE:
04050 {
04051 char tmp[38];
04052 TMR_SR_VersionInfo *info;
04053
04054 info = &sr->versionInfo;
04055
04056 TMR_hexDottedQuad(info->fwVersion, tmp);
04057 tmp[11] = '-';
04058 TMR_hexDottedQuad(info->fwDate, tmp + 12);
04059 tmp[23] = '-';
04060 tmp[24] = 'B';
04061 tmp[25] = 'L';
04062 TMR_hexDottedQuad(info->bootloader, tmp+26);
04063 TMR_stringCopy(value, tmp, 37);
04064 break;
04065 }
04066
04067 case TMR_PARAM_LICENSE_KEY:
04068 ret = TMR_ERROR_UNSUPPORTED;
04069 break;
04070
04071 case TMR_PARAM_USER_CONFIG:
04072 ret = TMR_ERROR_UNSUPPORTED;
04073 break;
04074
04075 case TMR_PARAM_READER_STATS:
04076 {
04077 if ((NULL != reader->pSupportsResetStats) && (false == *(reader->pSupportsResetStats)))
04078 {
04079
04080 return TMR_ERROR_UNSUPPORTED;
04081 }
04082
04087 if (TMR_READER_STATS_FLAG_NONE == reader->statsFlag)
04088 {
04089 reader->statsFlag = TMR_READER_STATS_FLAG_ALL;
04090 }
04091 ret = TMR_SR_cmdGetReaderStats(reader, reader->statsFlag, value);
04092 break;
04093 }
04094
04095 case TMR_PARAM_READER_STATS_ENABLE:
04096 {
04097 if ((NULL != reader->pSupportsResetStats) && (false == *(reader->pSupportsResetStats)))
04098 {
04099
04100 return TMR_ERROR_UNSUPPORTED;
04101 }
04102
04103 *(TMR_Reader_StatsFlag *)value = reader->statsFlag;
04104 break;
04105 }
04106
04107 case TMR_PARAM_READER_STATISTICS:
04108 ret = TMR_SR_cmdGetReaderStatistics(reader, TMR_SR_READER_STATS_ALL, value);
04109 break;
04110
04111 case TMR_PARAM_PRODUCT_GROUP:
04112 {
04113 const char *group;
04114 TMR_SR_ProductGroupID id = (TMR_SR_ProductGroupID)sr->productId;
04115 switch (id)
04116 {
04117 case TMR_SR_PRODUCT_MODULE:
04118 case TMR_SR_PRODUCT_INVALID:
04119 group = "Embedded Reader";
04120 break;
04121 case TMR_SR_PRODUCT_RUGGEDIZED_READER:
04122 group = "Ruggedized Reader";
04123 break;
04124 case TMR_SR_PRODUCT_USB_READER:
04125 group = "USB Reader";
04126 break;
04127 default:
04128 group = "Unknown";
04129 break;
04130 }
04131 if (NULL != value)
04132 {
04133 TMR_stringCopy(value, group, (int)strlen(group));
04134 }
04135 else
04136 {
04137 ret = TMR_ERROR_ILLEGAL_VALUE;
04138 }
04139 break;
04140 }
04141
04142 case TMR_PARAM_TAGREADATA_TAGOPSUCCESSCOUNT:
04143 {
04144 *(uint16_t *)value = sr->tagopSuccessCount;
04145 break;
04146 }
04147
04148 case TMR_PARAM_TAGREADATA_TAGOPFAILURECOUNT:
04149 {
04150 *(uint16_t *)value = sr->tagopFailureCount;
04151 break;
04152 }
04153 case TMR_PARAM_READER_WRITE_REPLY_TIMEOUT:
04154 case TMR_PARAM_READER_WRITE_EARLY_EXIT:
04155 {
04156 TMR_SR_Gen2ReaderWriteTimeOut timeout;
04157 ret = TMR_SR_cmdGetReaderWriteTimeOut(reader, protokey.protocol, &timeout);
04158 if (TMR_SUCCESS != ret)
04159 {
04160 break;
04161 }
04162 switch (key)
04163 {
04164 case TMR_PARAM_READER_WRITE_REPLY_TIMEOUT:
04165 {
04166 *(uint16_t *)value = (uint16_t)timeout.writetimeout;
04167 break;
04168 }
04169 case TMR_PARAM_READER_WRITE_EARLY_EXIT:
04170 {
04171 *(bool *)value = !((bool)timeout.earlyexit);
04172 break;
04173 }
04174 default:
04175 ret = TMR_ERROR_NOT_FOUND;
04176 }
04177 }
04178 break;
04179 case TMR_PARAM_METADATAFLAG:
04180 {
04181 *(uint16_t *)value = reader->userMetadataFlag;
04182 break;
04183 }
04184
04185 default:
04186 ret = TMR_ERROR_NOT_FOUND;
04187 }
04188
04189 switch (key)
04190 {
04191 case TMR_PARAM_ANTENNA_CHECKPORT:
04192 case TMR_PARAM_RADIO_ENABLEPOWERSAVE:
04193 case TMR_PARAM_RADIO_ENABLESJC:
04194 case TMR_PARAM_TAGREADDATA_RECORDHIGHESTRSSI:
04195 case TMR_PARAM_TAGREADDATA_REPORTRSSIINDBM:
04196 case TMR_PARAM_TAGREADDATA_UNIQUEBYANTENNA:
04197 case TMR_PARAM_TAGREADDATA_UNIQUEBYDATA:
04198 case TMR_PARAM_PRODUCT_GROUP_ID:
04199 case TMR_PARAM_PRODUCT_ID:
04200 ret = TMR_SR_cmdGetReaderConfiguration(reader, readerkey, value);
04201 break;
04202
04203 case TMR_PARAM_EXTENDEDEPC:
04204 {
04205 if ((TMR_SR_MODEL_M6E == sr->versionInfo.hardware[0]) ||
04206 (TMR_SR_MODEL_M6E_I == sr->versionInfo.hardware[0]) ||
04207 (TMR_SR_MODEL_M6E_NANO == sr->versionInfo.hardware[0]) ||
04208 (TMR_SR_MODEL_MICRO == sr->versionInfo.hardware[0]))
04209 {
04210 ret = TMR_ERROR_UNSUPPORTED;
04211 }
04212 else
04213 {
04214 ret = TMR_SR_cmdGetReaderConfiguration(reader, readerkey, value);
04215 }
04216 }
04217 break;
04218
04219 case TMR_PARAM_GEN2_Q:
04220 case TMR_PARAM_GEN2_TAGENCODING:
04221 case TMR_PARAM_GEN2_SESSION:
04222 case TMR_PARAM_GEN2_TARGET:
04223 case TMR_PARAM_GEN2_BLF:
04224 case TMR_PARAM_GEN2_TARI:
04225 case TMR_PARAM_GEN2_BAP:
04226 case TMR_PARAM_GEN2_PROTOCOLEXTENSION:
04227 #ifdef TMR_ENABLE_ISO180006B
04228 case TMR_PARAM_ISO180006B_BLF:
04229 case TMR_PARAM_ISO180006B_MODULATION_DEPTH:
04230 case TMR_PARAM_ISO180006B_DELIMITER:
04231 #endif
04232 ret = TMR_SR_cmdGetProtocolConfiguration(reader, protokey.protocol,
04233 protokey, value);
04234 break;
04235
04236 default:
04237 ;
04238 }
04239
04240 if (0 == BITGET(sr->paramConfirmed, key))
04241 {
04242 if ((TMR_SUCCESS == ret) || ret == TMR_ERROR_AUTOREAD_ENABLED )
04243 {
04244 BITSET(sr->paramPresent, key);
04245 }
04246 BITSET(sr->paramConfirmed, key);
04247 }
04248
04249 return ret;
04250 }
04251
04252 TMR_Status
04253 TMR_SR_SerialReader_init(TMR_Reader *reader)
04254 {
04255 reader->readerType = TMR_READER_TYPE_SERIAL;
04256
04257 #ifndef TMR_ENABLE_SERIAL_READER_ONLY
04258 reader->connect = TMR_SR_connect;
04259 reader->destroy = TMR_SR_destroy;
04260 reader->read = TMR_SR_read;
04261 reader->hasMoreTags = TMR_SR_hasMoreTags;
04262 reader->getNextTag = TMR_SR_getNextTag;
04263 reader->executeTagOp = TMR_SR_executeTagOp;
04264 reader->readTagMemWords = TMR_SR_readTagMemWords;
04265 reader->readTagMemBytes = TMR_SR_readTagMemBytes;
04266 reader->writeTagMemBytes = TMR_SR_writeTagMemBytes;
04267 reader->writeTagMemWords = TMR_SR_writeTagMemWords;
04268 reader->writeTag = TMR_SR_writeTag;
04269 reader->killTag = TMR_SR_killTag;
04270 reader->lockTag = TMR_SR_lockTag;
04271 reader->gpiGet = TMR_SR_gpiGet;
04272 reader->gpoSet = TMR_SR_gpoSet;
04273 #ifdef TMR_ENABLE_STDIO
04274 reader->firmwareLoad = TMR_SR_firmwareLoad;
04275 #endif
04276 reader->modifyFlash = TMR_SR_modifyFlash;
04277 reader->reboot = TMR_SR_reboot;
04278 #endif
04279 reader->cmdStopReading = TMR_SR_cmdStopReading;
04280 #ifdef TMR_ENABLE_BACKGROUND_READS
04281 reader->cmdAutonomousReading = TMR_SR_receiveAutonomousReading;
04282 #endif
04283
04284 reader->paramSet = TMR_SR_paramSet;
04285 reader->paramGet = TMR_SR_paramGet;
04286
04287 memset(reader->u.serialReader.paramConfirmed,0,
04288 sizeof(reader->u.serialReader.paramConfirmed));
04289 memset(reader->u.serialReader.paramPresent,0,
04290 sizeof(reader->u.serialReader.paramPresent));
04291 reader->u.serialReader.baudRate = 115200;
04292 reader->u.serialReader.currentProtocol = TMR_TAG_PROTOCOL_NONE;
04293 reader->u.serialReader.versionInfo.hardware[0] = TMR_SR_MODEL_UNKNOWN;
04294 reader->u.serialReader.supportsPreamble = false;
04295 reader->u.serialReader.extendedEPC = false;
04296 reader->u.serialReader.powerMode = TMR_SR_POWER_MODE_INVALID;
04297 reader->u.serialReader.transportTimeout = 1000;
04298 reader->u.serialReader.commandTimeout = 1000;
04299 reader->u.serialReader.regionId = TMR_REGION_NONE;
04300 reader->u.serialReader.tagsRemaining = 0;
04301 reader->u.serialReader.tagsRemainingInBuffer = 0;
04302 reader->u.serialReader.gen2AccessPassword = 0;
04303 reader->u.serialReader.oldQ.type = TMR_SR_GEN2_Q_INVALID;
04304 reader->u.serialReader.writeMode = TMR_GEN2_WORD_ONLY;
04305 reader->u.serialReader.tagopSuccessCount = 0;
04306 reader->u.serialReader.tagopFailureCount = 0;
04307 reader->u.serialReader.enableReadFiltering = true;
04308 reader->u.serialReader.readFilterTimeout = 0;
04309 reader->u.serialReader.usrTimeoutEnable = false;
04310 reader->u.serialReader.crcEnabled = true;
04311 reader->u.serialReader.transportType = TMR_SR_MSG_SOURCE_UNKNOWN;
04312 reader->u.serialReader.gen2AllMemoryBankEnabled = false;
04313 reader->u.serialReader.isBapEnabled = false;
04314 reader->u.serialReader.probeBaudRates.list = reader->u.serialReader.baudRates;
04315 reader->u.serialReader.probeBaudRates.max = TMR_MAX_PROBE_BAUDRATE_LENGTH;
04316 reader->u.serialReader.probeBaudRates.len = 0;
04317 reader->u.serialReader.enableAutonomousRead = false;
04318 reader->u.serialReader.isBasetimeUpdated = false;
04319 {
04320
04321 TMR_uint32List value;
04322 uint32_t rates[TMR_MAX_PROBE_BAUDRATE_LENGTH] ={9600, 115200, 921600, 19200, 38400, 57600,230400, 460800};
04323 value.list = rates;
04324 value.len = value.max = 8;
04325
04326 TMR_paramSet(reader, TMR_PARAM_PROBEBAUDRATES, &value);
04327 }
04328
04329 return TMR_reader_init_internal(reader);
04330 }
04331
04332 uint16_t TMR_SR_getConfigWord(TMR_Reader *reader, TMR_TagOp_GEN2_NXP_Untraceable op)
04333 {
04334 uint16_t configWord = 0x0000;
04335 uint16_t Mask;
04336 int Pos;
04337
04338 if(op.epc == 1)
04339 {
04340 configWord |= 0x0001 << 14;
04341 }
04342 Mask = 0x1F;
04343 Pos = 9;
04344 configWord |= (uint16_t)((op.epcLength & Mask) << Pos);
04345
04346 Mask = 0x03;
04347 Pos = 7;
04348 configWord |= (uint16_t)((op.tid & Mask) << Pos);
04349
04350 if (op.userMemory == 1)
04351 {
04352 configWord |= 0x0001 << 6;
04353 }
04354
04355 Mask = 0x03;
04356 Pos = 4;
04357 configWord |= (uint16_t)((op.range & Mask) << Pos);
04358
04359 return configWord;
04360 }
04361
04362 TMR_Status
04363 TMR_SR_executeTagOp(struct TMR_Reader *reader, TMR_TagOp *tagop, TMR_TagFilter *filter, TMR_uint8List *data)
04364 {
04365 TMR_Status ret;
04366 TMR_SR_SerialReader *sr;
04367
04368 sr = &reader->u.serialReader;
04369
04370 switch (tagop->type)
04371 {
04372 case (TMR_TAGOP_GEN2_WRITETAG):
04373 {
04374 TMR_TagOp_GEN2_WriteTag op;
04375
04376 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04377 if (TMR_SUCCESS != ret)
04378 {
04379 return ret;
04380 }
04381
04382 op = tagop->u.gen2.u.writeTag;
04383
04384 return TMR_SR_cmdWriteGen2TagEpc(reader, filter, sr->gen2AccessPassword,
04385 (uint16_t)(sr->commandTimeout),
04386 op.epcptr->epcByteCount,
04387 op.epcptr->epc,
04388 false);
04389 }
04390 case (TMR_TAGOP_GEN2_KILL):
04391 {
04392 TMR_TagOp_GEN2_Kill op;
04393
04394 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04395 if (TMR_SUCCESS != ret)
04396 {
04397 return ret;
04398 }
04399
04400 op = tagop->u.gen2.u.kill;
04401
04402 return TMR_SR_cmdKillTag(reader,
04403 (uint16_t)(sr->commandTimeout),
04404 op.password,
04405 filter);
04406 }
04407 case (TMR_TAGOP_GEN2_LOCK):
04408 {
04409 TMR_TagOp_GEN2_Lock op;
04410
04411 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04412 if (TMR_SUCCESS != ret)
04413 {
04414 return ret;
04415 }
04416
04417 op = tagop->u.gen2.u.lock;
04418
04419 return TMR_SR_cmdGEN2LockTag(reader, (uint16_t)sr->commandTimeout,
04420 op.mask, op.action, op.accessPassword, filter);
04421 }
04422 case (TMR_TAGOP_GEN2_WRITEDATA):
04423 {
04424 TMR_TagOp_GEN2_WriteData op;
04425
04426 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04427 if (TMR_SUCCESS != ret)
04428 {
04429 return ret;
04430 }
04431
04432 op = tagop->u.gen2.u.writeData;
04433 return TMR_SR_writeTagMemWords(reader, filter, op.bank, op.wordAddress, op.data.len, op.data.list);
04434 }
04435 case (TMR_TAGOP_GEN2_READDATA):
04436 {
04437 TMR_TagOp_GEN2_ReadData op;
04438 TMR_TagReadData read;
04439
04440 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04441 if (TMR_SUCCESS != ret)
04442 {
04443 return ret;
04444 }
04445
04446 if (NULL != data)
04447 {
04448 read.data.len = 0;
04449 read.data.list = data->list;
04450 read.data.max = data->max;
04451 }
04452 else
04453 {
04454 read.data.list = NULL;
04455 }
04456 read.metadataFlags = 0;
04457 op = tagop->u.gen2.u.readData;
04458 ret = TMR_SR_cmdGEN2ReadTagData(reader, (uint16_t)(sr->commandTimeout), op.bank,
04459 op.wordAddress, op.len, sr->gen2AccessPassword, filter, &read);
04460 if (NULL != data)
04461 {
04462 data->len = read.data.len;
04463 }
04464
04465 return ret;
04466 }
04467 case (TMR_TAGOP_GEN2_BLOCKWRITE):
04468 {
04469 TMR_TagOp_GEN2_BlockWrite op;
04470
04471 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04472 if (TMR_SUCCESS != ret)
04473 {
04474 return ret;
04475 }
04476
04477 op = tagop->u.gen2.u.blockWrite;
04478 return TMR_SR_cmdBlockWrite(reader,(uint16_t)sr->commandTimeout, op.bank,
04479 op.wordPtr, op.data.len, op.data.list, sr->gen2AccessPassword, filter);
04480 }
04481 case (TMR_TAGOP_GEN2_BLOCKPERMALOCK):
04482 {
04483 TMR_TagOp_GEN2_BlockPermaLock op;
04484
04485 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04486 if (TMR_SUCCESS != ret)
04487 {
04488 return ret;
04489 }
04490
04491 op = tagop->u.gen2.u.blockPermaLock;
04492
04493 return TMR_SR_cmdBlockPermaLock(reader, (uint16_t)sr->commandTimeout, op.readLock, op.bank,
04494 op.blockPtr, op.mask.len, op.mask.list, sr->gen2AccessPassword, filter, data);
04495 }
04496
04497 case (TMR_TAGOP_GEN2_BLOCKERASE):
04498 {
04499 TMR_TagOp_GEN2_BlockErase op;
04500
04501 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04502 if (TMR_SUCCESS != ret)
04503 {
04504 return ret;
04505 }
04506
04507 op = tagop->u.gen2.u.blockErase;
04508 return TMR_SR_cmdBlockErase(reader, (uint16_t)sr->commandTimeout, op.bank, op.wordPtr,
04509 op.wordCount, sr->gen2AccessPassword, filter);
04510 }
04511
04512 #ifdef TMR_ENABLE_GEN2_CUSTOM_TAGOPS
04513 case (TMR_TAGOP_GEN2_ALIEN_HIGGS2_PARTIALLOADIMAGE):
04514 {
04515 TMR_TagOp_GEN2_Alien_Higgs2_PartialLoadImage op;
04516
04517 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04518 if (TMR_SUCCESS != ret)
04519 {
04520 return ret;
04521 }
04522 op = tagop->u.gen2.u.custom.u.alien.u.higgs2.u.partialLoadImage;
04523 if (op.epcptr->epcByteCount > 12 || op.epcptr->epcByteCount <=0 )
04524 {
04525 return TMR_ERROR_PROTOCOL_INVALID_EPC;
04526 }
04527 return TMR_SR_cmdHiggs2PartialLoadImage(reader, (uint16_t)sr->commandTimeout,
04528 op.accessPassword, op.killPassword, op.epcptr->epcByteCount, op.epcptr->epc, filter);
04529 }
04530 case (TMR_TAGOP_GEN2_ALIEN_HIGGS2_FULLLOADIMAGE):
04531 {
04532 TMR_TagOp_GEN2_Alien_Higgs2_FullLoadImage op;
04533
04534 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04535 if (TMR_SUCCESS != ret)
04536 {
04537 return ret;
04538 }
04539
04540 op = tagop->u.gen2.u.custom.u.alien.u.higgs2.u.fullLoadImage;
04541 if (op.epcptr->epcByteCount > 12 || op.epcptr->epcByteCount <= 0 )
04542 {
04543 return TMR_ERROR_PROTOCOL_INVALID_EPC;
04544 }
04545 return TMR_SR_cmdHiggs2FullLoadImage(reader, (uint16_t)sr->commandTimeout, op.accessPassword,
04546 op.killPassword, op.lockBits, op.pcWord, op.epcptr->epcByteCount, op.epcptr->epc, filter);
04547 }
04548 case (TMR_TAGOP_GEN2_ALIEN_HIGGS3_FASTLOADIMAGE):
04549 {
04550
04551
04552
04553
04554 TMR_TagOp_GEN2_Alien_Higgs3_FastLoadImage op;
04555
04556 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04557 if (TMR_SUCCESS != ret)
04558 {
04559 return ret;
04560 }
04561
04562 op = tagop->u.gen2.u.custom.u.alien.u.higgs3.u.fastLoadImage;
04563 if (op.epcptr->epcByteCount > 12 || op.epcptr->epcByteCount <= 0 )
04564 {
04565 return TMR_ERROR_PROTOCOL_INVALID_EPC;
04566 }
04567 return TMR_SR_cmdHiggs3FastLoadImage(reader, (uint16_t)sr->commandTimeout, op.currentAccessPassword, op.accessPassword,
04568 op.killPassword, op.pcWord, op.epcptr->epcByteCount, op.epcptr->epc, filter);
04569 }
04570 case (TMR_TAGOP_GEN2_ALIEN_HIGGS3_LOADIMAGE):
04571 {
04572 TMR_TagOp_GEN2_Alien_Higgs3_LoadImage op;
04573
04574 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04575 if (TMR_SUCCESS != ret)
04576 {
04577 return ret;
04578 }
04579
04580 op = tagop->u.gen2.u.custom.u.alien.u.higgs3.u.loadImage;
04581 if (op.epcAndUserData->len > 76 || op.epcAndUserData->len <= 0 )
04582 {
04583 return TMR_ERROR_MSG_INVALID_PARAMETER_VALUE;
04584 }
04585 return TMR_SR_cmdHiggs3LoadImage(reader, (uint16_t)sr->commandTimeout, op.currentAccessPassword,
04586 op.accessPassword, op.killPassword, op.pcWord, (uint8_t)op.epcAndUserData->len, op.epcAndUserData->list, filter);
04587 }
04588 case (TMR_TAGOP_GEN2_ALIEN_HIGGS3_BLOCKREADLOCK):
04589 {
04590 TMR_TagOp_GEN2_Alien_Higgs3_BlockReadLock op;
04591
04592 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04593 if (TMR_SUCCESS != ret)
04594 {
04595 return ret;
04596 }
04597 op = tagop->u.gen2.u.custom.u.alien.u.higgs3.u.blockReadLock;
04598
04599 return TMR_SR_cmdHiggs3BlockReadLock(reader, (uint16_t)sr->commandTimeout, op.accessPassword, op.lockBits, filter);
04600 }
04601 case (TMR_TAGOP_GEN2_NXP_SETREADPROTECT):
04602 {
04603 TMR_TagOp_GEN2_NXP_SetReadProtect op;
04604
04605 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04606 if (TMR_SUCCESS != ret)
04607 {
04608 return ret;
04609 }
04610
04611 op = tagop->u.gen2.u.custom.u.nxp.u.setReadProtect;
04612
04613 return TMR_SR_cmdNxpSetReadProtect(reader, (uint16_t)sr->commandTimeout,
04614 tagop->u.gen2.u.custom.chipType, op.accessPassword, filter);
04615 }
04616 case (TMR_TAGOP_GEN2_NXP_RESETREADPROTECT):
04617 {
04618 TMR_TagOp_GEN2_NXP_ResetReadProtect op;
04619
04620 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04621 if (TMR_SUCCESS != ret)
04622 {
04623 return ret;
04624 }
04625
04626 op = tagop->u.gen2.u.custom.u.nxp.u.resetReadProtect;
04627 return TMR_SR_cmdNxpResetReadProtect(reader, (uint16_t)sr->commandTimeout,
04628 tagop->u.gen2.u.custom.chipType, op.accessPassword, filter);
04629 }
04630 case (TMR_TAGOP_GEN2_NXP_CHANGEEAS):
04631 {
04632 TMR_TagOp_GEN2_NXP_ChangeEAS op;
04633
04634 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04635 if (TMR_SUCCESS != ret)
04636 {
04637 return ret;
04638 }
04639
04640 op = tagop->u.gen2.u.custom.u.nxp.u.changeEAS;
04641 return TMR_SR_cmdNxpChangeEas(reader, (uint16_t)sr->commandTimeout, tagop->u.gen2.u.custom.chipType,
04642 op.accessPassword, op.reset, filter);
04643 }
04644 case (TMR_TAGOP_GEN2_NXP_EASALARM):
04645 {
04646 TMR_TagOp_GEN2_NXP_EASAlarm op;
04647
04648 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04649 if (TMR_SUCCESS != ret)
04650 {
04651 return ret;
04652 }
04653
04654 op = tagop->u.gen2.u.custom.u.nxp.u.EASAlarm;
04655 return TMR_SR_cmdNxpEasAlarm(reader, (uint16_t)sr->commandTimeout, tagop->u.gen2.u.custom.chipType,
04656 op.dr, op.m, op.trExt, data, filter);
04657 }
04658 case (TMR_TAGOP_GEN2_NXP_CALIBRATE):
04659 {
04660 TMR_TagOp_GEN2_NXP_Calibrate op;
04661
04662 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04663 if (TMR_SUCCESS != ret)
04664 {
04665 return ret;
04666 }
04667
04668 op = tagop->u.gen2.u.custom.u.nxp.u.calibrate;
04669 return TMR_SR_cmdNxpCalibrate(reader, (uint16_t)sr->commandTimeout, tagop->u.gen2.u.custom.chipType,
04670 op.accessPassword, data, filter);
04671 }
04672 case (TMR_TAGOP_GEN2_NXP_CHANGECONFIG):
04673 {
04674 TMR_TagOp_GEN2_NXP_ChangeConfig op;
04675
04676 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04677 if (TMR_SUCCESS != ret)
04678 {
04679 return ret;
04680 }
04681
04682 if(NULL != data)
04683 {
04684 data->len = 0;
04685 }
04686
04687 op = tagop->u.gen2.u.custom.u.nxp.u.changeConfig;
04688 return TMR_SR_cmdNxpChangeConfig(reader, (uint16_t)sr->commandTimeout, tagop->u.gen2.u.custom.chipType,
04689 op.accessPassword, op.configWord, data, filter);
04690 }
04691 case (TMR_TAGOP_GEN2_NXP_UNTRACEABLE):
04692 {
04693 TMR_TagOp_GEN2_NXP_Untraceable op;
04694 uint16_t configWord;
04695 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04696 if (TMR_SUCCESS != ret)
04697 {
04698 return ret;
04699 }
04700 op = tagop->u.gen2.u.custom.u.nxp.u.untraceable;
04701 configWord = TMR_SR_getConfigWord(reader,op);
04702 return TMR_SR_cmdGen2v2NXPUntraceable(reader,(uint16_t)sr->commandTimeout, tagop->u.gen2.u.custom.chipType,
04703 sr->gen2AccessPassword, configWord , op, data, filter);
04704 }
04705 case (TMR_TAGOP_GEN2_NXP_AUTHENTICATE):
04706 {
04707 TMR_TagOp_GEN2_NXP_Authenticate op;
04708
04709 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04710 if (TMR_SUCCESS != ret)
04711 {
04712 return ret;
04713 }
04714 op = tagop->u.gen2.u.custom.u.nxp.u.authenticate;
04715 return TMR_SR_cmdGen2v2NXPAuthenticate(reader,(uint16_t)sr->commandTimeout, tagop->u.gen2.u.custom.chipType,
04716 sr->gen2AccessPassword, op, data, filter);
04717 }
04718 case (TMR_TAGOP_GEN2_NXP_READBUFFER):
04719 {
04720 TMR_TagOp_GEN2_NXP_Readbuffer op;
04721
04722 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04723 if (TMR_SUCCESS != ret)
04724 {
04725 return ret;
04726 }
04727 op = tagop->u.gen2.u.custom.u.nxp.u.readBuffer;
04728 return TMR_SR_cmdGen2v2NXPReadBuffer(reader,(uint16_t)sr->commandTimeout, tagop->u.gen2.u.custom.chipType,
04729 sr->gen2AccessPassword, op, data, filter);
04730 }
04731 case (TMR_TAGOP_GEN2_IMPINJ_MONZA4_QTREADWRITE):
04732 {
04733 TMR_TagOp_GEN2_Impinj_Monza4_QTReadWrite op;
04734
04735 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04736 if (TMR_SUCCESS != ret)
04737 {
04738 return ret;
04739 }
04740
04741 if(NULL != data)
04742 {
04743 data->len = 0;
04744 }
04745
04746 op = tagop->u.gen2.u.custom.u.impinj.u.monza4.u.qtReadWrite;
04747 return TMR_SR_cmdMonza4QTReadWrite(reader, (uint16_t)sr->commandTimeout, op.accessPassword,
04748 op.controlByte, op.payload, data, filter);
04749 }
04750 case (TMR_TAGOP_GEN2_IDS_SL900A_GETSENSOR):
04751 {
04752 TMR_TagOp_GEN2_IDS_SL900A_GetSensorValue op;
04753
04754
04755 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04756 if (TMR_SUCCESS != ret)
04757 {
04758 return ret;
04759 }
04760
04761
04762 if(NULL != data)
04763 {
04764 data->len = 0;
04765 }
04766
04767 op = tagop->u.gen2.u.custom.u.ids.u.sensor;
04768 return TMR_SR_cmdSL900aGetSensorValue(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
04769 op.Password,op.sl900A.level, op.sl900A.sensortype, data, filter);
04770 }
04771
04772 case (TMR_TAGOP_GEN2_IDS_SL900A_GETMEASUREMENTSETUP):
04773 {
04774 TMR_TagOp_GEN2_IDS_SL900A_GetMeasurementSetup op;
04775
04776
04777 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04778 if (TMR_SUCCESS != ret)
04779 {
04780 return ret;
04781 }
04782
04783
04784 if(NULL != data)
04785 {
04786 data->len = 0;
04787 }
04788
04789 op = tagop->u.gen2.u.custom.u.ids.u.measurementSetup;
04790 return TMR_SR_cmdSL900aGetMeasurementSetup(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
04791 op.Password,op.sl900A.level, data, filter);
04792 }
04793
04794 case (TMR_TAGOP_GEN2_IDS_SL900A_GETCALIBRATIONDATA):
04795 {
04796 TMR_TagOp_GEN2_IDS_SL900A_GetCalibrationData op;
04797
04798
04799 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04800 if (TMR_SUCCESS != ret)
04801 {
04802 return ret;
04803 }
04804
04805
04806 if(NULL != data)
04807 {
04808 data->len = 0;
04809 }
04810
04811 op = tagop->u.gen2.u.custom.u.ids.u.calibrationData;
04812 return TMR_SR_cmdSL900aGetCalibrationData(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
04813 op.Password, op.sl900A.level, data, filter);
04814 }
04815
04816 case (TMR_TAGOP_GEN2_IDS_SL900A_SETCALIBRATIONDATA):
04817 {
04818 TMR_TagOp_GEN2_IDS_SL900A_SetCalibrationData op;
04819
04820
04821 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04822 if (TMR_SUCCESS != ret)
04823 {
04824 return ret;
04825 }
04826
04827
04828 if(NULL != data)
04829 {
04830 data->len = 0;
04831 }
04832
04833 op = tagop->u.gen2.u.custom.u.ids.u.setCalibration;
04834 return TMR_SR_cmdSL900aSetCalibrationData(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
04835 op.Password, op.sl900A.level, op.cal.raw, filter);
04836 }
04837
04838 case (TMR_TAGOP_GEN2_IDS_SL900A_SETSFEPARAMETERS):
04839 {
04840 TMR_TagOp_GEN2_IDS_SL900A_SetSfeParameters op;
04841
04842
04843 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04844 if (TMR_SUCCESS != ret)
04845 {
04846 return ret;
04847 }
04848
04849
04850 if(NULL != data)
04851 {
04852 data->len = 0;
04853 }
04854
04855 op = tagop->u.gen2.u.custom.u.ids.u.setSfeParameters;
04856 return TMR_SR_cmdSL900aSetSfeParameters(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
04857 op.Password, op.sl900A.level, op.sfe->raw, filter);
04858 }
04859
04860 case (TMR_TAGOP_GEN2_IDS_SL900A_GETLOGSTATE):
04861
04862 {
04863 TMR_TagOp_GEN2_IDS_SL900A_GetLogState op;
04864
04865
04866 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04867 if (TMR_SUCCESS != ret)
04868 {
04869 return ret;
04870 }
04871
04872
04873 if(NULL != data)
04874 {
04875 data->len = 0;
04876 }
04877
04878 op = tagop->u.gen2.u.custom.u.ids.u.getLog;
04879 return TMR_SR_cmdSL900aGetLogState(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
04880 op.Password, op.sl900A.level, data, filter);
04881 }
04882
04883 case (TMR_TAGOP_GEN2_IDS_SL900A_SETLOGMODE):
04884 {
04885 TMR_TagOp_GEN2_IDS_SL900A_SetLogMode op;
04886
04887
04888 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04889 if (TMR_SUCCESS != ret)
04890 {
04891 return ret;
04892 }
04893
04894
04895 if(NULL != data)
04896 {
04897 data->len = 0;
04898 }
04899
04900 op = tagop->u.gen2.u.custom.u.ids.u.setLogMode;
04901 return TMR_SR_cmdSL900aSetLogMode(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
04902 op.Password, op.sl900A.level, op.sl900A.dataLog, op.sl900A.rule, op.Ext1Enable, op.Ext2Enable, op.TempEnable,
04903 op.BattEnable, op.LogInterval, filter);
04904 }
04905
04906 case (TMR_TAGOP_GEN2_IDS_SL900A_INITIALIZE):
04907 {
04908 TMR_TagOp_GEN2_IDS_SL900A_Initialize op;
04909
04910
04911 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04912 if (TMR_SUCCESS != ret)
04913 {
04914 return ret;
04915 }
04916
04917
04918 if(NULL != data)
04919 {
04920 data->len = 0;
04921 }
04922
04923 op = tagop->u.gen2.u.custom.u.ids.u.initialize;
04924
04925 return TMR_SR_cmdSL900aInitialize(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
04926 op.Password, op.sl900A.level, op.delayTime.raw, op.applicationData.raw, filter);
04927 }
04928
04929 case (TMR_TAGOP_GEN2_IDS_SL900A_ENDLOG):
04930 {
04931 TMR_TagOp_GEN2_IDS_SL900A_EndLog op;
04932
04933
04934 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04935 if (TMR_SUCCESS != ret)
04936 {
04937 return ret;
04938 }
04939
04940
04941 if(NULL != data)
04942 {
04943 data->len = 0;
04944 }
04945
04946 op = tagop->u.gen2.u.custom.u.ids.u.endLog;
04947 return TMR_SR_cmdSL900aEndLog(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
04948 op.Password,op.sl900A.level, filter);
04949 }
04950
04951 case (TMR_TAGOP_GEN2_IDS_SL900A_SETPASSWORD):
04952 {
04953 TMR_TagOp_GEN2_IDS_SL900A_SetPassword op;
04954
04955
04956 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04957 if (TMR_SUCCESS != ret)
04958 {
04959 return ret;
04960 }
04961
04962
04963 if(NULL != data)
04964 {
04965 data->len = 0;
04966 }
04967
04968 op = tagop->u.gen2.u.custom.u.ids.u.setPassword;
04969 return TMR_SR_cmdSL900aSetPassword(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
04970 op.Password,op.sl900A.level, op.NewPassword, op.NewPasswordLevel, filter);
04971 }
04972
04973 case (TMR_TAGOP_GEN2_IDS_SL900A_ACCESSFIFOSTATUS):
04974 {
04975 TMR_TagOp_GEN2_IDS_SL900A_AccessFifoStatus op;
04976
04977
04978 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
04979 if (TMR_SUCCESS != ret)
04980 {
04981 return ret;
04982 }
04983
04984
04985 if(NULL != data)
04986 {
04987 data->len = 0;
04988 }
04989
04990 op = tagop->u.gen2.u.custom.u.ids.u.accessFifoStatus;
04991 return TMR_SR_cmdSL900aAccessFifoStatus(reader, (uint16_t)sr->commandTimeout, op.status.AccessPassword, op.status.CommandCode,
04992 op.status.Password, op.status.sl900A.level, op.status.operation, data, filter);
04993 }
04994 case (TMR_TAGOP_GEN2_IDS_SL900A_ACCESSFIFOREAD):
04995 {
04996 TMR_TagOp_GEN2_IDS_SL900A_AccessFifoRead op;
04997
04998
04999 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05000 if (TMR_SUCCESS != ret)
05001 {
05002 return ret;
05003 }
05004
05005
05006 if(NULL != data)
05007 {
05008 data->len = 0;
05009 }
05010
05011 op = tagop->u.gen2.u.custom.u.ids.u.accessFifoRead;
05012 return TMR_SR_cmdSL900aAccessFifoRead(reader, (uint16_t)sr->commandTimeout, op.read.AccessPassword, op.read.CommandCode,
05013 op.read.Password, op.read.sl900A.level, op.read.operation,op.length, data, filter);
05014 }
05015 case (TMR_TAGOP_GEN2_IDS_SL900A_ACCESSFIFOWRITE):
05016 {
05017 TMR_TagOp_GEN2_IDS_SL900A_AccessFifoWrite op;
05018
05019
05020 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05021 if (TMR_SUCCESS != ret)
05022 {
05023 return ret;
05024 }
05025
05026
05027 if(NULL != data)
05028 {
05029 data->len = 0;
05030 }
05031
05032 op = tagop->u.gen2.u.custom.u.ids.u.accessFifoWrite;
05033 return TMR_SR_cmdSL900aAccessFifoWrite(reader, (uint16_t)sr->commandTimeout, op.write.AccessPassword, op.write.CommandCode,
05034 op.write.Password, op.write.sl900A.level, op.write.operation, op.payLoad, data, filter);
05035 }
05036 case (TMR_TAGOP_GEN2_IDS_SL900A_STARTLOG):
05037 {
05038 TMR_TagOp_GEN2_IDS_SL900A_StartLog op;
05039
05040
05041 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05042 if (TMR_SUCCESS != ret)
05043 {
05044 return ret;
05045 }
05046
05047
05048 if(NULL != data)
05049 {
05050 data->len = 0;
05051 }
05052
05053 op = tagop->u.gen2.u.custom.u.ids.u.startLog;
05054
05055 return TMR_SR_cmdSL900aStartLog(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
05056 op.Password, op.sl900A.level, op.startTime, filter);
05057 }
05058 case (TMR_TAGOP_GEN2_IDS_SL900A_GETBATTERYLEVEL):
05059 {
05060 TMR_TagOp_GEN2_IDS_SL900A_GetBatteryLevel op;
05061
05062
05063 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05064 if (TMR_SUCCESS != ret)
05065 {
05066 return ret;
05067 }
05068
05069
05070 if(NULL != data)
05071 {
05072 data->len = 0;
05073 }
05074
05075 op = tagop->u.gen2.u.custom.u.ids.u.batteryLevel;
05076
05077 return TMR_SR_cmdSL900aGetBatteryLevel(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
05078 op.Password, op.sl900A.level, op.batteryType, data, filter);
05079 }
05080 case (TMR_TAGOP_GEN2_IDS_SL900A_SETLOGLIMITS):
05081 {
05082 TMR_TagOp_GEN2_IDS_SL900A_SetLogLimits op;
05083
05084
05085 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05086 if (TMR_SUCCESS != ret)
05087 {
05088 return ret;
05089 }
05090
05091
05092 if(NULL != data)
05093 {
05094 data->len = 0;
05095 }
05096
05097 op = tagop->u.gen2.u.custom.u.ids.u.setLogLimit;
05098
05099 return TMR_SR_cmdSL900aSetLogLimit(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
05100 op.Password, op.sl900A.level, op.limit.extremeLower, op.limit.lower, op.limit.upper, op.limit.extremeUpper, filter);
05101 }
05102 case (TMR_TAGOP_GEN2_IDS_SL900A_SETSHELFLIFE):
05103 {
05104 TMR_TagOp_GEN2_IDS_SL900A_SetShelfLife op;
05105
05106
05107 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05108 if (TMR_SUCCESS != ret)
05109 {
05110 return ret;
05111 }
05112
05113
05114 if(NULL != data)
05115 {
05116 data->len = 0;
05117 }
05118
05119 op = tagop->u.gen2.u.custom.u.ids.u.setShelfLife;
05120
05121 return TMR_SR_cmdSL900aSetShelfLife(reader, (uint16_t)sr->commandTimeout, op.AccessPassword, op.CommandCode,
05122 op.Password, op.sl900A.level, op.shelfLifeBlock0->raw, op.shelfLifeBlock1->raw, filter);
05123 }
05124 case (TMR_TAGOP_GEN2_DENATRAN_IAV_ACTIVATESECUREMODE):
05125 {
05126 TMR_TagOp_GEN2_Denatran_IAV_Activate_Secure_Mode op;
05127
05128 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05129 if (TMR_SUCCESS != ret)
05130 {
05131 return ret;
05132 }
05133
05134 if(NULL != data)
05135 {
05136 data->len = 0;
05137 }
05138
05139 op = tagop->u.gen2.u.custom.u.IavDenatran.u.secureMode;
05140 return TMR_SR_cmdIAVDenatranCustomOp(reader, (uint16_t)sr->commandTimeout, sr->gen2AccessPassword,
05141 op.mode, op.payload, data, filter);
05142 }
05143 case (TMR_TAGOP_GEN2_DENATRAN_IAV_AUTHENTICATEOBU):
05144 {
05145 TMR_TagOp_GEN2_Denatran_IAV_Authenticate_OBU op;
05146
05147 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05148 if (TMR_SUCCESS != ret)
05149 {
05150 return ret;
05151 }
05152
05153 if(NULL != data)
05154 {
05155 data->len = 0;
05156 }
05157
05158 op = tagop->u.gen2.u.custom.u.IavDenatran.u.authenticateOBU;
05159 return TMR_SR_cmdIAVDenatranCustomOp(reader, (uint16_t)sr->commandTimeout, sr->gen2AccessPassword,
05160 op.mode, op.payload, data, filter);
05161 }
05162 case (TMR_TAGOP_GEN2_ACTIVATE_SINIAV_MODE):
05163 {
05164 TMR_TagOp_GEN2_Denatran_IAV_Activate_Siniav_Mode op;
05165
05166 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05167 if (TMR_SUCCESS != ret)
05168 {
05169 return ret;
05170 }
05171
05172 if(NULL != data)
05173 {
05174 data->len = 0;
05175 }
05176
05177 op = tagop->u.gen2.u.custom.u.IavDenatran.u.activateSiniavMode;
05178 return TMR_SR_cmdIAVDenatranCustomActivateSiniavMode(reader, (uint16_t)sr->commandTimeout, sr->gen2AccessPassword,
05179 op.mode, op.payload, data, filter, op.isTokenDesc, op.token);
05180 }
05181 case (TMR_TAGOP_GEN2_OBU_AUTH_ID):
05182 {
05183 TMR_TagOp_GEN2_Denatran_IAV_OBU_Auth_ID op;
05184
05185 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05186 if (TMR_SUCCESS != ret)
05187 {
05188 return ret;
05189 }
05190
05191 if(NULL != data)
05192 {
05193 data->len = 0;
05194 }
05195
05196 op = tagop->u.gen2.u.custom.u.IavDenatran.u.obuAuthId;
05197 return TMR_SR_cmdIAVDenatranCustomOp(reader, (uint16_t)sr->commandTimeout, sr->gen2AccessPassword,
05198 op.mode, op.payload, data, filter);
05199 }
05200 case (TMR_TAGOP_GEN2_AUTHENTICATE_OBU_FULL_PASS1):
05201 {
05202 TMR_TagOp_GEN2_Denatran_IAV_OBU_Auth_Full_Pass1 op;
05203
05204 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05205 if (TMR_SUCCESS != ret)
05206 {
05207 return ret;
05208 }
05209
05210 if(NULL != data)
05211 {
05212 data->len = 0;
05213 }
05214
05215 op = tagop->u.gen2.u.custom.u.IavDenatran.u.obuAuthFullPass1;
05216 return TMR_SR_cmdIAVDenatranCustomOp(reader, (uint16_t)sr->commandTimeout, sr->gen2AccessPassword,
05217 op.mode, op.payload, data, filter);
05218 }
05219 case (TMR_TAGOP_GEN2_AUTHENTICATE_OBU_FULL_PASS2):
05220 {
05221 TMR_TagOp_GEN2_Denatran_IAV_OBU_Auth_Full_Pass2 op;
05222
05223 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05224 if (TMR_SUCCESS != ret)
05225 {
05226 return ret;
05227 }
05228
05229 if(NULL != data)
05230 {
05231 data->len = 0;
05232 }
05233
05234 op = tagop->u.gen2.u.custom.u.IavDenatran.u.obuAuthFullPass2;
05235 return TMR_SR_cmdIAVDenatranCustomOp(reader, (uint16_t)sr->commandTimeout, sr->gen2AccessPassword,
05236 op.mode, op.payload, data, filter);
05237 }
05238 case (TMR_TAGOP_GEN2_OBU_READ_FROM_MEM_MAP):
05239 {
05240 TMR_TagOp_GEN2_Denatran_IAV_OBU_ReadFromMemMap op;
05241
05242 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05243 if (TMR_SUCCESS != ret)
05244 {
05245 return ret;
05246 }
05247
05248 if(NULL != data)
05249 {
05250 data->len = 0;
05251 }
05252
05253 op = tagop->u.gen2.u.custom.u.IavDenatran.u.obuReadFromMemMap;
05254 return TMR_SR_cmdIAVDenatranCustomReadFromMemMap(reader, (uint16_t)sr->commandTimeout, sr->gen2AccessPassword,
05255 op.mode, op.payload, data, filter, op.readPtr);
05256 }
05257 case (TMR_TAGOP_GEN2_DENATRAN_IAV_READ_SEC):
05258 {
05259 TMR_TagOp_GEN2_Denatran_IAV_Read_Sec op;
05260
05261 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05262 if (TMR_SUCCESS != ret)
05263 {
05264 return ret;
05265 }
05266
05267 if(NULL != data)
05268 {
05269 data->len = 0;
05270 }
05271
05272 op = tagop->u.gen2.u.custom.u.IavDenatran.u.readSec;
05273 return TMR_SR_cmdIAVDenatranCustomReadSec(reader, (uint16_t)sr->commandTimeout, sr->gen2AccessPassword,
05274 op.mode, op.payload, data, filter, op.readPtr);
05275
05276 }
05277 case (TMR_TAGOP_GEN2_OBU_WRITE_TO_MEM_MAP):
05278 {
05279
05280 TMR_TagOp_GEN2_Denatran_IAV_OBU_WriteToMemMap op;
05281
05282 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05283 if (TMR_SUCCESS != ret)
05284 {
05285 return ret;
05286 }
05287
05288 if(NULL != data)
05289 {
05290 data->len = 0;
05291 }
05292
05293 op = tagop->u.gen2.u.custom.u.IavDenatran.u.obuWriteToMemMap;
05294 return TMR_SR_cmdIAVDenatranCustomWriteToMemMap(reader, (uint16_t)sr->commandTimeout, sr->gen2AccessPassword,
05295 op.mode, op.payload, data, filter, op.writePtr, op.wordData,op.tagIdentification, op.dataBuf);
05296 }
05297 case (TMR_TAGOP_GEN2_DENATRAN_IAV_WRITE_SEC):
05298 {
05299
05300 TMR_TagOp_GEN2_Denatran_IAV_Write_Sec op;
05301
05302 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05303 if (TMR_SUCCESS != ret)
05304 {
05305 return ret;
05306 }
05307
05308 if(NULL != data)
05309 {
05310 data->len = 0;
05311 }
05312
05313 op = tagop->u.gen2.u.custom.u.IavDenatran.u.writeSec;
05314 return TMR_SR_cmdIAVDenatranCustomWriteSec(reader, (uint16_t)sr->commandTimeout, sr->gen2AccessPassword,
05315 op.mode, op.payload, data, filter, op.dataWords, op.dataBuf);
05316 }
05317
05318 case (TMR_TAGOP_GEN2_DENATRAN_IAV_GET_TOKEN_ID):
05319 {
05320 TMR_TagOp_GEN2_Denatran_IAV_Get_Token_Id op;
05321
05322 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05323 if ( TMR_SUCCESS != ret)
05324 {
05325 return ret;
05326 }
05327
05328 if (NULL != data)
05329 {
05330 data->len = 0;
05331 }
05332
05333 op = tagop->u.gen2.u.custom.u.IavDenatran.u.getTokenId;
05334 return TMR_SR_cmdIAVDenatranCustomGetTokenId(reader, (uint16_t)sr->commandTimeout, sr->gen2AccessPassword,
05335 op.mode, data, filter);
05336 }
05337 case (TMR_TAGOP_GEN2_DENATRAN_IAV_AUTHENTICATE_OBU_FULL_PASS):
05338 {
05339 TMR_TagOp_GEN2_Denatran_IAV_OBU_Auth_Full_Pass op;
05340
05341 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05342 if (TMR_SUCCESS != ret)
05343 {
05344 return ret;
05345 }
05346
05347 if(NULL != data)
05348 {
05349 data->len = 0;
05350 }
05351
05352 op = tagop->u.gen2.u.custom.u.IavDenatran.u.obuAuthFullPass;
05353 return TMR_SR_cmdIAVDenatranCustomOp(reader, (uint16_t)sr->commandTimeout,
05354 sr->gen2AccessPassword, op.mode, op.payload, data, filter);
05355 }
05356 case (TMR_TAGOP_GEN2_DENATRAN_IAV_G0_PA_OBU_AUTHENTICATE_ID):
05357 {
05358 TMR_TagOp_GEN2_Denatran_IAV_G0_PA_OBU_Auth_ID op;
05359
05360 ret = setProtocol(reader, TMR_TAG_PROTOCOL_GEN2);
05361 if (TMR_SUCCESS != ret)
05362 {
05363 return ret;
05364 }
05365
05366 if(NULL != data)
05367 {
05368 data->len = 0;
05369 }
05370
05371 op = tagop->u.gen2.u.custom.u.IavDenatran.u.g0paobuauthid;
05372 return TMR_SR_cmdIAVDenatranCustomOp(reader, (uint16_t)sr->commandTimeout,
05373 sr->gen2AccessPassword, op.mode, op.payload, data, filter);
05374 }
05375 #endif
05376
05377 #ifdef TMR_ENABLE_ISO180006B
05378 case (TMR_TAGOP_ISO180006B_READDATA):
05379 {
05380 TMR_TagOp_ISO180006B_ReadData op;
05381 TMR_TagReadData read;
05382
05383 ret = setProtocol(reader, TMR_TAG_PROTOCOL_ISO180006B);
05384 if (TMR_SUCCESS != ret)
05385 {
05386 return ret;
05387 }
05388
05389 if (NULL != data)
05390 {
05391 read.data.max = data->max;
05392 read.data.len = 0;
05393 read.data.list = data->list;
05394 }
05395 else
05396 {
05397 read.data.list = NULL;
05398 }
05399 read.metadataFlags = 0;
05400
05401 op = tagop->u.iso180006b.u.readData;
05402 ret = TMR_SR_cmdISO180006BReadTagData(reader, (uint16_t)sr->commandTimeout,
05403 op.byteAddress, op.len, filter, &read);
05404 if (NULL != data)
05405 {
05406 data->len = read.data.len;
05407 }
05408 return ret;
05409 }
05410 case (TMR_TAGOP_ISO180006B_WRITEDATA):
05411 {
05412 TMR_TagOp_ISO180006B_WriteData op;
05413
05414 ret = setProtocol(reader, TMR_TAG_PROTOCOL_ISO180006B);
05415 if (TMR_SUCCESS != ret)
05416 {
05417 return ret;
05418 }
05419 op = tagop->u.iso180006b.u.writeData;
05420 return TMR_SR_cmdISO180006BWriteTagData(reader, (uint16_t)(sr->commandTimeout), op.byteAddress,
05421 (uint8_t)op.data.len, op.data.list, filter);
05422 }
05423 case (TMR_TAGOP_ISO180006B_LOCK):
05424 {
05425 TMR_TagOp_ISO180006B_Lock op;
05426
05427 ret = setProtocol(reader, TMR_TAG_PROTOCOL_ISO180006B);
05428 if (TMR_SUCCESS != ret)
05429 {
05430 return ret;
05431 }
05432
05433 op = tagop->u.iso180006b.u.lock;
05434 return TMR_SR_cmdISO180006BLockTag(reader, (uint16_t)(sr->commandTimeout), op.address, filter);
05435
05436 }
05437
05438 #endif
05439 default:
05440 {
05441 return TMR_ERROR_UNIMPLEMENTED_FEATURE;
05442 }
05443
05444 }
05445 }
05446
05450 TMR_Status
05451 TMR_SR_addTagOp(struct TMR_Reader *reader, TMR_TagOp *tagop,TMR_ReadPlan *rp, uint8_t *msg, uint8_t *j, uint32_t readTimeMs, uint8_t *byte )
05452 {
05453
05454 TMR_Status ret = TMR_SUCCESS;
05455 TMR_SR_SerialReader *sr;
05456 uint8_t i, lenbyte;
05457 i = *j; lenbyte = *byte;
05458
05459 sr = &reader->u.serialReader;
05460
05461
05462 switch (tagop->type)
05463 {
05464 case (TMR_TAGOP_GEN2_WRITETAG):
05465 {
05466 TMR_TagOp_GEN2_WriteTag *args;
05467
05468 args = &rp->u.simple.tagop->u.gen2.u.writeTag;
05469
05470 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05471 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05472 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
05473
05474 TMR_SR_msgAddGEN2WriteTagEPC(msg,&i, 0, args->epcptr->epc, args->epcptr->epcByteCount);
05475 break;
05476 }
05477 case TMR_TAGOP_GEN2_READDATA:
05478 {
05479 TMR_TagOp_GEN2_ReadData *args;
05480
05481 args = &rp->u.simple.tagop->u.gen2.u.readData;
05482
05487 if ((uint8_t)args->bank > 3)
05488 {
05489
05490 sr->gen2AllMemoryBankEnabled = true;
05491 }
05492
05493 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05494 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05495 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
05496
05497 TMR_SR_msgAddGEN2DataRead(msg, &i, 2000, args->bank, args->wordAddress,
05498 args->len, 0x00, false);
05499 break;
05500 }
05501 case TMR_TAGOP_GEN2_SECURE_READDATA:
05502 {
05503 TMR_TagOp_GEN2_SecureReadData *args;
05504 uint8_t accessPassword[4];
05505 int index = 0;
05506
05507
05508 isSecureAccessEnabled = true;
05509
05510 args = &rp->u.simple.tagop->u.gen2.u.secureReadData;
05511 if (args->passwordType == TMR_SECURE_GEN2_LOOKUP_TABLE_PASSWORD)
05512 {
05513
05514 accessPassword[index++] = args->password.secureAddressLength;
05515 accessPassword[index++] = args->password.secureAddressOffset;
05516 accessPassword[index++] = (args->password.secureFlashOffset >> 8);
05517 accessPassword[index++] = (args->password.secureFlashOffset & 0xFF);
05518
05519 sr->gen2AccessPassword = (uint32_t)accessPassword[0] << 24 |
05520 (uint32_t)accessPassword[1] << 16 |
05521 (uint32_t)accessPassword[2] << 8 |
05522 (uint32_t)accessPassword[3];
05523 }
05524 else
05525 {
05526
05527 sr->gen2AccessPassword = args->password.gen2PassWord.u.gen2Password;
05528 }
05529
05530 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05531 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND | TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05532 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
05533
05534 TMR_SR_msgAddGEN2DataRead(msg, &i, 2000, args->readData.bank, args->readData.wordAddress,
05535 args->readData.len,args->type, false);
05536
05537 isSecureAccessEnabled = false;
05538 break;
05539 }
05540 case TMR_TAGOP_GEN2_WRITEDATA:
05541 {
05542 TMR_TagOp_GEN2_WriteData *args;
05543 int idx ;
05544
05545 args = &rp->u.simple.tagop->u.gen2.u.writeData;
05546
05547 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05548 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05549 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
05550
05551 TMR_SR_msgAddGEN2DataWrite(msg, &i, 0, args->bank, args->wordAddress);
05552
05553 for(idx = 0 ; idx< args->data.len; idx++)
05554 {
05555 msg[i++]= (args->data.list[idx]>>8) & 0xFF;
05556 msg[i++]= (args->data.list[idx]>>0) & 0xFF;
05557 }
05558 break;
05559 }
05560 case TMR_TAGOP_GEN2_LOCK:
05561 {
05562 TMR_TagOp_GEN2_Lock *args;
05563
05564 args = &rp->u.simple.tagop->u.gen2.u.lock;
05565
05566 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05567 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05568 rp->u.simple.filter, rp->u.simple.protocol, args->accessPassword, &lenbyte);
05569
05570 TMR_SR_msgAddGEN2LockTag(msg, &i, 0, args->mask, args->action, 0);
05571 break;
05572 }
05573 case TMR_TAGOP_GEN2_KILL:
05574 {
05575 TMR_TagOp_GEN2_Kill *args;
05576
05577 args = &rp->u.simple.tagop->u.gen2.u.kill;
05578
05579 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05580 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05581 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
05582
05583 TMR_SR_msgAddGEN2KillTag(msg, &i, 0, args->password);
05584 break;
05585 }
05586 case TMR_TAGOP_GEN2_BLOCKWRITE:
05587 {
05588 TMR_TagOp_GEN2_BlockWrite *args;
05589 args = &rp->u.simple.tagop->u.gen2.u.blockWrite;
05590
05591 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05592 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05593 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
05594
05595 TMR_SR_msgAddGEN2BlockWrite(msg, &i, 0, args->bank, args->wordPtr, args->data.len, args->data.list, 0, NULL);
05596 break;
05597 }
05598 case TMR_TAGOP_GEN2_BLOCKPERMALOCK:
05599 {
05600 TMR_TagOp_GEN2_BlockPermaLock *args;
05601 args = &rp->u.simple.tagop->u.gen2.u.blockPermaLock;
05602
05603 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05604 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05605 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
05606
05607 TMR_SR_msgAddGEN2BlockPermaLock(msg, &i, 0,args->readLock, args->bank, args->blockPtr, args->mask.len,
05608 args->mask.list, 0, NULL);
05609 break;
05610 }
05611 case TMR_TAGOP_GEN2_BLOCKERASE:
05612 {
05613 TMR_TagOp_GEN2_BlockErase *args;
05614 args = &rp->u.simple.tagop->u.gen2.u.blockErase;
05615
05616 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05617 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05618 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
05619
05620 TMR_SR_msgAddGEN2BlockErase(msg, &i, 0, args->wordPtr, args->bank, args->wordCount, 0, NULL);
05621 break;
05622 }
05623
05624 #ifdef TMR_ENABLE_GEN2_CUSTOM_TAGOPS
05625 case TMR_TAGOP_GEN2_ALIEN_HIGGS2_PARTIALLOADIMAGE:
05626 {
05627 TMR_TagOp_GEN2_Alien_Higgs2_PartialLoadImage *args;
05628 args = &rp->u.simple.tagop->u.gen2.u.custom.u.alien.u.higgs2.u.partialLoadImage;
05629
05630 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05631 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05632 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
05633
05634 TMR_SR_msgAddHiggs2PartialLoadImage(msg, &i, 0, args->accessPassword, args->killPassword,
05635 args->epcptr->epcByteCount, args->epcptr->epc, NULL);
05636 break;
05637 }
05638 case TMR_TAGOP_GEN2_ALIEN_HIGGS2_FULLLOADIMAGE:
05639 {
05640 TMR_TagOp_GEN2_Alien_Higgs2_FullLoadImage *args;
05641 args = &rp->u.simple.tagop->u.gen2.u.custom.u.alien.u.higgs2.u.fullLoadImage;
05642
05643 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05644 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05645 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
05646
05647 TMR_SR_msgAddHiggs2FullLoadImage(msg, &i, 0, args->accessPassword, args->killPassword, args->lockBits,
05648 args->pcWord, args->epcptr->epcByteCount, args->epcptr->epc, NULL);
05649 break;
05650 }
05651 case TMR_TAGOP_GEN2_ALIEN_HIGGS3_FASTLOADIMAGE:
05652 {
05653 TMR_TagOp_GEN2_Alien_Higgs3_FastLoadImage *args;
05654 args = &rp->u.simple.tagop->u.gen2.u.custom.u.alien.u.higgs3.u.fastLoadImage;
05655
05656 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05657 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05658 rp->u.simple.filter, rp->u.simple.protocol, args->currentAccessPassword, &lenbyte);
05659
05660 TMR_SR_msgAddHiggs3FastLoadImage(msg, &i, 0, args->currentAccessPassword, args->accessPassword,
05661 args->killPassword, args->pcWord, args->epcptr->epcByteCount, args->epcptr->epc, NULL);
05662 break;
05663 }
05664 case TMR_TAGOP_GEN2_ALIEN_HIGGS3_LOADIMAGE:
05665 {
05666 TMR_TagOp_GEN2_Alien_Higgs3_LoadImage *args;
05667 args = &rp->u.simple.tagop->u.gen2.u.custom.u.alien.u.higgs3.u.loadImage;
05668
05669 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05670 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05671 rp->u.simple.filter, rp->u.simple.protocol, args->currentAccessPassword, &lenbyte);
05672
05673 TMR_SR_msgAddHiggs3LoadImage(msg, &i, 0, args->currentAccessPassword, args->accessPassword,
05674 args->killPassword, args->pcWord, (uint8_t)args->epcAndUserData->len, args->epcAndUserData->list, NULL);
05675 break;
05676 }
05677 case TMR_TAGOP_GEN2_ALIEN_HIGGS3_BLOCKREADLOCK:
05678 {
05679 TMR_TagOp_GEN2_Alien_Higgs3_BlockReadLock *args;
05680 args = &rp->u.simple.tagop->u.gen2.u.custom.u.alien.u.higgs3.u.blockReadLock;
05681
05682 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05683 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05684 rp->u.simple.filter, rp->u.simple.protocol, args->accessPassword, &lenbyte);
05685
05686 TMR_SR_msgAddHiggs3BlockReadLock(msg, &i, 0, args->accessPassword, args->lockBits, NULL);
05687 break;
05688 }
05689 case TMR_TAGOP_GEN2_NXP_SETREADPROTECT:
05690 {
05691 TMR_TagOp_GEN2_NXP_SetReadProtect *args;
05692 args = &rp->u.simple.tagop->u.gen2.u.custom.u.nxp.u.setReadProtect;
05693
05694 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05695 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05696 rp->u.simple.filter, rp->u.simple.protocol, args->accessPassword, &lenbyte);
05697
05698 TMR_SR_msgAddNXPSetReadProtect(msg, &i, 0, rp->u.simple.tagop->u.gen2.u.custom.chipType, args->accessPassword, NULL);
05699 break;
05700 }
05701 case TMR_TAGOP_GEN2_NXP_RESETREADPROTECT:
05702 {
05703 TMR_TagOp_GEN2_NXP_ResetReadProtect *args;
05704 args = &rp->u.simple.tagop->u.gen2.u.custom.u.nxp.u.resetReadProtect;
05705
05706 if (rp->u.simple.tagop->u.gen2.u.custom.chipType == TMR_SR_GEN2_NXP_G2X_SILICON)
05707 {
05708
05709
05710
05711 return TMR_ERROR_UNSUPPORTED;
05712 }
05713
05714 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05715 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05716 rp->u.simple.filter, rp->u.simple.protocol, args->accessPassword, &lenbyte);
05717
05718 TMR_SR_msgAddNXPResetReadProtect(msg, &i, 0, rp->u.simple.tagop->u.gen2.u.custom.chipType, args->accessPassword, NULL);
05719 break;
05720 }
05721 case TMR_TAGOP_GEN2_NXP_CHANGEEAS:
05722 {
05723 TMR_TagOp_GEN2_NXP_ChangeEAS *args;
05724 args = &rp->u.simple.tagop->u.gen2.u.custom.u.nxp.u.changeEAS;
05725
05726 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05727 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05728 rp->u.simple.filter, rp->u.simple.protocol, args->accessPassword, &lenbyte);
05729
05730 TMR_SR_msgAddNXPChangeEAS(msg, &i, 0, rp->u.simple.tagop->u.gen2.u.custom.chipType, args->accessPassword, args->reset, NULL);
05731 break;
05732 }
05733 case TMR_TAGOP_GEN2_NXP_EASALARM:
05734 {
05735 return TMR_ERROR_UNSUPPORTED;
05736 }
05737 case TMR_TAGOP_GEN2_NXP_CALIBRATE:
05738 {
05739 TMR_TagOp_GEN2_NXP_Calibrate *args;
05740 args = &rp->u.simple.tagop->u.gen2.u.custom.u.nxp.u.calibrate;
05741
05742 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05743 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05744 rp->u.simple.filter, rp->u.simple.protocol, args->accessPassword, &lenbyte);
05745
05746 TMR_SR_msgAddNXPCalibrate(msg, &i, 0, rp->u.simple.tagop->u.gen2.u.custom.chipType, args->accessPassword, NULL);
05747 break;
05748 }
05749 case TMR_TAGOP_GEN2_NXP_CHANGECONFIG:
05750 {
05751 TMR_TagOp_GEN2_NXP_ChangeConfig *args;
05752 args = &rp->u.simple.tagop->u.gen2.u.custom.u.nxp.u.changeConfig;
05753
05754 if (rp->u.simple.tagop->u.gen2.u.custom.chipType == TMR_SR_GEN2_NXP_G2X_SILICON)
05755 {
05756
05757 return TMR_ERROR_UNSUPPORTED;
05758 }
05759 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05760 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05761 rp->u.simple.filter, rp->u.simple.protocol, args->accessPassword, &lenbyte);
05762
05763 TMR_SR_msgAddNXPChangeConfig(msg, &i, 0, rp->u.simple.tagop->u.gen2.u.custom.chipType, 0, args->configWord, NULL);
05764 break;
05765 }
05766 case TMR_TAGOP_GEN2_IMPINJ_MONZA4_QTREADWRITE:
05767 {
05768 TMR_TagOp_GEN2_Impinj_Monza4_QTReadWrite *args;
05769 args = &rp->u.simple.tagop->u.gen2.u.custom.u.impinj.u.monza4.u.qtReadWrite;
05770
05771 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05772 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05773 rp->u.simple.filter, rp->u.simple.protocol, args->accessPassword, &lenbyte);
05774
05775 TMR_SR_msgAddMonza4QTReadWrite(msg, &i, 0, 0, args->controlByte, args->payload, NULL);
05776 break;
05777 }
05778 case TMR_TAGOP_GEN2_IDS_SL900A_GETSENSOR:
05779 {
05780 TMR_TagOp_GEN2_IDS_SL900A_GetSensorValue *args;
05781 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.sensor;
05782
05783 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05784 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05785 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05786
05787 TMR_SR_msgAddIdsSL900aGetSensorValue(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level,
05788 args->sl900A.sensortype, NULL);
05789 break;
05790 }
05791 case TMR_TAGOP_GEN2_IDS_SL900A_GETMEASUREMENTSETUP:
05792 {
05793 TMR_TagOp_GEN2_IDS_SL900A_GetMeasurementSetup *args;
05794 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.measurementSetup;
05795
05796 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05797 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05798 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05799
05800 TMR_SR_msgAddIdsSL900aGetMeasurementSetup(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level, NULL);
05801 }
05802
05803 case TMR_TAGOP_GEN2_IDS_SL900A_GETLOGSTATE:
05804 {
05805 TMR_TagOp_GEN2_IDS_SL900A_GetLogState *args;
05806 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.getLog;
05807
05808 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05809 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05810 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05811
05812 TMR_SR_msgAddIdsSL900aGetLogState(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level,NULL);
05813
05814 break;
05815 }
05816 case TMR_TAGOP_GEN2_IDS_SL900A_SETLOGMODE:
05817 {
05818 TMR_TagOp_GEN2_IDS_SL900A_SetLogMode *args;
05819 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.setLogMode;
05820
05821 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05822 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05823 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05824
05825 TMR_SR_msgAddIdsSL900aSetLogMode(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level,
05826 args->sl900A.dataLog, args->sl900A.rule, args->Ext1Enable, args->Ext2Enable, args->TempEnable,
05827 args->BattEnable, args->LogInterval, NULL);
05828
05829 break;
05830 }
05831
05832 case TMR_TAGOP_GEN2_IDS_SL900A_INITIALIZE:
05833 {
05834 TMR_TagOp_GEN2_IDS_SL900A_Initialize *args;
05835 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.initialize;
05836
05837 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05838 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05839 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05840
05841 TMR_SR_msgAddIdsSL900aInitialize(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level,
05842 args->delayTime.raw, args->applicationData.raw, NULL);
05843
05844 break;
05845 }
05846 case TMR_TAGOP_GEN2_IDS_SL900A_ENDLOG:
05847 {
05848 TMR_TagOp_GEN2_IDS_SL900A_EndLog *args;
05849 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.endLog;
05850
05851 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05852 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05853 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05854
05855 TMR_SR_msgAddIdsSL900aEndLog(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level, NULL);
05856 break;
05857
05858 }
05859 case TMR_TAGOP_GEN2_IDS_SL900A_SETPASSWORD:
05860 {
05861 TMR_TagOp_GEN2_IDS_SL900A_SetPassword *args;
05862 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.setPassword;
05863
05864 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05865 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05866 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05867
05868 TMR_SR_msgAddIdsSL900aSetPassword(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level,
05869 args->NewPassword, args->NewPasswordLevel, NULL);
05870 break;
05871 }
05872 case TMR_TAGOP_GEN2_IDS_SL900A_STARTLOG:
05873 {
05874 TMR_TagOp_GEN2_IDS_SL900A_StartLog *args;
05875 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.startLog;
05876
05877 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05878 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05879 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05880
05881 TMR_SR_msgAddIdsSL900aStartLog(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level, args->startTime, NULL);
05882 break;
05883
05884 }
05885 case TMR_TAGOP_GEN2_IDS_SL900A_ACCESSFIFOSTATUS:
05886 {
05887 TMR_TagOp_GEN2_IDS_SL900A_AccessFifoStatus *args;
05888 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.accessFifoStatus;
05889
05890 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05891 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05892 rp->u.simple.filter, rp->u.simple.protocol, args->status.AccessPassword, &lenbyte);
05893
05894 TMR_SR_msgAddIdsSL900aAccessFifoStatus(msg, &i, 0, 0, args->status.CommandCode, args->status.Password, args->status.sl900A.level, args->status.operation, NULL);
05895 break;
05896
05897 }
05898 case TMR_TAGOP_GEN2_IDS_SL900A_ACCESSFIFOREAD:
05899 {
05900 TMR_TagOp_GEN2_IDS_SL900A_AccessFifoRead *args;
05901 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.accessFifoRead;
05902
05903 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05904 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05905 rp->u.simple.filter, rp->u.simple.protocol, args->read.AccessPassword, &lenbyte);
05906
05907 TMR_SR_msgAddIdsSL900aAccessFifoRead(msg, &i, 0, 0, args->read.CommandCode, args->read.Password, args->read.sl900A.level, args->read.operation, args->length, NULL);
05908 break;
05909 }
05910 case TMR_TAGOP_GEN2_IDS_SL900A_ACCESSFIFOWRITE:
05911 {
05912 TMR_TagOp_GEN2_IDS_SL900A_AccessFifoWrite *args;
05913 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.accessFifoWrite;
05914
05915 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05916 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05917 rp->u.simple.filter, rp->u.simple.protocol, args->write.AccessPassword, &lenbyte);
05918
05919 TMR_SR_msgAddIdsSL900aAccessFifoWrite(msg, &i, 0, 0, args->write.CommandCode, args->write.Password, args->write.sl900A.level, args->write.operation, args->payLoad, NULL);
05920 break;
05921 }
05922 case TMR_TAGOP_GEN2_IDS_SL900A_GETCALIBRATIONDATA:
05923 {
05924 TMR_TagOp_GEN2_IDS_SL900A_GetCalibrationData *args;
05925 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.calibrationData;
05926
05927 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05928 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05929 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05930
05931 TMR_SR_msgAddIdsSL900aGetCalibrationData(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level, NULL);
05932 break;
05933 }
05934 case TMR_TAGOP_GEN2_IDS_SL900A_SETCALIBRATIONDATA:
05935 {
05936 TMR_TagOp_GEN2_IDS_SL900A_SetCalibrationData *args;
05937 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.setCalibration;
05938
05939 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05940 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05941 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05942
05943 TMR_SR_msgAddIdsSL900aSetCalibrationData(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level, args->cal.raw, NULL);
05944 break;
05945 }
05946 case TMR_TAGOP_GEN2_IDS_SL900A_SETSFEPARAMETERS:
05947 {
05948 TMR_TagOp_GEN2_IDS_SL900A_SetSfeParameters *args;
05949 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.setSfeParameters;
05950
05951 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05952 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05953 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05954
05955 TMR_SR_msgAddIdsSL900aSetSfeParameters(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level, args->sfe->raw, NULL);
05956 break;
05957
05958 }
05959 case TMR_TAGOP_GEN2_IDS_SL900A_GETBATTERYLEVEL:
05960 {
05961 TMR_TagOp_GEN2_IDS_SL900A_GetBatteryLevel *args;
05962 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.batteryLevel;
05963
05964 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05965 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05966 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05967
05968 TMR_SR_msgAddIdsSL900aGetBatteryLevel(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level, args->batteryType, NULL);
05969 break;
05970 }
05971 case TMR_TAGOP_GEN2_IDS_SL900A_SETLOGLIMITS:
05972 {
05973 TMR_TagOp_GEN2_IDS_SL900A_SetLogLimits *args;
05974 args = &rp->u.simple.tagop->u.gen2.u.custom.u.ids.u.setLogLimit;
05975
05976 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05977 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05978 rp->u.simple.filter, rp->u.simple.protocol, args->AccessPassword, &lenbyte);
05979
05980 TMR_SR_msgAddIdsSL900aSetLogLimit(msg, &i, 0, 0, args->CommandCode, args->Password, args->sl900A.level, args->limit.extremeLower,
05981 args->limit.lower, args->limit.upper, args->limit.extremeUpper, NULL);
05982 break;
05983 }
05984 case TMR_TAGOP_GEN2_DENATRAN_IAV_ACTIVATESECUREMODE:
05985 {
05986 TMR_TagOp_GEN2_Denatran_IAV_Activate_Secure_Mode *args;
05987 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.secureMode;
05988
05989 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
05990 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
05991 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
05992
05993 TMR_SR_msgAddIAVDenatranCustomOp(msg, &i, 0, 0, args->mode, args->payload, NULL);
05994 break;
05995 }
05996 case TMR_TAGOP_GEN2_DENATRAN_IAV_AUTHENTICATEOBU:
05997 {
05998 TMR_TagOp_GEN2_Denatran_IAV_Authenticate_OBU *args;
05999 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.authenticateOBU;
06000
06001 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06002 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06003 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06004
06005 TMR_SR_msgAddIAVDenatranCustomOp(msg, &i, 0, 0, args->mode, args->payload, NULL);
06006 break;
06007 }
06008 case TMR_TAGOP_GEN2_ACTIVATE_SINIAV_MODE:
06009 {
06010 TMR_TagOp_GEN2_Denatran_IAV_Activate_Siniav_Mode *args;
06011 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.activateSiniavMode;
06012
06013 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06014 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06015 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06016
06017 TMR_SR_msgAddIAVDenatranCustomActivateSiniavMode(msg, &i, 0, 0, args->mode, args->payload, NULL, args->isTokenDesc, args->token);
06018 break;
06019 }
06020 case TMR_TAGOP_GEN2_OBU_AUTH_ID:
06021 {
06022 TMR_TagOp_GEN2_Denatran_IAV_OBU_Auth_ID *args;
06023 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.obuAuthId;
06024
06025 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06026 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06027 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06028
06029 TMR_SR_msgAddIAVDenatranCustomOp(msg, &i, 0, 0, args->mode, args->payload, NULL);
06030 break;
06031 }
06032 case TMR_TAGOP_GEN2_AUTHENTICATE_OBU_FULL_PASS1:
06033 {
06034 TMR_TagOp_GEN2_Denatran_IAV_OBU_Auth_Full_Pass1 *args;
06035 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.obuAuthFullPass1;
06036
06037 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06038 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06039 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06040
06041 TMR_SR_msgAddIAVDenatranCustomOp(msg, &i, 0, 0, args->mode, args->payload, NULL);
06042 break;
06043 }
06044 case TMR_TAGOP_GEN2_AUTHENTICATE_OBU_FULL_PASS2:
06045 {
06046 TMR_TagOp_GEN2_Denatran_IAV_OBU_Auth_Full_Pass2 *args;
06047 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.obuAuthFullPass2;
06048
06049 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06050 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06051 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06052
06053 TMR_SR_msgAddIAVDenatranCustomOp(msg, &i, 0, 0, args->mode, args->payload, NULL);
06054 break;
06055 }
06056 case TMR_TAGOP_GEN2_OBU_READ_FROM_MEM_MAP:
06057 {
06058 TMR_TagOp_GEN2_Denatran_IAV_OBU_ReadFromMemMap *args;
06059 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.obuReadFromMemMap;
06060
06061 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06062 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06063 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06064
06065 TMR_SR_msgAddIAVDenatranCustomReadFromMemMap(msg, &i, 0, 0, args->mode, args->payload, NULL, args->readPtr);
06066 break;
06067 }
06068 case TMR_TAGOP_GEN2_DENATRAN_IAV_READ_SEC:
06069 {
06070 TMR_TagOp_GEN2_Denatran_IAV_Read_Sec *args;
06071 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.readSec;
06072
06073 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06074 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06075 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06076
06077 TMR_SR_msgAddIAVDenatranCustomReadSec(msg, &i, 0, 0, args->mode, args->payload, NULL, args->readPtr);
06078 break;
06079 }
06080
06081 case TMR_TAGOP_GEN2_OBU_WRITE_TO_MEM_MAP:
06082 {
06083 TMR_TagOp_GEN2_Denatran_IAV_OBU_WriteToMemMap *args;
06084 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.obuWriteToMemMap;
06085
06086 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06087 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06088 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06089
06090 TMR_SR_msgAddIAVDenatranCustomWriteToMemMap(msg, &i, 0, 0, args->mode, args->payload, NULL, args->writePtr, args->wordData, args->tagIdentification, args->dataBuf);
06091 break;
06092 }
06093
06094 case TMR_TAGOP_GEN2_DENATRAN_IAV_WRITE_SEC:
06095 {
06096 TMR_TagOp_GEN2_Denatran_IAV_Write_Sec *args;
06097 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.writeSec;
06098
06099 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06100 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06101 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06102
06103 TMR_SR_msgAddIAVDenatranCustomWriteSec(msg, &i, 0, 0, args->mode, args->payload, NULL, args->dataWords, args->dataBuf);
06104 break;
06105 }
06106
06107 case TMR_TAGOP_GEN2_DENATRAN_IAV_GET_TOKEN_ID:
06108 {
06109 TMR_TagOp_GEN2_Denatran_IAV_Get_Token_Id *args;
06110 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.getTokenId;
06111
06112 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06113 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06114 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06115
06116 TMR_SR_msgAddIAVDenatranCustomGetTokenId(msg, &i, 0, 0, args->mode, NULL);
06117 break;
06118 }
06119 case TMR_TAGOP_GEN2_DENATRAN_IAV_AUTHENTICATE_OBU_FULL_PASS:
06120 {
06121 TMR_TagOp_GEN2_Denatran_IAV_OBU_Auth_Full_Pass *args;
06122 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.obuAuthFullPass;
06123
06124 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06125 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06126 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06127
06128 TMR_SR_msgAddIAVDenatranCustomOp(msg, &i, 0, 0, args->mode, args->payload, NULL);
06129 break;
06130
06131 }
06132 case TMR_TAGOP_GEN2_DENATRAN_IAV_G0_PA_OBU_AUTHENTICATE_ID:
06133 {
06134 TMR_TagOp_GEN2_Denatran_IAV_G0_PA_OBU_Auth_ID *args;
06135 args = &rp->u.simple.tagop->u.gen2.u.custom.u.IavDenatran.u.g0paobuauthid;
06136
06137 prepEmbReadTagMultiple(reader, msg, &i, (uint16_t)readTimeMs, (TMR_SR_SearchFlag)(TMR_SR_SEARCH_FLAG_CONFIGURED_LIST
06138 | TMR_SR_SEARCH_FLAG_EMBEDDED_COMMAND|TMR_SR_SEARCH_FLAG_LARGE_TAG_POPULATION_SUPPORT),
06139 rp->u.simple.filter, rp->u.simple.protocol, sr->gen2AccessPassword, &lenbyte);
06140
06141 TMR_SR_msgAddIAVDenatranCustomOp(msg, &i, 0, 0, args->mode, args->payload, NULL);
06142 break;
06143 }
06144 #endif
06145 case TMR_TAGOP_LIST:
06146 return TMR_ERROR_UNIMPLEMENTED;
06147 default:
06148 return TMR_ERROR_INVALID;
06149 }
06150 *j = i;
06151 *byte = lenbyte;
06152 return ret;
06153
06154 }
06155
06156 void TMR_SR_updateBaseTimeStamp(TMR_Reader *reader)
06157 {
06158
06159 uint32_t starttimeLow, starttimeHigh;
06160
06161 starttimeHigh = 0;
06162 starttimeLow = 0;
06163 tm_gettime_consistent(&starttimeHigh, &starttimeLow);
06164 reader->u.serialReader.readTimeHigh = starttimeHigh;
06165 reader->u.serialReader.readTimeLow = starttimeLow;
06166 reader->u.serialReader.lastSentTagTimestampHigh = starttimeHigh;
06167 reader->u.serialReader.lastSentTagTimestampLow = starttimeLow;
06168 }
06169 #endif