ni_measurementlink_service
releases/1.4
  • API Reference
    • ni_measurementlink_service
      • Subpackages
        • ni_measurementlink_service.discovery
        • ni_measurementlink_service.grpc
        • ni_measurementlink_service.measurement
        • ni_measurementlink_service.session_management
          • Package Contents
            • Classes
            • Attributes
              • SessionManagementClient
                • SessionManagementClient.reserve_session()
                • SessionManagementClient.reserve_sessions()
                • SessionManagementClient.register_sessions()
                • SessionManagementClient.unregister_sessions()
                • SessionManagementClient.reserve_all_registered_sessions()
                • SessionManagementClient.register_multiplexer_sessions()
                • SessionManagementClient.unregister_multiplexer_sessions()
                • SessionManagementClient.get_multiplexer_sessions()
                • SessionManagementClient.get_all_registered_multiplexer_sessions()
              • GRPC_SERVICE_CLASS
              • GRPC_SERVICE_INTERFACE_NAME
              • INSTRUMENT_TYPE_NI_DAQMX
              • INSTRUMENT_TYPE_NI_DCPOWER
              • INSTRUMENT_TYPE_NI_DIGITAL_PATTERN
              • INSTRUMENT_TYPE_NI_DMM
              • INSTRUMENT_TYPE_NI_FGEN
              • INSTRUMENT_TYPE_NI_HSDIO
              • INSTRUMENT_TYPE_NI_MODEL_BASED_INSTRUMENT
              • INSTRUMENT_TYPE_NI_RELAY_DRIVER
              • INSTRUMENT_TYPE_NI_RFMX
              • INSTRUMENT_TYPE_NI_RFPM
              • INSTRUMENT_TYPE_NI_RFSA
              • INSTRUMENT_TYPE_NI_RFSG
              • INSTRUMENT_TYPE_NI_SCOPE
              • INSTRUMENT_TYPE_NI_SWITCH_EXECUTIVE_VIRTUAL_DEVICE
              • INSTRUMENT_TYPE_NONE
              • SITE_SYSTEM_PINS
              • BaseReservation
                • BaseReservation.multiplexer_session_info
                • BaseReservation.__enter__()
                • BaseReservation.__exit__()
                • BaseReservation.unreserve()
                • BaseReservation.initialize_session()
                • BaseReservation.initialize_multiplexer_session()
                • BaseReservation.initialize_sessions()
                • BaseReservation.initialize_multiplexer_sessions()
                • BaseReservation.get_connection()
                • BaseReservation.get_connection_with_multiplexer()
                • BaseReservation.get_connections()
                • BaseReservation.get_connections_with_multiplexer()
                • BaseReservation.create_nidaqmx_task()
                • BaseReservation.create_nidaqmx_tasks()
                • BaseReservation.get_nidaqmx_connection()
                • BaseReservation.get_nidaqmx_connection_with_multiplexer()
                • BaseReservation.get_nidaqmx_connections()
                • BaseReservation.get_nidaqmx_connections_with_multiplexer()
                • BaseReservation.initialize_nidcpower_session()
                • BaseReservation.initialize_nidcpower_sessions()
                • BaseReservation.get_nidcpower_connection()
                • BaseReservation.get_nidcpower_connection_with_multiplexer()
                • BaseReservation.get_nidcpower_connections()
                • BaseReservation.get_nidcpower_connections_with_multiplexer()
                • BaseReservation.initialize_nidigital_session()
                • BaseReservation.initialize_nidigital_sessions()
                • BaseReservation.get_nidigital_connection()
                • BaseReservation.get_nidigital_connection_with_multiplexer()
                • BaseReservation.get_nidigital_connections()
                • BaseReservation.get_nidigital_connections_with_multiplexer()
                • BaseReservation.initialize_nidmm_session()
                • BaseReservation.initialize_nidmm_sessions()
                • BaseReservation.get_nidmm_connection()
                • BaseReservation.get_nidmm_connection_with_multiplexer()
                • BaseReservation.get_nidmm_connections()
                • BaseReservation.get_nidmm_connections_with_multiplexer()
                • BaseReservation.initialize_nifgen_session()
                • BaseReservation.initialize_nifgen_sessions()
                • BaseReservation.get_nifgen_connection()
                • BaseReservation.get_nifgen_connection_with_multiplexer()
                • BaseReservation.get_nifgen_connections()
                • BaseReservation.get_nifgen_connections_with_multiplexer()
                • BaseReservation.initialize_niscope_session()
                • BaseReservation.initialize_niscope_sessions()
                • BaseReservation.get_niscope_connection()
                • BaseReservation.get_niscope_connection_with_multiplexer()
                • BaseReservation.get_niscope_connections()
                • BaseReservation.get_niscope_connections_with_multiplexer()
                • BaseReservation.initialize_niswitch_session()
                • BaseReservation.initialize_niswitch_sessions()
                • BaseReservation.get_niswitch_connection()
                • BaseReservation.get_niswitch_connections()
                • BaseReservation.initialize_niswitch_multiplexer_session()
                • BaseReservation.initialize_niswitch_multiplexer_sessions()
              • MultiplexerSessionContainer
                • MultiplexerSessionContainer.multiplexer_session_info
                • MultiplexerSessionContainer.__enter__()
                • MultiplexerSessionContainer.__exit__()
                • MultiplexerSessionContainer.initialize_multiplexer_session()
                • MultiplexerSessionContainer.initialize_multiplexer_sessions()
                • MultiplexerSessionContainer.initialize_niswitch_multiplexer_session()
                • MultiplexerSessionContainer.initialize_niswitch_multiplexer_sessions()
              • MultiSessionReservation
                • MultiSessionReservation.session_info
              • SingleSessionReservation
                • SingleSessionReservation.session_info
              • ChannelMapping
                • ChannelMapping.pin_or_relay_name
                • ChannelMapping.site
                • ChannelMapping.channel
                • ChannelMapping.multiplexer_resource_name
                • ChannelMapping.multiplexer_route
              • Connection
                • Connection.session
                • Connection.multiplexer_session
                • Connection.pin_or_relay_name
                • Connection.site
                • Connection.channel_name
                • Connection.session_info
                • Connection.multiplexer_resource_name
                • Connection.multiplexer_route
                • Connection.multiplexer_session_info
              • PinMapContext
                • PinMapContext.pin_map_id
                • PinMapContext.sites
              • MultiplexerSessionInformation
                • MultiplexerSessionInformation.session_name
                • MultiplexerSessionInformation.resource_name
                • MultiplexerSessionInformation.multiplexer_type_id
                • MultiplexerSessionInformation.session_exists
                • MultiplexerSessionInformation.session
              • SessionInformation
                • SessionInformation.session_name
                • SessionInformation.resource_name
                • SessionInformation.channel_list
                • SessionInformation.instrument_type_id
                • SessionInformation.session_exists
                • SessionInformation.channel_mappings
                • SessionInformation.session
              • SessionInitializationBehavior
                • SessionInitializationBehavior.AUTO
                • SessionInitializationBehavior.INITIALIZE_SERVER_SESSION
                • SessionInitializationBehavior.ATTACH_TO_SERVER_SESSION
                • SessionInitializationBehavior.INITIALIZE_SESSION_THEN_DETACH
                • SessionInitializationBehavior.ATTACH_TO_SESSION_THEN_CLOSE
              • TypedConnection
                • TypedConnection.pin_or_relay_name
                • TypedConnection.site
                • TypedConnection.channel_name
                • TypedConnection.session_info
                • TypedConnection.session
              • TypedConnectionWithMultiplexer
                • TypedConnectionWithMultiplexer.multiplexer_resource_name
                • TypedConnectionWithMultiplexer.multiplexer_type_id
                • TypedConnectionWithMultiplexer.multiplexer_route
                • TypedConnectionWithMultiplexer.multiplexer_session_info
                • TypedConnectionWithMultiplexer.multiplexer_session
              • TypedMultiplexerSessionInformation
                • TypedMultiplexerSessionInformation.session_name
                • TypedMultiplexerSessionInformation.resource_name
                • TypedMultiplexerSessionInformation.multiplexer_type_id
                • TypedMultiplexerSessionInformation.session_exists
                • TypedMultiplexerSessionInformation.session
              • TypedSessionInformation
                • TypedSessionInformation.session_name
                • TypedSessionInformation.resource_name
                • TypedSessionInformation.channel_list
                • TypedSessionInformation.instrument_type_id
                • TypedSessionInformation.session_exists
                • TypedSessionInformation.channel_mappings
                • TypedSessionInformation.session
              • Client
      • Package Contents
