Skip to main content

SDK to communicate with Baltech RFID readers.

Project description

Baltech SDK

Installation

pip install baltech-sdk

Usage

from baltech_sdk import Brp, UsbHid

# Sample code for GetInfo
with Brp(UsbHid()) as brp:
    print(brp.Sys_GetInfo())

# This is a shortcut for:
io = UsbHid()
brp = Brp(io, open=False)
brp.open()
print(brp.Sys_GetInfo())
brp.close()

A complete reference of the supported commands can be found here.

Supported IO protocols

from baltech_sdk import Brp, UsbHid, RS232

# USB HID autodetect connected reader
brp = Brp(UsbHid())

# USB HID by serialnumber
brp = Brp(UsbHid(serialnumber=99999999))

# Serial with (optional) custom settings
brp = Brp(RS232("COM1", baudrate=115200, parity=b"N"))

Reader Update

from baltech_sdk import Brp, UsbHid, ReaderUpdater

with Brp(UsbHid(), open=True) as brp:
    updater = ReaderUpdater.from_path("firmware.bf3")

    # simple upload
    updater.run(brp)

    # upload with progress
    for progress in updater.iter(brp):
        print(f"{progress.progress:.0%} ({progress.transferred_bytes} bytes)")

Access Reader Configuration

from baltech_sdk import Config

cfg_src = {(0x0201, 0x02): b'\x01'}   # instead of a confDict also a brp object 
                                     # can be passed to modify reader's 
                                     # configuration directly
cfg = Config(cfg_src)

# set value
cfg.Device_Boot_StartAutoreadAtPowerup("EnableOnce")

# get value
print(cfg.Device_Boot_StartAutoreadAtPowerup.get())

# delete value
cfg.Device_Boot_StartAutoreadAtPowerup.delete()

Templates and BaltechScripts

from baltech_sdk import Config, Template, BaltechScript, TemplateFilter

confdict = {}
cfg = Config(confdict)

cfg.Scripts_Events_OnAccepted(
    BaltechScript()
        .ToggleInverted("RedLed", RepeatCount=3, Delay=20)
        .Toggle("GreenLed", RepeatCount=1, Delay=20)
        .DefaultAction()
)
cfg.Autoread_Rule_Template(
    0, 
    Template()
        .Static(b"SNR:")
        .Serialnr(TemplateFilter(BinToAscii=True, Unpack=True, BinToBcd=True))
)
print(confdict)

Linux or macOS

To use baltech-sdk under Linux or macOS you need to build your own binary of the BaltechSDK and manually set the path to your binary.

from pathlib import Path
from baltech_sdk import set_brp_lib_path

set_brp_lib_path(Path("path/to/brp_lib"))

Further parameters on connections fors sensible data

Additional Options:

from baltech_sdk import Brp, UsbHid, SecureChannel

KEY = b'abcdefghijklmnuk'
brp = Brp(UsbHid(), 
          crypto=SecureChannel(security_level=1, key=KEY),  # encrypt communication
          monitor="plaintext"                               # log unencrypted data (if activated by user)
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baltech_sdk-5.2026.6.tar.gz (259.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

baltech_sdk-5.2026.6-py3-none-any.whl (265.1 kB view details)

Uploaded Python 3

File details

Details for the file baltech_sdk-5.2026.6.tar.gz.

File metadata

  • Download URL: baltech_sdk-5.2026.6.tar.gz
  • Upload date:
  • Size: 259.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for baltech_sdk-5.2026.6.tar.gz
Algorithm Hash digest
SHA256 42d1cf8050233ba7f0da9eeb7eb7be67e6afe210b3e8997ed8149ee765b220be
MD5 a3a10977f71eb3e3fa28b4f06da5d543
BLAKE2b-256 c85e2920fd68c95b60bbda24fc029fa0ddcedff2176e21fefe298629e47edeb4

See more details on using hashes here.

File details

Details for the file baltech_sdk-5.2026.6-py3-none-any.whl.

File metadata

  • Download URL: baltech_sdk-5.2026.6-py3-none-any.whl
  • Upload date:
  • Size: 265.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for baltech_sdk-5.2026.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f182107114579230d6f4fa29255cb524f8ab5df5e158c6da99b83ebe11a79ac3
MD5 57d63d8d3c503f35da085c0220fd81cf
BLAKE2b-256 bd8231b273def24bb837bc532c13b67c3ab84b27e08ff9d0e807f33e290d5d49

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page