Skip to main content

Installing

You can easily install zebra_scanner with pip:

sudo apt-get install libboost-all-dev libpugixml-dev
sudo 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.fetch_attributes()
    for id, attribute in scanner.attributes.items():
        if id<10:
            pp.pprint({
                "id": id,
                "datatype": attribute.datatype,
                "value": attribute.value,
                "permission": attribute.permission
            })

    @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)
    # do nothing while the scanner is reading in continous mode

Running the example

~/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'}
{   'datatype': 'F', 'id': 0, 'permission': 7, 'value': True}
{   'datatype': 'F', 'id': 1, 'permission': 7, 'value': True}
{   'datatype': 'F', 'id': 2, 'permission': 7, 'value': True}
{   'datatype': 'F', 'id': 3, 'permission': 7, 'value': True}
{   'datatype': 'F', 'id': 4, 'permission': 7, 'value': True}
{   'datatype': 'F', 'id': 5, 'permission': 7, 'value': False}
{   'datatype': 'F', 'id': 6, 'permission': 7, 'value': True}
{   'datatype': 'F', 'id': 7, 'permission': 7, 'value': False}
{   'datatype': 'F', 'id': 8, 'permission': 7, 'value': True}
{   'datatype': 'F', 'id': 9, 'permission': 7, 'value': False}
Scanned:
('Hello World', '3')
Scanned:
('00140092390052832143', '15')
Scanned:
('31039999993000000072\x1d', '15')
Scanned:
('01540092393881021000017500861331', '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.2.3.tar.gz (6.5 kB view details)

Uploaded Source

File details

Details for the file zebra-scanner-0.2.3.tar.gz.

File metadata

  • Download URL: zebra-scanner-0.2.3.tar.gz
  • Upload date:
  • Size: 6.5 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

Hashes for zebra-scanner-0.2.3.tar.gz
Algorithm Hash digest
SHA256 d949f07207f80e0b4562bb09b877412996667a9db248a90a5389a6deac1d21dc
MD5 5f3b10b7516016e6976de7306f4ccf6e
BLAKE2b-256 621173f072f62cf5ee3bbfd6f20feada6a6350442c49dc826ea1865b98f47b38

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.5

1 file

0.2.4

1 file

This release

0.2.3 This release

1 file

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

0.1.4

2 files

0.1.3

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page