Pure Python driver for NordicID UHF RFID readers
Project description
nurapy
Pure Python driver for NordicID UHF RFID readers
Table of Contents
Installation
pip install nurapy
Usage
Connect to the reader
# Create driver
reader = NurAPY()
# Connect
reader.connect(connection_string='COM8')
# Check connection status
if not reader.ping():
logging.error('Could not connect to NURAPY')
exit()
... use the reader ...
# Disconnect reader
reader.disconnect()
Get basic information about the reader
## GET INFO
reader_mode = reader.get_mode()
reader_info = reader.get_reader_info()
device_caps = reader.get_device_capabilities()
current_setup = reader.get_module_setup(setup_flags=[
ModuleSetupFlags.ALL
])
Sample response values:
reader_mode = Mode.APPLICATION
reader_info = NurReaderInfo(serial='K134500382', alt_serial='K134700326', name='STIX', fcc_id='', hw_version='PWM00226', sw_version='5.10.A', dev_build=None, num_gpio=None, num_sensors=0, num_regions=21, num_antennas=1, max_antennas=1)
device_caps = NurDeviceCaps(dwSize=40, flagSet1=15696847, flagSet2=0, maxTxdBm=27, txAttnStep=1, maxTxmW=500, txSteps=20, szTagBuffer=630, curCfgMaxAnt=1, curCfgMaxGPIO=0, chipVersion=<ReaderChipVersion.AS3993: 2>, moduleType=<ModuleType.NUR_L2_05W: 3>, moduleConfigFlags=4)
current_setup = ModuleSetup(link_freq=<ModuleSetupLinkFreq.BLF_256: 256000>, rx_decoding=<ModuleSetupRxDec.MILLER_4: 2>, tx_level=0, tx_modulation=<ModuleSetupTxMod.PRASK: 1>, region_id=<ModuleSetupRegion.EU: 0>, inventory_q=2, inventory_session=0, inventory_rounds=0, antenna_mask=1, scan_single_trigger_timeout=500, inventory_trigger_timeout=1000, selected_antenna=0, op_flags=2, inventory_target=<ModuleSetupInvTarget.AB: 2>, inventory_epc_length=255, write_rssi_filter=NurRssiFilter(min=0, max=0), inventory_rssi_filter=NurRssiFilter(min=0, max=0), read_to=500, write_to=500, lock_to=500, kill_to=500, period_setup=<ModuleSetupPowerSave.NOT_IN_USE: 0>, ant_power=[0, -1, -1, -1], power_offset=[-1, 0, 0, 0], antenna_mask_ex=256, autotune=NurAutoTuneSetup(mode=0, threshold_dBm=3), ant_power_ex=[-10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], rx_sensitivity=<ModuleSetupRxSens.NOMINAL: 0>)
Configure the reader
## MODULE SETUP
new_setup = ModuleSetup()
new_setup.link_freq = ModuleSetupLinkFreq.BLF_256
new_setup.rx_decoding = ModuleSetupRxDec.MILLER_4
new_setup.tx_level = 0
new_setup.antenna_mask = 1
new_setup.selected_antenna = 0
updated_setup = reader.set_module_setup(setup_flags=[
ModuleSetupFlags.LINKFREQ,
ModuleSetupFlags.RXDEC,
ModuleSetupFlags.TXLEVEL,
ModuleSetupFlags.ANTMASK,
ModuleSetupFlags.SELECTEDANT
], module_setup=new_setup)
Perform single synchronous inventory
# Trigger a simple inventory
inventory_response = reader.simple_inventory()
if inventory_response.tags_in_memory:
# Get data of read tags
tags = reader.get_id_buffer_with_metadata(clear=True)
logging.info(tags)
Perform continuous asynchronous inventory
def my_notification_callback(inventory_stream_notification: InventoryStreamNotification,
notified_tags: List[NurTagDataMeta]):
# If stream stopped, restart
if inventory_stream_notification.stopped:
logging.info('Restarting inventory stream')
reader.start_inventory_stream()
for tag in notified_tags:
logging.info(tag)
reader.clear_notified_tags()
# Configure the callback
reader.set_notification_callback(my_notification_callback)
# Start inventory stream
reader.start_inventory_stream()
# Do other stuff
time.sleep(1)
# Stop inventory stream
reader.stop_inventory_stream()
Sample report:
inventory_stream_notification = InventoryStreamNotification(stopped=False, rounds=2, collisions=0, last_q=2)
notified_tags = [NurTagDataMeta(rssi=-51, scaled_rssi=93, timestamp=5, frequency=866300, pc=13312, channel=1, antenna_id=0, epc=bytearray(b'Q\x10\x12\x03(\x000\x00\x00\x00V\x04'))]
License
nurapy
is distributed under the terms of the MIT license.
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
Built Distribution
File details
Details for the file nurapy-1.0.0.tar.gz
.
File metadata
- Download URL: nurapy-1.0.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c3c88f8bafd646e68aafc214f488717527a10fbf818040eaba78be537a0684c |
|
MD5 | d150ec8ce63949c6718c18f3ef9f4bf0 |
|
BLAKE2b-256 | 6b4dc05a265e19c31f95e1dfe24dff21c09653cf9298b645b98d5b77465d4a85 |
File details
Details for the file nurapy-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: nurapy-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac2293506317927916e8399929a05af6c55e1090765878abb8dd10b0d1a280ce |
|
MD5 | bb6cb439ff5e7bd314a42913d52140e1 |
|
BLAKE2b-256 | ad7a9bc3050549ccd91c46d52df08846906b39feee3703e863c1cb27232112ab |