Loading...
Searching...
No Matches
AisDeviceTracker Class Referencefinal

This class is used track device connections to the computer. It also provides instrument handlers specific to each connected device which provide control of the relevant device.

#include <AisDeviceTracker.h>

#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.
 
void deviceDisconnected (const QString &deviceName)
 a signal to be emitted whenever a device has been disconnected.
 
void firmwareUpdateNotification (const QString &message)
 a signal which is emitted regularaly during a firmware update, providing information about the progress of the update.
 

Public Member Functions

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

Static Public Member Functions

static AisDeviceTrackerInstance ()
 get the instance of the device tracker.
 

Member Function Documentation

◆ connectAllPluggedInDevices()

int AisDeviceTracker::connectAllPluggedInDevices ( )

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)
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
Parameters
deviceNamethe name of the newly disconnected device.
Examples
advancedControlFlow.cpp, basicExperiment.cpp, and pulseData.cpp.

◆ firmwareUpdateNotification

void AisDeviceTracker::firmwareUpdateNotification ( const QString & message)
signal
Parameters
messagea string containing the progress percentage message.
Examples
firmwareUpdate.cpp.

◆ getConnectedDevices()

const std::list< QString > AisDeviceTracker::getConnectedDevices ( ) const
Returns
a list of all the connected devices.

◆ getInstrumentHandler()

const AisInstrumentHandler & AisDeviceTracker::getInstrumentHandler ( const QString & deviceName) const
Parameters
deviceNamethe name of the connected device to get the instrument handler for (case sensitive).
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.
See also
AisInstrumentHandler
AisdeviceTracker::connectToDeviceOnComPort()
AisdeviceTracker::getConnectedDevices()

◆ Instance()

◆ newDeviceConnected

void AisDeviceTracker::newDeviceConnected ( const QString & deviceName)
signal
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.
Examples
advancedControlFlow.cpp, advancedExperiment.cpp, basicExperiment.cpp, dataOutput.cpp, linkedChannels.cpp, manualExperiment.cpp, nonblockingExperiment.cpp, and pulseData.cpp.

◆ saveLogToFile()

void AisDeviceTracker::saveLogToFile ( bool save)
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)
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 ( )

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
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: