nurapi
Table of Contents
Installation
pip install nurapi
Usage
Connect to the reader
# Create driver
reader = NUR()
# Connect
reader.ConnectSerialPortEx(port_name='COM8')
# or reader.ConnectSerialPort(port_numer=8)
# or reader.SetUsbAutoConnect(True)
# Check connection status just by checking physical layer status
reader.IsConnected()
# Check connection status checking full transport layer
reader.Ping()
... use the reader ...
# Disconnect reader
reader.Disconnect()
Get basic information about the reader
## GET INFO
reader_info = reader.GetReaderInfo()
device_caps = reader.GetDeviceCaps()
Sample response values:
reader_info = NurReaderInfo(serial='K134500382', alt_serial='K134700326', name='STIX', fcc_id='', hw_version='PWM0022', sw_ver_major=5, sw_ver_minor=10, dev_build=65, num_gpio=0, 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=2, moduleType=3, moduleConfigFlags=4, v2Level=1, secChipMajorVersion=0, secChipMinorVersion=0, secChipMaintenanceVersion=0, secChipReleaseVersion=0)
Configure the reader
## MODULE SETUP
module_setup = NurModuleSetup()
module_setup.link_freq = SETUP_LINK_FREQ.BLF_160
module_setup.rx_decoding = SETUP_RX_DEC.FM0
desired_tx_level_dbm = 25
module_setup.tx_level = ((device_caps.maxTxdBm - desired_tx_level_dbm) *
device_caps.txAttnStep)
module_setup.antenna_mask_ex = 0b00000001 # Antenna 1 (BIT0)
module_setup.selected_antenna = -1 # Automatic selection
reader.SetModuleSetup(
setup_flags=[
NUR_MODULESETUP_FLAGS.NUR_SETUP_LINKFREQ,
NUR_MODULESETUP_FLAGS.NUR_SETUP_RXDEC,
NUR_MODULESETUP_FLAGS.NUR_SETUP_TXLEVEL,
NUR_MODULESETUP_FLAGS.NUR_SETUP_ANTMASKEX,
NUR_MODULESETUP_FLAGS.NUR_SETUP_SELECTEDANT
],
module_setup=module_setup)
module_setup = reader.GetModuleSetup(
setup_flags=[
NUR_MODULESETUP_FLAGS.NUR_SETUP_LINKFREQ,
NUR_MODULESETUP_FLAGS.NUR_SETUP_RXDEC,
NUR_MODULESETUP_FLAGS.NUR_SETUP_TXLEVEL,
NUR_MODULESETUP_FLAGS.NUR_SETUP_ANTMASKEX,
NUR_MODULESETUP_FLAGS.NUR_SETUP_SELECTEDANT
])
Perform single synchronous inventory
# Trigger a simple inventory
inventory_response = reader.SimpleInventory()
if inventory_response.num_tags_mem > 0:
# Fetch read tags to tag buffer including metadata
tag_count = reader.FetchTags(include_meta=True)
# Get data of read tags
for idx in range(tag_count):
tag_data = reader.GetTagData(idx=idx)
# Clear tag buffer
reader.ClearTags()
Perform continuous asynchronous inventory
def my_callback(inventory_stream_data: NurInventoryStreamData):
global some_epc
# If stream stopped, restart
if inventory_stream_data.stopped:
reader.StartInventoryStream(rounds=10, q=0, session=0)
# Check number of tags read
tag_count = reader.GetTagCount()
# Get data of read tags
for idx in range(tag_count):
tag_data = reader.GetTagData(idx=idx)
some_epc = tag_data.epc
reader.ClearTags()
# Configure the callback
reader.set_notification_callback(notification_callback=my_callback)
# Start inventory stream
reader.StartInventoryStream(rounds=10, q=0, session=0)
# Do other stuff
time.sleep(1)
# Stop inventory stream
reader.StopInventoryStream()
Execute Read/Write operations
reader.WriteTagByEPC(
epc=bytes.fromhex('010203040506070809101112'),
secured=False,
passwd=0,
bank=NurBank.NUR_BANK_USER,
address=0,
byte_count=2,
data=bytearray([0x12, 0x34]))
data: bytearray = reader.ReadTagByEPC(
epc=bytes.fromhex('010203040506070809101112'),
secured=False,
passwd=0,
bank=NurBank.NUR_BANK_USER,
address=0,
byte_count=2)
License
nurapi is distributed under the terms of the MIT license.
Metadata
Release files for nurapi 1.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nurapi-1.5.2.tar.gz | 1.5 MB | Without provenance | Details for nurapi-1.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nurapi-1.5.2-py3-none-any.whl | Python 3 | none | any | Details for nurapi-1.5.2-py3-none-any.whl |
Total release size: 3.1 MB
Release files / nurapi-1.5.2.tar.gz
| Download URL | nurapi-1.5.2.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cef3f1edd5115f4ac4a24c108d509315b5a899df64b33c23a13e811bee9f30d1
|
|
BLAKE2b-256 checksum How to use checksums |
3a0b0b63bf16c530dba3c5c1a76e0c0b75783828902a36a3a464f284ed6d45cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Release files / nurapi-1.5.2-py3-none-any.whl
| Download URL | nurapi-1.5.2-py3-none-any.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4eba9ecad9c00370ddf918ee9eb96b7797089d72203bebaec7a75b9cb6c3c443
|
|
BLAKE2b-256 checksum How to use checksums |
a16655fc04ab95c73da192800565aa7183afb6612de95fdce4d4da4902457a1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Security for nurapi 1.5.2
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.