Class ReaderConnectionManagerBase
- Namespace
- TechnologySolutions.Rfid.AsciiProtocol.Extensions
- Assembly
- TechnologySolutions.Rfid.AsciiProtocol.Core.dll
Abstract base implementation of the IReaderConnectionManager interface with extension points for a particular target
public abstract class ReaderConnectionManagerBase : IReaderConnectionManager, IDisposable
- Inheritance
-
ReaderConnectionManagerBase
- Implements
- Derived
- Inherited Members
Properties
ConnectedReader
Gets the name of the currently connected reader
public INamedReader ConnectedReader { get; }
Property Value
ConnectionState
Gets or sets the connection state
public ReaderConnectionState ConnectionState { get; protected set; }
Property Value
ConnectionTransport
Gets or sets the currently connected IAsciiSerialTransport or null if not connected
public IAsciiSerialTransport ConnectionTransport { get; protected set; }
Property Value
IsConnected
Gets a value indicating whether the reader is currently connected
public bool IsConnected { get; }
Property Value
Methods
AddNewReader()
Shows a user interface to add a new reader to the available readers list
public abstract void AddNewReader()
ConnectAsync(INamedReader)
Connects to the specified reader - disconnecting any existing connection. If target is null this attempts to restore a connection to the last connected reader
public virtual Task ConnectAsync(INamedReader target)
Parameters
target
INamedReaderThe reader to connect to or null
Returns
- Task
A task to perform the connect
Disconnect()
Disconnects from the currently connected reader
public virtual void Disconnect()
Dispose()
Disposes an instance of the ReaderConnectionManagerBase class
public void Dispose()
Dispose(bool)
Disposes an instance of the ReaderConnectionManagerBase class
protected virtual void Dispose(bool disposing)
Parameters
disposing
boolTrue to dispose managed as well as native resources
ListAvailableReadersAsync()
When overridden in a derived class updates the list of available readers
public abstract Task<IEnumerable<INamedReader>> ListAvailableReadersAsync()
Returns
- Task<IEnumerable<INamedReader>>
A task to perform the task
OnConnectionChanged(INamedReader, ReaderConnectionState)
Raises the connection changed event
protected virtual void OnConnectionChanged(INamedReader reader, ReaderConnectionState state)
Parameters
reader
INamedReaderThe reader that has its connection changing
state
ReaderConnectionStateThe state of the connection
PerformConnectAsync(INamedReader)
When overridden in a derived class connects to the specified target
protected abstract Task<IAsciiSerialTransport> PerformConnectAsync(INamedReader target)
Parameters
target
INamedReaderThe device to connect to
Returns
- Task<IAsciiSerialTransport>
A task to perform the task
PerformDisconnect()
When overridden in a derived class disconnects from the current reader if any
protected virtual void PerformDisconnect()
ShowSettings()
Shows the settings to turn Bluetooth on
public abstract void ShowSettings()
Events
ConnectionStateChanged
Raised when the ConnectionState has changed
public event EventHandler ConnectionStateChanged