zplCore.comzplCore.com
class24 members

RfidTag

public sealed class RfidTag

Simulated UHF Gen2 tag memory (TDS §9.2): reserved bank (kill and access password), EPC bank (StoredCRC, PC word, EPC), TID and user memory, with Gen2 lock states and access password semantics. Used by ZplRfidSimulator; can also be prepared directly (pre-programmed or locked tags).

Constructors

SignatureDescription
# RfidTag(RfidTagProfile? profile = default, string? tid = default)A blank tag (all EPC and user bits zero, passwords 00000000, everything unlocked except the TID). profile: Memory sizes (default RfidTagProfile). · tid: TID bank contents in hex (default: a synthetic serialised TID starting with E2h, TDS §16).

Properties

PropertyTypeDescription
AccessPassword { get; }uintAccess password (reserved bank words 2–3).
EpcHex { get; }stringThe EPC as announced by the PC length bits, in hex.
FailingWrites { get; set; }intThe next n write operations fail (simulates a weak or damaged tag; the printer retries with ^RR).
KillPassword { get; }uintKill password (reserved bank words 0–1).
LockAccessPassword { get; }RfidLockState
LockEpc { get; }RfidLockState
LockKillPassword { get; }RfidLockState
LockTid { get; }RfidLockStateTID lock (permalocked by the tag manufacturer).
LockUser { get; }RfidLockState
Pc { get; }RfidPcStoredPC (EPC bank word 1).
Profile { get; }RfidTagProfileMemory sizes.
Silent { get; set; }boolThe tag does not answer (no tag at the antenna, dead tag).
StoredCrc { get; }ushortStoredCRC (EPC bank word 0): CRC-16 over PC and EPC words (Gen2, see RfidTag.Crc16).
TidHex { get; }stringTID bank in hex.
UserHex { get; }stringUser memory in hex.

Methods

Method SignatureReturnsDescription
# Bank(RfidBank bank)byte[]Whole bank contents (a copy).
static # Crc16(ReadOnlySpan<byte> data)ushortGen2 CRC-16 (ISO/IEC 13239: polynomial 1021h, preset FFFFh, ones' complement of the result; CRC-16/GENIBUS), as the tag computes the StoredCRC over the PC word and the EPC.
# DecodeEpc()EpcThe decoded EPC, or null when the EPC bank holds no valid EPC (see ZplRfid.TryDecodeEpc).
# Lock(RfidLockTarget target, RfidLockValue action, uint? accessPassword = default)RfidTagStatusGen2 Lock of a password or bank. Lock and unlock need the secured state; perma states cannot change.
# PermalockUserSections(int start, int count, uint? accessPassword = default)RfidTagStatusPermanently locks user memory sections (^RLB s,n; Gen2 BlockPermalock).
# Read(RfidBank bank, int word, int byteCount, uint? accessPassword = default)(RfidTagStatus, byte[])Reads byteCount bytes from word word of a bank. bank: Memory bank. · word: First 16-bit word. · byteCount: Bytes to read. · accessPassword: Access password the interrogator presents (null: none, i.e. open state).
# ToString()string
# Write(RfidBank bank, int word, ReadOnlySpan<byte> data, uint? accessPassword = default)RfidTagStatusWrites whole bytes from word word; an odd byte count fills the last word's low byte with 00h.