|
M5Unit-RFID 0.2.0 git rev:79c1939
|
Non-instantiable base class for UHF-RFID reader units. More...
#include <unit_UHFRFID.hpp>
Classes | |
| struct | config_t |
| Settings for begin. More... | |
Public Member Functions | |
| virtual bool | begin () override |
| virtual void | update (const bool force=false) override |
Settings for begin | |
| config_t | config () const |
| Gets the configuration. | |
| void | config (const config_t &cfg) |
| Sets the configuration. | |
Polling | |
| bool | startPolling (const uint16_t count) |
| Start continuous polling. | |
| bool | stopPolling () |
| Stop continuous polling. | |
| bool | inPolling () const |
| In continuous polling? | |
| unsigned long | lastFrameAt () const |
| Timestamp (m5::utility::millis()) of the most recently arrived frame. | |
Tag queue (raw; not deduplicated) | |
| size_t | available () const |
| Number of queued tag notifications. | |
| const m5::uhf::Tag & | oldest () const |
| Oldest queued tag. | |
| void | discard () |
| Discard the oldest queued tag. | |
| void | flush () |
| Discard all queued tags. | |
| uint32_t | dropped () const |
| Number of tag notifications dropped due to queue overflow. | |
| void | clearDropped () |
| Clear the dropped counter. | |
Reader settings | |
| virtual bool | readModuleInformation (m5::uhf::ModuleInformation &info)=0 |
| Read the module information. | |
| virtual bool | readTransmitPower (int16_t &dbm100)=0 |
| Read the transmit power in 1/100 dBm. | |
| virtual bool | writeTransmitPower (const int16_t dbm100)=0 |
| Write the transmit power in 1/100 dBm. | |
| virtual bool | readRegion (m5::uhf::Region ®ion)=0 |
| Read the operating region. | |
| virtual bool | writeRegion (const m5::uhf::Region region)=0 |
| Write the operating region. | |
| virtual bool | readChannel (uint8_t &index)=0 |
| Read the operating channel index. | |
| virtual bool | writeChannel (const uint8_t index)=0 |
| Write the operating channel index. | |
| virtual bool | writeAutomaticFrequencyHopping (const bool enable)=0 |
| Enable or disable automatic frequency hopping. | |
| virtual bool | writeContinuousCarrier (const bool enable)=0 |
| Turn the unmodulated carrier on or off. | |
| virtual bool | readQueryParameters (m5::uhf::QueryParameters &qp)=0 |
| Read the query parameters. | |
| virtual bool | writeQueryParameters (const m5::uhf::QueryParameters &qp)=0 |
| Write the query parameters. | |
| virtual bool | writeAutoSleepTime (const uint8_t minutes)=0 |
| Write the inactivity period after which the module sleeps automatically. | |
| virtual bool | writeIdle (const bool enter, const uint8_t minutes=0)=0 |
| Put the module into IDLE, or bring it out. | |
| virtual bool | sleep ()=0 |
| Put the module into low power sleep. | |
| virtual bool | wake ()=0 |
| Wake the module from low power sleep. | |
| virtual bool | writeOperatingChannels (const std::vector< uint8_t > &channels)=0 |
| Replace the channel list used for automatic frequency hopping. | |
| virtual bool | readBlockingSignal (m5::uhf::ChannelLevels &levels)=0 |
| Measure the blocking signal on every channel of the operating region. | |
| virtual bool | readChannelRSSI (m5::uhf::ChannelLevels &levels)=0 |
| Measure the RSSI on every channel of the operating region. | |
| virtual bool | readSelectParameter (m5::uhf::SelectParameter &sp)=0 |
| Read back the select mask the reader holds. | |
Tag operations | |
| virtual bool | writeSelectParameter (const m5::uhf::Bank bank, const uint32_t pointer_bits, const uint8_t *mask, const size_t mask_len)=0 |
| Store the mask that picks out one tag. | |
| virtual bool | writeSelectEnabled (const bool enable)=0 |
| Apply the stored mask to tag operations, or stop applying it. | |
| virtual TagResult | readTagMemory (std::vector< uint8_t > &out, const m5::uhf::Bank bank, const uint16_t word_address, const uint16_t word_count, const uint32_t access_password)=0 |
| Read word_count 16-bit words from bank, starting at word_address. | |
| virtual TagResult | writeTagMemory (const m5::uhf::Bank bank, const uint16_t word_address, const uint8_t *data, const size_t len, const uint32_t access_password)=0 |
| Write len bytes to bank, starting at word_address. | |
| virtual TagResult | lockTagMemory (const uint32_t payload, const uint32_t access_password)=0 |
| Apply a 20-bit Gen2 lock payload. | |
| virtual TagResult | killTag (const uint32_t kill_password)=0 |
| Kill the addressed tag permanently. | |
| virtual TagResult | blockPermalock (std::vector< uint8_t > &out, const m5::uhf::Bank bank, const uint16_t block_pointer, const uint8_t block_range, const uint8_t *mask, const size_t mask_len, const uint32_t access_password, const bool allow_permanent)=0 |
| Read or set which blocks of a bank are permanently locked. | |
| virtual TagResult | qtCommand (uint16_t &control, const bool write, const bool persistent, const uint32_t access_password)=0 |
| Read or write the QT control word of the addressed tag. | |
| virtual TagResult | nxpChangeConfig (uint16_t &config, const uint16_t toggle, const uint32_t access_password)=0 |
| Read the Config-Word of an NXP UCODE G2X, or invert bits of it. | |
| virtual TagResult | nxpChangeEAS (const bool enable, const uint32_t access_password)=0 |
| Set or clear the Product Status Flag of an NXP UCODE G2X. | |
| virtual bool | nxpEASAlarm (std::vector< uint8_t > &alarm)=0 |
| Ask the field whether any tag has its Product Status Flag asserted. | |
| virtual TagResult | nxpReadProtect (const bool protect, const uint32_t access_password)=0 |
| Turn the read protection of an NXP UCODE G2X on or off. | |
| virtual m5::uhf::Reason | classify (const uint8_t error_code) const =0 |
| Say what one of this reader's error codes means in EPC Gen2 terms. | |
Protected Member Functions | |
| UHFRFIDComponent (const uint8_t addr=0x00) | |
| virtual bool | pump (const uint32_t timeout_ms)=0 |
| virtual bool | start_polling_command (const uint16_t count)=0 |
| virtual bool | stop_polling_command ()=0 |
| bool | reject_while_polling (const char *what) const |
| bool | reject_without_selection (const char *what) const |
| void | push_tag (const m5::uhf::Tag &tag) |
| void | note_frame_arrival () |
| void | reissue_polling_if_needed () |
Protected Attributes | |
| config_t | _cfg {} |
| std::unique_ptr< m5::container::CircularBuffer< m5::uhf::Tag > > | _tags {} |
| uint32_t | _dropped {} |
| bool | _polling {} |
| bool | _rounds_running {} |
| bool | _select_mask_stored {} |
| bool | _select_enabled {} |
| uint16_t | _polling_count {} |
| unsigned long | _last_frame_at {} |
| unsigned long | _polling_issued_at {} |
Friends | |
| class | m5::uhf::UHFLayer |
Non-instantiable base class for UHF-RFID reader units.
Owns the UART transport, the frame pump and the raw tag queue. EPC Gen2 semantics live in m5::uhf::UHFLayer.
|
pure virtual |
Read or set which blocks of a bank are permanently locked.
| [out] | out | Mask read, one bit per block with the first block in the most significant bit. Left alone when locking |
| bank | Bank the blocks are in | |
| block_pointer | First block the mask covers, in units of sixteen | |
| block_range | Words of mask, each covering sixteen blocks | |
| mask | Mask to apply, or nullptr to read | |
| mask_len | Its length in bytes, which is twice block_range | |
| access_password | Access password the tag holds, or zero | |
| allow_permanent | Say so to mean a lock, which is refused without it |
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Say what one of this reader's error codes means in EPC Gen2 terms.
| error_code | Code from the error of a TagResult |
Which codes a reader uses is its own affair, so each reader says what its own mean. That keeps the layer above able to act on a failure without knowing the reader
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Kill the addressed tag permanently.
| kill_password | Kill password the tag holds, which may not be zero |
Implemented in m5::unit::UnitJRD4035.
|
inline |
Timestamp (m5::utility::millis()) of the most recently arrived frame.
Updated by note_frame_arrival() for every frame, including a no-tag notification (Inventory Fail). Useful to observe polling liveness from outside even when no tag is present, since available() alone cannot show that frames are still flowing.
|
pure virtual |
Apply a 20-bit Gen2 lock payload.
| payload | Lock payload, see m5::uhf::buildLockPayload |
| access_password | Access password the tag holds, or zero |
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Read the Config-Word of an NXP UCODE G2X, or invert bits of it.
| [out] | config | Word the tag holds once the command has been carried out |
| toggle | Bits to invert. Zero reads the word without changing anything | |
| access_password | Access password the tag holds, or zero |
The word is toggled rather than assigned: a one inverts the bit it stands over and a zero leaves it alone. Sending the same bits twice puts the word back
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Set or clear the Product Status Flag of an NXP UCODE G2X.
| enable | True to assert the flag, false to clear it |
| access_password | Access password the tag holds, or zero |
A tag whose flag is asserted answers nxpEASAlarm(), which is what an article surveillance gate listens for
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Ask the field whether any tag has its Product Status Flag asserted.
| [out] | alarm | Code the tag backscattered, or empty when nothing answered |
This asks the field rather than one tag, so it needs neither a selection nor a password. What answers hands back a code rather than a name: an NXP UCODE G2iM sends a fixed 64-bit one
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Turn the read protection of an NXP UCODE G2X on or off.
| protect | True to protect, false to put it back |
| access_password | Access password the tag holds, or zero |
Protected memory reads back as zeroes rather than falling silent, so the tag still answers an inventory round and can be addressed again to undo this
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Read or write the QT control word of the addressed tag.
| [in,out] | control | Word read, or word to write |
| write | True to write, false to read | |
| persistent | True to write where a loss of power does not undo it | |
| access_password | Access password the tag holds, or zero |
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Measure the blocking signal on every channel of the operating region.
| [out] | levels | Measured level of each channel |
Scans for interference the reader itself does not produce, which is what keeps a tag from being read when the antenna and the power are both fine
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Read the operating channel index.
| [out] | index | Channel index within the operating region |
Whichever channel the reader is on at that moment, which is not the same as a setting: while it hops it moves on its own, and two reads a second apart disagree
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Measure the RSSI on every channel of the operating region.
| [out] | levels | Measured level of each channel |
Reveals other readers operating nearby
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Read the module information.
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Read the query parameters.
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Read the operating region.
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Read back the select mask the reader holds.
| [out] | sp | Select parameter |
No tag replies to a Select, so this is the only way to confirm that the reader is addressing what the caller believes it is
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Read word_count 16-bit words from bank, starting at word_address.
| [out] | out | Bytes read |
| bank | Memory bank | |
| word_address | Start address in 16-bit words | |
| word_count | Number of 16-bit words | |
| access_password | Access password the tag holds, or zero |
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Read the transmit power in 1/100 dBm.
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Put the module into low power sleep.
Implemented in m5::unit::UnitJRD4035.
| bool m5::unit::UHFRFIDComponent::startPolling | ( | const uint16_t | count | ) |
Start continuous polling.
| count | Rounds requested per multiple polling command (0 - 65535) |
| bool m5::unit::UHFRFIDComponent::stopPolling | ( | ) |
Stop continuous polling.
|
pure virtual |
Wake the module from low power sleep.
Sends one byte to wake it and waits for the chip firmware to reload. The byte itself is thrown away by the module, which is why it is sent on its own rather than as the first real command
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Enable or disable automatic frequency hopping.
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Write the inactivity period after which the module sleeps automatically.
| minutes | 1 to 30 minutes, or 0 to disable automatic sleep |
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Write the operating channel index.
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Turn the unmodulated carrier on or off.
| enable | True to transmit a carrier, false to stop |
A carrier with nothing modulated onto it, which is what a spectrum analyser or a power meter needs to measure the transmitter. No tag answers it and nothing else uses it
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Put the module into IDLE, or bring it out.
| enter | True to enter IDLE, false to leave it |
| minutes | How long without work before the module enters IDLE by itself, 0 to 30. Zero means it does not |
IDLE turns off everything but the digital part and the serial port. Unlike sleep() it keeps what the module was holding, the select parameter included, and the module goes on answering commands
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Replace the channel list used for automatic frequency hopping.
| channels | Channel indices of the operating region, in the order to hop through |
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Write the query parameters.
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Write the operating region.
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Apply the stored mask to tag operations, or stop applying it.
| enable | True to address only the selected tag, false to address any tag |
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Store the mask that picks out one tag.
| bank | Bank the mask is matched against; Reserved is not selectable |
| pointer_bits | Where the mask starts, as a bit address inside the bank |
| mask | Mask bytes |
| mask_len | Length of mask in bytes |
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Write len bytes to bank, starting at word_address.
| bank | Memory bank |
| word_address | Start address in 16-bit words |
| data | Bytes to write |
| len | Their length, which has to be even |
| access_password | Access password the tag holds, or zero |
Implemented in m5::unit::UnitJRD4035.
|
pure virtual |
Write the transmit power in 1/100 dBm.
Implemented in m5::unit::UnitJRD4035.