Photomechanics API
ComponentBasedDeviceApiBase Class Referenceabstract

Default device API implementation base. More...

Inheritance diagram for ComponentBasedDeviceApiBase:
[legend]

Public Member Functions

async Task Initialize ()
 Initialize connection with device. More...
 
TComponent GetComponent< TComponent > ()
 Get component of given type. More...
 
- Public Member Functions inherited from AsyncDisposableExtendedBase
async ValueTask DisposeAsync ()
 
Task Initialize ()
 Initialize connection with device. More...
 
TComponent GetComponent< TComponent > ()
 Get component of given type. More...
 

Protected Member Functions

 ComponentBasedDeviceApiBase (ILogger logger)
 
abstract Task OnInitializing ()
 Initialize connection with turn table. More...
 
override async ValueTask DisposeAsyncCore ()
 
void InitializeComponents (IEnumerable< IDeviceApiComponent > components)
 Initialize components set. More...
 
void InitializeComponents (params IDeviceApiComponent[] components)
 Initialize components set. More...
 
- Protected Member Functions inherited from AsyncDisposableExtendedBase
 AsyncDisposableExtendedBase (ILogger logger)
 Base constructor for device api. More...
 
abstract ValueTask DisposeAsyncCore ()
 Derived type disposal logic. More...
 
void UpdateLoggerContext ()
 Unfortunately Serilog ForContext method does not store provided object as property value, calling its ToString method immediately instead. In some cases, we want to use information like device name/id as log context but it is only available when derived type is fully constructed and maybe some other initialization took place. For such cases, derived type can use this method to update Logger context value.
 

Additional Inherited Members

- Properties inherited from AsyncDisposableExtendedBase
ILogger Logger [get]
 Logger associated with this instance. This way extension methods can use logging without requiring it as parameter. More...
 
Boolean IsDisposed [get]
 Determines whether the object is being disposed or already disposed and no longer functional. More...
 
virtual IAsyncDisposableExtended Owner [get]
 Type and ToString values of this object will appear when logging begin/end of DisposeAsync. This object will also be used as Disposed sender, essentially allowing seamlessly using AsyncDisposableExtendedBase logic even when directly inheriting from it is not possible. Usually it simply returns "this" value, but AsyncDisposableExtendedImpl overrides it to return its owner instance for the aforementioned reason.
 
- Properties inherited from IAsyncDisposableExtended
Boolean IsDisposed [get]
 Determines whether the object is being disposed or already disposed and no longer functional. More...
 
ILogger Logger [get]
 Logger associated with this instance. This way extension methods can use logging without requiring it as parameter. More...
 
- Events inherited from AsyncDisposableExtendedBase
AsyncTypedEventHandler< IAsyncDisposableExtended >? Disposed
 
- Events inherited from IAsyncDisposableExtended
AsyncTypedEventHandler< IAsyncDisposableExtendedDisposed
 Occurs when object is disposed. It should be invoked at the end of IAsyncDisposable.DisposeAsync implementation in a Fire-and-Forget fashion (non-blocking).
 

Detailed Description

Default device API implementation base.

Member Function Documentation

◆ Initialize()

async Task ComponentBasedDeviceApiBase.Initialize ( )

Initialize connection with device.

Implements IComponentBasedDeviceApi.

◆ GetComponent< TComponent >()

TComponent ComponentBasedDeviceApiBase.GetComponent< TComponent > ( )

Get component of given type.

Implements IComponentBasedDeviceApi.

Type Constraints
TComponent :class 
TComponent :IDeviceApiComponent 

◆ OnInitializing()

abstract Task ComponentBasedDeviceApiBase.OnInitializing ( )
protectedpure virtual

Initialize connection with turn table.

Implemented in LegacyMftApi, MftApi, and RD300TurntableApi.

◆ DisposeAsyncCore()

override async ValueTask ComponentBasedDeviceApiBase.DisposeAsyncCore ( )
protectedvirtual

Derived type disposal logic.

Do not forget to call base.DisposeAsyncCore() when overriding this. TODO: find base call analyzer for virtual methods like this

Implements AsyncDisposableExtendedBase.

Reimplemented in LegacyMftApi, MftApi, and RD300TurntableApi.

◆ InitializeComponents() [1/2]

void ComponentBasedDeviceApiBase.InitializeComponents ( IEnumerable< IDeviceApiComponent components)
protected

Initialize components set.

Parameters
componentsComponents to be exposed to API consumers.

◆ InitializeComponents() [2/2]

void ComponentBasedDeviceApiBase.InitializeComponents ( params IDeviceApiComponent[]  components)
protected

Initialize components set.

Parameters
componentsComponents to be exposed to API consumers.