Table of Contents

Class AsciiResponse

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

Provides a base implementation of IAsciiResponse

public class AsciiResponse : IAsciiResponse
Inheritance
AsciiResponse
Implements
Derived
Inherited Members
Extension Methods

Constructors

AsciiResponse()

Initializes a new instance of the AsciiResponse class

public AsciiResponse()

Properties

Error

Gets ErrorCode as an ErrorCode

public ErrorCode? Error { get; }

Property Value

ErrorCode?

ErrorCode

Gets the error code received. Once as response has been cleared this will return null until OK or ER is received. If OK is received the value is set to string.Empty. If ER is received the value is set to the error code

public string ErrorCode { get; }

Property Value

string

IsResponseFinished

Gets a value indicating whether the response is finished, determined by whether the Lines contains an OK: or ER:

public bool IsResponseFinished { get; }

Property Value

bool

IsResponseStarted

Gets a value indicating whether the response has 1 or more lines received

public bool IsResponseStarted { get; }

Property Value

bool

Remarks

This returns true if Lines count is greater than 0 so will remain true after IsResponseFinished until ClearLastResponse() is called

IsResponseWithinLog

Gets a value indicating whether the response is currently within a download log phase.

public bool IsResponseWithinLog { get; }

Property Value

bool

Remarks

This is required internally to correctly receive a read log .rl response and exposed as useful for logic elsewhere

If the response is after an LB response line and before the LE response line then OK and ER responses need to be ignored as they are not the end of this command but sections of the log file being downloaded

IsSuccessful

Gets a value indicating whether the response is successful (Ended with OK:)

public bool IsSuccessful { get; }

Property Value

bool

Lines

Gets the lines received during the response

public IEnumerable<IAsciiResponseLine> Lines { get; }

Property Value

IEnumerable<IAsciiResponseLine>

Messages

Gets the messages received during the response

[Obsolete("This can be obtained easily without this property. Use the Messages() extension instead")]
public IEnumerable<string> Messages { get; }

Property Value

IEnumerable<string>

Parameters

Gets the parameters received during the response

[Obsolete("not all responses have parameters. Use the Parameters() extension instead")]
public IEnumerable<string> Parameters { get; }

Property Value

IEnumerable<string>

Response

Gets the lines received during the response

[Obsolete("Lines is preferred")]
public IEnumerable<IAsciiResponseLine> Response { get; }

Property Value

IEnumerable<IAsciiResponseLine>

Methods

AppendToResponse(IAsciiResponseLine)

Append the given line to the Lines updating IsResponseWithinLog and ErrorCode as appropriate

protected virtual void AppendToResponse(IAsciiResponseLine line)

Parameters

line IAsciiResponseLine

The line to append to the current response

ClearLastResponse()

Clears the response ready to receive a new one

public virtual void ClearLastResponse()