Class AsciiResponseExtensions
- Namespace
- TechnologySolutions.Rfid.AsciiProtocol
- Assembly
- TechnologySolutions.Rfid.AsciiProtocol.Core.dll
Extensions methods for the IAsciiResponseLine
public static class AsciiResponseExtensions
- Inheritance
-
AsciiResponseExtensions
- Inherited Members
Methods
AddHeader(AsciiResponder, string)
Adds the header specified to the list of AcceptedHeaders
public static void AddHeader(this AsciiResponder response, string header)
Parameters
response
AsciiResponderThe response that will accept the header
header
stringThe header to add
AddHeaders(AsciiResponder, IEnumerable<string>)
Adds the headers specified to the list of AcceptedHeaders
public static void AddHeaders(this AsciiResponder response, IEnumerable<string> headers)
Parameters
response
AsciiResponderThe response that will accept the headers
headers
IEnumerable<string>The accepted headers
AddHeaders(AsciiResponder, string)
Adds the comma, colon and/or space separated two-character headers to AcceptedHeaders
public static void AddHeaders(this AsciiResponder response, string headers)
Parameters
response
AsciiResponderThe response that will accept the headers
headers
stringThe accepted headers
HasHeader(IAsciiResponseLine, string)
Returns a value indicating whether the line has the specified header
public static bool HasHeader(this IAsciiResponseLine line, string header)
Parameters
line
IAsciiResponseLineThe line to test
header
stringThe header to test for (e.g. ME)
Returns
- bool
True if the line has the specified header
IsCommandStarted(IAsciiResponseLine)
Returns a value indicating whether the line has an "CS" header
public static bool IsCommandStarted(this IAsciiResponseLine line)
Parameters
line
IAsciiResponseLineThe line to test
Returns
- bool
True if the line starts with the CS header
IsError(IAsciiResponseLine)
Returns a value indicating whether the line has an "ER" header
public static bool IsError(this IAsciiResponseLine line)
Parameters
line
IAsciiResponseLineThe line to test
Returns
- bool
True if the line starts with the ER header
IsMessage(IAsciiResponseLine)
Returns a value indication whether the line has an "ME" header
public static bool IsMessage(this IAsciiResponseLine line)
Parameters
line
IAsciiResponseLineThe line to test
Returns
- bool
True if the line starts with the ME header
IsOk(IAsciiResponseLine)
Returns a value indicating whether the line has an "OK" header
public static bool IsOk(this IAsciiResponseLine line)
Parameters
line
IAsciiResponseLineThe line to test
Returns
- bool
True if the line starts with the OK header
IsParameters(IAsciiResponseLine)
Returns a value indicating whether the line has an "PR" header
public static bool IsParameters(this IAsciiResponseLine line)
Parameters
line
IAsciiResponseLineThe line to test
Returns
- bool
True if the line starts with the PR header
Messages(IAsciiResponse)
Returns the messages received during the response
public static IEnumerable<string> Messages(this IAsciiResponse response)
Parameters
response
IAsciiResponse
Returns
Parameters(IAsciiResponse)
Returns the parameters received during the response
public static IEnumerable<string> Parameters(this IAsciiResponse response)
Parameters
response
IAsciiResponse
Returns
RemoveHeader(AsciiResponder, string)
Removes the header specified to the list of AcceptedHeaders
public static void RemoveHeader(this AsciiResponder response, string header)
Parameters
response
AsciiResponderThe response that will accept the header
header
stringThe header to add
ValueByHeader(IAsciiResponse, string)
Returns the value of the first line in the response with the specified header or null if header is not found
public static string ValueByHeader(this IAsciiResponse response, string header)
Parameters
response
IAsciiResponseThe response to search
header
stringThe header to search for
Returns
- string
The value of the line or null (Nothing in visual basic) if a line with that header is not found
ValueByHeaderDateTime(IAsciiResponse, string)
Returns the value of the first line in the response with the specified header parsed as a date and or time or DateTime.MinValue if header is not found
public static DateTime ValueByHeaderDateTime(this IAsciiResponse response, string header)
Parameters
response
IAsciiResponseThe response to search
header
stringThe header to search for
Returns
- DateTime
The value of the line or DateTime.MinValue if a line with that header is not found
ValueByHeaderNumber(IAsciiResponse, string)
Returns the value of the first line in the response with the specified header parsed as a number
public static int ValueByHeaderNumber(this IAsciiResponse response, string header)
Parameters
response
IAsciiResponseThe response to search
header
stringThe header to search for
Returns
- int
The value of the line or DateTime.MinValue if a line with that header is not found
ValueByHeaderText(IAsciiResponse, string)
Returns the value of the first line in the response with the specified header or string.Empty if header is not found
public static string ValueByHeaderText(this IAsciiResponse response, string header)
Parameters
response
IAsciiResponseThe response to search
header
stringThe header to search for
Returns
- string
The value of the line or "" if a line with that header is not found
ValueByHeader<TEnum>(IAsciiResponse, string)
Returns the value of the first line in the response with the specified header parsed as the Enum type specified
public static TEnum ValueByHeader<TEnum>(this IAsciiResponse response, string header)
Parameters
response
IAsciiResponseThe response to search
header
stringThe header to search for
Returns
- TEnum
The value of the line
Type Parameters
TEnum
The Enum type expected