Class AsciiCommander
- Namespace
- TechnologySolutions.Rfid.AsciiProtocol
- Assembly
- TechnologySolutions.Rfid.AsciiProtocol.Core.dll
TSLAsciiCommander provides methods to communicate with TSL devices that use the TSL ASCII 2.0 Protocol Instances of this class support: •communication with any TSL Reader via an IAsciiSerialTransport •execution of an IAsciiCommand either synchronously or asynchronously •management of the responder chain for data received from the TSL device
public class AsciiCommander : AsciiCommandExecutorBase, IAsciiCommandExecuting, IAsciiCommander, IAsciiResponderChain, IReaderConnection, IAsciiSerialTransportConsumer, IDisposable
- Inheritance
-
AsciiCommander
- Implements
- Inherited Members
- Extension Methods
Constructors
AsciiCommander()
Initializes a new instance of the AsciiCommander class
public AsciiCommander()
Properties
IsConnected
Gets a value indicating whether a reader is connected
public bool IsConnected { get; }
Property Value
Transport
Gets or sets the transport used by this AsciiCommander
public IAsciiSerialTransport Transport { get; set; }
Property Value
Methods
CanExecuteCommand()
Returns a value indicating whether a command can be executed
public override bool CanExecuteCommand()
Returns
- bool
True if ExecuteCommand can be called
Remarks
This should be false when the reader is not connected or currently executing a command
Connect(IAsciiSerialTransport)
Connect the AsciiCommander to the given reader
public bool Connect(IAsciiSerialTransport transport)
Parameters
transport
IAsciiSerialTransportThe UHF Reader that supports the TSL ASCII 2.0 protocol
Returns
- bool
True if successfully connected
Remarks
This will Disconnect() any connected Transport before assigning it to transport
Disconnect()
Disconnects from the current device by disposing and setting the Transport property to null (Nothing in Visual Basic)
public void Disconnect()
Dispose(bool)
Disposes an instance of the AsciiCommander class
protected override void Dispose(bool disposing)
Parameters
disposing
boolTrue to dispose managed as well as unmanaged resources
PermanentlyDisconnect()
Sends the signal to the accessory to permanently disconnect
[Obsolete("Execute a SleepCommand instead")]
public void PermanentlyDisconnect()
Remarks
Once issued this will require reconnecting to the reader to use the accessory again. This may require switching to the iOS Settings App This is a convenience method and is equivalent to sending a TSLSleepCommand to the reader
Send(string)
Send the given string as a CrLf terminated string, to the reader. This method waits until the command has been successfully sent
public override void Send(string line)
Parameters
line
stringline The ASCII string to send to the device
Exceptions
- InvalidOperationException
if no device is connected