ni_measurementlink_service
  • API Reference
  • ni_measurementlink_service
  • ni_measurementlink_service.session_management
  • Edit on GitHub

ni_measurementlink_service.session_management

Public API for accessing the MeasurementLink session management service.

Package Contents

Classes

SessionManagementClient

Client for accessing the MeasurementLink session management service.

BaseReservation

Manages session reservation.

MultiplexerSessionContainer

Manages multiplexer session information.

MultiSessionReservation

Manages reservation for multiple sessions.

SingleSessionReservation

Manages reservation for a single session.

ChannelMapping

Mapping of each channel to the pin and site it is connected to.

Connection

Describes the connection between an instance of a pin and an instrument channel.

PinMapContext

Container for the pin map and sites.

MultiplexerSessionInformation

Container for the multiplexer session information.

SessionInformation

Container for the session information.

SessionInitializationBehavior

Specifies whether to initialize a new session or attach to an existing session.

TypedConnection

Generic version of Connection that preserves the session type.

TypedConnectionWithMultiplexer

Generic version of Connection that preserves the instrument and multiplexer session type.

TypedMultiplexerSessionInformation

Generic version of MultiplexerSessionInformation that preserves the session type.

TypedSessionInformation

Generic version of SessionInformation that preserves the session type.

Attributes

GRPC_SERVICE_CLASS

GRPC_SERVICE_INTERFACE_NAME

INSTRUMENT_TYPE_NI_DAQMX

INSTRUMENT_TYPE_NI_DCPOWER

INSTRUMENT_TYPE_NI_DIGITAL_PATTERN

INSTRUMENT_TYPE_NI_DMM

INSTRUMENT_TYPE_NI_FGEN

INSTRUMENT_TYPE_NI_HSDIO

INSTRUMENT_TYPE_NI_MODEL_BASED_INSTRUMENT

INSTRUMENT_TYPE_NI_RELAY_DRIVER

INSTRUMENT_TYPE_NI_RFMX

INSTRUMENT_TYPE_NI_RFPM

INSTRUMENT_TYPE_NI_RFSA

INSTRUMENT_TYPE_NI_RFSG

INSTRUMENT_TYPE_NI_SCOPE

INSTRUMENT_TYPE_NI_SWITCH_EXECUTIVE_VIRTUAL_DEVICE

INSTRUMENT_TYPE_NONE

SITE_SYSTEM_PINS

Site number used to identify and filter by system pins.

Client

Alias for compatibility with code that uses session_management.Client.

class ni_measurementlink_service.session_management.SessionManagementClient(*, discovery_client=None, grpc_channel=None, grpc_channel_pool=None)[source]

Bases: object

Client for accessing the MeasurementLink session management service.

