docs(inventory): document undecoded-laser + BAR: decoder-LDD model

This commit is contained in:
2026-07-06 18:13:57 +01:00
parent 5dce1ae794
commit 830225ecf5
+37 -31
View File
@@ -8,12 +8,12 @@ Written in PLIB C, built with the TopSpeed compiler (`tsc /m scan`).
## Phases ## Phases
- **Phase 1 (this commit): scan and validate.** Reads barcodes from the scanner - **Phase 1 (current): scan and validate.** Read UPC barcodes from the integral
and prints each one, flagging whether it is a valid UPC-A. laser and display them.
Modules: `upc` (validation), `bcode` (scanner input), `scan` (the demo). Modules: `upc` (validation), `bcode` (scanner input), `scan` (the demo).
- **Phase 2 (next): inventory database.** A DBF file keyed on UPC holding a - **Phase 2 (next): inventory database.** A DBF file keyed on UPC holding a
quantity and a name. Scan to add stock (increment, or create on first sight), quantity and a name. Scan to add stock, scan to consume by a quantity unit.
scan to consume by a quantity unit. Built on the SIBO `Dbf*` API. Built on the SIBO `Dbf*` API (`p_dbf.h`).
## Build ## Build
@@ -21,37 +21,43 @@ Written in PLIB C, built with the TopSpeed compiler (`tsc /m scan`).
tsc /m scan tsc /m scan
``` ```
Produces `scan.img`. `scan.pr` compiles `upc.c`, `bcode.c` and `scan.c` and Produces `scan.img`. `scan.pr` compiles `upc.c`, `bcode.c`, `scan.c` and links
links them. `scan.img`.
## How the scanner is read ## How the scanner is read (important)
On the Workabout the barcode module decodes the label in hardware and sends the The Workabout MX integral laser is an **undecoded (HHLC)** scanner: it emits a
result as an RS232 stream, so there is no special barcode driver call: the app raw bar/space signal, not decoded ASCII. The hardware serial decoder in the
opens the serial port and reads it. The scanner is on the top internal slot, RS232/Barcode module handles only wands and wand-emulation scanners — the HC
which is port **D**, so the device is `TTY:D` (`bcode.c`). guide explicitly lists "Undecoded Laser Scanner (HHLC)" as **unsupported** there.
That is why reading `TTY:D` directly returned nothing even though the laser's
own good-read LED lit.
The scan loop is blocking: it reads the scanner and prints each barcode; you The decode is done in **software** by a barcode decoder LDD. The SDK ships
exit via the System screen. (An asynchronous scan-or-Esc loop was tried but several in `\SIBOSDK\LIB`; each registers the device `BAR:`:
panicked the Window Server: on SIBO the keyboard is event-driven through the
window server, not a raw `CON:` byte read, and a proper async loop needs the
Window Server event API, whose reference manual is not in this repo's `docs/`.)
This Phase 1 build also prints the byte length of each decoded barcode, so the | LDD | Symbology |
exact format the scanner emits for a UPC can be confirmed before Phase 2 uses | --- | --- |
it as a database key. | `BAREAN.LDD` | EAN / **UPC** |
| `BARC39.LDD` | Code 39 |
| `BAR128.LDD` | Code 128 |
| `BARITF.LDD` | Interleaved 2 of 5 |
| `BARMPLES.LDD` | MSI Plessey |
| `BARRAW.LDD` | raw / undecoded |
## Things to confirm on the device So the flow is: `p_loadldd("BAREAN")``p_open("BAR:")` → read decoded
barcodes. **`BAREAN.LDD` must be present on the device** for `p_loadldd` to find
it (copy it from `\SIBOSDK\LIB`, or load it via the system config).
Because this cannot be compiled or run off-device, these points are written to The current build is a **diagnostic**: it dumps every byte of each read
the SDK docs but may need adjusting once you build and test: (`n=<count>: <decimal bytes> "<printable>"`) so the exact decoded format — length,
any type/prefix byte, terminator — can be confirmed before the reader and the
Phase 2 database key are finalised.
- **Serial line settings.** `bcodeOpen` opens `TTY:D` with the default mode. If ## The `BAR:` read protocol
the scanner needs a specific baud/parity/framing, configure the channel with
`p_iow(chan, P_FSET, &config)` (E_CONFIG, `p_config.h`) after opening. The precise read semantics of `BAR:` (data format, any symbology configuration
- **Terminator.** `BCODE_TERM` in `bcode.h` is set to CR (`0x0D`), the common via escape sequences) live in the I/O Devices Reference manual, which is not
case. Change it if your scanner suffixes LF or something else. among the committed docs. The diagnostic build exists to establish that format
- **Raw scan format.** The build prints `len=NN [text]` per scan. Confirm empirically. Once a scan prints, the reader (terminator handling, UPC
whether a UPC arrives as exactly 12 digits or with extra characters (a validation via `upc.c`) and Phase 2 follow.
leading zero / EAN-13, or a symbology prefix); Phase 2 normalises to the
database key based on this.