ImagingTools Core SDK
Public Member Functions | List of all members
imtdev::IDeviceControllerabstract

Common interface for controlling devices. More...

#include <IDeviceController.h>

Inheritance diagram for imtdev::IDeviceController:
imtdev::IDeviceEnumerator imtdev::CDeviceControllerCompBase imtdev::CDeviceControllerProxyComp

Public Member Functions

virtual const QByteArrayList & GetSupportedDeviceTypeIds () const =0
 Get IDs of device types supported by the controller.
 
virtual const IDeviceSpecificationGetDeviceStaticInfo (const QByteArray &deviceTypeId) const =0
 Get device static info for the given device type ID.
 
virtual const imtbase::ICollectionInfoGetDeviceInstanceList () const =0
 Get the list of available device instances.
 
virtual bool SetDeviceInstanceName (const QByteArray &deviceId, const QString &name)=0
 Set custom name for a device instance.
 
virtual bool SetDeviceInstanceDescription (const QByteArray &deviceId, const QString &description)=0
 Set custom description for a device instance.
 
virtual DeviceInstancePtr GetDeviceInstance (const QByteArray &deviceId) const =0
 Get device instance info for the given device ID.
 
virtual const IDeviceStateProviderGetDeviceStateProvider () const =0
 Get provider of current device states.
 
virtual DeviceAccessorPtr OpenDevice (const QByteArray &deviceId, const iprm::IParamsSet *paramsPtr)=0
 Open a device and start its processing loop.
 
virtual bool CloseDevice (const QByteArray &deviceId)=0
 Close a device and stop its processing loop.
 
- Public Member Functions inherited from imtdev::IDeviceEnumerator
virtual StartResult StartEnumeration (IResultHandler *resultHandlerPtr)=0
 Start device enumeration process.
 
virtual void CancelEnumeration ()=0
 Cancel device enumeration process.
 

Additional Inherited Members

- Public Types inherited from imtdev::IDeviceEnumerator
enum  StartResult { SR_OK , SR_PREVIOUS_ENUMERATION_NOT_FINISHED , SR_FAILED }
 Start enumeration result codes. More...
 

Detailed Description

Common interface for controlling devices.

IDeviceController is the central control hub for device management in the imtdev library. It provides comprehensive device lifecycle management including enumeration, opening/closing, state tracking, and access to device information.

The controller acts as a facade that coordinates multiple subsystems:

Device Lifecycle:
Devices managed by the controller go through several states:
  • DS_NONE: Device is not available
  • DS_CLOSED: Device is available but not actively processing
  • DS_OPENED: Device is active and can execute commands
Usage Pattern:
// Obtain device controller reference (via component system)
IDeviceController* pController = // get from component system
// Enumerate available devices
pController->EnumerateDevices();
// Get list of discovered devices
const ICollectionInfo& devices = pController->GetDeviceInstanceList();
// Get device instance information
QByteArray deviceId = // get device ID from list
DeviceInstancePtr pInstance = pController->GetDeviceInstance(deviceId);
// Open device for command execution
DeviceAccessorPtr pAccessor = pController->OpenDevice(deviceId, nullptr);
if (pAccessor)
{
// Execute commands on the device
pAccessor->ExecuteCommand(commandId, params);
// Close device when done
pController->CloseDevice(deviceId);
}
Common interface for controlling devices.
virtual const imtbase::ICollectionInfo & GetDeviceInstanceList() const =0
Get the list of available device instances.
virtual DeviceInstancePtr GetDeviceInstance(const QByteArray &deviceId) const =0
Get device instance info for the given device ID.
virtual bool CloseDevice(const QByteArray &deviceId)=0
Close a device and stop its processing loop.
virtual DeviceAccessorPtr OpenDevice(const QByteArray &deviceId, const iprm::IParamsSet *paramsPtr)=0
Open a device and start its processing loop.
Thread Safety:
Implementations should provide thread-safe access to device lists and opened devices. The base implementation (CDeviceControllerCompBase) uses mutex protection for this purpose.
See also
IDeviceEnumerator
IDeviceAccessor
IDeviceStateProvider
IDeviceInstance
CDeviceControllerCompBase

Definition at line 83 of file IDeviceController.h.

Member Function Documentation

◆ CloseDevice()

virtual bool imtdev::IDeviceController::CloseDevice ( const QByteArray &  deviceId)
pure virtual

