Metadata-Version: 2.4
Name: nirfmxbluetoothgen
Version: 26.3.0
Summary: Python APIs for interacting with RFmx Bluetooth(R) Generation Product
License: MIT
License-File: LICENSE
Keywords: rfmx,nirfmx,nirfmxbluetoothgen
Author: NI
Author-email: opensource@ni.com
Maintainer: Thangam V
Maintainer-email: thangam.v@emerson.com
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Manufacturing
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Scientific/Engineering :: Instrument Drivers
Provides-Extra: dev
Requires-Dist: fasteners (>=0.19)
Requires-Dist: grpcio (>=1.49.0,<2.0)
Requires-Dist: hightime (>=0.2.2)
Requires-Dist: numpy (>=1.22) ; python_version >= "3.9" and python_version < "3.12" and implementation_name != "pypy"
Requires-Dist: numpy (>=1.26) ; implementation_name != "pypy" and python_version == "3.12"
Requires-Dist: numpy (>=2.1) ; implementation_name == "pypy" and python_version == "3.10"
Requires-Dist: numpy (>=2.1) ; python_version >= "3.13" and python_version < "4.0" and implementation_name != "pypy"
Requires-Dist: numpy (>=2.3) ; python_version >= "3.11" and python_version < "4.0" and implementation_name == "pypy"
Requires-Dist: protobuf (>=4.21)
Project-URL: Documentation, https://nirfmx-python-nirfmxbluetoothgen.readthedocs-hosted.com/
Project-URL: Repository, https://github.com/ni/nirfmx-python
Description-Content-Type: text/markdown

| **Info**      | Contains Python APIs for interacting with RFmx Bluetooth® Test Generation Product. |
| :------------ | :------------------------------------------------------------------- |
| **Author**    | National Instruments                                                 |

# Table of Contents

- [Table of Contents](#table-of-contents)
- [About](#about)
  - [Documentation](#documentation)
  - [Operating System Support](#operating-system-support)
- [Installation](#installation)
- [License](#license)
- [Support and Feedback](#support-and-feedback)
- [Example](#example)


# About

The **nirfmx-python** repository generates Python bindings (Application Programming Interface)
for interacting with the RFmx Products.

**nirfmx-python** follows [Python Software Foundation](https://devguide.python.org/#status-of-python-branches)
support policy for different versions.


## RFmx Instr Python API Status

| Item                         | Details                      |
|------------------------------|-------------------------------|
| **Driver Version Tested**    | [2026 Q1](http://www.ni.com/downloads/)                      |
| **Supported Python Versions**| Python 3.9+ (64-bit)    |
| **Documentation**            | [RFmx Instr Docs](https://nirfmx-python-nirfmxinstr.readthedocs-hosted.com/en/latest/) |


## RFmx Bluetooth® Test Generation Python API Status

| Item                         | Details                      |
|------------------------------|-------------------------------|
| **Driver Version Tested**    | [2026 Q1](http://www.ni.com/downloads/)                      |
| **Supported Python Versions**| Python 3.9+ (64-bit)    |
| **Documentation**            | [RFmx Bluetooth® Test Generation Docs](https://nirfmx-python-nirfmxbluetoothgen.readthedocs-hosted.com/en/latest/) |


## Documentation

You can find the latest API documentation for the **nirfmx-python** package
on [Read the Docs](https://nirfmx-python-nirfmxinstr.readthedocs-hosted.com/en/latest/)

Refer to the [RFmx User Manual](https://www.ni.com/docs/en-US/bundle/rfmx/page/user-manual-welcome.html)
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](https://www.ni.com/r/hw-support) for 
which versions of the driver support your hardware on a given operating system.


## Installation

You can use [pip](http://pypi.python.org/pypi/pip) to download [nirfmxbluetoothgen](https://pypi.org/project/nirfmxbluetoothgen/) and install it.
    
    $ python -m pip install nirfmxbluetoothgen

## Upgrade

You can use [pip](http://pypi.python.org/pypi/pip) to upgrade [nirfmxbluetoothgen](https://pypi.org/project/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](https://github.com/ni/grpc-device/wiki/Server-Security-Support).


## Support and Feedback

For support with Python API, hardware, the driver runtime or any other questions,
please visit [NI Community Forums](https://forums.ni.com/).

## RFmx Bluetooth Generation Example

```python

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
```

