Table of Contents

Interface IAsciiTransportEnumerator

Namespace
TechnologySolutions.Rfid.AsciiProtocol.Transports
Assembly
TechnologySolutions.Rfid.AsciiProtocol.Core.dll

Provides methods to identify available IAsciiTransports to use to connect to ASCII Protocol readers

public interface IAsciiTransportEnumerator

Remarks

Similar in behaviour to the Windows.Devices.Enumeration.DeviceWatcher class this reports live changes to the list of available IReaderConnections Once an instance has been created a call to Start() is required to start enumeration. The existing connections are then reported until the State changes to EnumerationCompleted after which the existing device list is complete but it will continue to monitor for new devices. When no longer required Stop() should be called or the instance should be disposed.

This is still to be worked out but App Suspend will force the enumeration to abort or stop on some platforms and may need to be resumed by the application.

Properties

CanShowAddNew

Gets a value indicating whether ShowAddNew() will display a user interface to add a new transport of this type

bool CanShowAddNew { get; }

Property Value

bool

Physical

Gets the physical transport supported by this enumerator

PhysicalTransport Physical { get; }

Property Value

PhysicalTransport

State

Gets the current state of the enumerator as notified by StateChanged

EnumerationState State { get; }

Property Value

EnumerationState

Methods

ListAsciiTransportsAsync()

Returns the IAsciiTransports already known to this enumerator

Task<IEnumerable<IAsciiTransport>> ListAsciiTransportsAsync()

Returns

Task<IEnumerable<IAsciiTransport>>

The task to get the list of known transports

Remarks

If the enumerated is not already started (i.e. in state Started or EnumerationCompleted) then it will Start() the enumerator. The task will return when the list is complete (i.e. when the enumerator reaches EnumerationCompleted). If the enumerator was not started before then it will be stopped again with a call to Stop()

ShowAddNew()

If CanShowAddNew returns true for this instance then this method will initiate the display a UI component to add a new transport of this type

void ShowAddNew()

Start()

Starts the enumerator

[Obsolete("Use StartAsync which is what is called. Provides better clarity that an Async task is started here rather than an async void")]
void Start()

StartAsync()

This is a background enumeration task that runs until StopAsync() is called.

Task StartAsync()

Returns

Task

The task that enumerates the transports and then changes in transports

Stop()

Stops the enumerator

[Obsolete("Use StopAsync which is what is called. Provides better clarity this this is async void task")]
void Stop()

StopAsync()

Returns a task that stops the enumeration task and then waits for the task to stop

Task StopAsync()

Returns

Task

The task to stop the enumeration

Events

StateChanged

Raised when the enumerator changes State

event EventHandler StateChanged

Event Type

EventHandler