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:
class StateObserver : public imod::CSingleModelObserverBase
{
protected:
void OnUpdate(const istd::IChangeable::ChangeSet& changeSet) override
{
int changeFlags = changeSet.GetFlags();
if (changeFlags & IDeviceStateProvider::CF_STATE_CHANGED)
{
}
}
};
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.