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 Q3
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 Q3
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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

nirfmxbluetoothgen-26.5.0-py3-none-any.whl (108.5 kB view details)

Uploaded Python 3

File details

Details for the file nirfmxbluetoothgen-26.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nirfmxbluetoothgen-26.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8d22fe5ea8cb2326df6e7279fd7bbf58c1201d30af5551d0220ec7707fd7ee1
MD5 e03306378fa53c81ffc2003fec5b7b57
BLAKE2b-256 cd573e23fee09125d81f84a54faaf4af297c8ca903e15fdb270d263c89f1a23a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nirfmxbluetoothgen-26.5.0-py3-none-any.whl:

Publisher: Publish-Package.yml on ni/nirfmx-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

26.5.0 This release

1 file

26.3.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page