Parameters:
  • discovery_client (Optional[ni_measurementlink_service.discovery.DiscoveryClient]) –

  • grpc_channel (Optional[grpc.Channel]) –

  • grpc_channel_pool (Optional[ni_measurementlink_service.grpc.channelpool.GrpcChannelPool]) –

reserve_session(context, pin_or_relay_names=None, instrument_type_id=None, timeout=0.0)[source]

Reserve a single session.

Reserve the session matching the given pins, sites, and instrument type ID and return the information needed to create or access the session.

Parameters:
  • context (ni_measurementlink_service.session_management._types.PinMapContext) – Includes the pin map ID for the pin map in the Pin Map Service, as well as the list of sites for the measurement.

  • pin_or_relay_names (Union[str, Iterable[str], None]) –

    One or multiple pins, pin groups, relays, or relay groups to use for the measurement.

    If unspecified, reserve sessions for all pins and relays in the registered pin map resource.

  • instrument_type_id (Optional[str]) –

    Instrument type ID for the measurement.

    If unspecified, this method reserve sessions for all instrument types connected in the registered pin map resource.

    For NI instruments, use instrument type id constants, such as INSTRUMENT_TYPE_NI_DCPOWER or INSTRUMENT_TYPE_NI_DMM.

    For custom instruments, use the instrument type id defined in the pin map file.

  • timeout (Optional[float]) –

    Timeout in seconds.

    Allowed values: 0 (non-blocking, fails immediately if resources cannot be reserved), -1 (infinite timeout), or any other positive numeric value (wait for that number of seconds)

Returns:

A reservation object with which you can query information about the session and unreserve it.

Return type:

ni_measurementlink_service.session_management._reservation.SingleSessionReservation

reserve_sessions(context, pin_or_relay_names=None, instrument_type_id=None, timeout=0.0)[source]

Reserve multiple sessions.

Reserve sessions matching the given pins, sites, and instrument type ID and return the information needed to create or access the sessions.

Parameters:
  • context (ni_measurementlink_service.session_management._types.PinMapContext) – Includes the pin map ID for the pin map in the Pin Map Service, as well as the list of sites for the measurement.

  • pin_or_relay_names (Union[str, Iterable[str], None]) –

    One or multiple pins, pin groups, relays, or relay groups to use for the measurement.

    If unspecified, reserve sessions for all pins and relays in the registered pin map resource.

  • instrument_type_id (Optional[str]) –

    Instrument type ID for the measurement.

    If unspecified, this method reserves sessions for all instrument types connected in the registered pin map resource.

    For NI instruments, use instrument type id constants, such as INSTRUMENT_TYPE_NI_DCPOWER or INSTRUMENT_TYPE_NI_DMM.

    For custom instruments, use the instrument type id defined in the pin map file.

  • timeout (Optional[float]) –

    Timeout in seconds.

    Allowed values: 0 (non-blocking, fails immediately if resources cannot be reserved), -1 (infinite timeout), or any other positive numeric value (wait for that number of seconds)

Returns:

A reservation object with which you can query information about the sessions and unreserve them.

Return type:

ni_measurementlink_service.session_management._reservation.MultiSessionReservation

register_sessions(session_info)[source]

Register sessions with the session management service.

Indicates that the sessions are open and will need to be closed later.

Parameters:

session_info (Iterable[ni_measurementlink_service.session_management._types.SessionInformation]) – Sessions to register.

Return type:

None

unregister_sessions(session_info)[source]

Unregisters sessions from the session management service.

Indicates that the sessions have been closed and will need to be reopened before they can be used again.

Parameters:

session_info (Iterable[ni_measurementlink_service.session_management._types.SessionInformation]) – Sessions to unregister.

Return type:

None

reserve_all_registered_sessions(instrument_type_id=None, timeout=0.0)[source]

Reserve all sessions currently registered with the session management service.

Parameters:
  • instrument_type_id (Optional[str]) –

    Instrument type ID for the measurement.

    If unspecified, reserve sessions for all instrument types connected in the registered pin map resource.

    For NI instruments, use instrument type id constants, such as INSTRUMENT_TYPE_NI_DCPOWER or INSTRUMENT_TYPE_NI_DMM.

    For custom instruments, use the instrument type id defined in the pin map file.

  • timeout (Optional[float]) –

    Timeout in seconds.

    Allowed values: 0 (non-blocking, fails immediately if resources cannot be reserved), -1 (infinite timeout), or any other positive numeric value (wait for that number of seconds)

Returns:

A reservation object with which you can query information about the sessions and unreserve them.

Return type:

ni_measurementlink_service.session_management._reservation.MultiSessionReservation

register_multiplexer_sessions(multiplexer_session_info)[source]

Register multiplexer sessions with the session management service.

Indicates that the sessions are open and will need to be closed later.

Parameters:

multiplexer_session_info (Iterable[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]) – Sessions to register.

Return type:

None

unregister_multiplexer_sessions(multiplexer_session_info)[source]

Unregisters multiplexer sessions from the session management service.

Indicates that the sessions have been closed and will need to be reopened before they can be used again.

Parameters:

multiplexer_session_info (Iterable[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]) – Sessions to unregister.

Return type:

None

get_multiplexer_sessions(pin_map_context, multiplexer_type_id=None)[source]

Get all multiplexer session infos matching the specified criteria.

Returns the information needed to create or access the multiplexer sessions without reserving the connected instruments.

Parameters:
  • pin_map_context (ni_measurementlink_service.session_management._types.PinMapContext) – Includes the pin map ID for the pin map in the pin map service, as well as the list of sites for the measurement.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

The multiplexer session container with the matching session infos.

Return type:

