feat(inventory): Phase 1 - scan and validate UPC barcodes #1

Open
lyrathorpe wants to merge 54 commits from feat/inventory-phase1-scan into main
Showing only changes of commit d76326729c - Show all commits
+13 -7
View File
@@ -31,8 +31,15 @@ result as an RS232 stream, so there is no special barcode driver call: the app
opens the serial port and reads it. The scanner is on the top internal slot, opens the serial port and reads it. The scanner is on the top internal slot,
which is port **D**, so the device is `TTY:D` (`bcode.c`). which is port **D**, so the device is `TTY:D` (`bcode.c`).
The scan loop is asynchronous: it waits on the scanner and the keyboard at the The scan loop is blocking: it reads the scanner and prints each barcode; you
same time, so a scan is processed immediately and Esc quits at any point. exit via the System screen. (An asynchronous scan-or-Esc loop was tried but
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
exact format the scanner emits for a UPC can be confirmed before Phase 2 uses
it as a database key.
## Things to confirm on the device ## Things to confirm on the device
@@ -44,8 +51,7 @@ the SDK docs but may need adjusting once you build and test:
`p_iow(chan, P_FSET, &config)` (E_CONFIG, `p_config.h`) after opening. `p_iow(chan, P_FSET, &config)` (E_CONFIG, `p_config.h`) after opening.
- **Terminator.** `BCODE_TERM` in `bcode.h` is set to CR (`0x0D`), the common - **Terminator.** `BCODE_TERM` in `bcode.h` is set to CR (`0x0D`), the common
case. Change it if your scanner suffixes LF or something else. case. Change it if your scanner suffixes LF or something else.
- **Esc key code.** `KEY_ESC` in `scan.c` is `27`; adjust if the console - **Raw scan format.** The build prints `len=NN [text]` per scan. Confirm
delivers a different code. whether a UPC arrives as exactly 12 digits or with extra characters (a
- **`CON:` async read.** Phase 1 reads single keystrokes asynchronously from leading zero / EAN-13, or a symbology prefix); Phase 2 normalises to the
`CON:`; if that behaves differently on your unit, the keyboard handling in database key based on this.
`scan.c` is where to look.