A SiLA 2 connector for the Zebra DS8178 cordless 1D/2D barcode scanner on its CR8178 cradle, built with the UniteLabs CDK. It talks to the scanner through the cradle's USB serial port with Zebra's Simple Serial Interface (SSI), and runs without hardware against a simulated scanner.
Scanning, Stop Scan, the beeper and its settings, the aiming pattern, enabling and disabling scanning, and reading
the cradle's identity are implemented, tested against the simulated scanner, and checked on a DS8178 with a CR8178-SC
cradle. Checked on hardware as well: 1D codes, QR codes up to 1500 characters in UTF-8 or ISO-8859-1, Data Matrix,
two clients scanning at once, and recovery after the cradle is unplugged and plugged back in. The hardware checks are
in tests/integration; see Checking a real scanner.
All features are published as ca.accelerationconsortium/barcodereader/<Feature>/v1.
| Feature | Endpoint | Kind | What it does |
|---|---|---|---|
| Barcode Reader Controller | Scan | observable command | Read one bar code, as if the trigger were pulled, and return its symbology and data; timeout 0.5 to 9.9 s |
| StopScan | command | End a running Scan early; Scan then reports ScanStoppedError |
|
| ScannedBarcode | observable property | Every bar code read from now on, by Scan or by pulling the trigger | |
| ScanningEnabled, SetScanningEnabled | property, command | Whether the scanner reads bar codes at all | |
| StartAiming, StopAiming | commands | Switch the red aiming pattern on and off | |
| Beeper Controller | Beep | command | Sound one of the 30 documented beep patterns |
| BeepAfterScan, SetBeepAfterScan | property, command | Turn off the beep after each read; error beeps still sound | |
| Tone, SetTone | property, command | Set the beeper's pitch, or off to silence the beep after reads; Beep and the disconnection beep are still heard |
|
| Cradle Information Provider | Model, SerialNumber, ManufactureDate, FirmwareVersion | properties | Identify the CR8178 cradle |
| Simulation Controller | StartRealMode, StartSimulationMode, SimulationMode | standard SiLA | Switch between the simulated and the real scanner at runtime |
Scan refuses with ScanningDisabledError while scanning is disabled and with ScannerBusyError while another scan
runs, and reports NoBarcodeDecodedError when the timeout passes or ScanStoppedError when Stop Scan ended it. Endpoints that talk to the scanner report
ScannerNotRespondingError when it does not answer.
- Plug the cradle's USB cable into the computer. The cable's square plug at the cradle end carries USB, not Ethernet.
- On Windows only, install the Zebra USB CDC driver first (zebra.com/support > Barcode Scanners > USB CDC Driver). Without it the scanner can stall at power-up (Product Reference Guide p. 8-5).
- Pair the scanner to the cradle by scanning the bar code on the cradle.
- Scan the "SSI over USB CDC" programming bar code (Product Reference Guide p. 8-6). Out of the box the scanner
types bar codes like a keyboard and cannot be controlled. After rebooting it appears as a serial port:
/dev/cu.usbmodem*on macOS,/dev/ttyACM*on Linux,COM*on Windows. - Start with
"simulation_mode": falseinconfig.json, or callSimulationController.StartRealModefrom a client. Leaveserial_portempty to find the one connected cradle by its Zebra USB ID, or set it when several are connected.
On every connection the connector checks that the scanner sends bar codes as SSI packets. If not, it switches the
setting once and stores it on the scanner (parameter 238). If the scanner does not answer, Start Real Mode fails
with StartRealModeFailed and the connector stays in simulation.
Ensure that Python 3.10 or newer is installed on your system. You can download Python from the official website python.org.
It is highly recommended to use a virtual environment to manage the dependencies for your connector project. This keeps the dependencies for different connectors isolated from each other. Use the following command to create a virtual environment:
python -m venv venvActivate the virtual environment:
-
On Windows:
.\venv\Scripts\activate.bat
-
On macOS/Linux:
source venv/bin/activate
If you are on a Windows machine, you may additionally wish to set the UNITELABS_CDK_APP environment variable to the connector's entry point. This can be done by running the following command:
set UNITELABS_CDK_APP=unitelabs.zebra_ds8178:create_appSetting this environment variable will allow you to run varous CLI commands without providing --app unitelabs.zebra_ds8178:create_app every time.
Install the necessary Python packages into your active virtual environment. Use pip to download the connector along with its dependencies:
python -m pip install unitelabs-zebra-ds8178 \
--index-url https://gitlab.com/api/v4/groups/1009252/-/packages/pypi/simpleIf you are working with a private connector repository, authenticate pip to allow access:
python -m pip install unitelabs-zebra-ds8178 \
--index-url https://<username>:<password>@gitlab.com/api/v4/groups/1009252/-/packages/pypi/simpleTo get information about the configuration values for the connector simply run:
-
On Windows:
config show --app unitelabs.zebra_ds8178:create_app
-
On macOS/Linux:
config show
To create a configuration file for our connector we run:
-
On Windows:
config create --app unitelabs.zebra_ds8178:create_app
-
On macOS/Linux:
config create
Used as such this command will create a config.json in the current working directory. If you prefer to use yaml for your config file or would like to save the file to a different location, simply add the --path argument:
-
On Windows:
config create --app unitelabs.zebra_ds8178:create_app --path <path to config>
-
On macOS/Linux:
config create --path <path to config>
The file that is created will be populated with default configuration values that you may now edit.
Note: The cloud_server_endpoint values are only necessary if you want to use the connector with the UniteLabs platform.
config/zebra_ds8178_config.example.json shows every setting with its
default. Copy it to config.json to start from it; config.json itself is ignored by git. The connector's own
settings:
| Setting | Default | Meaning |
|---|---|---|
serial_port |
null |
Serial port of the cradle, e.g. /dev/ttyACM0, /dev/cu.usbmodem14101 or COM3; empty finds the Zebra cradle by its USB ID |
simulation_mode |
true |
Start with the simulated scanner |
To list the serial ports on this machine, run:
uv run python -m unitelabs.bus.utils.device_manager_cliNote: with unitelabs-cdk 0.16, config show fails on sila_server.version; read the example file instead.
After installation, you can verify that everything works by starting the connector using the CLI tool included in the dependencies:
Note: This must be done in the activated environment setup in Step 1.
connector start --app unitelabs.zebra_ds8178:create_appIf you decided to create your configuration file at a non-default location, you can specify it with the --config-path or -cfg argument:
connector start --app unitelabs.zebra_ds8178:create_app -cfg <path to config>In this way one can have multiple configurations for the same connector.
To change how much the connector logs, set the levels under logging in the configuration file (see
config schema); the -v flags of earlier versions are deprecated.
To interact with the running connector, we recommend using the SiLA Browser.
To secure communication between the connector and its clients, you can enable TLS encryption. Start by installing the optional cryptography package for generating TLS certificates:
python -m pip install cryptographyTo generate a pair of public and private keys, use the following command:
certificate generateWithout any arguments this command uses the default config location to get the connector's UUID and host name, required to generate TLS certificates. It will prompt you as to whether or not you want to update your config file to enable TLS encryption on your connector. This prompt can be suppressed with the use of the --non-interactive or -y flag, which will update the config file with paths to the locally created files without prompting, or with --embed or -e flag to write the file contents into the config file directly.
You can adjust your config file's host to reflect the machine's hostname, or set it to localhost if the connector should only be accessible locally.
If your config file was created at a non-default path, you can provide it with the --config-path or -cfg option:
certificate generate -cfg <path to config>By default the generate command creates the cert.pem and key.pem files in your current working directory. You can customize the output directory with the --target argument.
If you choose not to update your config file with the paths to your certificates using --non-interactive or -y or to have the file contents saved directly in your config file with --embed or -e flag, you will have to modify the config file yourself to set the following values under sila_server:
certificate_chain- the path to thecert.pemfileprivate_key- the path to thekey.pemfiletls- a boolean that toggles on/off TLS encryption for the SiLA server
With your updated config file you can once again run:
connector start --app unitelabs.zebra_ds8178:create_appImportant: Never share the
key.pemfile with anyone. Only thecert.pemis required for clients to connect to encrypted servers.
- Over USB CDC the connector talks to the cradle, which passes scans, beeps and aiming through to the scanner but answers attribute requests itself. The handheld scanner's own serial number and battery state are therefore not available, and Cradle Information Provider reports the cradle's values.
- The scanner's LEDs cannot be controlled: it acknowledges the SSI LED commands but lights nothing.
- Scan waits at most 9.9 s, the scanner's longest decode session.
- A bar code read by pulling the trigger while Scan waits is returned by Scan, because the scanner does not say what started a read.
- The simulated scanner does not simulate trigger pulls, so ScannedBarcode only reports bar codes read by Scan in simulation mode.
- The beeper settings last until the scanner powers down; they are written temporarily, so restarting the connector does not reset them. Whether error beeps still sound with the tone off has not been verified.
- GS1 data keeps its field separator, the GS character (0x1D), in
Data; some clients, the SiLA Browser among them, do not display it. A GS1 Data Matrix may be reported asdata matrix, so recognise GS1 data by its content rather than by its symbology. - Image capture, symbology settings and the other scanner parameters are not exposed.
- The Lock Controller is registered but does not yet protect the commands.
We welcome contributions to improve our connectors. Follow the steps below to set up your development environment.
We use uv for Python packaging.
Install and configure uv:
pipx install uvNote: requires uv>=0.6.8.
Clone the repository:
git clone https://github.com/AccelerationConsortium/zebra-ds8178.gitSet up the development environment and start the connector:
uv sync --all-extras
uv run connector startNote: By default, uv will sync all dependencies with every call to uv run CMD. To prevent this use uv run --frozen CMD or set the environment variable UV_FROZEN=true.
Set up pre-commit hooks to ensure code quality:
uv run pre-commit installTo run the test suite:
uv run pytestTo run tests with a specific version of python, e.g. Python 3.12:
uv run --python 3.12 --all-extras pytesttests/integration checks the connector against a real scanner and is skipped unless you pass the cradle's
serial port:
uv run pytest tests/integration --serial-port /dev/cu.usbmodem1201 -sThe tests read the cradle, sound one beep, flash the aiming pattern, and disable scanning only to enable it again.
To also read a bar code, hold one in front of the scanner window and add --with-barcode.
What only ears and eyes can confirm, Stop Scan and the beeper settings, scripts/lab_check.py walks through
against a running connector in real mode, asking what you heard or saw and restoring the beeper settings at the end:
uv run python scripts/lab_check.py --port <sila port>To improve the development experience, we recommend running the connector in developer mode. This will automatically reload the connector whenever changes to the source code are saved.
uv run connector dev --app unitelabs.zebra_ds8178:create_appIf you found a bug, please use the issue tracker.