ni_measurementlink_service.session_management._reservation.MultiplexerSessionContainer

get_all_registered_multiplexer_sessions(multiplexer_type_id=None)[source]

Get all multiplexer session infos registered with the session management service.

Parameters:

multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

The multiplexer session container with the matching session infos registered with the session management service.

Return type:

ni_measurementlink_service.session_management._reservation.MultiplexerSessionContainer

ni_measurementlink_service.session_management.GRPC_SERVICE_CLASS = 'ni.measurementlink.sessionmanagement.v1.SessionManagementService'
ni_measurementlink_service.session_management.GRPC_SERVICE_INTERFACE_NAME = 'ni.measurementlink.sessionmanagement.v1.SessionManagementService'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_DAQMX = 'niDAQmx'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_DCPOWER = 'niDCPower'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_DIGITAL_PATTERN = 'niDigitalPattern'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_DMM = 'niDMM'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_FGEN = 'niFGen'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_HSDIO = 'niHSDIO'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_MODEL_BASED_INSTRUMENT = 'niModelBasedInstrument'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_RELAY_DRIVER = 'niRelayDriver'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_RFMX = 'niRFmx'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_RFPM = 'niRFPM'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_RFSA = 'niRFSA'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_RFSG = 'niRFSG'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_SCOPE = 'niScope'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NI_SWITCH_EXECUTIVE_VIRTUAL_DEVICE = 'niSwitchExecutiveVirtualDevice'
ni_measurementlink_service.session_management.INSTRUMENT_TYPE_NONE = ''
ni_measurementlink_service.session_management.SITE_SYSTEM_PINS

Site number used to identify and filter by system pins.

Pins that have a site number of SITE_SYSTEM_PINS are system pins and do not belong to a specific site.

When querying connections, you can specify a site number of SITE_SYSTEM_PINS to restrict the query to return only system pins.

class ni_measurementlink_service.session_management.BaseReservation(session_management_client, session_info, multiplexer_session_info=None, pin_or_relay_group_mappings=None, reserved_pin_or_relay_names=None, reserved_sites=None)[source]

Bases: _BaseSessionContainer

Manages session reservation.

Parameters:
  • session_management_client (ni_measurementlink_service.session_management._client.SessionManagementClient) –

  • session_info (Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.SessionInformation]) –

  • multiplexer_session_info (Optional[Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.MultiplexerSessionInformation]]) –

  • pin_or_relay_group_mappings (Optional[Mapping[str, Iterable[str]]]) –

  • reserved_pin_or_relay_names (Union[str, Iterable[str], None]) –

  • reserved_sites (Optional[Iterable[int]]) –

property multiplexer_session_info: Sequence[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]

Multiplexer session information object.

Return type:

Sequence[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]

__enter__()[source]

Context management protocol. Returns self.

Return type:

Self

__exit__(exc_type, exc_val, traceback)[source]

Context management protocol. Calls unreserve().

Parameters:
  • exc_type (Optional[Type[BaseException]]) –

  • exc_val (Optional[BaseException]) –

  • traceback (Optional[types.TracebackType]) –

Return type:

Literal[False]

unreserve()[source]

Unreserve sessions.

Return type:

None

initialize_session(session_constructor, instrument_type_id)[source]

Initialize a single instrument session.

This is a generic method that supports any instrument driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.SessionInformation], ni_measurementlink_service.session_management._types.TSession]) – A function that constructs sessions based on session information.

  • instrument_type_id (str) –

    Instrument type ID for the session.

    For custom instruments, use the instrument type id defined in the pin map file.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If the instrument type ID is empty, no reserved sessions match the instrument type ID, or too many reserved sessions match the instrument type ID.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[ni_measurementlink_service.session_management._types.TSession]]

initialize_multiplexer_session(session_constructor, multiplexer_type_id=None)[source]

Initialize a single multiplexer session.

This is a generic method that supports any multiplexer driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation], ni_measurementlink_service.session_management._types.TMultiplexerSession]) – A function that constructs multiplexer sessions based on multiplexer session information.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a multiplexer session information

object. The session object is available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available or too many multiplexer sessions are available.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_sessions(session_constructor, instrument_type_id)[source]

Initialize multiple instrument sessions.

This is a generic method that supports any instrument driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.SessionInformation], ni_measurementlink_service.session_management._types.TSession]) – A function that constructs sessions based on session information.

  • instrument_type_id (str) –

    Instrument type ID for the session.

    For custom instruments, use the instrument type id defined in the pin map file.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If the instrument type ID is empty or no reserved sessions matched the instrument type ID.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[ni_measurementlink_service.session_management._types.TSession]]]

initialize_multiplexer_sessions(session_constructor, multiplexer_type_id=None)[source]

Initialize multiple multiplexer sessions.

This is a generic method that supports any multiplexer driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation], ni_measurementlink_service.session_management._types.TMultiplexerSession]) – A function that constructs multiplexer sessions based on multiplexer session information.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a sequence of multiplexer session information

objects. The session objects are available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[ni_measurementlink_service.session_management._types.TMultiplexerSession]]]

get_connection(session_type, pin_or_relay_name=None, site=None, instrument_type_id=None)[source]

Get the connection matching the specified criteria.

This is a generic method that supports any instrument driver.

Parameters:
  • session_type (Type[ni_measurementlink_service.session_management._types.TSession]) – The session type.

  • pin_or_relay_name (Optional[str]) – The pin or relay name to match against. If not specified, the pin or relay name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

  • instrument_type_id (Optional[str]) – The instrument type ID to match against. If not specified, the instrument type ID is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[ni_measurementlink_service.session_management._types.TSession]

