Files
parking_solution/wiki/sources/qrcode-sdk.md
T
julian b7efa081ec
Build & push images / images (push) Successful in 3m7s
feat(devices): DT-008 reader discovery + auto-configuration over the vendor UDP protocol
The Dingtian DT-008's Windows-only config tool speaks a small binary UDP protocol
(reader :24680 unicast get/set, :24582 broadcast search/set-network), reversed in
wiki/raw/dingtian_qr_linux (PROTOCOL.md + dingtian_qr.py, copied to scripts/). Reading
park-2's readers with it from the booth found both in WG26 output mode — the "beeps but
captures nothing" enrolment failure: they never pushed HTTP at all.

The app now speaks the protocol itself (packages/devices dingtian-qr-config.ts, Node dgram,
host-network container) and the dingtian-qr-reader driver uses it:
- discover(): first driver to implement the wizard's Scan capability; rows show serial, IP,
  output mode, current server target, card format, firmware.
- preconditions: output type must be HTTP (fixable — save switches it); typed serial must
  equal the reported one and the reader must answer on UDP (both block the save).
- configureInputPush(): set-network the reader's server to this booth's IP + listen port,
  confirmed by polling (the reader applies it without an ack and is silent for seconds).
- usesPushAuth=false: the scan GET carries no credentials, so no push secret is stored.
- a reader saved without an IP warns instead of failing (legacy vendor-tool setup).

Verified on the bench unit: WG26→HTTP, target 8080→8081→8080, struct byte-identical after.
15 protocol tests against a fake reader + 17 adapter tests. Wiki: device-discovery,
first-run-setup, dingtian-dt008-reader, site-device-installation §2 (SSH procedure; the
"needs a Windows laptop" claim withdrawn), new source page dingtian-qr-linux-tool.
2026-10-08 15:22:33 +02:00

64 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
type: source
tags: [parking, hardware, readers, qr, protocol, sdk]
sources: [qrcode-sdk]
updated: 2026-06-16
---
# Source: QRCode SDK v1.6.5 (Dingtian DT-008 QR reader)
Vendor SDK for the QR access reader (the Dingtian [[dingtian-dt008-reader]]). Defines the
reader↔server **HTTP protocol** — the missing piece the datasheet omitted. Files at
`QRCode_sdk - QRCode_v1_6_5/sdk/` (config tool `QRCode_v1_6_5.exe`, demos in C#/PHP/VC++, protocol
docs `readme.txt`, `qrcode_HTTP_GET.txt`, `VC++/how to.txt`). **Not copied into `raw/`** — bulky +
binaries; this summary is the faithful capture. Entity: [[dingtian-dt008-reader]]. The SDK documents
only the HTTP push; the exe's *configuration* protocol (UDP) is reversed in [[dingtian-qr-linux-tool]].
## The protocol — HTTP GET poll, server replies the verdict
The reader is configured (via the Windows tool) with a **server IP/port + "server language"**
(JSP/PHP/C#/ASP/CGI — this only selects the URL path, e.g. `/qa/mcardsea.php`; transport is plain
HTTP either way). **On each scan** the reader sends:
```
GET /qa/mcardsea.php?cardid=445D2C&mjihao=1&cjihao=HW256097&status=11&time=1540402036 HTTP/1.0
```
| Param | Meaning |
| --- | --- |
| `cardid` | **the scanned QR/barcode data** (or card id) |
| `mjihao` | device id (machine number) |
| `cjihao` | device serial number |
| `status` | **2 chars**: high = valid `1`/invalid `0` (reader's own pre-check), low = direction **`1`=in / `0`=out**. A 1-char status = fail. |
| `time` | UTC time |
**Server → reader reply (JSON) — this is the access DECISION and drives the beep + output:**
```json
{"data":[{"cardid":"<echo>","cjihao":0,"mjihao":1,"status":1,"time":"<utc>","output":2}],"code":0,"message":""}
```
| Reply field | Meaning (from the C# demo comments) |
| --- | --- |
| `status` | **`1` = valid → buzzer 2×; `0` = invalid → buzzer 1×** |
| `output` | **`0` = Access, `1` = WG26, `2` = WG34** — output line/format driven on a valid read |
| `time` | UTC — **can sync the device clock** |
| `code` | `0` = success |
> **Implication (explains the "no beep"):** the reader's beep/accept is decided by the **server's
> reply**, not locally. A non-JSON / missing reply ⇒ no valid feedback ⇒ no beep, even though the
> scan succeeded. So "no beep" ≠ "didn't scan" — it means the server didn't answer with the verdict.
## Integration consequence
This is **host-in-the-loop, synchronous**: the GET *is* the access query; our JSON reply *is* the
decision. So the backend endpoint must **decide (valid/invalid + direction) and reply** — richer
than a fire-and-forget read. Direction comes from the `status` low digit. See [[dingtian-dt008-reader]] +
[[device-input-flow]].
## Defaults / misc
- Default device IP `192.168.1.99` (`readme.txt`).
- Demos: PHP `qa/mcardsea.php` (minimal echo, status 0), C# raw-socket server on :80 (full parse),
VC++ raw HTTP example. All show the same GET-in / JSON-out contract.