Photomechanics API
MftCommandRunner Class Reference

Provides methods to send commands and receive messages from turntable. More...

Inheritance diagram for MftCommandRunner:
[legend]

Public Member Functions

 MftCommandRunner (MftMessagesTransport transport, ILogger logger)
 Construct command runner on top of the provided messages transport.
 
override String ToString ()
 
void StartConnectionWatchdog ()
 Begin periodically sending "get something" command. When using network transport, this keeps connection alive and provides additional disconnect detection measure. Also starts periodic checks if some command did not get response in expected time. API will self-dispose in that case.
 
async Task RunToCompletion (MftCommandBase command)
 Run command and then await its ITurntableCommand.WaitFinishAsync.
 
- Public Member Functions inherited from AsyncDisposableExtendedBase
async ValueTask DisposeAsync ()
 

Protected Member Functions

override async ValueTask DisposeAsyncCore ()
 Derived type disposal logic. 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.
 

Properties

MftMessagesTransport Transport [get]
 Underlying messages transport.
 
- 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...
 

Additional Inherited Members

- 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

Provides methods to send commands and receive messages from turntable.

API for handling turn table commands.

When command is sent to turn table through provided transport, it is added to internal commands list. When message is received, it's command header is compared to each of that commands and message content is dispatched to corresponding command.

When command is sent to turn table (through transport), it is added to internal commands list. When message is received, it's command header is compared to each of that commands and message content is dispatched to corresponding command.

Member Function Documentation

◆ DisposeAsyncCore()

override async ValueTask MftCommandRunner.DisposeAsyncCore ( )
protectedvirtual

Derived type disposal logic.

Implements AsyncDisposableExtendedBase.