Table of Contents

Interface IZ21ResponseHandler

Namespace
Z21.Core.ResponseHandler
Assembly
Z21.Client.dll
public interface IZ21ResponseHandler

Properties

Name

Human-readable command according to the specification.

string Name { get; }

Property Value

string

Methods

CanHandle(byte[])

Returns true if this response handler can handle the response. False otherwise.

bool CanHandle(byte[] response)

Parameters

response byte[]

Returns

bool

Handle(byte[])

void Handle(byte[] response)

Parameters

response byte[]

MatchesFrame(byte[], int, params (int Index, byte Value)[])

Length-safe frame matcher shared by every response handler. Returns true only when response is non-null, at least minimumLength bytes long, and every (index, value) pair in expected matches. It never throws on a short or null datagram, replacing the per-handler try/catch (IndexOutOfRangeException) guard and the duplicated response.Length >= n checks.

bool MatchesFrame(byte[] response, int minimumLength, params (int Index, byte Value)[] expected)

Parameters

response byte[]
minimumLength int
expected (int Index, byte Value)[]

Returns

bool