get_connection_with_multiplexer(session_type, multiplexer_session_type, pin_or_relay_name=None, site=None, instrument_type_id=None)[source]

Get the connection matching the specified criteria.

This is a generic method that supports any instrument driver.

Parameters:
  • session_type (Type[ni_measurementlink_service.session_management._types.TSession]) – The instrument session type.

  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_or_relay_name (Optional[str]) – The pin or relay name to match against. If not specified, the pin or relay name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

  • instrument_type_id (Optional[str]) – The instrument type ID to match against. If not specified, the instrument type ID is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[ni_measurementlink_service.session_management._types.TSession, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_connections(session_type, pin_or_relay_names=None, sites=None, instrument_type_id=None)[source]

Get all connections matching the specified criteria.

This is a generic method that supports any instrument driver.

Parameters:
  • session_type (Type[ni_measurementlink_service.session_management._types.TSession]) – The expected session type.

  • pin_or_relay_names (Union[str, Iterable[str], None]) – The pin or relay name(s) to match against. If not specified, the pin or relay name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

  • instrument_type_id (Optional[str]) – The instrument type ID to match against. If not specified, the instrument type ID is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[ni_measurementlink_service.session_management._types.TSession]]

get_connections_with_multiplexer(session_type, multiplexer_session_type, pin_or_relay_names=None, sites=None, instrument_type_id=None)[source]

Get all connections matching the specified criteria.

This is a generic method that supports any instrument driver.

Parameters:
  • session_type (Type[ni_measurementlink_service.session_management._types.TSession]) – The instrument session type.

  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_or_relay_names (Union[str, Iterable[str], None]) – The pin or relay name(s) to match against. If not specified, the pin or relay name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

  • instrument_type_id (Optional[str]) – The instrument type ID to match against. If not specified, the instrument type ID is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[ni_measurementlink_service.session_management._types.TSession, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

create_nidaqmx_task(initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Create a single NI-DAQmx task.

Parameters:

initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will create a new task or attach to an existing task.

Returns:

A context manager that yields a session information object. The task object is available via the session field.

Raises:

ValueError – If no NI-DAQmx tasks are reserved or too many NI-DAQmx tasks are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidaqmx.Task]]

Note

If the session_exists field is False, the returned task is empty and the caller is expected to add channels to it.

See also

For more details, see nidaqmx.Task.

create_nidaqmx_tasks(initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Create multiple NI-DAQmx tasks.

Parameters:

initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will create a new task or attach to an existing task.

Returns:

A context manager that yields a sequence of session information objects. The task objects are available via the session field.

Raises:

ValueError – If no NI-DAQmx tasks are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidaqmx.Task]]]

Note

If the session_exists field is False, the returned tasks are empty and the caller is expected to add channels to them.

See also

For more details, see nidaqmx.Task.

get_nidaqmx_connection(pin_name=None, site=None)[source]

Get the NI-DAQmx connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[nidaqmx.Task]

get_nidaqmx_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-DAQmx connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidaqmx.Task, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_nidaqmx_connections(pin_names=None, sites=None)[source]

Get all NI-DAQmx connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[nidaqmx.Task]]

get_nidaqmx_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-DAQmx connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidaqmx.Task, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_nidcpower_session(reset=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-DCPower instrument session.

Parameters:
  • reset (bool) – Specifies whether to reset channel(s) during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDCPOWER_SIMULATE, NIDCPOWER_BOARD_TYPE, and NIDCPOWER_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no NI-DCPower sessions are reserved or too many NI-DCPower sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidcpower.Session]]

See also

For more details, see nidcpower.Session.

initialize_nidcpower_sessions(reset=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-DCPower instrument sessions.

Parameters:
  • reset (bool) – Specifies whether to reset channel(s) during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDCPOWER_SIMULATE, NIDCPOWER_BOARD_TYPE, and NIDCPOWER_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no NI-DCPower sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidcpower.Session]]]

See also

For more details, see nidcpower.Session.

get_nidcpower_connection(pin_name=None, site=None)[source]

Get the NI-DCPower connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[nidcpower.Session]

get_nidcpower_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-DCPower connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidcpower.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_nidcpower_connections(pin_names=None, sites=None)[source]

Get all NI-DCPower connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[nidcpower.Session]]

get_nidcpower_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-DCPower connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidcpower.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_nidigital_session(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-Digital Pattern instrument session.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDIGITAL_SIMULATE, NIDIGITAL_BOARD_TYPE, and NIDIGITAL_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no NI-Digital sessions are reserved or too many NI-Digital sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidigital.Session]]

See also

For more details, see nidigital.Session.

initialize_nidigital_sessions(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-Digital Pattern instrument sessions.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDIGITAL_SIMULATE, NIDIGITAL_BOARD_TYPE, and NIDIGITAL_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no NI-Digital sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidigital.Session]]]

See also

For more details, see nidigital.Session.

get_nidigital_connection(pin_name=None, site=None)[source]

Get the NI-Digital Pattern connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[nidigital.Session]

get_nidigital_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-Digital Pattern connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidigital.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_nidigital_connections(pin_names=None, sites=None)[source]

Get all NI-Digital Pattern connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[nidigital.Session]]

get_nidigital_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-Digital Pattern connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidigital.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_nidmm_session(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-DMM instrument session.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDMM_SIMULATE, NIDMM_BOARD_TYPE, and NIDMM_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no NI-DMM sessions are reserved or too many NI-DMM sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidmm.Session]]

See also

For more details, see nidmm.Session.

initialize_nidmm_sessions(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-DMM instrument sessions.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDMM_SIMULATE, NIDMM_BOARD_TYPE, and NIDMM_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no NI-DMM sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidmm.Session]]]

