Projects:WebUSB and WebBluetooth receipt printers/Technical Documentation
Contents |
Introduction
WebUSB and WebBluetooth is fully supported by Chrome since version 61 in desktop systems: Windows, Linux, Mac, and mobile systems: Android. This technology contains all functionality needed to communicate with receipt printers. But iOS (iPhone, iPad) do not support any of these technologies at this moment.
The API makes extent use of javascript Promises to provide an asynchronous API. For security reasons, WebUSB and WebBluetooth are only available to secure pages (https://…) and request queries of WebUSB or WebBluetooth devices can only be executed as a result of a user gesture, like a click. Request queries cannot be executed in asynchronous calls.
Challenges and risks
Basic support of printing receipts using WebUSB and WebBluetooth is a very feasible project. But being a reimplementation with an experimental technology of a core piece of POS terminals, several challenges and risks must be faced:
- Support all printers currently supported in the Hardware Manager
- Reduce to the minimum implementation differences with Hardware Manager.
- Support cash drawer status detection.
- Printing images. In the hardware manager, images are located in the lib/ folder. For WebUSB and WebBluetooth images must be requested from the Openbravo server side.
- Character sets. Especially Non-Latin character sets like Chinesse, Korean, Arabic, …
- Ability to support all types of devices the Hardware Manager supports: customer displays, RFID, payment devices.
Project scope
The current hardware manager supports a large list of devices types: printers, cash drawers, customer displays, RFID. Different connections: USB, serial, javapos, Different printer models, Different character sets, … For the first version of this project the plan is to support the following:
- Hardware: Receipt printers and cash drawer (only opening the cash drawer)
- Connections: USB and Bluetooth. Bluetooth is new, not supported by the Hardware Manager
- USB Printer models supported. All USB models supported by the Hardware Manager:
- Epson TM T88V
- Epson TM T20 and T20II
- Wincor Nixdorf TH230+
- Star Mircronics TSP-100
- NCR 7197
- HP A799
- Bluetooth printers supported:
- POS-5582 DD Portable Mini Printer 58mm Bluetooth
- Drawer models. Any drawer connected to the receipt printer
- Character sets: Latin character set
- Platforms: Chrome on Windows, MacOS Linux and Android.
- XML receipt specification: text size, style (normal, and bold), images, EAN13 and CODE128 barcodes, QR codes, opening drawer.
Appendix
WebUSB and WebBluetooth specifications:
- WebUSB specification https://wicg.github.io/webusb/
- Browsers that support WebUSB https://caniuse.com/#feat=webusb
- WebBluetooth specification: https://webbluetoothcg.github.io/web-bluetooth/
- Browsers that support WebBluetooth https://caniuse.com/#feat=web-bluetooth
Chrome provides also internal pages that allows to inspect and debug USB and Bluetooth connections:
- Chrome internal page to explore near Bluetooth devices chrome://bluetooth-internals/
- Chrome devices log. Includes USB and Bluetooth devices: chrome://device-log/