Python APIs for interacting with RFmx Bluetooth(R) Generation Product
Project description
| Info | Contains Python APIs for interacting with RFmx Bluetooth® Test Generation Product. |
|---|---|
| Author | National Instruments |
Table of Contents
About
The nirfmx-python repository generates Python bindings (Application Programming Interface) for interacting with the RFmx Products.
nirfmx-python follows Python Software Foundation support policy for different versions.
RFmx Instr Python API Status
| Item | Details |
|---|---|
| Driver Version Tested | 2026 Q1 |
| Supported Python Versions | Python 3.9+ (64-bit) |
| Documentation | RFmx Instr Docs |
RFmx Bluetooth® Test Generation Python API Status
| Item | Details |
|---|---|
| Driver Version Tested | 2026 Q1 |
| Supported Python Versions | Python 3.9+ (64-bit) |
| Documentation | RFmx Bluetooth® Test Generation Docs |
Documentation
You can find the latest API documentation for the nirfmx-python package on Read the Docs
Refer to the RFmx User Manual for an overview of RFmx, system requirements, troubleshooting, key concepts, etc.
Operating System Support
nirfmx-python supports Windows systems where the supported drivers are installed. Refer to NI Hardware and Operating System Compatibility for which versions of the driver support your hardware on a given operating system.
Installation
You can use pip to download nirfmxbluetoothgen and install it.
$ python -m pip install nirfmxbluetoothgen
Upgrade
You can use pip to upgrade nirfmxbluetoothgen package using following command:
$ python -m pip install nirfmxbluetoothgen --upgrade
License
This project is licensed under the MIT License. While the source code is not publicly released, the license permits binary distribution with attribution.
Note: This Python driver depends on several third-party components that are subject to separate commercial licenses. Users are responsible for ensuring they have the appropriate rights and licenses to use those dependencies in their environments.
gRPC Features
For driver APIs that support it, passing a GrpcSessionOptions instance as a parameter to nirfmxinstr.Session.init() is subject to the NI General Purpose EULA.
SSL/TLS Support
The server supports both server-side TLS and mutual TLS. Security configuration is accomplished by setting the server_cert, server_key and root_cert values in the server's configuration file. The server expects the certificate files specified in the configuration file to exist in a certs folder that is located in the same directory as the configuration file being used by the server. For more detailed information on SSL/TLS support refer to the Server Security Support wiki page.
Support and Feedback
For support with Python API, hardware, the driver runtime or any other questions, please visit NI Community Forums.
RFmx Bluetooth Generation Example
import nirfmxbluetoothgen
import nirfsg
waveform_name = "BTWaveform"
script = (
"script GenerateDataPkt\n"
" repeat forever\n"
" generate BTWaveform\n"
" end repeat\n"
"end script"
)
btsg_session = None
rfsg_session = None
try:
# Create Bluetooth Generation Session
btsg_session = nirfmxbluetoothgen.Session(
nirfmxbluetoothgen.CompatibilityVersion.Version020000, "RFSG"
)
# Convert Channel Number to Carrier Frequency
carrier_frequency, error_code = btsg_session.channel_number_to_carrier_frequency(3, 0)
# Configure BD Address
btsg_session.set_bd_address_lap("", 0)
btsg_session.set_bd_address_uap("", 0)
btsg_session.set_bd_address_nap("", 0)
# Configure Packet Type
btsg_session.set_packet_type("", nirfmxbluetoothgen.PacketType.DH1.value)
# Configure Number of Unique Packets and Idle Slots
btsg_session.set_number_of_unique_packets("", 1)
btsg_session.set_number_of_idle_slots("", 1)
# Configure Payload Header
btsg_session.set_payload_header_llid("", 0)
btsg_session.set_payload_header_flow("", 0)
btsg_session.set_payload_length_mode("", nirfmxbluetoothgen.PayloadLengthMode.MAXIMUM_LENGTH.value)
actual_payload_length, error_code = btsg_session.get_actual_payload_length("")
# Configure Payload Data
btsg_session.set_payload_data_type("", nirfmxbluetoothgen.PayloadDataType.PN_SEQUENCE.value)
btsg_session.set_payload_pn_order("", 9)
btsg_session.set_payload_pn_seed("", 497)
# Configure Packet Header
btsg_session.set_packet_header_lt_address("", 0)
btsg_session.set_packet_header_flow("", 0)
btsg_session.set_packet_header_arqn("", nirfmxbluetoothgen.PacketHeaderArqn.NAK.value)
btsg_session.set_packet_header_seqn("", 0)
# Configure Waveform Properties
btsg_session.set_auto_headroom_enabled("", nirfmxbluetoothgen.AutoHeadroomEnabled.TRUE.value)
btsg_session.set_carrier_frequency_offset("", 0.0)
# Configure IQ Impairments
btsg_session.set_all_iq_impairments_enabled("", nirfmxbluetoothgen.AllIQImpairmentsEnabled.FALSE.value)
# Configure AWGN
btsg_session.set_awgn_enabled("", nirfmxbluetoothgen.AwgnEnabled.FALSE.value)
btsg_session.set_carrier_to_noise_ratio("", 50.0)
# Configure Whitening
btsg_session.set_whitening_enabled("", nirfmxbluetoothgen.WhiteningEnabled.FALSE.value)
btsg_session.set_whitening_clock("", 0)
# Create RFSG Session
rfsg_session = nirfsg.Session("RFSG")
rfsg_session.frequency = carrier_frequency
rfsg_session.external_gain = 0.0
rfsg_session.power_level_type = nirfsg.PowerLevelType.PEAK
# Create and Download Waveform
btsg_session.rfsg_create_and_download_waveform(rfsg_session, "", waveform_name)
# Configure Script and Initiate Generation
btsg_session.rfsg_configure_script(rfsg_session, "", script, 0.0)
actual_headroom, error_code = btsg_session.get_actual_headroom("")
rfsg_session.output_enabled = True
rfsg_session.initiate()
# Print Results
print("------------------BT Generate Data Packet------------------")
print(f"Carrier Frequency (Hz) : {carrier_frequency}")
print(f"Actual Payload Length (bytes) : {actual_payload_length}")
print(f"Actual Headroom (dB) : {actual_headroom}")
except Exception as e:
print("ERROR: " + str(e))
finally:
# Close Sessions
if btsg_session is not None:
if rfsg_session is not None:
rfsg_session.abort()
rfsg_session.output_enabled = False
rfsg_session.commit()
btsg_session.rfsg_clear_database(rfsg_session, "", "")
btsg_session.close()
btsg_session = None
if rfsg_session is not None:
rfsg_session.close()
rfsg_session = None
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nirfmxbluetoothgen-26.3.0-py3-none-any.whl.
File metadata
- Download URL: nirfmxbluetoothgen-26.3.0-py3-none-any.whl
- Upload date:
- Size: 84.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63e7430adee029c1874f734244a9aa30f83e504cd7914eafb33b60f674c67daa
|
|
| MD5 |
0d16d22e97c8c1b8e15bae5b45a8fa6b
|
|
| BLAKE2b-256 |
7e0e886d97935832df2597fcdd89fbbd8173acb9b0f7d34f033111faa88e9d68
|