Installing
You can easily install zebra_scanner with pip:
pip install zebra_scanner
A minimal example
import pprint
import time
from zebra_scanner import CoreScanner
pp = pprint.PrettyPrinter(indent=4)
scanners = []
cs = CoreScanner()
@cs.on_scanner_added
def on_scanner_added(scanner):
print("New scanner found:")
pp.pprint(scanner.__dict__)
scanners.append(scanner)
scanner.pull_trigger()
@scanner.on_barcode
def on_barcode(barcode):
print("Scanned:")
print(barcode.code, barcode.type)
@cs.on_scanner_removed
def on_scanner_removed(scanner):
print("Scanner removed:")
scanner.release_trigger()
scanners.remove(scanner)
pp.pprint(scanner.__dict__)
while True:
time.sleep(0.1)
for scanner in scanners:
# should have been done in on_scanner_added
# but somehow it does not work immediately
# upon registration of a new scanner
scanner.pull_trigger()
Running the example
Creating states and state machines is pretty straightforward:
~/Development/zebra-scanner/examples$ python test.py
New scanner found:
{ 'DoM': '10Mar18',
'GUID': 'AFF531D4821A3E4BB2127A380DA81FB0',
'PID': '1900',
'VID': '05e0',
'firwmare': 'PAABLS00-005-R05',
'modelnumber': 'PL-3307-B100R',
'scannerID': '1',
'serialnumber': '00000000K10U532B',
'type': 'SNAPI'}
Scanned:
('00140092390052832143', '15')
Scanned:
('01040092393881071000017500861331', '15')
Scanned:
('00140092390052832143', '15')
Scanned:
('00140092390052832143', '15')
^CScanner removed:
{ 'DoM': '10Mar18',
'GUID': 'AFF531D4821A3E4BB2127A380DA81FB0',
'PID': '1900',
'VID': '05e0',
'firwmare': 'PAABLS00-005-R05',
'modelnumber': 'PL-3307-B100R',
'scannerID': '1',
'serialnumber': '00000000K10U532B',
'type': 'SNAPI'}
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zebra-scanner-0.1.3.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zebra-scanner-0.1.3.tar.gz.
File metadata
- Download URL: zebra-scanner-0.1.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd3e9507a7c1036b88f18c21d91528406ca3594a524561fa55b2f2d621ea1106
|
|
| MD5 |
7c1d5592586c96c0ee46000b84d761b9
|
|
| BLAKE2b-256 |
4c27a0b34c3ab821a9463d34c1eca6054ca537a78db12ad10a78aabd4fee0d51
|
File details
Details for the file zebra_scanner-0.1.3-py2.7-linux-x86_64.egg.
File metadata
- Download URL: zebra_scanner-0.1.3-py2.7-linux-x86_64.egg
- Upload date:
- Size: 315.4 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05ed0fba30d570c838e227c90c4450a3e86cbed91805708246f340da412976ea
|
|
| MD5 |
409b2215f07c38c63e16873b4c0d456e
|
|
| BLAKE2b-256 |
73aab4d7051016cc79af2658a67c9858cb76f368e35de97ca59a820c8bcb6932
|