Squidstat API User Manual
Loading...
Searching...
No Matches
AisDeviceTracker Class Referencefinal

This class is used track device connections to the computer. It can establish connection with plugged-in devices. It also provides instrument handlers specific to each connected device which can provide control of the specific device like starting experiments. More...

#include <AisDeviceTracker.h>

Inheritance diagram for AisDeviceTracker:

Signals

void newDeviceConnected (const QString &deviceName)
 a signal to be emitted whenever a new connection has been successfully established with a device. More...
 
void deviceDisconnected (const QString &deviceName)
 a signal to be emitted whenever a device has been disconnected. More...
 
void firmwareUpdateNotification (const QString &message)
 

Public Member Functions

AisErrorCode connectToDeviceOnComPort (const QString &comPort)
 establish a connection with a device connected on a USB port. More...
 
const AisInstrumentHandlergetInstrumentHandler (const QString &deviceName) const
 get an instrument handler to control a specific device. More...
 
const std::list< QString > getConnectedDevices () const
 get a list of all the connected devices. More...
 
int connectAllPluggedInDevices ()
 connect all devices physically plugged to the computer. More...
 
AisErrorCode updateFirmwareOnComPort (const QString &comport) const
 update firmware on connected device at USB port. More...
 
int updateFirmwareOnAllAvailableDevices ()
 request firmware update for all available devices. More...
 
void saveLogToFile (bool save)
 Allow to collect device error message in file for debugging purpose. More...
 
void setLogFilePath (const QString &path)
 This will help to change the log file directory. More...
 

Static Public Member Functions

static AisDeviceTrackerInstance ()
 

Detailed Description

This class is used track device connections to the computer. It can establish connection with plugged-in devices. It also provides instrument handlers specific to each connected device which can provide control of the specific device like starting experiments.

Member Function Documentation

◆ connectAllPluggedInDevices()

int AisDeviceTracker::connectAllPluggedInDevices ( )

connect all devices physically plugged to the computer.

This will automatically detect all the communication ports that have devices plugged in and establish a connection with each.

Returns
the number of new devices that have successfully established a connection with the computer. If a device has already been connected before calling this function, it will not be counted in the return value.
Note
emits newDeviceConnected() signal with the device name for each successful connection.

◆ connectToDeviceOnComPort()

AisErrorCode AisDeviceTracker::connectToDeviceOnComPort ( const QString &  comPort)

establish a connection with a device connected on a USB port.

Parameters
comPortthe communication port to connect through.
Returns
AisErrorCode::Success if a connection was established with the device through the given communication port. If not successful, possible returned errors are:
Note
emits newDeviceConnected() signal with the device name if establishing the connection was successful.
You need to specify the communication port specific to your computer. For example, on PC, you may find your port number through the 'device manager'. An example would be "COM15".

◆ deviceDisconnected

void AisDeviceTracker::deviceDisconnected ( const QString &  deviceName)
signal

a signal to be emitted whenever a device has been disconnected.

Parameters
deviceNamethe name of the newly disconnected device.

◆ getConnectedDevices()

const std::list< QString > AisDeviceTracker::getConnectedDevices ( ) const

get a list of all the connected devices.

Returns
a list of all the connected devices.

◆ getInstrumentHandler()

const AisInstrumentHandler & AisDeviceTracker::getInstrumentHandler ( const QString &  deviceName) const

get an instrument handler to control a specific device.

Parameters
deviceNamethe name of the connected device to get the instrument handler for.
Returns
the instrument handler that controls the specified device.
Note
You may get a list of the connected devices using getConnectedDevices(). Also, whenever a device has been connected by calling connectToDeviceOnComPort(), a signal is emitted with the device name. A signal and slot example is shown here.
See also
AisInstrumentHandler
connectToDeviceOnComPort()
getConnectedDevices()

◆ newDeviceConnected

void AisDeviceTracker::newDeviceConnected ( const QString &  deviceName)
signal

a signal to be emitted whenever a new connection has been successfully established with a device.

Parameters
deviceNamethe name of the newly connected device.
Note
this signal will be emitted for each newly connected device whenever either connectToDeviceOnComPort() or connectAllPluggedInDevices() successfully established connections.

◆ saveLogToFile()

void AisDeviceTracker::saveLogToFile ( bool  save)

Allow to collect device error message in file for debugging purpose.

Note
by default it will be true.
Parameters
saveWhen set to 'false,' it will not write logs to the file. When set to 'true,' it will begin writing device error logs to the file.
See also
setLogFilePath

◆ setLogFilePath()

void AisDeviceTracker::setLogFilePath ( const QString &  path)

This will help to change the log file directory.

Note
by default it will be Document/Admiral Instrument/API
Parameters
pathSet the path value at which you want to save the log file.
Note
If you set 'false' for 'saveLogToFile,' it will not generate the log file. It is recommended to set it to 'true' or leave the permission as the default setting.
See also
saveLogToFile

◆ updateFirmwareOnAllAvailableDevices()

int AisDeviceTracker::updateFirmwareOnAllAvailableDevices ( )

request firmware update for all available devices.

This will automatically detect devices not currently in use and update firmware if necessary.

Returns
the number of devices that have successfully requested for firmware update. If a device has already been updated firmware before calling this function, it will not be counted in the return value. If any error is generated while requesting firmware update, it will not be counted in the return value.
Note
emits firmwareUpdateNotification() signal will provide notification regarding firmware update of all devices.
You can update firmware when you reset the device physically through reset button.
See also
updateFirmwareOnComPort

◆ updateFirmwareOnComPort()

AisErrorCode AisDeviceTracker::updateFirmwareOnComPort ( const QString &  comport) const

update firmware on connected device at USB port.

Parameters
comPortthe communication port to connect through.
Returns
AisErrorCode::Success if firmware update successfully initiated through the given communication port. If not successful, possible returned errors are:
Note
emits firmwareUpdateNotification() signal to provide firmware update progress.
You need to specify the communication port specific to your computer. For example, on PC, you may find your port number through the 'device manager'. An example would be "COM15".

The documentation for this class was generated from the following file: