Skip to main content

Pure Python driver for NordicID UHF RFID readers

Project description

nurapy

PyPI - Version PyPI - Python Version OS ARCH


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

nurapy-1.1.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

nurapy-1.1.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file nurapy-1.1.0.tar.gz.

File metadata

  • Download URL: nurapy-1.1.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for nurapy-1.1.0.tar.gz
Algorithm Hash digest
SHA256 058e6c0c3068c2c1d460b7eb3f44042737dfc049699ed01b54ba1fe657047f67
MD5 ad54533bee4b224690a4309a47b28e63
BLAKE2b-256 a840dfd7ef0ddcca2cdec9fa3a814b8b03aebdb8474cb394420002caf20d5fe6

See more details on using hashes here.

File details

Details for the file nurapy-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: nurapy-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for nurapy-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa6f108ae04fd137ee665f16856b345ccd86bb0655fe00afd58e415b11407cd3
MD5 a8ce1dec27e1c96971d8fef11a0f59eb
BLAKE2b-256 8b5790baf1e2d6b118603f2331d7759b17bc9d7b8dcda116535946184080b418

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