Skip to main content
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 Q4
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 Q4
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

To also install gRPC support for remote NI gRPC Device Server communication:

$ python -m pip install "nirfmxbluetoothgen[grpc]"

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_v2(3, 0, 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)

    # 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
    )
    actual_payload_length, error_code = btsg_session.get_actual_payload_length("")

    # Configure Payload Data
    btsg_session.set_payload_data_type(
        "",
        nirfmxbluetoothgen.PayloadDataType.PN_SEQUENCE
    )
    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)
    btsg_session.set_packet_header_seqn("", 0)

    # Configure Waveform Properties
    btsg_session.set_auto_headroom_enabled("", nirfmxbluetoothgen.AutoHeadroomEnabled.TRUE)
    btsg_session.set_carrier_frequency_offset("", 0.0)

    # Configure IQ Impairments
    btsg_session.set_all_iq_impairments_enabled(
        "", 
        nirfmxbluetoothgen.AllIQImpairmentsEnabled.FALSE
    )

    # Configure AWGN
    btsg_session.set_awgn_enabled("", nirfmxbluetoothgen.AwgnEnabled.FALSE)
    btsg_session.set_carrier_to_noise_ratio("", 50.0)

    # Configure Whitening
    btsg_session.set_whitening_enabled("", nirfmxbluetoothgen.WhiteningEnabled.FALSE)
    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

Numpy array size handling in RFmx APIs

The numpy arrays are passed in pre-allocated. If the pre allocated array size does not match the actual array size returned by the measurement, the array is automatically resized to fit the data, which may invalidate the previously created view. Passing an empty array (size 0) is fine; it will be resized as needed.

Metadata

Release files for nirfmxbluetoothgen 26.8.0

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

Built distribution (wheel)

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

Release files / nirfmxbluetoothgen-26.8.0-py3-none-any.whl

Download URL nirfmxbluetoothgen-26.8.0-py3-none-any.whl
Size 108.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af2dbad0c999ccd1805f9e5e5243a5edfaa5b51c6b767c5813a55b064c358489
BLAKE2b-256 checksum
How to use checksums
6ead0b9a9f682588cfdb68ef826c58a18ec1437f44d6356ea6dc4c8bce7176a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for nirfmxbluetoothgen 26.8.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.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for nirfmxbluetoothgen-26.8.0-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

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