- class TMSiSDK.device.devices.apex.apex_device.ApexDevice(serial_number, dr_interface: DeviceInterfaceType, pairing_status=PairingStatus.no_pairing_needed, dongle_serial_number=0, idx=-1)#
Bases:
TMSiDevice
A class to represent and handle the Apex
- __init__(serial_number, dr_interface: DeviceInterfaceType, pairing_status=PairingStatus.no_pairing_needed, dongle_serial_number=0, idx=-1)#
Initialize the Device.
- Parameters:
dr_serial_number (int) – Serial number of the device.
dr_interface (DeviceInterfaceType) – Interface to use to communicate with the device.
pairing_status (PairingStatus, optional) – pairing status, defaults to PairingStatus.no_pairing_needed
dongle_serial_number (int) – Serial number of the dongle, default to 0.
idx (int, optional) – Device index, defaults to -1.
Methods
__init__
(serial_number, dr_interface[, ...])Initialize the Device.
close
()Closes the connection to the device.
discover
([num_retries])Discovers available devices.
download_file_from_device
(file_id[, filename])Creates a data stream to download the file from the device.
export_configuration
(filename)Exports the current configuration to an xml file.
Gets configuration for card recording.
Gets card status.
Gets the list of active channels.
Gets the list of active impedance channels.
get_device_card_file_info
(file_id)Gets the information of the file on the device's card.
Gets the list of files available on the device's card.
Gets the list of channels.
get_device_data
(POINTER_received_data_array, ...)Gets data from the device during sampling.
Returns the value of the device handle.
Gets the list of impedance channels.
Gets impedance data from the device during sampling.
Gets the report with device information.
get_device_interface_status
([interface])Gets the device interface status.
Gets the list of available devices.
Get name of the device
Returns the power status of the device
Gets the sampling configuration of the device.
get_device_sampling_frequency
([detailed])Gets the sampling frequency.
Gets the serial number of the device.
Gets the state of the device.
Gets the time on the device.
Returns the device type.
Returns the list of available dongles.
Gets the serial number of the dongle.
Gets the percentage of file downloaded.
Returns the interface of the device.
Gets the version of the DLL and USB drivers.
Gets the last event available
Gets the available events in the buffer
get_file_channels
(file_id)Gets the list of channels from the file.
get_id
()Gets the device id.
Returns if live impedance is enabled.
Returns the number of active channels of the device.
Returns the number of active impedance channels of the device.
Returns the number of channels of the device.
Returns the number of impedance channels of the device.
Returns the pairing status of the device.
get_sdk
()Gets the handle of the communication library
import_configuration
(filename)Imports the file configuration to the device.
open
([dongle_id])Opens the connection with the device.
pair_device
(device_id)Pairs the device with the dongle
Reload information from device
Resets the memory card of the device.
Resets the incoming buffer.
Resets the incoming event buffer.
Resets the device to default configuration.
set_card_recording_config
(config)Sets the configuration for recording on card.
set_device_channel_names
(names, indices)Sets the device channel names
set_device_download_file_request
(file_request)Sets the download file request to start or stop the download stream.
set_device_impedance_request
(measurement_request)Sets the impedance request to start or stop the acquisition.
set_device_interface
([device_interface, control])Set the device interface.
set_device_references
(list_references, ...)Sets the channels to be used as reference.
set_device_sampling_config
([...])Sets the sampling configuration of the device.
set_device_sampling_request
(measurement_request)Sets the sampling request to start or stop the acquisition.
set_device_time
(datetime)Sets the datetime of the device.
start_download_file
(file_id[, filename, ...])Starts the download of the file requested.
start_measurement
(measurement_type[, ...])Starts the measurement requested.
Stops the download of the file.
Stops the measurement requested.
Interrupts the download after user abort command.
- close()#
Closes the connection to the device.
- discover(num_retries: int = 3)#
Discovers available devices.
- Parameters:
dr_interface (DeviceInterfaceType) – Device interface to be searched. Allowed interfaces: usb and bluetooth.
num_retries – Number of retries, optional
- download_file_from_device(file_id: int, filename: str = None)#
Creates a data stream to download the file from the device.
- Parameters:
file_id (int) – id of the file to download.
filename (str, optional) – filename where to write the impedance report (if available), defaults to None
- Raises:
- export_configuration(filename: str)#
Exports the current configuration to an xml file.
- get_card_recording_config() TMSiDevCardRecCfg #
Gets configuration for card recording.
- Raises:
- Returns:
Configuration of the card recording.
- Return type:
- get_card_status() TMSiDevCardStatus #
Gets card status.
- Raises:
- Returns:
Configuration of the card recording.
- Return type:
- get_device_active_channels() list #
Gets the list of active channels.
- Raises:
- Returns:
The list of channels
- Return type:
list[ApexChannel]
- get_device_active_impedance_channels() list #
Gets the list of active impedance channels.
- Raises:
- Returns:
The list of channels
- Return type:
list[ApexImpedanceChannel]
- get_device_card_file_info(file_id: int) tuple #
Gets the information of the file on the device’s card.
- Parameters:
file_id (int) – Id of the file to be investigated.
- Raises:
- Returns:
A tuple with file metadata and file details.
- Return type:
- get_device_card_file_list() list #
Gets the list of files available on the device’s card.
- Raises:
- Returns:
A list of file info.
- Return type:
list[TMSiDevCardFileInfo]
- get_device_channels() list #
Gets the list of channels.
- Raises:
- Returns:
The list of channels
- Return type:
list[ApexChannel]
- get_device_data(POINTER_received_data_array: pointer, buffer_size: int, POINTER_num_of_sets: pointer, POINTER_data_type: pointer) TMSiDeviceRetVal #
Gets data from the device during sampling.
- Parameters:
POINTER_received_data_array (pointer(array[c_float])) – array that will contain the received data.
buffer_size (int) – maximum size of the buffer.
POINTER_num_of_sets (pointer(c_uint)) – number of sets of data received.
POINTER_data_type (pointer(c_int)) – type of data received.
- Raises:
TMSiError – TMSiErrorCode.api_invalid_command if device is not in sampling mode
- Returns:
return value of the call
- Return type:
- get_device_handle_value() int #
Returns the value of the device handle.
- Returns:
Device handle.
- Return type:
int
- get_device_impedance_channels() list #
Gets the list of impedance channels.
- Raises:
- Returns:
The list of channels
- Return type:
list[ApexImpedanceChannel]
- get_device_impedance_data(POINTER_received_data_array: pointer, buffer_size: int, POINTER_num_of_sets: pointer) TMSiDeviceRetVal #
Gets impedance data from the device during sampling.
- Parameters:
POINTER_received_data_array (pointer(array[TMSiImpedanceSample])) – array that will contain the received data.
buffer_size (int) – maximum size of the buffer.
POINTER_num_of_sets (pointer) – number of sets of data received.
- Raises:
TMSiError – TMSiErrorCode.api_invalid_command if device is not in sampling mode
- Returns:
return value of the call
- Return type:
- get_device_info_report() TMSiDevInfoReport #
Gets the report with device information.
- Raises:
- Returns:
the device info report.
- Return type:
- get_device_interface_status(interface=DeviceInterfaceType.bluetooth) TMSiInterfaceStatus #
Gets the device interface status.
- Parameters:
interface (DeviceInterfaceType, optional) – interface to check, defaults to DeviceInterfaceType.bluetooth
- Raises:
- Returns:
interface status of the device.
- Return type:
- get_device_list() list #
Gets the list of available devices.
- Parameters:
dr_interface (DeviceInterfaceType) – interface to check.
- Returns:
a list of available devices on the requested interface.
- Return type:
list[ApexDevice]
- get_device_name()#
Get name of the device
- Returns:
name of the device
- Return type:
str
- get_device_power_status() TMSiDevPowerStatus #
Returns the power status of the device
- Raises:
- Returns:
device power status.
- Return type:
- get_device_sampling_config() TMSiDevSamplingCfg #
Gets the sampling configuration of the device.
- Raises:
- Returns:
device sampling configuration
- Return type:
- get_device_sampling_frequency(detailed=False) int #
Gets the sampling frequency.
- Parameters:
detailed (bool, optional) – detailed frequency description, defaults to False
- Returns:
sampling frequency or frequencies.
- Return type:
int or dictionary if detailed
- get_device_serial_number() int #
Gets the serial number of the device.
- Returns:
serial number of the device.
- Return type:
int
- get_device_state() DeviceState #
Gets the state of the device.
- Returns:
the device state.
- Return type:
- get_device_time() datetime #
Gets the time on the device.
- get_device_type() str #
Returns the device type.
- Returns:
the device type.
- Return type:
str
- get_dongle_list() list #
Returns the list of available dongles.
- Returns:
list of available dongles.
- Return type:
list[ApexDongle]
- get_dongle_serial_number() int #
Gets the serial number of the dongle.
- Returns:
serial number of the device.
- Return type:
int
- get_downloaded_percentage() int #
Gets the percentage of file downloaded.
- Returns:
percentage of file downloaded.
- Return type:
int
- get_dr_interface() DeviceInterfaceType #
Returns the interface of the device.
- Returns:
the interface of the device.
- Return type:
- get_driver_version() tuple #
Gets the version of the DLL and USB drivers.
- Raises:
TMSiError – TMSiErrorCode.device_error if it fails.
- Returns:
tuple(dll_version, usb_version)
- Return type:
tuple(str, str)
- get_event()#
Gets the last event available
- Parameters:
POINTER_event (TMSiEvent) – pointer to the event structure to fill.
- get_event_buffer()#
Gets the available events in the buffer
- Returns:
TMSiDeviceRetVal
- Return type:
- get_file_channels(file_id)#
Gets the list of channels from the file.
- Parameters:
file_id (int) – id of the file
- Returns:
The list of channels
- Return type:
list[ApexChannel]
- get_id() int #
Gets the device id.
- Returns:
the device id.
- Return type:
int
- get_live_impedance() bool #
Returns if live impedance is enabled.
- Returns:
True if enabled, False if disabled.
- Return type:
bool
- get_num_active_channels() int #
Returns the number of active channels of the device.
- Returns:
number of active channels of the device.
- Return type:
int
- get_num_active_impedance_channels() int #
Returns the number of active impedance channels of the device.
- Returns:
number of active impedance channels of the device.
- Return type:
int
- get_num_channels() int #
Returns the number of channels of the device.
- Returns:
number of channels of the device.
- Return type:
int
- get_num_impedance_channels() int #
Returns the number of impedance channels of the device.
- Returns:
number of impedance channels of the device.
- Return type:
int
- get_pairing_status()#
Returns the pairing status of the device.
- Returns:
pairing status of the device.
- Return type:
- get_sdk() CDLL #
Gets the handle of the communication library
- Returns:
the handle of the communication library.
- Return type:
CDLL
- import_configuration(filename: str)#
Imports the file configuration to the device.
- open(dongle_id=65535)#
Opens the connection with the device.
- pair_device(device_id: int) TMSiDeviceRetVal #
Pairs the device with the dongle
- Parameters:
device_id (int) – Id of the device
- Returns:
return value of the call
- Return type:
- reload_device()#
Reload information from device
- Raises:
TMSiError – TMSiErrorCode.api_invalid_command if device is not in connected state
- reset_device_card()#
Resets the memory card of the device.
- reset_device_data_buffer()#
Resets the incoming buffer.
- reset_device_event_buffer()#
Resets the incoming event buffer.
- Raises:
TMSiError – TMSiErrorCode.device_error if reset fails
- reset_to_factory_default()#
Resets the device to default configuration.
- set_card_recording_config(config: TMSiDevCardRecCfg) TMSiDevCardRecCfg #
Sets the configuration for recording on card.
- Parameters:
config (TMSiDevCardRecCfg) – configuration to be set.
- Raises:
- Returns:
the new available configuration for recording on card.
- Return type:
- set_device_channel_names(names: list, indices: list) list #
Sets the device channel names
- Parameters:
names (list[str]) – names to be set.
indices (list[int]) – index of the channels to edit.
- Raises:
- Returns:
list of new channels.
- Return type:
list[ApexChannel]
- set_device_download_file_request(file_request: TMSiDevSetCardFileReq)#
Sets the download file request to start or stop the download stream.
- Parameters:
file_request (TMSiDevSetCardFileReq) – file request to start or stop.
- Raises:
- set_device_impedance_request(measurement_request: TMSiDevImpedanceRequest)#
Sets the impedance request to start or stop the acquisition.
- set_device_interface(device_interface=DeviceInterfaceType.bluetooth, control=TMSiControl.ControlEnabled) TMSiInterfaceStatus #
Set the device interface.
- Parameters:
device_interface (DeviceInterfaceType, optional) – the interface to set, defaults to DeviceInterfaceType.bluetooth
control (TMSiControl, optional) – enable or disable interface, defaults to TMSiControl.ControlEnabled
- Raises:
TMSiError – TMSiErrorCode.device_not_connected if not connected.
- Returns:
the new status of the device interface.
- Return type:
- set_device_references(list_references: list, list_indices: list)#
Sets the channels to be used as reference.
- Parameters:
list_references (list[int]) – list of reference values.
list_indices (list[int]) – list of indices to be edited.
- Raises:
- Returns:
list of new channels.
- Return type:
list[ApexChannel]
- set_device_sampling_config(sampling_frequency=ApexBaseSampleRate.Decimal, live_impedance=ApexLiveImpedance.On, impedance_limit=0) TMSiDevSamplingCfg #
Sets the sampling configuration of the device.
- Parameters:
sampling_frequency (ApexBaseSampleRate, optional) – sample rate to set, defaults to ApexBaseSampleRate.Decimal
live_impedance (ApexLiveImpedance, optional) – enable or disable live impedance, defaults to ApexLiveImpedance.On
impedance_limit (int, optional) – kOhms value of the impedance limit, defaults to 0
- Raises:
- Returns:
the new sampling configuration
- Return type:
- set_device_sampling_request(measurement_request: TMSiDevSampleRequest)#
Sets the sampling request to start or stop the acquisition.
- Parameters:
measurement_request (TMSiDevSampleRequest) – measurement request to configure the acquisition.
- Raises:
- set_device_time(datetime: datetime)#
Sets the datetime of the device.
- start_download_file(file_id: int, filename: str = None, n_of_samples: int = None)#
Starts the download of the file requested.
- Parameters:
file_id (int) – id of the file to download.
filename (str, optional) – filename where to write the impedance report (if available), defaults to None
- Raises:
- start_measurement(measurement_type: MeasurementType, thread_refresh=None)#
Starts the measurement requested.
- Parameters:
measurement_type (MeasurementType) – measurement to start
thread_refresh (float, optional.) – refresh time for sampling and conversion threads, defaults to None.
- Raises:
- stop_download_file()#
Stops the download of the file.
- Raises:
TMSiError – TMSiErrorCode.api_invalid_command if not sampling.
- stop_measurement()#
Stops the measurement requested.
- Raises:
TMSiError – TMSiErrorCode.api_invalid_command if not sampling.
- user_abort_download()#
Interrupts the download after user abort command.