RFmx Bluetooth® Test Generation Python API Documentation ======================================================== About ===== The **nirfmx-python** repository generates Python bindings (Application Programming Interface) for interacting with the NI-RFmx drivers. **nirfmx-python** follows `Python Software Foundation `_ support policy for different versions. Operating System Support ======================== **nirfmxbluetoothgen** 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. .. code-block:: shell $ python -m pip install nirfmxbluetoothgen Support and Feedback ==================== For support with Python API, hardware, the driver runtime or any other questions, please visit `NI Community Forums `_. Documentation: ============== .. toctree:: :maxdepth: 1 attributes bluetoothgen enums errors grpc_session_options Example: ======== .. code-block:: 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_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, AWGN, Whitening btsg_session.set_all_iq_impairments_enabled("", nirfmxbluetoothgen.AllIQImpairmentsEnabled.FALSE.value) btsg_session.set_awgn_enabled("", nirfmxbluetoothgen.AwgnEnabled.FALSE.value) btsg_session.set_carrier_to_noise_ratio("", 50.0) btsg_session.set_whitening_enabled("", nirfmxbluetoothgen.WhiteningEnabled.FALSE.value) btsg_session.set_whitening_clock("", 0) # Create RFSG Session and configure 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(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 Additional Documentation ======================== Refer to the `NI-RFmx User Manual `_ for an overview of NI-RFmx, system requirements, troubleshooting, key concepts, etc. 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 :py:meth:`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). Indices and Tables ================== * :ref:`genindex` * :ref:`modindex`