See also

For more details, see nidmm.Session.

get_nidmm_connection(pin_name=None, site=None)[source]

Get the NI-DMM connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[nidmm.Session]

get_nidmm_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-DMM connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidmm.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_nidmm_connections(pin_names=None, sites=None)[source]

Get all NI-DMM connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[nidmm.Session]]

get_nidmm_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-DMM connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidmm.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_nifgen_session(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-FGEN instrument session.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIFGEN_SIMULATE, NIFGEN_BOARD_TYPE, and NIFGEN_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no NI-FGEN sessions are reserved or too many NI-FGEN sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[nifgen.Session]]

See also

For more details, see nifgen.Session.

initialize_nifgen_sessions(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-FGEN instrument sessions.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIFGEN_SIMULATE, NIFGEN_BOARD_TYPE, and NIFGEN_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no NI-FGEN sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[nifgen.Session]]]

See also

For more details, see nifgen.Session.

get_nifgen_connection(pin_name=None, site=None)[source]

Get the NI-FGEN connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[nifgen.Session]

get_nifgen_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-FGEN connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nifgen.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_nifgen_connections(pin_names=None, sites=None)[source]

Get all NI-FGEN connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[nifgen.Session]]

get_nifgen_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-FGEN connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nifgen.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_niscope_session(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-SCOPE instrument session.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NISCOPE_SIMULATE, NISCOPE_BOARD_TYPE, and NISCOPE_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no NI-SCOPE sessions are reserved or too many NI-SCOPE sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[niscope.Session]]

See also

For more details, see niscope.Session.

initialize_niscope_sessions(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-SCOPE instrument sessions.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NISCOPE_SIMULATE, NISCOPE_BOARD_TYPE, and NISCOPE_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no NI-SCOPE sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[niscope.Session]]]

See also

For more details, see niscope.Session.

get_niscope_connection(pin_name=None, site=None)[source]

Get the NI-SCOPE connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[niscope.Session]

get_niscope_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-SCOPE connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[niscope.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_niscope_connections(pin_names=None, sites=None)[source]

Get all NI-SCOPE connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[niscope.Session]]

get_niscope_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-SCOPE connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[niscope.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_niswitch_session(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-SWITCH relay driver instrument session.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no relay driver sessions are reserved or too many relay driver sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[niswitch.Session]]

See also

For more details, see niswitch.Session.

initialize_niswitch_sessions(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-SWITCH relay driver instrument sessions.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no relay driver sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[niswitch.Session]]]

See also

For more details, see niswitch.Session.

get_niswitch_connection(relay_name=None, site=None)[source]

Get the NI-SWITCH relay driver connection matching the specified criteria.

Parameters:
  • relay_name (Optional[str]) – The relay name to match against. If not specified, the relay name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[niswitch.Session]

get_niswitch_connections(relay_names=None, sites=None)[source]

Get all NI-SWITCH relay driver connections matching the specified criteria.

Parameters:
  • relay_names (Union[str, Iterable[str], None]) – The relay name(s) to match against. If not specified, the relay name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[niswitch.Session]]

initialize_niswitch_multiplexer_session(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO, multiplexer_type_id=None)[source]

Initialize a single NI-SWITCH multiplexer session.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a session information object. The

multiplexer session object is available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available or too many multiplexer sessions are available.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[niswitch.Session]]

See also

For more details, see niswitch.Session.

initialize_niswitch_multiplexer_sessions(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO, multiplexer_type_id=None)[source]

Initialize multiple NI-SWITCH multiplexer sessions.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a sequence of multiplexer session

information objects. The session objects are available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[niswitch.Session]]]

See also

For more details, see niswitch.Session.

class ni_measurementlink_service.session_management.MultiplexerSessionContainer(session_management_client, multiplexer_session_info)[source]

Bases: _BaseSessionContainer

Manages multiplexer session information.

Parameters:
  • session_management_client (ni_measurementlink_service.session_management._client.SessionManagementClient) –

  • multiplexer_session_info (Optional[Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.MultiplexerSessionInformation]]) –

property multiplexer_session_info: Sequence[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]

Multiplexer session information object.

Return type:

Sequence[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]

__enter__()[source]

Context management protocol. Returns self.

Return type:

Self

__exit__(exc_type, exc_val, traceback)[source]

Context management protocol.

Parameters:
  • exc_type (Optional[Type[BaseException]]) –

  • exc_val (Optional[BaseException]) –

  • traceback (Optional[types.TracebackType]) –

Return type:

None

initialize_multiplexer_session(session_constructor, multiplexer_type_id=None)[source]

Initialize a single multiplexer session.

This is a generic method that supports any multiplexer driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation], ni_measurementlink_service.session_management._types.TMultiplexerSession]) – A function that constructs multiplexer sessions based on multiplexer session information.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a multiplexer session information

object. The session object is available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available or too many multiplexer sessions are available.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_multiplexer_sessions(session_constructor, multiplexer_type_id=None)[source]

Initialize multiple multiplexer sessions.

This is a generic method that supports any multiplexer driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation], ni_measurementlink_service.session_management._types.TMultiplexerSession]) – A function that constructs multiplexer sessions based on multiplexer session information.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a sequence of multiplexer session information

objects. The session objects are available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[ni_measurementlink_service.session_management._types.TMultiplexerSession]]]

initialize_niswitch_multiplexer_session(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO, multiplexer_type_id=None)[source]

Initialize a single NI-SWITCH multiplexer session.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_MULTIPLEXER_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a session information object. The

multiplexer session object is available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available or too many multiplexer sessions are available.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[niswitch.Session]]

See also

