10#ifndef M5_UNIT_RFID_UHF_UHF_HPP
11#define M5_UNIT_RFID_UHF_UHF_HPP
19#include <m5_utility/crc.hpp>
57enum class Session : uint8_t { S0, S1, S2, S3 };
123 return reason < Reason::NoAnswer;
130 case Reason::NoSelection:
131 return "no tag selected";
132 case Reason::BadArgument:
133 return "the request cannot succeed as asked";
135 return "the reader could not make room to send it";
136 case Reason::Unsupported:
137 return "this chip does not have the command";
139 return "the memory is locked";
140 case Reason::InsufficientPower:
141 return "the tag has not the power";
142 case Reason::MemoryOverrun:
143 return "past the end of the memory";
144 case Reason::Refused:
145 return "the tag declined";
146 case Reason::NoAnswer:
147 return "nobody answered";
148 case Reason::AccessFailed:
149 return "the tag would not be accessed; the password may be wrong";
150 case Reason::ReaderFault:
151 return "the reader did not carry it out";
153 return "the answer could not be read";
174 std::array<uint8_t, EPC_MAX_BYTES>
data{};
187 inline const uint8_t* begin()
const
191 inline const uint8_t* end()
const
201 bool assign(
const uint8_t* src,
const size_t len);
202 bool operator==(
const Epc& o)
const;
214 std::array<uint8_t, TID_MAX_BYTES>
data{};
227 inline const uint8_t* begin()
const
231 inline const uint8_t* end()
const
241 bool assign(
const uint8_t* src,
const size_t len);
242 bool operator==(
const Tid& o)
const;
261 TexasInstruments = 0x002,
265 STMicroelectronics = 0x007,
266 EPMicroelectronics = 0x008,
267 EMMicroelectronic = 0x00B,
273 FudanMicroelectronics = 0x027,
275 HuadaSemiconductor = 0x032,
281inline uint16_t
word_at(
const uint8_t* data,
const size_t word_index)
283 return static_cast<uint16_t
>((data[word_index * 2] << 8) | data[word_index * 2 + 1]);
305 {Vendor::Impinj,
"Impinj"},
306 {Vendor::TexasInstruments,
"Texas Instruments"},
307 {Vendor::Alien,
"Alien Technology"},
308 {Vendor::Atmel,
"Atmel"},
309 {Vendor::NXP,
"NXP Semiconductors"},
310 {Vendor::STMicroelectronics,
"ST Microelectronics"},
311 {Vendor::EPMicroelectronics,
"EP Microelectronics"},
312 {Vendor::EMMicroelectronic,
"EM Microelectronic"},
313 {Vendor::Quanray,
"Quanray Electronics"},
314 {Vendor::Fujitsu,
"Fujitsu"},
315 {Vendor::Nationz,
"Nationz"},
316 {Vendor::Invengo,
"Invengo"},
317 {Vendor::RFMicron,
"RFMicron"},
318 {Vendor::FudanMicroelectronics,
"Shanghai Fudan Microelectronics Group"},
319 {Vendor::AMS,
"ams AG"},
320 {Vendor::HuadaSemiconductor,
"Huada Semiconductor"},
321 {Vendor::Mikron,
"PJSC Mikron"},
323 count =
sizeof(entries) /
sizeof(entries[0]);
415 case Chip::AlienHiggs9:
420 case Chip::AlienHiggs4:
425 case Chip::Em4423SmallEpc:
427 case Chip::Em4423LargeEpc:
430 case Chip::ImpinjMonza4D:
432 case Chip::ImpinjMonza4E:
434 case Chip::ImpinjMonza4i:
436 case Chip::ImpinjMonza4QT:
439 case Chip::ImpinjM750:
441 case Chip::ImpinjM770:
443 case Chip::ImpinjM780:
445 case Chip::ImpinjM781:
447 case Chip::NxpUcode8m:
450 case Chip::NxpUcode7xm1k:
452 case Chip::NxpUcode7xm2k:
453 case Chip::NxpUcode7xmPlus:
455 case Chip::NxpUcodeG2iM:
460 case Chip::NxpUcodeG2iMPlus:
479 case Chip::AlienHiggs9:
481 case Chip::AlienHiggs4:
484 case Chip::Em4423SmallEpc:
486 case Chip::Em4423LargeEpc:
489 case Chip::ImpinjMonza4D:
491 case Chip::ImpinjMonza4E:
493 case Chip::ImpinjMonza4i:
495 case Chip::ImpinjMonza4QT:
498 case Chip::ImpinjM730:
500 case Chip::ImpinjM750:
502 case Chip::ImpinjM770:
504 case Chip::ImpinjM780:
506 case Chip::ImpinjM781:
508 case Chip::NxpUcode7:
510 case Chip::NxpUcode8m:
512 case Chip::NxpUcode7xm1k:
513 case Chip::NxpUcode7xm2k:
514 case Chip::NxpUcode7xmPlus:
516 case Chip::NxpUcode8:
520 case Chip::NxpUcode9:
522 case Chip::NxpUcode9xe:
524 case Chip::NxpUcodeG2iM:
526 case Chip::NxpUcodeG2iMPlus:
544 case Chip::AlienHiggs3:
549 case Chip::NxpUcodeG2iM:
550 case Chip::NxpUcodeG2iMPlus:
570 case Chip::ImpinjMonza4QT:
572 case Chip::ImpinjMonza4i:
574 case Chip::AlienHiggs3:
580 case Chip::Em4423SmallEpc:
582 case Chip::Em4423LargeEpc:
626 case Chip::NxpUcodeG2iM:
627 case Chip::NxpUcodeG2iMPlus:
630 case Chip::ImpinjMonza4QT:
633 case Chip::ImpinjMonza4i:
637 case Chip::NxpUcode7xm1k:
638 case Chip::NxpUcode7xm2k:
639 case Chip::NxpUcode7xmPlus:
641 case Chip::AlienHiggs3:
643 case Chip::Em4423SmallEpc:
644 case Chip::Em4423LargeEpc:
647 case Chip::NxpUcode8:
648 case Chip::NxpUcode8m:
649 case Chip::NxpUcode9:
650 case Chip::NxpUcode9xe:
654 return Support::Unknown;
666 case Chip::ImpinjMonza4QT:
669 case Chip::Em4423SmallEpc:
670 case Chip::Em4423LargeEpc:
674 return Support::Unknown;
688 case Chip::NxpUcodeG2iM:
689 case Chip::NxpUcodeG2iMPlus:
693 case Chip::NxpUcode8:
694 case Chip::NxpUcode8m:
697 case Chip::Em4423SmallEpc:
698 case Chip::Em4423LargeEpc:
703 return Support::Unknown;
721 case Chip::ImpinjMonza4QT:
724 case Chip::NxpUcode7xm1k:
725 case Chip::NxpUcode7xm2k:
726 case Chip::NxpUcode7xmPlus:
730 case Chip::ImpinjMonza4i:
734 case Chip::AlienHiggs3:
736 case Chip::Em4423SmallEpc:
737 case Chip::Em4423LargeEpc:
758 if (bits == 0 || count == 0) {
762 const uint32_t upto = bits * count;
765 if (user == 0 || user >= upto) {
768 return user - bits * (count - 1);
781 case Chip::NxpUcode8:
785 case Chip::NxpUcode9:
787 case Chip::NxpUcode9xe:
789 case Chip::NxpUcode7:
791 case Chip::ImpinjM730:
813 constexpr uint16_t HIGGS9_POOL_WORDS{49};
816 constexpr uint16_t G2IM_PLUS_POOL_WORDS{48};
820 case Chip::AlienHiggs9:
821 pool = HIGGS9_POOL_WORDS;
823 case Chip::NxpUcodeG2iMPlus:
824 pool = G2IM_PLUS_POOL_WORDS;
834 const uint16_t epc_words =
static_cast<uint16_t
>((pc >> 11) & 0x1F);
835 return epc_words < pool ? static_cast<uint32_t>(pool - epc_words) * 16U : 0U;
852 return tid !=
nullptr && len >= 2 && (tid[1] & 0x80) != 0;
864 const uint8_t v =
static_cast<uint8_t
>((xtid_header >> 13) & 0x07);
865 return v == 0 ? 0U :
static_cast<uint16_t
>(48 + (v - 1) * 16);
938 if (tid[i] != 0x00) {
954 for (
size_t i = 0; i < count; ++i) {
955 if (
static_cast<uint16_t
>(entries[i].vendor) == mdid) {
959 return Vendor::Unknown;
974 switch (model_number) {
977 return Chip::ImpinjMonza4D;
979 return Chip::ImpinjMonza4QT;
981 return Chip::ImpinjMonza4E;
983 return Chip::ImpinjMonza4i;
986 return Chip::ImpinjM750;
988 return Chip::ImpinjM730;
990 return Chip::ImpinjM770;
993 return Chip::ImpinjM780;
995 return Chip::ImpinjM781;
997 return Chip::Unknown;
1000 switch (model_number) {
1002 return Chip::AlienHiggs3;
1006 return Chip::AlienHiggs4;
1011 return Chip::AlienHiggs9;
1013 return Chip::Unknown;
1015 case Vendor::EMMicroelectronic:
1016 switch (model_number) {
1021 return Chip::Em4423SmallEpc;
1023 return Chip::Em4423LargeEpc;
1025 return Chip::Unknown;
1028 switch (model_number) {
1030 return Chip::NxpUcodeG2iM;
1032 return Chip::NxpUcodeG2iMPlus;
1034 return Chip::NxpUcode7;
1037 return Chip::NxpUcode7xm1k;
1039 return Chip::NxpUcode7xm2k;
1041 return Chip::NxpUcode7xmPlus;
1043 return Chip::NxpUcode8;
1045 return Chip::NxpUcode8m;
1051 return Chip::NxpUcode9xe;
1057 return Chip::NxpUcode9;
1059 return Chip::Unknown;
1062 return Chip::Unknown;
1101 return Chip::Unknown;
1103 const uint16_t mdid =
static_cast<uint16_t
>(((tid[1] & 0x1F) << 4) | (tid[2] >> 4));
1104 const uint16_t model =
static_cast<uint16_t
>(((tid[2] & 0x0F) << 8) | tid[3]);
1140 const size_t held = len / 2;
1142 plan.word_address =
static_cast<uint16_t
>(held);
1143 plan.words =
static_cast<uint16_t
>(total - held);
1158 const size_t have = len / 2;
1160 plan.word_address =
static_cast<uint16_t
>(have);
1161 plan.words =
static_cast<uint16_t
>(total - have);
1181 tag.
has_xtid = (tid[1] & 0x80) != 0;
1184 tag.
mdid =
static_cast<uint16_t
>(((tid[1] & 0x1F) << 4) | (tid[2] >> 4));
1186 tag.
model_number =
static_cast<uint16_t
>(((tid[2] & 0x0F) << 8) | tid[3]);
1199 const uint16_t header = detail::word_at(tid, 2);
1207 if ((word + 1) * 2 <= len) {
1208 const uint16_t ocs = detail::word_at(tid, word);
1210 tag.
epc_max_bits =
static_cast<uint32_t
>(ocs & 0x1F) * 16U;
1219 if ((word + 2) * 2 <= len) {
1223 tag.
user_memory_bits =
static_cast<uint32_t
>(detail::word_at(tid, word + 1)) * 16U;
1270 return action == LockAction::PermanentOpen || action == LockAction::PermanentLock;
1286 for (
size_t i = 0; i < count; ++i) {
1287 const uint8_t slot =
static_cast<uint8_t
>(settings[i].target);
1288 const uint8_t action =
static_cast<uint8_t
>(settings[i].action);
1289 const uint8_t mask =
static_cast<uint8_t
>(0x02 | (action & 0x01));
1290 const uint8_t mask_shift =
static_cast<uint8_t
>(18 - slot * 2);
1291 const uint8_t action_shift =
static_cast<uint8_t
>(8 - slot * 2);
1292 payload |=
static_cast<uint32_t
>(mask) << mask_shift;
1293 payload |=
static_cast<uint32_t
>(action) << action_shift;
1359 bool invert_output{};
1360 bool transparent_mode{};
1361 bool raw_data_mode{};
1431 std::array<uint8_t, SELECT_MASK_MAX_BYTES>
mask{};
1443 std::string hardware_version{};
1444 std::string software_version{};
1445 std::string manufacturer{};
1461inline std::string
to_hex(
const uint8_t* data,
const size_t len)
1463 static const char digits[] =
"0123456789ABCDEF";
1466 for (
size_t i = 0; i < len; ++i) {
1467 s += digits[(data[i] >> 4) & 0x0F];
1468 s += digits[data[i] & 0x0F];
1480 for (
size_t i = 0; i < len; ++i) {
1483 size =
static_cast<uint8_t
>(len);
1487inline bool Epc::operator==(
const Epc& o)
const
1492 for (
size_t i = 0; i <
size; ++i) {
1502 return detail::to_hex(
data.data(),
size);
1511 for (
size_t i = 0; i < len; ++i) {
1514 size =
static_cast<uint8_t
>(len);
1518inline bool Tid::operator==(
const Tid& o)
const
1523 for (
size_t i = 0; i <
size; ++i) {
1538 return detail::to_hex(
data.data(),
size);
1545 for (
size_t i = 0; i < count; ++i) {
1547 return entries[i].
name;
1564 return Support::Yes;
1578 if (tag.
vendor != Vendor::Unknown && tag.
vendor != Vendor::Impinj) {
1594 if (tag.
vendor != Vendor::Unknown && tag.
vendor != Vendor::NXP) {
1603 case Chip::AlienHiggs3:
1604 return "Alien Higgs-3";
1605 case Chip::AlienHiggs9:
1606 return "Alien Higgs-9";
1607 case Chip::AlienHiggs4:
1608 return "Alien Higgs-4";
1609 case Chip::Em4423SmallEpc:
1610 return "EM Microelectronic EM4423 (small EPC)";
1611 case Chip::Em4423LargeEpc:
1612 return "EM Microelectronic EM4423 (large EPC)";
1613 case Chip::ImpinjMonza4D:
1614 return "Impinj Monza 4D";
1615 case Chip::ImpinjMonza4E:
1616 return "Impinj Monza 4E";
1617 case Chip::ImpinjMonza4i:
1618 return "Impinj Monza 4i";
1619 case Chip::ImpinjMonza4QT:
1620 return "Impinj Monza 4QT";
1621 case Chip::ImpinjM730:
1622 return "Impinj M730";
1623 case Chip::ImpinjM750:
1624 return "Impinj M750";
1625 case Chip::ImpinjM770:
1626 return "Impinj M770";
1627 case Chip::ImpinjM780:
1628 return "Impinj M780";
1629 case Chip::ImpinjM781:
1630 return "Impinj M781";
1631 case Chip::NxpUcodeG2iM:
1632 return "NXP UCODE G2iM";
1633 case Chip::NxpUcodeG2iMPlus:
1634 return "NXP UCODE G2iM+";
1635 case Chip::NxpUcode7:
1636 return "NXP UCODE 7";
1637 case Chip::NxpUcode8:
1638 return "NXP UCODE 8";
1639 case Chip::NxpUcode7xm1k:
1640 return "NXP UCODE 7xm-1k";
1641 case Chip::NxpUcode7xm2k:
1642 return "NXP UCODE 7xm-2k";
1643 case Chip::NxpUcode7xmPlus:
1644 return "NXP UCODE 7xm+";
1645 case Chip::NxpUcode8m:
1646 return "NXP UCODE 8m";
1647 case Chip::NxpUcode9:
1648 return "NXP UCODE 9";
1649 case Chip::NxpUcode9xe:
1650 return "NXP UCODE 9xe";
1672 return crc.range(data, len);
1688 buf[0] =
static_cast<uint8_t
>(tag.
pc >> 8);
1689 buf[1] =
static_cast<uint8_t
>(tag.
pc & 0xFF);
1690 for (
size_t i = 0; i < tag.
epc.
size; ++i) {
1691 buf[2 + i] = tag.
epc[i];
1707 return static_cast<uint8_t
>((pc >> 11) & 0x1F);
1722 return (pc & 0x0400) != 0;
1732 return (pc & 0x0200) != 0;
1746 return (pc & 0x0100) != 0;
1760 return static_cast<uint16_t
>(pc & 0x01FF);
1775 for (
size_t i = 0; i < dst.size(); ++i) {
1776 if (dst[i].epc == tag.
epc) {
Top level namespace of M5Stack.
UHF-RFID (EPC Gen2) related namespace.
Signal level measured on each channel of the operating region.
Definition uhf.hpp:1454
std::vector< int8_t > dbm
Measured level of each channel in dBm (signed)
Definition uhf.hpp:1456
uint8_t first_channel
Index of the first measured channel.
Definition uhf.hpp:1455
EPC of a tag.
Definition uhf.hpp:173
bool assign(const uint8_t *src, const size_t len)
Copy in from a raw buffer, refusing anything longer than EPC_MAX_BYTES.
Definition uhf.hpp:1474
uint8_t operator[](const size_t i) const
Byte at the given index.
Definition uhf.hpp:178
std::string toString() const
Uppercase hex.
Definition uhf.hpp:1500
std::array< uint8_t, EPC_MAX_BYTES > data
Bytes, only the first size are valid.
Definition uhf.hpp:174
uint8_t size
Number of valid bytes.
Definition uhf.hpp:175
uint8_t & operator[](const size_t i)
Byte at the given index.
Definition uhf.hpp:183
bool empty() const
Holds no EPC?
Definition uhf.hpp:196
One entry of a lock operation. Targets left out keep their current lock state.
Definition uhf.hpp:1255
Config-Word of an NXP UCODE G2iM or G2iM+, spelled out.
Definition uhf.hpp:1351
bool external_supply
A supply is present on the chip's input.
Definition uhf.hpp:1355
bool tamper_alarm
The tamper loop has been broken.
Definition uhf.hpp:1354
bool max_backscatter
Answer as loudly as the chip can. Set from the factory.
Definition uhf.hpp:1367
bool digital_output
Reduce the range when the condition holds.
Definition uhf.hpp:1368
bool protect_epc
EPC reads back as zeroes.
Definition uhf.hpp:1371
bool conditional_range
Reduce the range when the condition holds.
Definition uhf.hpp:1365
bool protect_tid
TID reads back as zeroes.
Definition uhf.hpp:1372
bool conditional_short
Which state of the condition is the one that reduces it.
Definition uhf.hpp:1366
bool protect_user
User memory reads back as zeroes.
Definition uhf.hpp:1370
bool range_reduction
G2iM+ only.
Definition uhf.hpp:1369
bool psf_alarm
Product Status Flag. A tag holding this answers EAS_Alarm.
Definition uhf.hpp:1373
QT control word of an Impinj Monza 4QT.
Definition uhf.hpp:1410
bool public_memory
The tag shows its public memory map rather than its private one.
Definition uhf.hpp:1414
bool short_range
The tag answers at a reduced range once it is open or about to be.
Definition uhf.hpp:1412
EPC Gen2 query parameters.
Definition uhf.hpp:1302
Session session
Session whose inventoried flag qualifies the round.
Definition uhf.hpp:1304
Target target
Inventoried flag value that is invited to answer.
Definition uhf.hpp:1305
uint8_t q
Q value: a tag answers in one of 2^Q slots.
Definition uhf.hpp:1303
SelectFilter filter
Which tags the round invites, in terms of SL.
Definition uhf.hpp:1311
The mask the reader holds, and how it is matched.
Definition uhf.hpp:1424
Bank bank
Bank the mask is matched against.
Definition uhf.hpp:1427
bool truncate
Whether a matching tag replies with only the bits past the mask.
Definition uhf.hpp:1430
uint8_t mask_length_bits
Length of the mask in bits.
Definition uhf.hpp:1429
uint8_t target
Target: which flag the action acts on, 100 being SL.
Definition uhf.hpp:1425
uint8_t mask_size
Bytes of mask in use.
Definition uhf.hpp:1432
std::string maskAsString() const
Mask as uppercase hex.
Definition uhf.hpp:1531
uint32_t pointer_bits
Where the mask starts, as a bit address inside the bank.
Definition uhf.hpp:1428
std::array< uint8_t, SELECT_MASK_MAX_BYTES > mask
Mask bytes.
Definition uhf.hpp:1431
uint8_t action
Action: what matching and non-matching tags are set to.
Definition uhf.hpp:1426
A tag, as the EPC Gen2 standard calls it.
Definition uhf.hpp:366
bool supports_security
Security indicator (TID bit 09h)
Definition uhf.hpp:386
Epc epc
EPC.
Definition uhf.hpp:371
Chip chip
Identified chip, Unknown when the pair below is not listed.
Definition uhf.hpp:375
uint16_t crc
CRC-16 reported by the tag.
Definition uhf.hpp:369
std::string vendorAsString() const
Mask designer as a printable name, "Unknown" when the identifier is not one we list.
Definition uhf.hpp:1541
uint32_t permalock_block_bits
BlockPermalock granularity, 0 when unknown.
Definition uhf.hpp:384
int8_t rssi
RSSI in dBm (signed)
Definition uhf.hpp:370
bool has_xtid
XTID indicator (TID bit 08h)
Definition uhf.hpp:385
bool supports_file
Definition uhf.hpp:387
uint32_t user_memory_bits
Size of the User bank, 0 when unknown. On a chip that shares a pool with the EPC this is what the ban...
Definition uhf.hpp:382
bool supports_block_permalock
BlockPermaLock support, as the XTID reports it.
Definition uhf.hpp:392
uint16_t mdid
Raw mask-designer identifier (9 bits)
Definition uhf.hpp:377
uint16_t model_number
Tag model number (12 bits)
Definition uhf.hpp:378
Tid tid
TID starting at word 0.
Definition uhf.hpp:374
std::string chipAsString() const
Chip name, "Unknown" until the tag has been identified.
Definition uhf.hpp:1600
bool valid() const
Holds a usable EPC?
Definition uhf.hpp:395
uint16_t serial_bits
Definition uhf.hpp:379
uint16_t pc
Protocol Control.
Definition uhf.hpp:368
Vendor vendor
Named mask designer, Unknown when mdid is not listed.
Definition uhf.hpp:376
uint32_t epc_max_bits
Largest EPC the chip accepts, 0 when unknown.
Definition uhf.hpp:383
TID of a tag.
Definition uhf.hpp:213
bool empty() const
Holds no TID?
Definition uhf.hpp:236
uint8_t & operator[](const size_t i)
Byte at the given index.
Definition uhf.hpp:223
uint8_t operator[](const size_t i) const
Byte at the given index.
Definition uhf.hpp:218
uint8_t size
Number of valid bytes.
Definition uhf.hpp:215
bool assign(const uint8_t *src, const size_t len)
Copy in from a raw buffer, refusing anything longer than TID_MAX_BYTES.
Definition uhf.hpp:1505
std::array< uint8_t, TID_MAX_BYTES > data
Bytes, only the first size are valid.
Definition uhf.hpp:214
std::string toString() const
Uppercase hex.
Definition uhf.hpp:1536
What to read next of a tag's TID, given what has been read of it so far.
Definition uhf.hpp:1112
uint16_t words
Words to read, zero once nothing is left to read.
Definition uhf.hpp:1114
uint16_t word_address
Word address the next read starts at.
Definition uhf.hpp:1113
bool fits
False when the header describes more than a Tid can hold.
Definition uhf.hpp:1115
A named mask designer paired with the name the registry spells it out as.
Definition uhf.hpp:290
const char * name
Name as the GS1 registry gives it.
Definition uhf.hpp:292
Vendor vendor
Enumerator.
Definition uhf.hpp:291
constexpr uint16_t NXP_CONFIG_CONDITIONAL_SHORT
Which way the condition is read.
Definition uhf.hpp:1332
size_t xtidTotalWords(const uint16_t xtid_header)
Length of the whole TID an XTID header describes, in 16-bit words.
Definition uhf.hpp:893
uint32_t chipSharedUserMemoryBits(const Chip chip, const uint16_t pc)
User memory of a chip that carves it out of one pool with the EPC, in bits.
Definition uhf.hpp:809
uint32_t chipEpcMaxBits(const Chip chip)
Largest EPC a chip is known to accept, in bits.
Definition uhf.hpp:476
bool append_unique(std::vector< Tag > &dst, const Tag &tag)
Append a tag unless an identical EPC is already present.
Definition uhf.hpp:1770
constexpr uint16_t NXP_CONFIG_RAW_DATA_MODE
Cleared when the tag loses power.
Definition uhf.hpp:1330
bool tidHasXtid(const uint8_t *tid, const size_t len)
Does a TID say it carries an extended TID, and with it a serial number?
Definition uhf.hpp:850
constexpr uint16_t GEN2_CRC16_POLYNOMIAL
Polynomial of the EPC Gen2 CRC-16 (x^16 + x^12 + x^5 + 1)
Definition uhf.hpp:1659
constexpr uint16_t NXP_CONFIG_DIGITAL_OUTPUT
Drives the chip's output pad.
Definition uhf.hpp:1334
uint32_t buildLockPayload(const LockSetting *settings, const size_t count)
Build the 20-bit payload of the Gen2 Lock command.
Definition uhf.hpp:1283
bool isPermanent(const LockAction action)
Is this action one of the two that cannot be undone?
Definition uhf.hpp:1268
TidReadPlan tidReadPlan(const uint8_t *tid, const size_t len)
Say what to read next of a TID.
Definition uhf.hpp:1129
constexpr uint16_t NXP_CONFIG_EXTERNAL_SUPPLY
Read only. External supply present.
Definition uhf.hpp:1327
NxpConfigWord decodeNxpConfigWord(const uint16_t word)
Spell out the Config-Word of an NXP UCODE G2iM or G2iM+.
Definition uhf.hpp:1383
const char * reasonAsString(const Reason reason)
Spell out a Reason.
Definition uhf.hpp:127
Support tagQTSupport(const Tag &tag)
What can be said about this tag having the Impinj QT command.
Definition uhf.hpp:1576
Vendor resolveVendor(const uint16_t mdid)
Resolve a named mask designer from its identifier.
Definition uhf.hpp:950
constexpr size_t XTID_FIXED_WORDS
Words the two fixed TID words and the XTID header take up.
Definition uhf.hpp:884
constexpr uint16_t NXP_CONFIG_PROTECT_TID
TID reads back as zeroes.
Definition uhf.hpp:1338
void fillSizesFromChip(Tag &tag)
Fill in what the tag left unsaid from what its chip is known to hold.
Definition uhf.hpp:1073
constexpr size_t SELECT_MASK_MAX_BYTES
Longest select mask the module accepts, the length field being 8 bits wide.
Definition uhf.hpp:1315
Chip chipFromTid(const uint8_t *tid, const size_t len)
Name the chip from the two fixed words of a TID.
Definition uhf.hpp:1098
constexpr uint16_t XTID_USER_MEMORY_BLOCKPERMALOCK
bit 10, two words
Definition uhf.hpp:876
constexpr uint16_t XTID_EXTENDED_HEADER
bit 0, header continues
Definition uhf.hpp:878
uint32_t chipPermalockBlockBits(const Chip chip)
Size of the block BlockPermalock works in, in bits.
Definition uhf.hpp:718
uint16_t chipTidWords(const Chip chip)
Words of TID a chip carries without an XTID header to say so.
Definition uhf.hpp:541
uint8_t pcEPCLengthWords(const uint16_t pc)
EPC length in 16-bit words encoded in the PC.
Definition uhf.hpp:1705
uint16_t xtidSerialBits(const uint16_t xtid_header)
Serial length an XTID header announces.
Definition uhf.hpp:862
Session
EPC Gen2 session.
Definition uhf.hpp:57
SelectFilter
Which tags an inventory round invites, in terms of the SL flag.
Definition uhf.hpp:73
@ NotSelected
Only tags whose SL flag is deasserted.
@ Selected
Only tags whose SL flag is asserted.
@ All
Every tag answers, whatever its SL flag says.
@ AllAlias
Same as All; the standard leaves this encoding equivalent.
uint16_t pcNumberingSystemIdentifier(const uint16_t pc)
Numbering System Identifier of the PC.
Definition uhf.hpp:1758
std::string to_hex(const uint8_t *data, const size_t len)
Render a byte buffer as uppercase hex.
Definition uhf.hpp:1461
Support
What can be said about a chip having a command.
Definition uhf.hpp:596
constexpr uint16_t XTID_LOCK_BIT
bit 9, one word
Definition uhf.hpp:877
uint16_t gen2_crc16(const uint8_t *data, const size_t len)
Calculate the EPC Gen2 CRC-16.
Definition uhf.hpp:1669
constexpr size_t TID_CHIP_WORDS
Words at the front of a TID that name the chip rather than the individual tag.
Definition uhf.hpp:914
Target
EPC Gen2 inventoried flag target.
Definition uhf.hpp:63
constexpr size_t TID_MAX_BYTES
How much of the TID identify() keeps.
Definition uhf.hpp:165
constexpr uint16_t NXP_CONFIG_INVERT_OUTPUT
Cleared when the tag loses power.
Definition uhf.hpp:1328
constexpr uint8_t TID_CLASS_EPCGLOBAL
ISO/IEC 15963 allocation class identifier used by EPCglobal tags.
Definition uhf.hpp:839
bool chipHasNoUserMemory(const Chip chip)
Is this a chip whose datasheet says it has no User bank at all?
Definition uhf.hpp:778
const VendorEntry * vendorEntries(size_t &count)
The mask designers this library names.
Definition uhf.hpp:302
LockAction
What a lock setting does.
Definition uhf.hpp:1244
@ PermanentLock
Not writeable from any state. Cannot be undone.
@ Lock
Writeable from the secured state only.
@ Open
Writeable from either the open or the secured state.
@ PermanentOpen
Permanently writeable and can never be locked. Cannot be undone.
constexpr uint16_t NXP_CONFIG_TRANSPARENT_MODE
Cleared when the tag loses power.
Definition uhf.hpp:1329
Support tagBlockPermalockSupport(const Tag &tag)
What can be said about this tag having BlockPermalock.
Definition uhf.hpp:1561
Support chipNxpCustomCommandSupport(const Chip chip)
What the chip's datasheet says about it having the commands NXP added of its own.
Definition uhf.hpp:685
constexpr uint16_t GEN2_CRC16_INIT
Initial value of the EPC Gen2 CRC-16.
Definition uhf.hpp:1657
bool pcXPCIndicator(const uint16_t pc)
XPC indicator of the PC.
Definition uhf.hpp:1730
Support tagNxpCustomCommandSupport(const Tag &tag)
What can be said about this tag having the commands NXP added of its own.
Definition uhf.hpp:1592
bool decodeTid(Tag &tag, const uint8_t *tid, const size_t len)
Decode the fixed part of a TID into a tag.
Definition uhf.hpp:1176
Support chipBlockPermalockSupport(const Chip chip)
What the chip's datasheet says about it having BlockPermalock.
Definition uhf.hpp:623
bool pcToggle(const uint16_t pc)
Toggle bit of the PC.
Definition uhf.hpp:1744
constexpr uint16_t XTID_OPTIONAL_COMMAND_SUPPORT
bit 12, one word
Definition uhf.hpp:874
Chip
Chip a tag is built around, resolved from the mask-designer identifier and model number.
Definition uhf.hpp:332
constexpr size_t TID_FIXED_WORDS
Words every TID starts with, which say what the chip is and whether an XTID follows.
Definition uhf.hpp:882
Chip resolveChip(const Vendor vendor, const uint16_t model_number)
Resolve a chip from its mask designer and model number.
Definition uhf.hpp:970
bool pcUserMemoryIndicator(const uint16_t pc)
User Memory Indicator of the PC.
Definition uhf.hpp:1720
bool tagUnchanged(const Reason reason)
Is the tag known to be as it was before the operation?
Definition uhf.hpp:121
constexpr size_t EPC_MAX_BYTES
Longest EPC the standard allows: the PC length field is 5 bits, so 31 words.
Definition uhf.hpp:158
Support chipQTSupport(const Chip chip)
What the chip's datasheet says about it having the Impinj QT command.
Definition uhf.hpp:663
Reason
Why an operation meant to change a tag did not change it.
Definition uhf.hpp:90
@ ReaderFault
The reader answered, and said it had not done it.
@ Malformed
The answer could not be read.
@ MemoryOverrun
The address or length reaches past what the tag holds.
@ NoSelection
No tag had been selected.
@ AccessFailed
The reader could not get the tag into the state the command needs.
@ InsufficientPower
The tag has not the power to carry it out.
@ Unsupported
This chip is said not to have the command at all.
@ Locked
The memory is locked against this.
@ Busy
The reader could not make room to send it.
@ NoAnswer
Nobody answered. Whether the tag acted on it cannot be told from here.
@ Refused
Declined without saying which of these it was.
@ BadArgument
The request cannot succeed as it was asked.
constexpr uint16_t NXP_CONFIG_TAMPER_ALARM
Read only. Tag Tamper Alarm.
Definition uhf.hpp:1326
bool tidTellsTagsApart(const uint8_t *tid, const size_t len)
Can a mask built from this TID tell one tag of the chip from another?
Definition uhf.hpp:932
bool verify_tag_crc(const Tag &tag)
Verify the CRC-16 reported with a detected tag.
Definition uhf.hpp:1681
uint32_t chipPermalockLastBlockBits(const Chip chip)
How many bits the last block of a chip actually covers.
Definition uhf.hpp:754
constexpr uint16_t NXP_CONFIG_PSF_ALARM
Product Status Flag, read by EAS.
Definition uhf.hpp:1339
constexpr uint16_t NXP_CONFIG_MAX_BACKSCATTER
Set as the chip leaves the factory.
Definition uhf.hpp:1333
constexpr uint16_t NXP_CONFIG_PROTECT_EPC
EPC reads back as zeroes.
Definition uhf.hpp:1337
uint32_t chipUserMemoryBits(const Chip chip)
User memory a chip is known to hold, in bits.
Definition uhf.hpp:412
Vendor
Mask designers this library knows by name.
Definition uhf.hpp:258
constexpr uint16_t NXP_CONFIG_PROTECT_USER
User memory reads back as zeroes.
Definition uhf.hpp:1336
constexpr uint16_t XTID_BLOCKWRITE_BLOCKERASE
bit 11, four words
Definition uhf.hpp:875
Bank
EPC Gen2 memory bank.
Definition uhf.hpp:32
@ Reserved
Kill password and access password.
constexpr uint16_t NXP_CONFIG_RANGE_REDUCTION
Range reduction, G2iM+ only.
Definition uhf.hpp:1335
constexpr uint16_t GEN2_CRC16_XOROUT
Final xor value of the EPC Gen2 CRC-16.
Definition uhf.hpp:1661
Region
Operating region.
Definition uhf.hpp:44
@ Unspecified
Keep the module's factory setting.
const char * supportAsString(const Support support)
Spell out a Support.
Definition uhf.hpp:603
constexpr uint16_t NXP_CONFIG_CONDITIONAL_RANGE
Conditional read range reduction.
Definition uhf.hpp:1331
uint16_t chipPermalockBlockCount(const Chip chip)
How many blocks a chip divides its user memory into for BlockPermalock.
Definition uhf.hpp:567
LockTarget
What a lock setting applies to, in the order EPC Gen2 lays them out.
Definition uhf.hpp:1235
uint16_t word_at(const uint8_t *data, const size_t word_index)
Read one big-endian 16-bit word out of a byte buffer.
Definition uhf.hpp:281