|
M5Unit-RFID 0.2.0 git rev:79c1939
|
UHF-RFID unit based on the JRD-4035 module (magicRF M100) More...
#include <unit_JRD4035.hpp>
Classes | |
| struct | config_t |
| Settings for begin. More... | |
Public Member Functions | |
| virtual bool | begin () override |
| virtual bool | sleep () override |
| Put the module into low power sleep. | |
| virtual bool | writeSelectParameter (const m5::uhf::Bank bank, const uint32_t pointer_bits, const uint8_t *mask, const size_t mask_len) override |
| Store the mask that picks out one tag. | |
| virtual bool | writeSelectEnabled (const bool enable) override |
| 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) override |
| 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) override |
| Write len bytes to bank, starting at word_address. | |
| virtual TagResult | lockTagMemory (const uint32_t payload, const uint32_t access_password) override |
| Apply a 20-bit Gen2 lock payload. | |
| virtual TagResult | killTag (const uint32_t kill_password) override |
| 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) override |
| 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) override |
| 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) override |
| 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) override |
| Set or clear the Product Status Flag of an NXP UCODE G2X. | |
| virtual bool | nxpEASAlarm (std::vector< uint8_t > &alarm) override |
| Ask the field whether any tag has its Product Status Flag asserted. | |
| virtual TagResult | nxpReadProtect (const bool protect, const uint32_t access_password) override |
| Turn the read protection of an NXP UCODE G2X on or off. | |
| virtual m5::uhf::Reason | classify (const uint8_t error_code) const override |
| Say what one of this reader's error codes means in EPC Gen2 terms. | |
Settings for begin | |
| config_t | config () const |
| Gets the configuration. | |
| void | config (const config_t &cfg) |
| Sets the configuration. | |
Reader settings | |
| virtual bool | readModuleInformation (m5::uhf::ModuleInformation &info) override |
| Read the module information. | |
| virtual bool | readTransmitPower (int16_t &dbm100) override |
| Read the transmit power in 1/100 dBm. | |
| virtual bool | writeTransmitPower (const int16_t dbm100) override |
| Write the transmit power in 1/100 dBm. | |
| virtual bool | readRegion (m5::uhf::Region ®ion) override |
| Read the operating region. | |
| virtual bool | writeRegion (const m5::uhf::Region region) override |
| Write the operating region. | |
| virtual bool | readChannel (uint8_t &index) override |
| Read the operating channel index. | |
| virtual bool | writeChannel (const uint8_t index) override |
| Write the operating channel index. | |
| virtual bool | writeAutomaticFrequencyHopping (const bool enable) override |
| Enable or disable automatic frequency hopping. | |
| virtual bool | writeContinuousCarrier (const bool enable) override |
| Turn the unmodulated carrier on or off. | |
| virtual bool | readQueryParameters (m5::uhf::QueryParameters &qp) override |
| Read the query parameters. | |
| virtual bool | writeQueryParameters (const m5::uhf::QueryParameters &qp) override |
| Write the query parameters. | |
| virtual bool | writeAutoSleepTime (const uint8_t minutes) override |
| Write the inactivity period after which the module sleeps automatically. | |
| virtual bool | writeIdle (const bool enter, const uint8_t minutes=0) override |
| Put the module into IDLE, or bring it out. | |
| virtual bool | wake () override |
| Wake the module from low power sleep. | |
| virtual bool | writeOperatingChannels (const std::vector< uint8_t > &channels) override |
| Replace the channel list used for automatic frequency hopping. | |
| virtual bool | readBlockingSignal (m5::uhf::ChannelLevels &levels) override |
| Measure the blocking signal on every channel of the operating region. | |
| virtual bool | readChannelRSSI (m5::uhf::ChannelLevels &levels) override |
| Measure the RSSI on every channel of the operating region. | |
| virtual bool | readSelectParameter (m5::uhf::SelectParameter &sp) override |
| Read back the select mask the reader holds. | |
Receiver tuning, specific to this chip | |
| bool | readDemodulatorParameters (m100::DemodulatorParameters &dp) |
| Read the receiver demodulator settings. | |
| bool | writeDemodulatorParameters (const m100::DemodulatorParameters &dp) |
| Write the receiver demodulator settings. | |
Public Member Functions inherited from m5::unit::UHFRFIDComponent | |
| virtual void | update (const bool force=false) override |
| config_t | config () const |
| Gets the configuration. | |
| void | config (const config_t &cfg) |
| Sets the configuration. | |
| 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. | |
| 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. | |
Protected Member Functions | |
| virtual bool | pump (const uint32_t timeout_ms) override |
| virtual bool | start_polling_command (const uint16_t count) override |
| virtual bool | stop_polling_command () override |
| bool | send_command (const uint8_t command, const uint8_t *param, const uint16_t param_len) |
| bool | send_and_wait (m100::Frame &response, const uint8_t command, const uint8_t *param, const uint16_t param_len, const uint32_t timeout_ms=0, const uint8_t answer_command=0) |
| bool | read_frame (m100::Frame &out, const uint32_t timeout_ms) |
| void | flush_rx () |
| void | route_frame (const m100::Frame &f) |
| void | resynchronize () |
| bool | read_module_information_kind (std::string &out, const uint8_t kind) |
| bool | read_channel_levels (m5::uhf::ChannelLevels &levels, const uint8_t command) |
| bool | succeeded (const m100::Frame &response, const char *what) const |
| TagResult | tag_carried_it_out (const m100::Frame &response, const char *what) const |
| TagResult | send_tag_operation (m100::Frame &response, const uint8_t command, const uint8_t *param, const uint16_t param_len, const char *what, const uint8_t answer_command=0) |
Protected Member Functions inherited from m5::unit::UHFRFIDComponent | |
| UHFRFIDComponent (const uint8_t addr=0x00) | |
| 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 () |
Static Protected Member Functions | |
| static uint8_t | error_code_of (const m100::Frame &response) |
Protected Attributes | |
| uint8_t | _frame_header {m100::jrd::FRAME_HEADER} |
| uint8_t | _frame_end {m100::jrd::FRAME_END} |
| std::vector< uint8_t > | _rx {} |
| m100::Frame | _response {} |
| bool | _response_pending {} |
| uint8_t | _awaiting_command {} |
| config_t | _cfg_jrd4035 {} |
Protected Attributes inherited from m5::unit::UHFRFIDComponent | |
| 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 {} |
UHF-RFID unit based on the JRD-4035 module (magicRF M100)
EPCglobal UHF Class 1 Gen 2 / ISO 18000-6C at 840-960MHz over UART
|
overridevirtual |
Reimplemented from m5::unit::UHFRFIDComponent.
|
overridevirtual |
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 |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Kill the addressed tag permanently.
| kill_password | Kill password the tag holds, which may not be zero |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Apply a 20-bit Gen2 lock payload.
| payload | Lock payload, see m5::uhf::buildLockPayload |
| access_password | Access password the tag holds, or zero |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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
Implements m5::unit::UHFRFIDComponent.
|
overrideprotectedvirtual |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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 |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Measure the RSSI on every channel of the operating region.
| [out] | levels | Measured level of each channel |
Reveals other readers operating nearby
Implements m5::unit::UHFRFIDComponent.
| bool m5::unit::UnitJRD4035::readDemodulatorParameters | ( | m100::DemodulatorParameters & | dp | ) |
Read the receiver demodulator settings.
| [out] | dp | Demodulator parameters |
|
overridevirtual |
Read the module information.
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Read the query parameters.
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Read the operating region.
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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 |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Read the transmit power in 1/100 dBm.
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Put the module into low power sleep.
Implements m5::unit::UHFRFIDComponent.
|
overrideprotectedvirtual |
Implements m5::unit::UHFRFIDComponent.
|
overrideprotectedvirtual |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Enable or disable automatic frequency hopping.
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Write the inactivity period after which the module sleeps automatically.
| minutes | 1 to 30 minutes, or 0 to disable automatic sleep |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Write the operating channel index.
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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
Implements m5::unit::UHFRFIDComponent.
| bool m5::unit::UnitJRD4035::writeDemodulatorParameters | ( | const m100::DemodulatorParameters & | dp | ) |
Write the receiver demodulator settings.
| dp | Demodulator parameters |
Transmit power decides how far the reader reaches and these decide how far it listens. Lowering both is what makes a tag resting on the antenna readable: left at the factory settings, which reach about a metre and a half, the reader misses most inventory rounds at contact however strong the reply is
|
overridevirtual |
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
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Replace the channel list used for automatic frequency hopping.
| channels | Channel indices of the operating region, in the order to hop through |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Write the query parameters.
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Write the operating region.
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Apply the stored mask to tag operations, or stop applying it.
| enable | True to address only the selected tag, false to address any tag |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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 |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
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 |
Implements m5::unit::UHFRFIDComponent.
|
overridevirtual |
Write the transmit power in 1/100 dBm.
Implements m5::unit::UHFRFIDComponent.