For more details, see niswitch.Session.

initialize_niswitch_multiplexer_sessions(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO, multiplexer_type_id=None)[source]

Initialize multiple NI-SWITCH multiplexer sessions.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_MULTIPLEXER_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a sequence of multiplexer session

information objects. The session objects are available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[niswitch.Session]]]

See also

For more details, see niswitch.Session.

class ni_measurementlink_service.session_management.MultiSessionReservation(session_management_client, session_info, multiplexer_session_info=None, pin_or_relay_group_mappings=None, reserved_pin_or_relay_names=None, reserved_sites=None)[source]

Bases: BaseReservation

Manages reservation for multiple sessions.

Parameters:
  • session_management_client (ni_measurementlink_service.session_management._client.SessionManagementClient) –

  • session_info (Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.SessionInformation]) –

  • multiplexer_session_info (Optional[Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.MultiplexerSessionInformation]]) –

  • pin_or_relay_group_mappings (Optional[Mapping[str, Iterable[str]]]) –

  • reserved_pin_or_relay_names (Union[str, Iterable[str], None]) –

  • reserved_sites (Optional[Iterable[int]]) –

property session_info: List[ni_measurementlink_service.session_management._types.SessionInformation]

Multiple session information objects.

Return type:

List[ni_measurementlink_service.session_management._types.SessionInformation]

class ni_measurementlink_service.session_management.SingleSessionReservation(session_management_client, session_info, multiplexer_session_info=None, pin_or_relay_group_mappings=None, reserved_pin_or_relay_names=None, reserved_sites=None)[source]

Bases: BaseReservation

Manages reservation for a single session.

Parameters:
  • session_management_client (ni_measurementlink_service.session_management._client.SessionManagementClient) –

  • session_info (Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.SessionInformation]) –

  • multiplexer_session_info (Optional[Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.MultiplexerSessionInformation]]) –

  • pin_or_relay_group_mappings (Optional[Mapping[str, Iterable[str]]]) –

  • reserved_pin_or_relay_names (Union[str, Iterable[str], None]) –

  • reserved_sites (Optional[Iterable[int]]) –

property session_info: ni_measurementlink_service.session_management._types.SessionInformation

Single session information object.

Return type:

ni_measurementlink_service.session_management._types.SessionInformation

class ni_measurementlink_service.session_management.ChannelMapping[source]

Bases: NamedTuple

Mapping of each channel to the pin and site it is connected to.

pin_or_relay_name: str

The pin or relay that is mapped to a channel.

site: int

The site on which the pin or relay is mapped to a channel.

For system pins/relays, the site number is SITE_SYSTEM_PINS (-1) as they do not belong to a specific site.

channel: str

The channel to which the pin or relay is mapped on this site.

multiplexer_resource_name: str

The multiplexer resource name used to open this session in the driver.

multiplexer_route: str

The multiplexer route through which the pin is connected to an instrument’s channel.

class ni_measurementlink_service.session_management.Connection[source]

Bases: NamedTuple

Describes the connection between an instance of a pin and an instrument channel.

This object maps a pin or relay on a specific site to the corresponding instrument session and channel name.

property session: object

The instrument session.

Return type:

object

property multiplexer_session: object

The multiplexer session.

Return type:

object

pin_or_relay_name: str

The pin or relay name.

site: int

The site number.

For system pins/relays, the site number is SITE_SYSTEM_PINS (-1) as they do not belong to a specific site.

channel_name: str

The instrument channel name.

session_info: SessionInformation

The instrument session information.

multiplexer_resource_name: str

Resource name used to open this session in the driver.

multiplexer_route: str

The multiplexer route through which the pin is connected to an instrument’s channel.

multiplexer_session_info: MultiplexerSessionInformation | None

The multiplexer session information.

class ni_measurementlink_service.session_management.PinMapContext[source]

Bases: NamedTuple

Container for the pin map and sites.

pin_map_id: str

The resource id of the pin map in the Pin Map service that should be used for the call.

sites: List[int] | None

List of site numbers being used for the call.

If None or empty, use all sites in the pin map.

class ni_measurementlink_service.session_management.MultiplexerSessionInformation[source]

Bases: NamedTuple

Container for the multiplexer session information.

session_name: str

Session name used by the session management service and NI gRPC Device Server.

resource_name: str

Resource name used to open this session in the driver.

multiplexer_type_id: str

User-defined identifier for the multiplexer type in the pin map editor.

session_exists: bool

Indicates whether the session is registered with the session management service.

When calling measurements from TestStand, the test sequence’s ProcessSetup callback creates instrument sessions and registers them with the session management service so that they can be shared between multiple measurement steps. In this case, the session_exists attribute is True, indicating that the instrument sessions were already created and any one-time setup has been performed.

When calling measurements outside of TestStand, the session_exists attribute is False, indicating that the measurement is responsible for creating the instrument sessions and performing any one-time setup.

session: object

The driver session object.

This field is None until the appropriate initialize_multiplexer_session(s) method is called.

class ni_measurementlink_service.session_management.SessionInformation[source]

Bases: NamedTuple

Container for the session information.

session_name: str

Session name used by the session management service and NI gRPC Device Server.

resource_name: str

Resource name used to open this session in the driver.

channel_list: str

Channel list used for driver initialization and measurement methods.

This field is empty for any SessionInformation returned from Client.reserve_all_registered_sessions.

instrument_type_id: str

Indicates the instrument type for this session.

Pin maps have built in instrument definitions using the instrument type id constants such as INSTRUMENT_TYPE_NI_DCPOWER. For custom instruments, the user defined instrument type id is defined in the pin map file.

session_exists: bool

Indicates whether the session is registered with the session management service.

