# UniTAP.tsi_lib

class DeviceMask(enum.IntEnum):

Enum where members are also (and must be) ints

Sink = <DeviceMask.Sink: 0>
Source = <DeviceMask.Source: 1>
All = <DeviceMask.All: 2>
Nothing = <DeviceMask.Nothing: 3>

##### Inherited Members

enum.Enum
  name
  value
builtins.int
  conjugate
  bit_length
  bit_count
  to_bytes
  from_bytes
  as_integer_ratio
  real
  imag
  numerator
  denominator

class DeviceAlreadyInUse(builtins.Exception):

Redefinition of base exception. Define error of 'device already in use'.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback
  add_note
  args

class FailedToOpenDevice(builtins.Exception):

Redefinition of base exception. Define error of 'device already in use'.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback
  add_note
  args

class DeviceNotFound(builtins.Exception):

Redefinition of base exception. Define error of 'device not found'.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback
  add_note
  args

class DeviceNotSupported(builtins.Exception):

Redefinition of base exception. Define error of 'device not supported'.

##### Inherited Members

builtins.Exception
  Exception
builtins.BaseException
  with_traceback
  add_note
  args

class TsiLib:

Class `TsiLib` allows working with TSI Devices.

- Open selected device `open`.

def cleanup(self):

Clear list of devices and call function `TSI_Clean` for cleaning TSI library.

def open(self, info: Union[str, int]) -> UniTAP.dev.device.TSIDevice:

Open selected TSI device.

###### Arguments:

- info (str|int) - serial number of device or device index.

###### Returns:

> object of `TSIDevice` type

def close(self, device: UniTAP.dev.device.TSIDevice ):

Close selected device `TSIDevice` (removing from list of devices)

###### Arguments:

- device (`TSIDevice`) - object of `TSIDevice` type

def get_list_of_available_devices( self, require_caps: Optional[ DeviceMask ] = None, unallowed_caps: Optional[ DeviceMask ] = None) -> list:

Returns list of available devices for using by selected masks.

###### Arguments:

- require_caps (`DeviceMask`) - object of `DeviceMask` type
- unallowed_caps (`DeviceMask`) - object of `DeviceMask` type

###### Returns:

> object of `list` type

def get_list_of_available_roles(self, dev_series_model: Union[str, UniTAP.dev.device.TSIDevice ]) -> list:

Returns list of available roles for the selected device.

###### Arguments:

- dev_series_model (`str`|`TSIDevice`) - serial number of device

###### Returns:

> object of `list` type with `MODEL_TO_CLASS` roles

def get_str_list_of_available_roles(self, dev_series_model: Union[str, UniTAP.dev.device.TSIDevice ]) -> list:

Returns list of available roles for the selected device.

###### Arguments:

- dev_series_model (`str`|`TSIDevice`) - serial number of device

###### Returns:

> object of `list` type with `str`