Interface IAsciiSerialTransport
- Namespace
- TechnologySolutions.Rfid.AsciiProtocol
- Assembly
- TechnologySolutions.Rfid.AsciiProtocol.Core.dll
Provides a connection to a Technology Solutions ASCII Protocol reader. The connection is closed by disposing the instance
public interface IAsciiSerialTransport : IDisposable
- Inherited Members
Properties
IsDataAvailable
Gets a value indicating whether there is more data to read
[Obsolete("Use IsLineAvailable instead")]
bool IsDataAvailable { get; }
Property Value
IsLineAvailable
Gets a value indicating whether there is one or more lines to read with ReadLine()
bool IsLineAvailable { get; }
Property Value
Methods
ReadLine()
Reads a line from the port removing the terminator
string ReadLine()
Returns
- string
The line read
Remarks
Though not defied older implementations of this interface throw a InvalidOperationException when this method is called when not IsLineAvailable. Newer implementations should return a line or empty line when IsLineAvailable and return null (Nothing in Visual Basic) if there is no line to read. The caller then has the opportunity to call ReadLine without having to check IsLineAvailable and not have an exception thrown. Older code that uses a newer implementation will probably encounter a NullReferenceException rather than an InvalidOperationException as they attempt to use the result of the call to ReadLine
WriteLine(string)
Sends the line to the port appending the appropriate line end
void WriteLine(string value)
Parameters
value
stringThe line to write
Events
ConnectionLost
Raised when the connection to the reader encounters and error and the connection is dropped
event EventHandler<ConnectionLostEventArgs> ConnectionLost
Event Type
Received
Raised when a new line is available to read
event EventHandler Received