zplCore.comzplCore.com
class10 members

ZplRfidSimulator

public sealed class ZplRfidSimulator

RFID tag simulation: executes the RFID commands of a label (^RF write/read/passwords, ^RQ, ^RZ, ^RLM/^RLB, ^RS, ^RR, ^RW, ^HV) against a simulated Gen2 RfidTag like a Zebra RFID printer: EPC written at 20h with memory bank E (12 bytes) or A (PC length adjusted), read-back verification, access password and lock semantics, retries (^RR), void and re-try of the label (^RS n), ^HV responses and ~RV result reporting. ZplVirtualPrinter.RfidSimulator uses it per printed label.

Assumptions where the RFID programming guides are silent: ^RF with memory bank E and less than 12 bytes of data zero-fills the rest of the 96 bits; more than 12 bytes is an encode error; a byte count n that differs from the data length writes n bytes (data truncated or zero-filled). ^WT, ^WF, ^RU, ^RM, ^RT and ^RI are accepted and noted but not simulated. Not thread-safe; one instance per printer.

Constructors

SignatureDescription
# ZplRfidSimulator()

Properties

PropertyTypeDescription
ReportResults { get; set; }bool~RV E / D: report "_+,n_" / "_-,n_" after each label (default false).
Settings { get; }RfidPrinterSettingsPersistent ^RS / ^RR / ^RW state (updated by the commands of every label).
TagProfile { get; set; }RfidTagProfileMemory sizes of the tags ZplRfidSimulator.NextTag supplies (default RfidTagProfile: 496-bit EPC, 512-bit user memory).
TagSupply { get; set; }Func<int, RfidTag>Supplies the tag of the n-th label (0-based, counting voided labels); return null for "no tag in the field". Default: a new blank tag of ZplRfidSimulator.TagProfile. Use it for pre-programmed, locked or weak tags.

Methods

Method SignatureReturnsDescription
# ApplySettings(IReadOnlyList<ZplRfidCommand> commands)voidApplies the persistent ^RS / ^RR / ^RW settings of a label without touching a tag (to know ^RS n before encoding).
# Encode(IReadOnlyList<ZplRfidCommand> commands, RfidTag tag)RfidLabelResultExecutes one label's RFID commands on tag (one encoding attempt).
# NextTag()RfidTagThe next tag from ZplRfidSimulator.TagSupply (or a blank one).
static # Report(bool success, int voided)string~RV response (RFID Programming Guide 2): "_+,n_" success after n voided labels, "_-,n_" failed after n voided labels.
# Simulate(string zpl, ZplRenderSettings? settings = default)IReadOnlyList<RfidLabelResult>Renders zpl (to resolve ^FN, ^FH, ^SN …) and encodes every label with RFID commands like a printer: on failure the label is voided and retried with the next tag up to ^RS n times. ~RVE / ~RVD in the input switch result reporting.