When calling measurements from TestStand, the test sequence’s ProcessSetup callback creates instrument sessions and registers them with the session management service so that they can be shared between multiple measurement steps. In this case, the session_exists attribute is True, indicating that the instrument sessions were already created and any one-time setup (such as creating NI-DAQmx channels or loading NI-Digital files) has been performed.

When calling measurements outside of TestStand, the session_exists attribute is False, indicating that the measurement is responsible for creating the instrument sessions and performing any one-time setup.

channel_mappings: Iterable[ChannelMapping]

List of mappings from channels to pins and sites.

Each item contains a mapping for a channel in this instrument resource, in the order of the channel_list. This field is empty for any SessionInformation returned from Client.reserve_all_registered_sessions.

session: object

The driver session object.

This field is None until the appropriate initialize_session(s) method is called.

class ni_measurementlink_service.session_management.SessionInitializationBehavior[source]

Bases: enum.IntEnum

Specifies whether to initialize a new session or attach to an existing session.

AUTO = 0

The NI gRPC Device Server will attach to an existing session with the specified name if it exists, otherwise the server will initialize a new session.

Note: When using the Session as a context manager and the context exits, the behavior depends on what happened when the constructor was called. If it resulted in a new session being initialized on the NI gRPC Device Server, then it will automatically close the server session. If it instead attached to an existing session, then it will detach from the server session and leave it open.

INITIALIZE_SERVER_SESSION = 1

Initialize a new session with the specified name.

Note: When using the Session as a context manager and the context exits, it will automatically close the server session.

ATTACH_TO_SERVER_SESSION = 2

Attach to an existing session with the specified name.

Note: When using the Session as a context manager and the context exits, it will detach from the server session and leave it open.

INITIALIZE_SESSION_THEN_DETACH = 3

Initialize a new session.

When exiting the context manager, detach instead of closing.

Note: This initialization behavior is intended for TestStand code modules used in Setup steps or ProcessSetup callback sequences.

ATTACH_TO_SESSION_THEN_CLOSE = 4

Attach to an existing session.

When exiting the context manager, automatically close the server session.

Note: This initialization behavior is intended for TestStand code modules used in Cleanup steps or ProcessCleanup callback sequences.

class ni_measurementlink_service.session_management.TypedConnection[source]

Bases: Protocol, Generic[TSession_co]

Generic version of Connection that preserves the session type.

For more details, see the corresponding documentation for Connection.

property pin_or_relay_name: str

The pin or relay name.

Return type:

str

property site: int

The site number.

For system pins/relays, the site number is SITE_SYSTEM_PINS (-1) as they do not belong to a specific site.

Return type:

int

property channel_name: str

The instrument channel name.

Return type:

str

property session_info: TypedSessionInformation[TSession_co]

The instrument session information.

Return type:

TypedSessionInformation[TSession_co]

property session: TSession_co

The instrument session.

Return type:

TSession_co

class ni_measurementlink_service.session_management.TypedConnectionWithMultiplexer[source]

Bases: TypedConnection[TSession_co], Protocol, Generic[TSession_co, TMultiplexerSession_co]

Generic version of Connection that preserves the instrument and multiplexer session type.

For more details, see the corresponding documentation for Connection.

property multiplexer_resource_name: str

Resource name used to open this session in the driver.

Return type:

str

property multiplexer_type_id: str

User-defined identifier for the multiplexer type in the pin map editor.

Return type:

str

property multiplexer_route: str

The multiplexer route through which the pin is connected to an instrument’s channel.

Return type:

str

property multiplexer_session_info: TypedMultiplexerSessionInformation[TMultiplexerSession_co]

The multiplexer session information.

Return type:

TypedMultiplexerSessionInformation[TMultiplexerSession_co]

property multiplexer_session: TMultiplexerSession_co

The multiplexer session.

Return type:

TMultiplexerSession_co

class ni_measurementlink_service.session_management.TypedMultiplexerSessionInformation[source]

Bases: Protocol, Generic[TMultiplexerSession_co]

Generic version of MultiplexerSessionInformation that preserves the session type.

For more details, see the corresponding documentation of MultiplexerSessionInformation.

property session_name: str

Session name used by the session management service and NI gRPC Device Server.

Return type:

str

property resource_name: str

Resource name used to open this session in the driver.

Return type:

str

property multiplexer_type_id: str

User-defined identifier for the multiplexer type in the pin map editor.

Return type:

str

property session_exists: bool

Indicates whether the session is registered with the session management service.

Return type:

bool

property session: TMultiplexerSession_co

The driver session object.

Return type:

TMultiplexerSession_co

class ni_measurementlink_service.session_management.TypedSessionInformation[source]

Bases: Protocol, Generic[TSession_co]

Generic version of SessionInformation that preserves the session type.

For more details, see the corresponding documentation for SessionInformation.

property session_name: str

Session name used by the session management service and NI gRPC Device Server.

Return type:

str

property resource_name: str

Resource name used to open this session in the driver.

Return type:

str

property channel_list: str

Channel list used for driver initialization and measurement methods.

Return type:

str

property instrument_type_id: str

Indicates the instrument type for this session.

Return type:

str

property session_exists: bool

Indicates whether the session is registered with the session management service.

Return type:

bool

property channel_mappings: Iterable[ChannelMapping]

List of mappings from channels to pins and sites.

Return type:

Iterable[ChannelMapping]

property session: TSession_co

The driver session object.

Return type:

TSession_co

ni_measurementlink_service.session_management.Client

Alias for compatibility with code that uses session_management.Client.

Previous

© Copyright 2024, National Instruments. Revision 2ba12c60.

Built with Sphinx using a theme provided by Read the Docs.