zplCore.comzplCore.com
class16 members

ZplRfid

public static class ZplRfid

RFID Studio: EPC encoding and decoding after the GS1 EPC Tag Data Standard (TDS 2.3), ZPL RFID command generation, consistency checks between the RFID commands and the printed barcodes, and a tag memory simulation.

Try it online on zplCloud.com: RFID Studio

Methods

Method SignatureReturnsDescription
static # BuildCommands(Epc epc, RfidEncodeOptions? options = default)stringZPL commands that encode epc into the tag of a label: ^RS (tag type, position, void, tries, error handling), ^RR, ^RW, ^RB (format E), the ^RF write of the EPC with PC handling, user memory, passwords, ^RLM locks and ^HV host verification. Insert the result between ^XA and ^XZ; it prints nothing. Throws ArgumentException: An option is out of range or does not fit the EPC (e.g. RfidPcMode.Keep with 198 bits).
static # Check(string zpl, ComplianceOptions? options = default)ComplianceReportRFID consistency pre-check of zpl with the built-in "rfid" rule pack (ZPL3901–ZPL3912): the EPC written by ^RF/^RQ is valid after TDS 2.3, fits the ^RF memory bank and PC bits, matches the GS1 keys printed on the label, and ^RB, ^RS, ^RL, ^HV are consistent. Same as ZplCompliance.Check(zpl, CompliancePacks.Rfid).
static # DecodeEpc(string hex)EpcDecodes the EPC binary encoding from EPC bank bit 20h, given as hex ("3074257BF7194E4000001A85"; spaces and a 0x prefix are allowed). Trailing word padding is ignored. Throws EpcException: Not a supported, valid EPC (unknown header, partition 7, wrong check digit …).
static # DecodeEpc(ReadOnlySpan<byte> data)EpcDecodes EPC bytes (from bit 20h of the EPC bank).
static # DecodeEpcBank(string hexFromPcWord)(RfidPc, Epc)Decodes EPC bank contents that start with the PC word (as read from word 1, e.g. with ^RFR,H,1,n,1): the PC length bits select how many words belong to the EPC.
static # DecodeEpcFields(string layout, string values)EpcDecodes the ^RB fields of format E back to an EPC (when the layout packs a supported scheme).
static # EncodeEpc(string elementString, int filter = 0, int? companyPrefixLength = default)EpcEncodes with the smallest fixed-length scheme that fits: SGTIN-96 / SGTIN-198, SSCC-96, SGLN-96 / SGLN-195, GRAI-96 / GRAI-170, GIAI-96 / GIAI-202 (the 96-bit scheme when the serial is numeric without leading zero and in range).
static # EncodeEpc(EpcScheme scheme, string elementString, int filter = 0, int? companyPrefixLength = default)EpcEncodes the GS1 key of elementString ("(01)…(21)…", "(00)…", "(414)…(254)…", "(8003)…", "(8004)…", bracketed or raw with FNC1/GS) in scheme. Values and check digits are validated. scheme: Binary scheme; see ZplRfid.EncodeEpc for automatic selection. · elementString: GS1 element string with the key (other AIs are ignored with a warning; DSGTIN+ also takes one date AI). · filter: Filter value 0–7 (TDS §10; 0 = "All Others"). · companyPrefixLength: Digits of the GS1 Company Prefix (6–12; 4 and 5 are encoded as 6). Required for the fixed-length schemes (it selects the partition), optional for the "+" schemes (then only Epc.PureIdentityUri stays null). A GTIN-8 always uses 8. Throws EpcException: The value cannot be encoded in this scheme; EpcException.Error says why.
static # EncodeEpc(EpcScheme? scheme, IReadOnlyList<Gs1Element> elements, int filter = 0, int? companyPrefixLength = default)EpcEncodes AI/value pairs (e.g. from Gs1.Parse); scheme null picks the smallest fixed-length scheme like ZplRfid.EncodeEpc. Use this form for values with parentheses, which the bracketed element string cannot carry.
static # EncodeSgln(string gln, string extension, int? companyPrefixLength, int filter = 0, EpcScheme? scheme = default)EpcSGLN from a 13-digit GLN and an optional extension (AI 254).
static # EncodeSgtin(string gtin, string serial, int? companyPrefixLength, int filter = 0, EpcScheme? scheme = default)EpcSGTIN from a GTIN (8, 12, 13 or 14 digits with check digit) and serial (AI 21). gtin: GTIN-8, -12, -13 or -14 with check digit. · serial: Serial number, AI (21). · companyPrefixLength: GS1 Company Prefix digits (6–12, see ZplRfid.EncodeEpc). · filter: Filter value 0–7 (TDS Table 10-1; 1 = point of sale item). · scheme: Null: SGTIN-96 when the serial fits, else SGTIN-198.
static # EncodeSscc(string sscc, int? companyPrefixLength, int filter = 0, EpcScheme scheme = EpcScheme.Sscc96)EpcSSCC-96 (or scheme = EpcScheme.SsccPlus) from an 18-digit SSCC.
static # EpcLayout(Epc epc)(string, string)The ^RB layout and the ^FD field values (decimal, comma-separated) of a 96-bit EPC for ^RFW,E, e.g. ("96,8,3,3,24,20,38", "48,3,5,9506000,134355,6789"). Field widths follow the scheme's partition. Throws ArgumentException: The scheme is not 96 bits or a field exceeds 64 bits (GIAI-96 asset references over 62 bits are fine).
static # ParseEpcUri(string uri, EpcScheme? scheme = default, int filter = 0)EpcParses an EPC Tag URI ("urn:epc:tag:sgtin-96:3.0614141.812345.6789", control fields such as [att=x01] are ignored) or a Pure Identity URI ("urn:epc:id:sscc:0614141.1234567890") and encodes it. A Pure Identity URI carries neither scheme nor filter: pass scheme (default: smallest fixed-length scheme) and filter.
static # ToRfidItem(Epc epc)RfidItemA RfidItem (label designer) that writes epc in hex with tag type Gen 2 and PC auto-adjust (RfidMemoryBank.EpcAutoPc, ^RFW,H,,,A).
static # TryDecodeEpc(string hex, out Epc epc, out string error)boolZplRfid.DecodeEpc without exceptions.