Photomechanics API
MftMessagesTransport Class Reference

Represents physical turn table messages transport. Provides methods for send and receive messages. More...

Inheritance diagram for MftMessagesTransport:
[legend]

Public Member Functions

 MftMessagesTransport (IDataTransport dataTransport, ILogger logger)
 Create messages transport over given channel.
 
override String ToString ()
 
async ValueTask SendCommand (String command)
 Send given command string. Command begin and end inserted automatically;
 
void StartListening ()
 Start listening for messages.
 
- Public Member Functions inherited from AsyncDisposableExtendedBase
async ValueTask DisposeAsync ()
 

Static Public Attributes

const Char CommandBegin = '#'
 PC-to-turntable command begin character.
 
const Char CommandEnd = '.'
 PC-to-turntable command end character.
 
const Char MessageBegin = '['
 Turntable-to-PC message begin character.
 
const Char MessageEnd = ']'
 Turntable-to-PC message end character.
 

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

String ConnectionInfo [get]
 ITurntableApi.ConnectionInfo.
 
Boolean IsNetwork [get]
 Determines whether this transport is running over network.
 
- 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

TypedEventHandler< MftMessagesTransport, Char > CharacterOutsideOfMessageReceived
 Occurs when received character that is not inside message (not preceded by message begin character).
 
TypedEventHandler< MftMessagesTransport, String > MessageReceived
 Occurs when message is received.
 
- 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

Represents physical turn table messages transport. Provides methods for send and receive messages.

This base class can be inherited in order to implement custom communication channel (for instance, if needed to control turntable that is connected to remote PC). The messages transport is then used by higher-level API's.

Member Function Documentation

◆ DisposeAsyncCore()

override async ValueTask MftMessagesTransport.DisposeAsyncCore ( )
protectedvirtual

Derived type disposal logic.

Implements AsyncDisposableExtendedBase.