ImagingTools Core SDK
List of all members
imtdev::CDeviceStateProviderAdapterComp

Adapter component providing standalone device state provider. More...

#include <CDeviceStateProviderAdapterComp.h>

Inheritance diagram for imtdev::CDeviceStateProviderAdapterComp:
imtdev::IDeviceStateProvider

Additional Inherited Members

- Public Types inherited from imtdev::IDeviceStateProvider
enum  DeviceState { DS_NONE , DS_CLOSED , DS_OPENED }
 Runtime state of a device. More...
 
enum  ChangeFlags { CF_STATE_CHANGED = istd::IChangeable::ChangeFlags::CF_NO_UNDO + 7171 }
 Change notification flags. More...
 

Detailed Description

Adapter component providing standalone device state provider.

CDeviceStateProviderAdapterComp implements the Adapter Pattern to extract and expose the IDeviceStateProvider interface from an IDeviceController as a standalone component. This enables state tracking to be used independently of the full controller interface.

Purpose:
Decouples device state tracking from device control operations, enabling:
  • State monitoring without controller access
  • Independent state provider references
  • Simplified dependency injection
  • UI binding to state changes only
Key Features:
  • Standalone Interface: Provides IDeviceStateProvider without full controller
  • Change Forwarding: Propagates state change notifications from controller
  • Automatic Binding: Connects to controller's state provider on creation
  • Cleanup Handling: Properly unbinds on destruction
Component Configuration:
Lifecycle:
  • OnComponentCreated(): Binds to controller's state provider for change notifications
  • OnComponentDestroyed(): Unbinds from controller's state provider
Usage Pattern:
// Obtain state provider adapter instance (via component system)
CDeviceStateProviderAdapterComp* pStateAdapter = // get from component system
// Component is configured with DeviceController reference
// Use as standalone state provider
IDeviceStateProvider* pStateProvider = pStateAdapter;
IDeviceStateProvider::DeviceState state = pStateProvider->GetDeviceState(deviceId);
// Register for state change notifications
class StateObserver : public imod::CSingleModelObserverBase
{
protected:
void OnUpdate(const istd::IChangeable::ChangeSet& changeSet) override
{
int changeFlags = changeSet.GetFlags();
if (changeFlags & IDeviceStateProvider::CF_STATE_CHANGED)
{
// Update UI based on state change
}
}
};
Adapter component providing standalone device state provider.
Interface for tracking device connection states.
DeviceState
Runtime state of a device.
virtual DeviceState GetDeviceState(const QByteArray &deviceId) const =0
Get the current state of a device.
See also
IDeviceStateProvider
IDeviceController
CDeviceInstanceListAdapterComp

Definition at line 76 of file CDeviceStateProviderAdapterComp.h.