Close a device and stop its processing loop.

Transitions a device from DS_OPENED to DS_CLOSED state, releasing resources and stopping any active processing.

Parameters
deviceIdUnique identifier of the device to close
Returns
true if device was closed successfully, false otherwise
See also
OpenDevice()
Note
The device must be in DS_OPENED state for this operation to succeed

◆ GetDeviceInstance()

virtual DeviceInstancePtr imtdev::IDeviceController::GetDeviceInstance ( const QByteArray &  deviceId) const
pure virtual

Get device instance info for the given device ID.

Retrieves runtime information about a specific device instance, including identifiers, version information, and attributes.

Note
For some devices, instance information can only be obtained when the device is open (in DS_OPENED state).
Parameters
deviceIdUnique identifier of the device
Returns
Shared pointer to device instance, or nullptr if not found
See also
IDeviceInstance
OpenDevice()

◆ GetDeviceInstanceList()

virtual const imtbase::ICollectionInfo & imtdev::IDeviceController::GetDeviceInstanceList ( ) const
pure virtual

Get the list of available device instances.

Returns a collection containing information about all devices that have been discovered through enumeration. The collection supports iteration and provides change notifications when devices are added or removed.

Returns
Reference to collection info containing device instances
See also
EnumerateDevices()
imtbase::ICollectionInfo

◆ GetDeviceStateProvider()

virtual const IDeviceStateProvider & imtdev::IDeviceController::GetDeviceStateProvider ( ) const
pure virtual

Get provider of current device states.

Returns the state provider that tracks the current state (DS_NONE, DS_CLOSED, DS_OPENED) of all devices managed by this controller.

Returns
Reference to device state provider
See also
IDeviceStateProvider

◆ GetDeviceStaticInfo()

virtual const IDeviceSpecification * imtdev::IDeviceController::GetDeviceStaticInfo ( const QByteArray &  deviceTypeId) const
pure virtual

Get device static info for the given device type ID.

Retrieves the device specification that describes static properties, capabilities, and supported commands for a specific device type.

Parameters
deviceTypeIdUnique identifier of the device type
Returns
Pointer to device specification, or nullptr if device type is not supported
See also
IDeviceSpecification
GetSupportedDeviceTypeIds()

◆ GetSupportedDeviceTypeIds()

virtual const QByteArrayList & imtdev::IDeviceController::GetSupportedDeviceTypeIds ( ) const
pure virtual

Get IDs of device types supported by the controller.

Returns a list of device type identifiers that this controller can manage. Each device type has associated static information (IDeviceSpecification) that describes its capabilities.

Returns
Reference to list of supported device type IDs
See also
GetDeviceStaticInfo()

◆ OpenDevice()

virtual DeviceAccessorPtr imtdev::IDeviceController::OpenDevice ( const QByteArray &  deviceId,
const iprm::IParamsSet *  paramsPtr 
)
pure virtual

Open a device and start its processing loop.

Transitions a device from DS_CLOSED to DS_OPENED state, making it ready for command execution. Returns a device accessor that can be used to interact with the device.

Parameters
deviceIdUnique identifier of the device to open
paramsPtrOptional parameters for device initialization (can be nullptr)
Returns
Device accessor for command execution, or nullptr if open failed
See also
CloseDevice()
IDeviceAccessor
Note
The device must be in DS_CLOSED state for this operation to succeed

◆ SetDeviceInstanceDescription()

virtual bool imtdev::IDeviceController::SetDeviceInstanceDescription ( const QByteArray &  deviceId,
const QString &  description 
)
pure virtual

Set custom description for a device instance.

Allows overriding the default device description with custom text. This description provides additional context about the device.

Parameters
deviceIdUnique identifier of the device
descriptionCustom description to assign to the device
Returns
true if description was set successfully, false otherwise
See also
SetDeviceInstanceName()

◆ SetDeviceInstanceName()

virtual bool imtdev::IDeviceController::SetDeviceInstanceName ( const QByteArray &  deviceId,
const QString &  name 
)
pure virtual

Set custom name for a device instance.

Allows overriding the default device name with a user-friendly name. This name is typically displayed in user interfaces.

Parameters
deviceIdUnique identifier of the device
nameCustom name to assign to the device
Returns
true if name was set successfully, false otherwise
See also
SetDeviceInstanceDescription()