VioletMax DL-721 RFID Integration
=================================

Delphi target
-------------
Delphi 12.3, Windows 32-bit (Win32).

Project source files
--------------------
1. Replace the existing P_EpcItemMap.pas and P_EpcItemMap.dfm.
2. Add U_DSTP2x.pas to the VioletMax project.
3. Add F_RFIDLabelDesigner.pas to the VioletMax project/search path.
4. Add F_DL721Tools.pas to the VioletMax project/search path.

Runtime files
-------------
Copy these files beside VioletMax.exe (the Win32 output directory):

  libDSThermal.dll
  sdkcfg.xml
  dssdk.img
  ewl.img
  wxbase30u_vc140.dll
  wxmsw30u_adv_vc140.dll
  wxmsw30u_core_vc140.dll
  vcomp140.dll

Write EPC workflow
------------------
1. Open the form from the stock item.
2. Enter Generate Qty and press Generate EPC Grid.
3. Press Write EPC.
4. Confirm the batch.
5. VioletMax detects the DL-721 and processes the grid from first row to last.
6. Every label prints the item description and barcode, writes its EPC and
   verifies the EPC returned by the printer.
7. A fresh USB SDK session is used for each label.
8. When the whole batch succeeds, the EPC grid mapping is saved automatically.

EPC integrity
-------------
- Numeric barcodes keep the original VioletMax 48-bit numeric encoding.
- Alphanumeric barcodes use the first 48 bits of a stable SHA-256 hash, so
  letters are never discarded and different item codes do not collapse to the
  same EPC barcode section.
- Serial ranges are reserved transactionally in epc_serial_counter before a
  batch is generated, preventing two users from receiving the same serials.
- Every EPC is validated as exactly 24 HEX characters and checked against
  epc_item_map before printing.
- Printer verification accepts only the exact EPC token returned by PrintLc.

Important
---------
Run RFID label positioning from DSTP2xDemo whenever the RFID label type/size
changes. The current label canvas is 50 x 25 mm at 203 dpi.

The generated grid now contains only the new pending batch. Use Load saved grid
when you intentionally want to view previously saved EPC rows.

RFID Label Designer
-------------------
The former Print Barcode Label button now opens Label Designer. The Text and
Barcode field lists are loaded dynamically from every field in stock. Font,
font size, bold, and the X/Y/width/height measurements can be saved. Settings
are stored beside VioletMax.exe in RFIDLabelDesign.ini. BtnWriteEPC uses the
saved design through the same verified SDK label-context workflow.

When the selected text contains Arabic, VioletMax renders the complete mixed
Unicode text into a temporary Windows bitmap and sends it through the official
DSTP2x_Lbl_DrawImage API. This preserves Arabic shaping and right-to-left
ordering while the EPC remains in the same SDK print job.

DL-721 Printer Tools
--------------------
Printer Tools opens a separate maintenance form for ordinary/RFID positioning,
EPC and TID reading, power and protocol inspection/changes, paper movement,
printer identity/status, self-check, restart, and optional cutter commands.
Calibration and destructive configuration actions require confirmation. Every
operation detects, connects, runs and disconnects automatically.
