Skip to main content

uhfreader18

PyPI version Python License: MIT CI

Dependency-free Python library for the UHFReader18 binary protocol. Supports command/response operations, CRC-validated response parsing, TCP stream reassembly, autonomous tag reports, heartbeats, and a receive-server CLI.

uhfreader18 talks to the RFID reader protocol. For HW-VX6330K / HW-VX6346KL module discovery and network/serial configuration, use hw-vx-config.

Features

  • Build UHFReader18 command and response frames.
  • Validate CRC-16/CCITT-reflected checksums.
  • Read reader information and change reader address, power, or scan time.
  • Discover the reader's configured address through broadcast 0xFF.
  • Reassemble fragmented or combined TCP response streams.
  • Parse autonomous 0xEE tag reports and six-byte heartbeats.
  • Filter pushed frames by reader-address allowlist.
  • Run a dependency-free TCP receive server.
  • Typed package with no runtime dependencies.

Requirements

  • Python 3.10 or newer
  • TCP access to a UHFReader18 reader, directly or through a serial-to-Ethernet bridge

Install

pip install uhfreader18

Command Client

from uhfreader18 import RfidClient

with RfidClient("192.168.1.100", 2077) as reader:
    info, address = reader.discover_address()
    print(f"address=0x{address:02X}")
    print(f"firmware={info.version}")
    print(f"power={info.power} dBm")

Supported high-level operations:

with RfidClient("192.168.1.100", 2077) as reader:
    info = reader.get_reader_info(adr=0x00)
    reader.set_address(current_adr=0x00, new_adr=0x01)
    reader.set_power(adr=0x01, power=30)
    reader.set_scan_time(adr=0x01, scan_time=10)

The reader protocol handles one command at a time. RfidClient waits for a complete matching response and handles TCP fragmentation internally.

Parse a Push Stream

TCP does not preserve message boundaries. Keep one StreamBuffer per connection and feed every received chunk in arrival order:

from uhfreader18 import StreamBuffer

stream = StreamBuffer(allowed_readers={0x00, 0x01})
result = stream.feed(tcp_bytes)

for frame in result.frames:
    print(frame.tag, frame.reader_address, frame.command_name)

for heartbeat in result.heartbeats:
    print("heartbeat", heartbeat.hex_readable())

for error in result.errors:
    print("protocol error", error)

Frame.tag renders the response data as uppercase hex after removing trailing NUL bytes. It remains an opaque report value: available captures do not yet prove where flags, antenna metadata, EPC, and padding split for every reader.

Build Frames

from uhfreader18 import Command, Status, build_command_frame, build_response_frame

command = build_command_frame(0x00, Command.GET_READER_INFO)
report = build_response_frame(
    0x00,
    Command.TAG_REPORT,
    Status.SUCCESS,
    bytes.fromhex("2000708C2B380B2D00000000"),
)

Receive Server

uhfreader18-server
uhfreader18-server --host 0.0.0.0 --port 2077
uhfreader18-server --allowed-readers 00,01
uhfreader18-server --fields tag,reader,peer
uhfreader18-server --debug

The server validates and logs reports. Applications needing custom sinks should use StreamBuffer directly.

Protocol

Response frame:

Len | Adr | reCmd | Status | Data[] | CRC-16 LSB | CRC-16 MSB

Command frame:

Len | Adr | Cmd | Data[] | CRC-16 LSB | CRC-16 MSB

CRC parameters:

  • preset: 0xFFFF
  • polynomial: 0x8408
  • storage: little-endian

Observed heartbeat:

56 00 00 00 00 00

Package Relationship

flowchart LR
    APP[Application] --> CONFIG[hw-vx-config]
    APP --> RFID[uhfreader18]
    CONFIG -->|runtime dependency| RFID
    CONFIG <-->|UDP configuration| HWVX[HW-VX module]
    RFID <-->|TCP command/response| HWVX
    HWVX -->|TCP tag push| RFID
  • hw-vx-config: HW-VX discovery, network settings, serial settings, DHCP, reboot.
  • uhfreader18: RFID command/response and autonomous push-stream protocol.

Development

python -m venv .venv
. .venv/bin/activate
pip install -e ".[dev]"
ruff check src tests
ruff format --check src tests
pyright
pytest
python -m build
python -m twine check dist/*

Tests use fake sockets and captured frame bytes; no hardware is required.

Current Limits

  • High-level inventory/read/write tag methods are not implemented.
  • 0xEE payload fields remain opaque until more hardware captures establish layout.
  • Networking API is synchronous; no async client or server contract.
  • Hardware verification currently covers the captured push frame and operations inherited from hw-vx-config; test additional reader firmware before relying on uncommon commands.

License

MIT — see LICENSE.

Metadata

Release files for uhfreader18 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uhfreader18 0.1.0
File Size Uploaded Provenance Actions
uhfreader18-0.1.0.tar.gz 16.5 kB Without provenance Details for uhfreader18-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for uhfreader18 0.1.0
File Interpreter ABI Platform Actions
uhfreader18-0.1.0-py3-none-any.whl Python 3 none any Details for uhfreader18-0.1.0-py3-none-any.whl

Total release size: 31.7 kB

Release files / uhfreader18-0.1.0.tar.gz

Download URL uhfreader18-0.1.0.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
767a0f1b711613d27b543b6ab8c1126bfba51e8971c6dd8a012dd5bd4a9968a8
BLAKE2b-256 checksum
How to use checksums
bcc9ed01a6782404ad24dbc2b6f78d12e570c89405a9022f7fc00a6b9fe8ab7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / uhfreader18-0.1.0-py3-none-any.whl

Download URL uhfreader18-0.1.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
715ba8b7989a8584291e84494cc3a288ac73bb52a806937a8253ed4f384614d2
BLAKE2b-256 checksum
How to use checksums
56ec9354582eaba16d43e8916d9affe43986ae328bbd113a816d66a88631b0ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Security for uhfreader18 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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