diff --git a/code/inventory/bcode.h b/code/inventory/bcode.h index 77dfbb1..3953157 100644 --- a/code/inventory/bcode.h +++ b/code/inventory/bcode.h @@ -1,43 +1,45 @@ /* - * bcode.h - barcode scanner input via the Workabout serial port. + * bcode.h - barcode scanner input on the Workabout MX (integral laser). * - * On the Workabout the barcode module decodes the label in hardware and - * delivers the result as an RS232 stream, so a scan is simply read from the - * serial channel using the standard PLIB serial I/O. The scanner here is on - * the top internal slot, which is port D -> device "TTY:D". + * The Workabout MX integral laser is an UNDECODED (HHLC) scanner: it emits a + * raw bar/space signal, not decoded ASCII. The hardware serial decoder in the + * RS232/Barcode module only handles wands and wand-emulation scanners (the HC + * guide lists "Undecoded Laser Scanner (HHLC)" as unsupported there), which is + * why reading TTY:D directly yielded nothing even though the laser's own + * good-read LED lit. + * + * The decode is instead done in software by a barcode decoder LDD. The SDK + * ships several (\SIBOSDK\LIB): BAREAN (EAN/UPC), BARC39, BAR128, BARITF, + * BARMPLES, BARRAW. Each registers the device "BAR:". For UPC we load BAREAN. + * + * Usage: bcodeLoad() once, then bcodeOpen() to get a channel, then read it. + * The BAREAN.LDD file must be present on the device so p_loadldd can find it. */ #ifndef BCODE_H #define BCODE_H #include +/* Decoder LDD to load (BAREAN.LDD = EAN/UPC) and the device it registers. */ +#define BCODE_LDD "BAREAN" +#define BCODE_DEV "BAR:" + +/* Longest decoded barcode we handle (UPC-A is 12; headroom for EAN/supplements). */ +#define BCODE_MAXLEN 24 + /* - * Terminator the scanner appends after each decoded barcode. Most serial - * barcode readers send a carriage return (0x0D). If yours sends LF or a - * different suffix, change this to match its configuration. + * Load the UPC/EAN decoder LDD. Returns 0 if loaded, or a negative PLIB error. + * E_FILE_EXIST (already loaded) is treated as success by callers. */ -#define BCODE_TERM 0x0D - -/* Longest decoded barcode we handle (UPC-A is 12; headroom for EAN etc.). */ -#define BCODE_MAXLEN 20 +GLREF_C INT bcodeLoad(VOID); /* - * Open the barcode serial channel (TTY:D). Stores the channel handle in - * *pChan. Returns 0 on success or a negative PLIB error code. + * Open a channel to the barcode decoder device (BAR:). Stores it in *pChan. + * Returns 0 on success or a negative PLIB error. */ GLREF_C INT bcodeOpen(VOID **pChan); /* Close a channel opened by bcodeOpen. Safe to call with NULL. */ GLREF_C VOID bcodeClose(VOID *chan); -/* - * Line assembler. Feeds n freshly-read bytes from raw into the caller's line - * buffer (current length *pLen, capacity max). When BCODE_TERM is seen the - * completed, NUL-terminated barcode is left in line, *pLen is reset to 0 and - * 1 is returned. Otherwise returns 0 (more bytes needed). Control bytes below - * space (other than the terminator) are ignored; overflow bytes are dropped - * until the next terminator. - */ -GLREF_C INT bcodeAssemble(UBYTE *raw, INT n, TEXT *line, INT *pLen, INT max); - #endif /* BCODE_H */