Skip to content

Vion Dale SDK API Reference ​

Auto-generated from source code. Types marked with [PublicApi].

Vion.Dale.Sdk.AnalogIo.TestKit ​

IAnalogInputExtensions ​

Extension methods to simulate analog input changes in tests.

Methods:

  • RaiseInputChanged(IAnalogInput, double) — Raise the InputChanged event on an IAnalogInput for tests.
    • analogInput: The analog input instance to raise the event on.
    • value: The new analog input value.

IAnalogOutputExtensions ​

Extension methods to simulate analog output changes in tests.

Methods:

  • RaiseOutputChanged(IAnalogOutput, double) — Raise the OutputChanged event on an IAnalogOutput for tests.
    • analogOutput: The analog output instance to raise the event on.
    • value: The new analog output value.

IAnalogOutputProviderExtensions ​

Extension methods to simulate analog output commands arriving at a provider in tests.

Methods:

  • RaiseSetReceived(IAnalogOutputProvider, double) — Raise the SetReceived event on an IAnalogOutputProvider for tests.
    • analogOutputProvider: The analog output provider instance to raise the event on.
    • value: The commanded analog output value.

LogicBlockTestContextExtensions ​

Extension methods to verify analog output messages in test contexts.

Methods:

  • VerifyAnalogOutputSet<T>(LogicBlockTestContext<T>, IAnalogOutput, double?, double, Times?) — Assert that at the specified analog output was set with the given value.
    • testContext: The test context for the logic block.
    • analogOutput: The analog output to verify, or null to verify any analog output.
    • value: The expected value, or null to skip value verification.
    • tolerance: The inclusive tolerance for the value comparison; the default of 0 means exact equality.
    • times: The expected number of times the output was set, or null for once.
  • VerifyAnalogOutputConfirmed<T>(LogicBlockTestContext<T>, IAnalogOutputProvider, double?, double, Times?) — Assert that the specified analog output provider confirmed the given value.
    • testContext: The test context for the logic block.
    • analogOutputProvider: The analog output provider to verify, or null to verify any.
    • value: The expected value, or null to skip value verification.
    • tolerance: The inclusive tolerance for the value comparison; the default of 0 means exact equality.
    • times: The expected number of confirmations, or null for once.
  • VerifyAnalogInputDriven<T>(LogicBlockTestContext<T>, IAnalogInputProvider, double?, double, Times?) — Assert that the specified analog input provider drove the given value.
    • testContext: The test context for the logic block.
    • analogInputProvider: The analog input provider to verify, or null to verify any.
    • value: The expected value, or null to skip value verification.
    • tolerance: The inclusive tolerance for the value comparison; the default of 0 means exact equality.
    • times: The expected number of drives, or null for once.
  • Matches(double, double?, double) — Bit equality first, then the tolerance band. The difference comparison alone is false for a non-number against itself and for either infinity against itself at every tolerance, and a block can write any of the three — so a value it wrote has to be assertable. A signed zero matches an unsigned one either way.
  • EnsureUsableTolerance(double) — A tolerance is a width, so it is a number of at least zero. A non-number or a negative one makes the band empty and rejects even an exact value, which no caller can mean; an infinite tolerance is a legal width that admits every finite value.

Vion.Dale.Sdk.AnalogIo.Input ​

AnalogInputChanged ​

Message from the AnalogInputHandler to a LogicBlock IO to notify about an analog input change.

Methods:

  • Constructor — Message from the AnalogInputHandler to a LogicBlock IO to notify about an analog input change.

IAnalogInput ​

Represents an analog input that can be used to communicate with hardware.


IAnalogInputProvider ​

The provider side of an analog input: a simulator binds it to drive the value a IAnalogInput observes.

Development and bench surface only. It stands in for the hardware an analog input would read, so a configuration binding it is refused by the production runtime — bind it from simulator blocks, never from a block meant to run on a device. Call whenever the simulated signal changes; the direction is one-way, so there is nothing to receive back.

Methods:

  • Drive(double) — Drives the value the analog input observes.
    • value: The value the simulated signal now carries.

Vion.Dale.Sdk.AnalogIo.Output ​

AnalogOutputChanged ​

Message from the AnalogOutputHandler to a LogicBlock IO to notify about an analog output change

Methods:

  • Constructor — Message from the AnalogOutputHandler to a LogicBlock IO to notify about an analog output change

IAnalogOutput ​

Represents an analog output that can be used to communicate with hardware.

Methods:

  • Set(double) — Sets the analog output to the specified value.
    • value: The value to set the analog output to.

IAnalogOutputProvider ​

The provider side of an analog output: a simulator binds it to receive what a IAnalogOutput commanded and to confirm back the value it applied.

Development and bench surface only. It stands in for the hardware an analog output would drive, so a configuration binding it is refused by the production runtime — bind it from simulator blocks, never from a block meant to run on a device. Handle to model the equipment's reaction, then call with the value it actually took; ignoring a command is a legitimate model of hardware that did not take it up.

Methods:

  • Confirm(double) — Confirms the value the simulated hardware applied.
    • value: The value that was applied.

SetAnalogOutput ​

Message from a LogicBlock IO to the AnalogOutputHandler to set an analog output

Methods:

  • Constructor — Message from a LogicBlock IO to the AnalogOutputHandler to set an analog output

Vion.Dale.Sdk.DigitalIo.TestKit ​

IDigitalInputExtensions ​

Extension methods to simulate digital input changes in tests.

Methods:

  • RaiseInputChanged(IDigitalInput, bool) — Raise the InputChanged event on an IDigitalInput for tests.
    • digitalInput: The digital input instance to raise the event on.
    • value: The new digital input value.

IDigitalOutputExtensions ​

Extension methods to simulate digital output changes in tests.

Methods:

  • RaiseOutputChanged(IDigitalOutput, bool) — Raise the OutputChanged event on an IDigitalOutput for tests.
    • digitalOutput: The digital output instance to raise the event on.
    • value: The new digital output value.

IDigitalOutputProviderExtensions ​

Extension methods to simulate digital output commands arriving at a provider in tests.

Methods:

  • RaiseSetReceived(IDigitalOutputProvider, bool) — Raise the SetReceived event on an IDigitalOutputProvider for tests.
    • digitalOutputProvider: The digital output provider instance to raise the event on.
    • value: The commanded digital output value.

LogicBlockTestContextExtensions ​

Extension methods to verify digital output messages in test contexts.

Methods:

  • VerifyDigitalOutputSet<T>(LogicBlockTestContext<T>, IDigitalOutput, bool?, Times?) — Assert that at the specified digital output was set with the given value.
    • testContext: The test context for the logic block.
    • digitalOutput: The digital output to verify, or null to verify any digital output.
    • value: The expected value, or null to skip value verification.
    • times: The expected number of times the output was set, or null for once.
  • VerifyDigitalOutputConfirmed<T>(LogicBlockTestContext<T>, IDigitalOutputProvider, bool?, Times?) — Assert that the specified digital output provider confirmed the given value.
    • testContext: The test context for the logic block.
    • digitalOutputProvider: The digital output provider to verify, or null to verify any.
    • value: The expected value, or null to skip value verification.
    • times: The expected number of confirmations, or null for once.
  • VerifyDigitalInputDriven<T>(LogicBlockTestContext<T>, IDigitalInputProvider, bool?, Times?) — Assert that the specified digital input provider drove the given value.
    • testContext: The test context for the logic block.
    • digitalInputProvider: The digital input provider to verify, or null to verify any.
    • value: The expected value, or null to skip value verification.
    • times: The expected number of drives, or null for once.

Vion.Dale.Sdk.DigitalIo.Input ​

DigitalInputChanged ​

Message from the DigitalInputHandler to a LogicBlock IO to notify about a digital input change.

Methods:

  • Constructor — Message from the DigitalInputHandler to a LogicBlock IO to notify about a digital input change.

IDigitalInput ​

Represents a digital input that can be used to communicate with hardware.


IDigitalInputProvider ​

The provider side of a digital input: a simulator binds it to drive the value a IDigitalInput observes.

Development and bench surface only. It stands in for the hardware a digital input would read, so a configuration binding it is refused by the production runtime — bind it from simulator blocks, never from a block meant to run on a device. Call whenever the simulated signal changes; the direction is one-way, so there is nothing to receive back.

Methods:

  • Drive(bool) — Drives the value the digital input observes.
    • value: The value the simulated signal now carries.

Vion.Dale.Sdk.DigitalIo.Output ​

DigitalOutputChanged ​

Message from the DigitalOutputHandler to a LogicBlock IO to notify about a digital output change

Methods:

  • Constructor — Message from the DigitalOutputHandler to a LogicBlock IO to notify about a digital output change

IDigitalOutput ​

Represents a digital output that can be used to communicate with hardware.

Methods:

  • Set(bool) — Sets the digital output to the specified value.
    • value: The value to set the digital output to.

IDigitalOutputProvider ​

The provider side of a digital output: a simulator binds it to receive what a IDigitalOutput commanded and to confirm back the value it applied.

Development and bench surface only. It stands in for the hardware a digital output would drive, so a configuration binding it is refused by the production runtime — bind it from simulator blocks, never from a block meant to run on a device. Handle to model the equipment's reaction, then call with the value it actually took; ignoring a command is a legitimate model of hardware that did not take it up.

Methods:

  • Confirm(bool) — Confirms the value the simulated hardware applied.
    • value: The value that was applied.

SetDigitalOutput ​

Message from a LogicBlock IO to the DigitalOutputHandler to set a digital output

Methods:

  • Constructor — Message from a LogicBlock IO to the DigitalOutputHandler to set a digital output

Vion.Dale.Sdk.Http.TestKit ​

FakeHttpHarness ​

Drives a block's HTTP calls against answers the test scripts: the SDK's real registration, client, serializer and error mapping run, and only the innermost message handler is replaced, so every request is recorded and held until the test answers it. Nothing opens a socket. var harness = new FakeHttpHarness(ctx.TimeProvider); var sut = new MyBlock(harness.Client, logger); // built through the TestKit context builder sut.Poll(); Assert.AreEqual("http://device/status", harness.Requests[0].Uri.ToString()); harness.Respond(HttpStatusCode.NotFound); ctx.FlushPendingActions(); // the block's error callback runs

Requests are answered oldest first, and an answer returns only once the SDK has handed the block's callback to the block's dispatcher, so the next drive of the block's context runs it. A per-request timeout is measured on the harness's clock: pass the context's clock and advancing it expires a held request exactly as the SDK would. Without a clock the harness uses a virtual one nothing advances, so a held request never times out on its own. Replacing the innermost handler takes what the platform's handler does with it: a redirect is not followed (a scripted 3xx reaches the block as a non-success status), no cookie is kept, no body is decompressed, and a Content-Length is not checked against its body. The client's own timeout is not applied to a held request.

Properties:

  • Client — The fully wired client to inject into the block under test.
  • Requests — Every request the block issued, oldest first, answered or not.
  • PendingCount — How many requests are waiting for an answer.

Methods:

  • Constructor — Initializes a new instance of the FakeHttpHarness class on a virtual clock nothing advances.
  • Constructor — Initializes a new instance of the FakeHttpHarness class measuring per-request timeouts on .
    • timeProvider: The clock a per-request timeout elapses on — normally the test context's.
  • Dispose — Disposes the composed services. A request still outstanding is abandoned: its callbacks never run.
  • Respond(string) — Answers the oldest outstanding request with status 200 and as its application/json body.
    • json: The response body.
  • Respond(HttpStatusCode, string, string, IEnumerable<KeyValuePair<string, string>>) — Answers the oldest outstanding request with , an optional body and optional headers.
    • statusCode: The response status.
    • body: The response body, or null for an empty one.
    • contentType: The content type of .
    • headers: The response headers, added as the wire would carry them, a name given twice sent twice — a content header such as Content-Language goes onto the body — or null for none. Content-Type is 's, and is refused here.
  • Fail(Exception) — Fails the oldest outstanding request with , the way a transport failure arrives.
    • exception: The exception the transport raised, delivered to the block unchanged.

FakeHttpRequest ​

A request a block issued through a FakeHttpHarness, as the SDK composed it for the wire.

Properties:

  • Method — Gets the request method.
  • Uri — Gets the absolute request URI.
  • Headers — Gets the request and content headers as sent, by case-insensitive name, including the ones the SDK adds itself; a header with several values carries them joined by ", ".
  • Body — Gets the request body as UTF-8 text, or null when the request carried no content.
  • ContentType — Gets the content type of the body, or null when there is none.
  • Timeout — Gets the per-request timeout the block passed, or null when it passed none.

FakeHttpServerClient ​

Sends requests to a FakeHttpServerHarness's server and returns its answers, as a client on the network would see them.

Methods:

  • Send(HttpMethod, string, string, IReadOnlyDictionary<string, string>) — Sends one request and returns the server's answer.
    • method: The request method.
    • pathAndQuery: The request target: a path starting with /, optionally followed by a query.
    • body: The request body as UTF-8 text, or null for none.
    • headers: The request headers, or null for none.

FakeHttpServerHarness ​

Hosts the SDK's real HTTP server over an in-memory transport, so the route table, the request log and the configuration rules under test are the SDK's own — no socket, no free port. using var harness = new FakeHttpServerHarness(); var sut = new MySimulatorBlock(harness.ServerFactory, logger); sut.Tick(); // enables the server and publishes its documents var response = harness.Client.Send(HttpMethod.Get, "/api/status.json"); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);

The client view carries a request straight to the server, so what the socket transport decides on its own — the framing, a HEAD response's missing body, the size caps, a malformed request, closing the connection, the read bound, the connection limit, a response cut short — is not exercised through it: every request it sends is answered and recorded. The server's own lifecycle is: a disposed server refuses to be enabled here exactly as on a gateway.

Properties:

  • Server — The fully wired server to inject into the block under test, or hand out through ServerFactory.
  • ServerFactory — A factory handing out Server, for a block that creates its server from a factory.
  • Client — The client-side view that sends requests to Server.

Methods:

  • Constructor — Initializes a new instance of the FakeHttpServerHarness class on a virtual clock nothing advances.
  • Constructor — Initializes a new instance of the FakeHttpServerHarness class stamping requests from .
    • timeProvider: The clock each request's arrival is stamped from — normally the test context's.
  • Dispose — (no description)

FakeHttpServerResponse ​

An answer a FakeHttpServerHarness's server gave.

Properties:

  • StatusCode — Gets the response status.
  • ContentType — Gets the content type of the body, or null when none was set.
  • Headers — Gets every other header the response carries by case-insensitive name, a repeated one joined by ", ".
  • Body — Gets the response body as UTF-8 text.

Vion.Dale.Sdk.Http ​

ContentNullAfterDeserializationException ​

Thrown when a response body was well-formed JSON that deserialized to null — the literal null document — rather than to the type a member asked for.

It is distinct from the JsonException a body that is absent, truncated or not JSON at all produces, and it is the only way to tell "the server answered null" from "the server answered rubbish" without matching on message text.

Properties:

  • Type — Gets the type the response body could not be deserialized into.

Methods:

  • Constructor — Initializes a new instance of the ContentNullAfterDeserializationException class.
    • type: The type the response body could not be deserialized into.

HttpClientSummary ​

A point-in-time summary of one HTTP client's requests: when a server last answered, the last failure, lifetime counts per outcome, and round trips over a recent window and since the client started.

Read it whenever you want it — every read returns a consistent snapshot. Every field is a service-property-legal type, so the whole summary can be published as one [ServiceProperty]. It changes with every request, so a member publishing it whole sends a new value once per interval for as long as the client is in use: once every 30 s by default, or at the MinInterval the member assigns. Where a signal's every edge matters, take it from the request's receipt instead. Each client instance keeps its own summary. A block that calls two services and wants them apart injects two clients. There is no up/down verdict: one client may call many servers, and only the caller knows its own cadence. Build one from LastResponseAt and the last failure. The Recent figures cover a window of the last 15 minutes on the client's clock — at least 15 and less than 16, or the client's whole life where that is shorter. An empty window reads its mean and max as null and its count as zero. Round trips are taken only from requests a server answered: successes, client errors, server errors and content errors. The counts and the since start maximum are for the lifetime of the client instance and are never reset. A call refused at the caller, before any request exists, is not counted.

Properties:

  • LastResponseAt — When a server last answered, with any status.
  • LastFailureAt — When the last request that did not succeed ended.
  • LastFailureOutcome — How that request ended.
  • LastFailureStatusCode — The status that request was answered with, or null when no response arrived.
  • SuccessCount — Requests answered with a 2xx status whose content was read.
  • ClientErrorCount — Requests answered with a status outside 2xx and below 500.
  • ServerErrorCount — Requests answered with a status of 500 or above.
  • ContentErrorCount — Requests answered with a 2xx status whose body was absent, malformed or null.
  • TimeoutCount — Requests the request's own timeout, or the client's, ended.
  • TransportErrorCount — Requests whose connection, TLS handshake or response stream failed.
  • InvalidCount — Requests the client could not build or refused before sending.
  • RecentRoundTripCount — Requests a server answered in the last 15 minutes.
  • RecentMeanRoundTrip — The mean round trip over the last 15 minutes.
  • RecentMaxRoundTrip — The longest round trip in the last 15 minutes.
  • MaxRoundTrip — The longest round trip since the client started.
  • MaxRoundTripAt — When the request that set ended.
  • InFlightCount — Requests issued and not yet ended.

Methods:

  • Constructor — A point-in-time summary of one HTTP client's requests: when a server last answered, the last failure, lifetime counts per outcome, and round trips over a recent window and since the client started.
    • LastResponseAt: When a server last answered, with any status.
    • LastFailureAt: When the last request that did not succeed ended.
    • LastFailureOutcome: How that request ended.
    • LastFailureStatusCode: The status that request was answered with, or null when no response arrived.
    • SuccessCount: Requests answered with a 2xx status whose content was read.
    • ClientErrorCount: Requests answered with a status outside 2xx and below 500.
    • ServerErrorCount: Requests answered with a status of 500 or above.
    • ContentErrorCount: Requests answered with a 2xx status whose body was absent, malformed or null.
    • TimeoutCount: Requests the request's own timeout, or the client's, ended.
    • TransportErrorCount: Requests whose connection, TLS handshake or response stream failed.
    • InvalidCount: Requests the client could not build or refused before sending.
    • RecentRoundTripCount: Requests a server answered in the last 15 minutes.
    • RecentMeanRoundTrip: The mean round trip over the last 15 minutes.
    • RecentMaxRoundTrip: The longest round trip in the last 15 minutes.
    • MaxRoundTrip: The longest round trip since the client started.
    • MaxRoundTripAt: When the request that set ended.
    • InFlightCount: Requests issued and not yet ended.

HttpOutcome ​

How a single HTTP request ended.

The first four values mean a server answered: ClientError and ServerError carry the status it answered with on StatusCode. Timeout and TransportError mean no usable answer arrived — a TransportError keeps the 2xx status when the body broke after the headers — and Invalid that the request was never handed to the transport at all. A status of 500 or above is a ServerError; every other status outside 2xx — a 4xx, or a 1xx or 3xx the platform did not follow — is a ClientError.

Fields/Values:

  • Success — The server answered with a 2xx status, and its content was read where the request reads any.
  • ClientError — The server answered with a status outside 2xx and below 500 — the request was not what it accepts.
  • ServerError — The server answered with a status of 500 or above.
  • ContentError — The server answered with a 2xx status, but its body was absent, malformed or deserialized to null.
  • Timeout — The request's own timeout, or the client's, elapsed before the response arrived.
  • TransportError — The connection, the TLS handshake or the response stream failed.
  • Invalid — Not sent: the client could not be built, or it refused the request — a URL no base address makes absolute, a disposed client, a request message sent before.

HttpReceipt ​

The facts of one HTTP request, handed to its success and its error callback alongside the value or the exception.

StatusCode is the status of the response the client judged, and is null when no response arrived. It is what tells a server's answer from a failure to reach one: a refused connection and a 404 both arrive as an HttpRequestException, and only the 404 carries a status here. Headers are that response's headers, its content headers included, on a refusal as on a success, and are null exactly when StatusCode is. A header the platform understands, such as a date, reads in the platform's canonical form. RetryAfter is the delay the response's Retry-After asks for, or null when it sends none in either standard form; what to do with it is the block's decision. The instant is taken when the outcome was observed, before the callback is handed to the block, so it is unaffected by how long the block takes to run it. ReceivedAt is wall clock and is what you publish; ReceivedTimestamp is the same instant on the monotonic scale — age a value with TimeProvider.GetElapsedTime(receipt.ReceivedTimestamp). RoundTrip runs from handing the request to the client until the outcome was observed: for the members that return a value it includes reading and deserializing the body; for SendRequest it ends at the response headers, because the body is the callback's to read. Ignoring a receipt is a discard: (value, _) =&gt; Temperature = value.Current.

Properties:

  • ReceivedAt — The UTC wall clock instant the outcome was observed.
  • ReceivedTimestamp — The same instant on the monotonic timestamp scale, for ageing the value.
  • RoundTrip — The time from handing the request to the client until the outcome was observed.
  • Outcome — How the request ended.
  • StatusCode — The status of the response, or null when no response arrived.
  • Headers — The headers of the response and of its content by case-insensitive name, a header sent more than once carrying its values joined by ", "; null when no response arrived.
  • RetryAfter — Gets the delay the response's Retry-After asks for, or null when it sends none in either form.

Methods:

  • Constructor — The facts of one HTTP request, handed to its success and its error callback alongside the value or the exception.
    • ReceivedAt: The UTC wall clock instant the outcome was observed.
    • ReceivedTimestamp: The same instant on the monotonic timestamp scale, for ageing the value.
    • RoundTrip: The time from handing the request to the client until the outcome was observed.
    • Outcome: How the request ended.
    • StatusCode: The status of the response, or null when no response arrived.
    • Headers: The headers of the response and of its content by case-insensitive name, a header sent more than once carrying its values joined by ", "; null when no response arrived.
  • TryParseHttpDate(string, DateTime@) — Reads IMF-fixdate alone. The two obsolete forms an HTTP-date may also take never reach it: the platform parses a date header and renders every form it understands as IMF-fixdate before the package can read the header.

ILogicBlockHttpClient ​

Provides non-blocking HTTP client functionality for logic blocks.

Properties:

  • Summary — Gets a snapshot of every request this client has issued: when a server last answered, the last failure, counts per outcome and round trips. Each client instance keeps its own; see HttpClientSummary for what publishing it costs.

Methods:

  • GetJson<T>(IActorDispatcher, string, Action<T, HttpReceipt>, Action<Exception, HttpReceipt>, Dictionary<string, string>, TimeSpan?) — Performs a non-blocking HTTP GET request and passes the deserialized JSON response to the callback.
    • dispatcher: The dispatcher that will invoke the callbacks. Pass the logic block that should handle the callbacks (typically this when calling from within a logic block).
    • url: The URL to send the GET request to.
    • successCallback: Callback invoked with the deserialized response and the request's HttpReceipt on success.
    • errorCallback: Callback invoked with the exception and the request's HttpReceipt if the request fails. The receipt's StatusCode is set only when a response arrived, which is what tells a non-success status from a transport failure. One class per failure: HttpRequestException for a non-success status or a transport failure the handler wrapped, TimeoutException when either the timeout above or the HttpClient's own elapsed, InvalidOperationException for a URL that is not an absolute URI, JsonException for a body that is absent or malformed, ContentNullAfterDeserializationException for one that deserializes to null, and otherwise whatever the transport threw — this client wraps nothing else. Errors are always logged, regardless of whether an error callback is specified.
    • headers: HTTP headers to include in the request.
    • timeout: A bound on this request alone, applied in addition to the HttpClient's own timeout rather than in place of it: whichever elapses first ends the request, so a value longer than the client's does not extend it. Either bound's expiry arrives as a TimeoutException naming, in seconds, the bound that actually elapsed.
  • PostJson<T, T2>(IActorDispatcher, string, T, Action<T2, HttpReceipt>, Action<Exception, HttpReceipt>, Dictionary<string, string>, TimeSpan?) — Performs a non-blocking HTTP POST request with a JSON body and passes the deserialized JSON response to the callback.
    • dispatcher: The dispatcher that will invoke the callbacks. Pass the logic block that should handle the callbacks (typically this when calling from within a logic block).
    • url: The URL to send the POST request to.
    • body: The object to serialize as the JSON request body.
    • successCallback: Callback invoked with the deserialized response and the request's HttpReceipt on success.
    • errorCallback: Callback invoked with the exception and the request's HttpReceipt if the request fails. The receipt's StatusCode is set only when a response arrived, which is what tells a non-success status from a transport failure. One class per failure: HttpRequestException for a non-success status or a transport failure the handler wrapped, TimeoutException when either the timeout above or the HttpClient's own elapsed, InvalidOperationException for a URL that is not an absolute URI, JsonException for a body that is absent or malformed, ContentNullAfterDeserializationException for one that deserializes to null, and otherwise whatever the transport threw — this client wraps nothing else. Errors are always logged, regardless of whether an error callback is specified.
    • headers: HTTP headers to include in the request.
    • timeout: A bound on this request alone, applied in addition to the HttpClient's own timeout rather than in place of it: whichever elapses first ends the request, so a value longer than the client's does not extend it. Either bound's expiry arrives as a TimeoutException naming, in seconds, the bound that actually elapsed.
  • PostJson<T>(IActorDispatcher, string, T, Action<HttpReceipt>, Action<Exception, HttpReceipt>, Dictionary<string, string>, TimeSpan?) — Performs a non-blocking HTTP POST request with a JSON body. The callback is invoked on success without a response body.
    • dispatcher: The dispatcher that will invoke the callbacks. Pass the logic block that should handle the callbacks (typically this when calling from within a logic block).
    • url: The URL to send the POST request to.
    • body: The object to serialize as the JSON request body.
    • successCallback: Callback invoked with the request's HttpReceipt when the request succeeds.
    • errorCallback: Callback invoked with the exception and the request's HttpReceipt if the request fails. The receipt's StatusCode is set only when a response arrived, which is what tells a non-success status from a transport failure. One class per failure: HttpRequestException for a non-success status or a transport failure the handler wrapped, TimeoutException when either the timeout above or the HttpClient's own elapsed, InvalidOperationException for a URL that is not an absolute URI, JsonException for a body that is absent or malformed, ContentNullAfterDeserializationException for one that deserializes to null, and otherwise whatever the transport threw — this client wraps nothing else. Errors are always logged, regardless of whether an error callback is specified.
    • headers: HTTP headers to include in the request.
    • timeout: A bound on this request alone, applied in addition to the HttpClient's own timeout rather than in place of it: whichever elapses first ends the request, so a value longer than the client's does not extend it. Either bound's expiry arrives as a TimeoutException naming, in seconds, the bound that actually elapsed.
  • PutJson<T, T2>(IActorDispatcher, string, T, Action<T2, HttpReceipt>, Action<Exception, HttpReceipt>, Dictionary<string, string>, TimeSpan?) — Performs a non-blocking HTTP PUT request with a JSON body and passes the deserialized JSON response to the callback.
    • dispatcher: The dispatcher that will invoke the callbacks. Pass the logic block that should handle the callbacks (typically this when calling from within a logic block). Errors are always logged, regardless of whether an error callback is specified.
    • url: The URL to send the PUT request to.
    • body: The object to serialize as the JSON request body.
    • successCallback: Callback invoked with the deserialized response and the request's HttpReceipt on success.
    • errorCallback: Callback invoked with the exception and the request's HttpReceipt if the request fails. The receipt's StatusCode is set only when a response arrived, which is what tells a non-success status from a transport failure. One class per failure: HttpRequestException for a non-success status or a transport failure the handler wrapped, TimeoutException when either the timeout above or the HttpClient's own elapsed, InvalidOperationException for a URL that is not an absolute URI, JsonException for a body that is absent or malformed, ContentNullAfterDeserializationException for one that deserializes to null, and otherwise whatever the transport threw — this client wraps nothing else.
    • headers: HTTP headers to include in the request.
    • timeout: A bound on this request alone, applied in addition to the HttpClient's own timeout rather than in place of it: whichever elapses first ends the request, so a value longer than the client's does not extend it. Either bound's expiry arrives as a TimeoutException naming, in seconds, the bound that actually elapsed.
  • PutJson<T>(IActorDispatcher, string, T, Action<HttpReceipt>, Action<Exception, HttpReceipt>, Dictionary<string, string>, TimeSpan?) — Performs a non-blocking HTTP PUT request with a JSON body. The callback is invoked on success without a response body.
    • dispatcher: The dispatcher that will invoke the callbacks. Pass the logic block that should handle the callbacks (typically this when calling from within a logic block).
    • url: The URL to send the PUT request to.
    • body: The object to serialize as the JSON request body.
    • successCallback: Callback invoked with the request's HttpReceipt when the request succeeds.
    • errorCallback: Callback invoked with the exception and the request's HttpReceipt if the request fails. The receipt's StatusCode is set only when a response arrived, which is what tells a non-success status from a transport failure. One class per failure: HttpRequestException for a non-success status or a transport failure the handler wrapped, TimeoutException when either the timeout above or the HttpClient's own elapsed, InvalidOperationException for a URL that is not an absolute URI, JsonException for a body that is absent or malformed, ContentNullAfterDeserializationException for one that deserializes to null, and otherwise whatever the transport threw — this client wraps nothing else. Errors are always logged, regardless of whether an error callback is specified.
    • headers: HTTP headers to include in the request.
    • timeout: A bound on this request alone, applied in addition to the HttpClient's own timeout rather than in place of it: whichever elapses first ends the request, so a value longer than the client's does not extend it. Either bound's expiry arrives as a TimeoutException naming, in seconds, the bound that actually elapsed.
  • DeleteJson<T>(IActorDispatcher, string, Action<T, HttpReceipt>, Action<Exception, HttpReceipt>, Dictionary<string, string>, TimeSpan?) — Performs a non-blocking HTTP DELETE request and passes the deserialized JSON response to the callback.
    • dispatcher: The dispatcher that will invoke the callbacks. Pass the logic block that should handle the callbacks (typically this when calling from within a logic block).
    • url: The URL to send the DELETE request to.
    • successCallback: Callback invoked with the deserialized response and the request's HttpReceipt on success.
    • errorCallback: Callback invoked with the exception and the request's HttpReceipt if the request fails. The receipt's StatusCode is set only when a response arrived, which is what tells a non-success status from a transport failure. One class per failure: HttpRequestException for a non-success status or a transport failure the handler wrapped, TimeoutException when either the timeout above or the HttpClient's own elapsed, InvalidOperationException for a URL that is not an absolute URI, JsonException for a body that is absent or malformed, ContentNullAfterDeserializationException for one that deserializes to null, and otherwise whatever the transport threw — this client wraps nothing else. Errors are always logged, regardless of whether an error callback is specified.
    • headers: HTTP headers to include in the request.
    • timeout: A bound on this request alone, applied in addition to the HttpClient's own timeout rather than in place of it: whichever elapses first ends the request, so a value longer than the client's does not extend it. Either bound's expiry arrives as a TimeoutException naming, in seconds, the bound that actually elapsed.
  • Delete(IActorDispatcher, string, Action<HttpReceipt>, Action<Exception, HttpReceipt>, Dictionary<string, string>, TimeSpan?) — Performs a non-blocking HTTP DELETE request. The callback is invoked on success without a response body.
    • dispatcher: The dispatcher that will invoke the callbacks. Pass the logic block that should handle the callbacks (typically this when calling from within a logic block).
    • url: The URL to send the DELETE request to.
    • successCallback: Callback invoked with the request's HttpReceipt when the request succeeds.
    • errorCallback: Callback invoked with the exception and the request's HttpReceipt if the request fails. The receipt's StatusCode is set only when a response arrived, which is what tells a non-success status from a transport failure. One class per failure: HttpRequestException for a non-success status or a transport failure the handler wrapped, TimeoutException when either the timeout above or the HttpClient's own elapsed, InvalidOperationException for a URL that is not an absolute URI, JsonException for a body that is absent or malformed, ContentNullAfterDeserializationException for one that deserializes to null, and otherwise whatever the transport threw — this client wraps nothing else. Errors are always logged, regardless of whether an error callback is specified.
    • headers: HTTP headers to include in the request.
    • timeout: A bound on this request alone, applied in addition to the HttpClient's own timeout rather than in place of it: whichever elapses first ends the request, so a value longer than the client's does not extend it. Either bound's expiry arrives as a TimeoutException naming, in seconds, the bound that actually elapsed.
  • SendRequest(IActorDispatcher, HttpRequestMessage, Action<HttpResponseMessage, HttpReceipt>, Action<Exception, HttpReceipt>, TimeSpan?) — Performs a non-blocking HTTP request and passes the HttpResponseMessage to the callback.
    • dispatcher: The dispatcher that will invoke the callbacks. Pass the logic block that should handle the callbacks (typically this when calling from within a logic block).
    • request: The HttpRequestMessage to send. It stays yours: this member does not dispose it, and its method, URI, headers and content are the ones sent — no URL or header parameter of this member applies, and no content type is set for you.
    • successCallback: Callback invoked with the HttpResponseMessage and the request's HttpReceipt on success. The response is yours to read and to dispose: unlike the members that carry a response type, this one disposes nothing, and the callback may be reached while the body is still arriving, because the response is handed over as soon as its headers are in.
    • errorCallback: Callback invoked with the exception and the request's HttpReceipt if the request fails. The receipt's StatusCode is set only when a response arrived, which is what tells a non-success status from a transport failure. One class per failure: HttpRequestException for a non-success status or a transport failure the handler wrapped, TimeoutException when either the timeout above or the HttpClient's own elapsed, InvalidOperationException for a URL that is not an absolute URI, JsonException for a body that is absent or malformed, ContentNullAfterDeserializationException for one that deserializes to null, and otherwise whatever the transport threw — this client wraps nothing else. Errors are always logged, regardless of whether an error callback is specified.
    • timeout: A bound on this request alone, applied in addition to the HttpClient's own timeout rather than in place of it: whichever elapses first ends the request, so a value longer than the client's does not extend it. Either bound's expiry arrives as a TimeoutException naming, in seconds, the bound that actually elapsed.

ServiceCollectionExtensions ​

Extension methods for setting up logic block HTTP client and server services in an IServiceCollection.

Methods:

  • AddDaleHttpSdk(IServiceCollection, Action<HttpClient>) — Adds HTTP services to the specified IServiceCollection.
    • serviceCollection: The IServiceCollection to add services to.
    • configureClient: Action to configure additional settings and/or override defaults.

Fields/Values:

  • DefaultTimeout — The bound every request inherits when no caller sets one of its own.
  • HttpClientDefaultTimeout — The timeout an HttpClient starts life with. Ours is applied only while the client still carries it, so a value an earlier registration's configureClient chose is not overwritten by a later registration; the platform announces this number in its documentation and nowhere a caller can read it.

Vion.Dale.Sdk.Http.Server ​

HttpServerRequest ​

A request a hosted HTTP server answered, as the client sent it.

Properties:

  • Method — Gets the request method, as the client spelled it.
  • Path — Gets the request path, without the query string.
  • Query — Gets the query string without its leading ?, or an empty string when there is none.
  • Headers — Gets the request headers by case-insensitive name; a header sent more than once carries its values joined by ", ".
  • Body — Gets the request body.
  • ReceivedAt — Gets when the request arrived, on the clock the server was composed with.
  • StatusCode — Gets the status the server answered the request with: the published response's, or the 404 or 405 it sent when nothing was published for the request.

HttpServerResponse ​

A response a hosted HTTP server sends: a status, an optional content type, headers and a body.

A response is immutable: returns a new one, so a header reaches a response however it was built — HttpServerResponse.Json(body, HttpStatusCode.TooManyRequests).WithHeader("Retry-After", "120"). The server writes Content-Type, Content-Length and Connection itself, and refuses each of them and Transfer-Encoding as a header.

Properties:

  • StatusCode — Gets the status code sent.
  • ContentType — Gets the Content-Type sent with the body, or null for none.
  • Body — Gets the body sent.
  • Headers — Gets the headers sent besides the content type, in the order added; a name added twice is sent twice.

Methods:

  • Constructor — Initializes a new instance of the HttpServerResponse class.
    • statusCode: The status code of a final response, from 200 to 599.
    • contentType: The Content-Type of the body, or null for none: printable ASCII and tabs only, since it is written into the response's header block as given.
    • body: The body; copied, so later changes to the array are not sent.
  • WithHeader(string, string) — Returns a copy of this response that also sends the header with .
    • name: The header name: a token, and none of Content-Type, Content-Length, Connection and Transfer-Encoding in any case.
    • value: The header value: printable ASCII and tabs only, since it is written into the response's header block as given.
  • Json(string, HttpStatusCode) — Creates a response carrying as UTF-8 with the application/json content type.
    • json: The JSON document to send.
    • statusCode: The status code; 200 by default.
  • NotFound — The empty 404 the server sends for a path nothing is published on.
  • MethodNotAllowed(IEnumerable<string>) — The empty 405 the server sends for a path published only under other methods, naming those methods.
  • Refusal(HttpStatusCode) — A refusal the transport answers itself, before a request reaches the route table.

HttpServerSummary ​

A point-in-time summary of what a hosted HTTP server has answered and refused: counts of requests answered and refused, the last request and the last refusal, and the connections it is serving now.

Read it whenever you want it, without a Sync callback — every read returns a consistent snapshot. Every field is a service-property-legal type, so the whole summary can be published as one [ServiceProperty]. It changes with every request, so a member publishing it whole sends a new value once per interval for as long as requests arrive: once every 30 s by default, or at the MinInterval the member assigns. A request is counted as answered once its response has been written in full — the moment it is also recorded for the block to take. A route the block published itself with a 404 counts as answered; only a 404 or 405 the server sent because nothing was published counts as unmatched. The counts are for the lifetime of the server instance, across disabling and enabling, and are never reset. DroppedCount is the lifetime total; the snapshot's DroppedRequestCount counts only since the block last took the requests.

Properties:

  • LastRequestAt — The latest arrival among the requests the server has recorded.
  • AnsweredCount — Requests answered from a response the block published.
  • UnmatchedCount — Requests answered 404 or 405 because nothing was published for them.
  • RefusedCount — Requests the server refused itself: malformed, chunked, or over a size cap.
  • OverloadedCount — Connections refused with 503 because the connection limit was reached.
  • AbandonedCount — Connections closed with neither a response written in full nor a refusal.
  • DroppedCount — Recorded requests dropped from the log before the block took them.
  • LastRefusalAt — When the server last refused a request or a connection.
  • LastRefusalStatus — The status it refused with.
  • ActiveConnections — Connections the server is serving now.

Methods:

  • Constructor — A point-in-time summary of what a hosted HTTP server has answered and refused: counts of requests answered and refused, the last request and the last refusal, and the connections it is serving now.
    • LastRequestAt: The latest arrival among the requests the server has recorded.
    • AnsweredCount: Requests answered from a response the block published.
    • UnmatchedCount: Requests answered 404 or 405 because nothing was published for them.
    • RefusedCount: Requests the server refused itself: malformed, chunked, or over a size cap.
    • OverloadedCount: Connections refused with 503 because the connection limit was reached.
    • AbandonedCount: Connections closed with neither a response written in full nor a refusal.
    • DroppedCount: Recorded requests dropped from the log before the block took them.
    • LastRefusalAt: When the server last refused a request or a connection.
    • LastRefusalStatus: The status it refused with.
    • ActiveConnections: Connections the server is serving now.

IHttpServerSnapshot ​

The view of a hosted HTTP server a Sync callback receives: the responses it serves and the requests it has answered. Valid only while that callback runs.

Properties:

  • DroppedRequestCount — Gets how many answered requests were dropped, oldest first, because more arrived than the server keeps between two calls to .

Methods:

  • SetResponse(HttpMethod, string, HttpServerResponse) — Serves for on , replacing any response already set for that pair. The path starts with /, carries no query, and matches case-sensitively.
    • method: The request method to answer.
    • path: The request path to answer, without a query string.
    • response: The response to send.
  • RemoveResponse(HttpMethod, string) — Stops serving on .
    • method: The request method.
    • path: The request path.
  • ClearResponses — Stops serving every response, so every request answers 404.
  • TakeReceivedRequests — Returns the requests answered since the last call, oldest first, and resets DroppedRequestCount.

ILogicBlockHttpServer ​

Hosts an HTTP server for a logic block: clients elsewhere on the network request paths, and the server answers each from the responses the block has published.

Plain HTTP only. The server speaks unencrypted HTTP/1.1 and authenticates nobody: anything that can reach the port can read every response and send any request. Bind a trusted interface, or serve nothing a network peer must not see. The server is configured via properties and gated by IsEnabled: configure while disabled, then enable. It listens on loopback (127.0.0.1) on port 8080 unless told otherwise, so nothing off the machine reaches it until the block sets ListenAddress to an interface, or to 0.0.0.0 for all of them. The block publishes responses inside , keyed by method and path, and takes the requests the server has answered there too. Requests are answered on background threads from what the block last published; no event or callback is ever delivered to the block from those threads, so a block reacts to a request on its own cadence. A path with no response answers 404, and a path published only under other methods answers 405. Each connection carries one request and is closed after its response. A request body needs a Content-Length; a chunked body, an oversized request, a malformed one or a client that does not finish its request in time is refused by the server itself and never reaches the block.

Properties:

  • IsEnabled — Gets or sets whether the server is enabled. Setting true binds the listener and throws, leaving the server disabled, when the port cannot be bound. Must not be set from inside a Sync callback.
  • ListenAddress — Gets or sets the local IP address the server listens on. Default is "127.0.0.1" (loopback); "0.0.0.0" listens on all interfaces. Changeable only while disabled.
  • Port — Gets or sets the local port the server listens on, from 1 to 65535. Default is 8080; changeable only while disabled.
  • IsListening — Gets a value indicating whether the server is currently listening for connections.
  • Summary — Gets a snapshot of what the server has answered and refused, readable without a Sync callback; see HttpServerSummary for what publishing it costs.

Methods:

  • Sync(Action<IHttpServerSnapshot>) — Executes with exclusive access to the published responses and the answered requests.
    • access: The callback receiving the snapshot. It runs on the caller's thread while requests wait for it to return; keep it short, and do not use the snapshot after it returns.
  • Sync<T>(Func<IHttpServerSnapshot, T>) — Executes with exclusive access to the published responses and the answered requests, and returns its result.
    • access: The callback receiving the snapshot; see .

ILogicBlockHttpServerFactory ​

Factory for creating instances of ILogicBlockHttpServer.

Methods:

  • Create — Creates a new, disabled ILogicBlockHttpServer. Each instance hosts one server on its own port.

Vion.Dale.Sdk.MBus.TestKit ​

IMBusExtensions ​

Extension methods on IMBus for answering a logic block's pending M-Bus read in a test.

A simulation answers the read the block has pending and completes it, because a binding has one read in flight at a time; a second simulation with no read pending is refused. Every answer is stamped from the test context's virtual clock, and the callbacks are dispatched the way production dispatches them — call LogicBlockTestContext.FlushPendingActions() to run them. A capture from a log or a datasheet is replayed as hexadecimal text, one string per telegram, and runs through the frame checks and the decoder a gateway runs.

Methods:

  • SimulateReadResponse<T>(IMBus, LogicBlockTestContext<T>, string[]) — Answers the pending read with the given telegrams, through the frame checks and the decoder.
    • mBus: The M-Bus contract instance.
    • testContext: The test context the read was recorded in.
    • telegramsHex: Each telegram as hexadecimal text, from its start byte to its stop byte.
  • SimulateReadError<T>(IMBus, LogicBlockTestContext<T>, MBusOutcome) — Completes the pending read through its error callback with .
    • mBus: The M-Bus contract instance.
    • testContext: The test context the read was recorded in.
    • outcome: How the read failed; any outcome but Success.

LogicBlockTestContextExtensions ​

Verification extension methods for asserting M-Bus reads in tests.

Methods:

  • VerifyMBusReadSent<T>(LogicBlockTestContext<T>, IMBus, int?, int?, Times?) — Asserts that an M-Bus read was sent.
    • testContext: The test context for the logic block.
    • mBus: The M-Bus contract to filter by, or null for any.
    • primaryAddress: The expected primary address, or null to skip verification.
    • maxTelegrams: The expected telegram count, or null to skip verification.
    • times: The expected number of times, or null for once.

Vion.Dale.Sdk.MBus ​

IMBus ​

Reads wired M-Bus meters through the service provider that owns the M-Bus master. The provider returns the telegrams as the meter sent them; this contract checks and decodes them, and a logic block picks values from the readout with MBusSelectors.

Declare the binding as IMBus with [ServiceProviderContractBinding], enable it, and read on a timer. A contract starts disabled and executes no read until IsEnabled is set. One read is in flight per binding. A while the binding's previous read is pending is dropped: it publishes nothing, invokes neither callback and is counted in Link.BusyCount. The pending read's callbacks still arrive. One read returns the whole meter, so read once per interval. Every failure reaches the error callback as an MBusException whose Outcome equals the receipt's. Every M-Bus binding of a runtime shares one handler, and with it a limit of pending reads. Expiry is checked by a sweep that runs about once a second.

Properties:

  • IsEnabled — Whether the contract executes reads; false until set. A read already accepted still completes.
  • DefaultOperationTimeout — How long the service provider has to answer a read once it is published, including the time the read waits in the provider's line queue behind other meters; 300 s by default.
  • MaxQueuedAge — How long a read may take to reach the shared handler before it is completed as Expired unpublished; 30 s by default, null for no limit.
  • Link — The link to the meter: its state, counts per outcome and of busy reads, and recent latencies.

Methods:

  • Read(int, int, IActorDispatcher, Action<MBusReadout, MBusReceipt>, Action<Exception, MBusReceipt>, TimeSpan?) — Reads every telegram of the meter at , up to , and returns at once; the readout or the failure arrives later through . A read while this binding's previous read is pending does nothing, and an argument out of range is refused through the error callback.
    • primaryAddress: The meter's primary address, 0–250.
    • maxTelegrams: How many telegrams the meter sends, at least 1; a smaller count leaves the readout incomplete.
    • dispatcher: The actor the callbacks run on, normally the logic block itself.
    • successCallback: Receives the readout and the receipt.
    • errorCallback: Receives the failure, an MBusException, and the receipt.
    • operationTimeout: This read's operation timeout, or null for DefaultOperationTimeout .

MBusException ​

Every failed M-Bus read reaches the error callback as this exception; its Outcome equals the receipt's, which is what a logic block decides on.

Properties:

  • Outcome — How the read ended; the same as the receipt's outcome.
  • ResponseCode — The response code the service provider answered with, or null when no answer arrived.
  • Telegrams — For a ProtocolError, the telegrams as received, which a logic block can log as a capture; empty otherwise.

MBusFunction ​

Which value of a quantity a data record carries, as its function field states.

Fields/Values:

  • Instantaneous — The current value.
  • Maximum — A maximum value.
  • Minimum — A minimum value.
  • ValueDuringError — The value during an error state.

MBusHeader ​

The fixed header of a variable data telegram: who the meter is and the state it reports.

Properties:

  • Identification — The identification number, as its eight digits with leading zeros kept.
  • Manufacturer — The manufacturer, as its three-letter code.
  • Version — The meter's version or generation, as the manufacturer defines it.
  • Medium — The medium (device type) code.
  • AccessNumber — The access number, which the meter increments with each answer.
  • Status — The status byte.

MBusLinkState ​

The contract's verdict on the link to its meter, from the last read whose outcome says something about it.

Fields/Values:

  • Unknown — No read has said anything about the meter yet.
  • Online — The meter last answered with telegrams that passed their checks.
  • Faulted — The last read got no answer, a garbled one, an unavailable line, a timeout or telegrams that failed their checks.

MBusLinkSummary ​

A point-in-time summary of one M-Bus binding's link to its meter: the current verdict, when the meter was last heard from, lifetime counts per outcome and of busy reads, and latencies over a recent window and since the contract started.

Read it whenever you want it: every read returns a consistent snapshot. Every field is a service-property-legal type, so the whole summary can be published as one [ServiceProperty]; it changes with every read, so a member publishing it whole sends at most once every 30 s by default. State moves only on outcomes that say something about the meter: Success sets Online; NoResponse, Garbled, LineUnavailable, Timeout and ProtocolError set Faulted. Expired, Dropped and Invalid leave it alone. It does not decay with time; build a freshness rule from LastContactAt. A rising BusyCount means reads are issued faster than the line answers them: the binding's previous read was still pending each time. The Recent figures cover at least the last 15 minutes and less than 16 on the contract's clock, or its whole life where that is shorter. Round trip is taken from reads the provider answered, queued wait from reads that reached the shared handler; an empty window reads its mean and max as null.

Properties:

  • State — The verdict of the last read that said something about the meter.
  • LastContactAt — When the meter last answered with telegrams that passed their checks.
  • LastFailureAt — When the last read that did not succeed completed.
  • LastFailureOutcome — The outcome recorded at .
  • SuccessCount — Reads the meter answered with valid telegrams.
  • NoResponseCount — Reads the meter did not answer.
  • GarbledCount — Reads the provider saw garbled on the line.
  • LineUnavailableCount — Reads the provider could not put on its line.
  • TimeoutCount — Reads no answer arrived for in time.
  • ProtocolErrorCount — Reads whose telegrams failed their checks or could not be decoded.
  • ExpiredCount — Reads that aged past MaxQueuedAge before they were published.
  • DroppedCount — Reads dropped at the runtime-wide limit of pending reads.
  • InvalidCount — Reads refused for their arguments or mapping, or not understood by the provider.
  • BusyCount — Reads dropped because the binding's previous read was still pending.
  • RecentRoundTripCount — Reads the provider answered in the last 15 minutes.
  • RecentMeanRoundTrip — The mean publish-to-answer time over the last 15 minutes.
  • RecentMaxRoundTrip — The longest publish-to-answer time in the last 15 minutes.
  • MaxRoundTrip — The longest publish-to-answer time since the contract started.
  • MaxRoundTripAt — When the read that set was observed.
  • RecentQueuedWaitCount — Reads that reached the shared handler in the last 15 minutes.
  • RecentMeanQueuedWait — The mean hop to the shared handler over the last 15 minutes.
  • RecentMaxQueuedWait — The longest hop to the shared handler in the last 15 minutes.
  • MaxQueuedWait — The longest hop to the shared handler since the contract started.
  • MaxQueuedWaitAt — When the read that set was observed.

Methods:

  • Constructor — A point-in-time summary of one M-Bus binding's link to its meter: the current verdict, when the meter was last heard from, lifetime counts per outcome and of busy reads, and latencies over a recent window and since the contract started.
    • State: The verdict of the last read that said something about the meter.
    • LastContactAt: When the meter last answered with telegrams that passed their checks.
    • LastFailureAt: When the last read that did not succeed completed.
    • LastFailureOutcome: The outcome recorded at .
    • SuccessCount: Reads the meter answered with valid telegrams.
    • NoResponseCount: Reads the meter did not answer.
    • GarbledCount: Reads the provider saw garbled on the line.
    • LineUnavailableCount: Reads the provider could not put on its line.
    • TimeoutCount: Reads no answer arrived for in time.
    • ProtocolErrorCount: Reads whose telegrams failed their checks or could not be decoded.
    • ExpiredCount: Reads that aged past MaxQueuedAge before they were published.
    • DroppedCount: Reads dropped at the runtime-wide limit of pending reads.
    • InvalidCount: Reads refused for their arguments or mapping, or not understood by the provider.
    • BusyCount: Reads dropped because the binding's previous read was still pending.
    • RecentRoundTripCount: Reads the provider answered in the last 15 minutes.
    • RecentMeanRoundTrip: The mean publish-to-answer time over the last 15 minutes.
    • RecentMaxRoundTrip: The longest publish-to-answer time in the last 15 minutes.
    • MaxRoundTrip: The longest publish-to-answer time since the contract started.
    • MaxRoundTripAt: When the read that set was observed.
    • RecentQueuedWaitCount: Reads that reached the shared handler in the last 15 minutes.
    • RecentMeanQueuedWait: The mean hop to the shared handler over the last 15 minutes.
    • RecentMaxQueuedWait: The longest hop to the shared handler in the last 15 minutes.
    • MaxQueuedWait: The longest hop to the shared handler since the contract started.
    • MaxQueuedWaitAt: When the read that set was observed.

MBusOutcome ​

How a single M-Bus read ended.

Success sets the link state to Online; NoResponse, Garbled, LineUnavailable, Timeout and ProtocolError set it to Faulted. The others are decided without the meter — the request aged out, the shared limit was reached, the call or the deployment was wrong — and leave the link state as it was. A read refused because the binding's previous read is still pending has no outcome: it invokes neither callback and is counted in BusyCount.

Fields/Values:

  • Success — The meter answered and every telegram passed its checks.
  • NoResponse — The meter stayed silent through the service provider's repetitions.
  • Garbled — The service provider saw a checksum, framing, length or collision fault on the line.
  • LineUnavailable — The service provider's line or terminal was not ready, or its request queue was full.
  • Timeout — No answer arrived within the operation timeout.
  • ProtocolError — An answer arrived, but a telegram failed its checks or could not be decoded.
  • Expired — Not attempted: the read aged past MaxQueuedAge before it was published.
  • Dropped — Not attempted: the runtime-wide limit of pending reads was reached.
  • Invalid — Not attempted, or not understood: an argument was out of range, the binding is not mapped, or the service provider and this SDK are of different contract versions.

MBusQuantity ​

What a data record measures, as its value information names it. A record's Number is reported in the unit each member names, whichever coding of the quantity the meter sent.

A record whose value information is outside the decoder's table carries no quantity and is reached by its code.

Fields/Values:

  • Energy — Active energy, reported in Wh; codings in J are converted.
  • ReactiveEnergy — Reactive energy, reported in varh.
  • Volume — Volume, reported in m³.
  • Power — Active power, reported in W; codings in J/h are converted.
  • ReactivePower — Reactive power, reported in var.
  • ApparentPower — Apparent power, reported in VA.
  • VolumeFlow — Volume flow, reported in m³/h; codings per minute and per second are converted.
  • FlowTemperature — Flow (inlet) temperature, reported in °C.
  • ReturnTemperature — Return (outlet) temperature, reported in °C.
  • TemperatureDifference — Temperature difference, reported in K.
  • Voltage — Voltage, reported in V.
  • Current — Current, reported in A.
  • Frequency — Frequency, reported in Hz.
  • OperatingTime — Operating time, reported in h; codings in seconds, minutes and days are converted.
  • Dimensionless — A number without a unit, such as a power factor.
  • DateTime — A date, or a date and time, read from Timestamp.

MBusReadout ​

Everything one read returned: the telegrams in the order the meter sent them, and their records joined in that order.

A readout is incomplete when its last telegram announces more records than were read: the provider stopped before the meter did. Values from the telegrams that were not read are then missing, never zero. Fewer telegrams than the read asked for means the provider stopped; as many as asked for means the meter sends more than the read asked for.

Properties:

  • Header — The header of the first telegram.
  • Telegrams — The telegrams, in the order the meter sent them.
  • Records — The records of every telegram, in telegram order.
  • IsComplete — Whether the last telegram announces no further records, so every record the meter sends was read.
  • OnMiss — Called with each selector that finds nothing on a complete readout; the contract logs it.

Methods:

  • Find(MBusSelector) — The first record, in telegram order, that names, or null when none does.
    • selector: The record to find.
  • Value(MBusSelector, MBusUnit) — The value of the record names, in ; null when no record matches or the record has no value. On a complete readout a miss is logged once per selector.
    • selector: The record to read.
    • unit: The unit to convert the value into, one of its quantity's units.
  • SelectorFor(MBusRecord) — A selector that finds in this readout: by meaning where that names it unambiguously, by code otherwise. null for a record whose data and value information repeat an earlier record's, which every selector reaching it would find first.
    • record: A record of this readout.
  • Describe — One line per record: its number and telegram, quantity, value and unit, storage, tariff, subunit and function, its bytes, and a selector that finds it — or the record that shadows it.
  • Create(IReadOnlyList<byte[]>, int, int) — Checks and decodes the frames one read returned from the meter at .
  • ShadowOf(int) — The index of the earliest record with the same data and value information bytes, or -1 when there is none.

MBusReceipt ​

The per-read facts of one M-Bus read, handed to the success and the error callback.

The instants are taken in the shared handler the moment the answer or failure was observed, before the callback reaches the logic block's mailbox, so a receipt is usable as the age of the values it accompanies. Publish ReceivedAt; age a value with TimeProvider.GetElapsedTime(receipt.ReceivedTimestamp), which a corrected wall clock cannot move. QueuedWait is the hop from the logic block to the shared handler. RoundTrip runs from the handler's publish to the answer, so it includes the time the read waited in the service provider's line queue behind other meters.

Properties:

  • ReceivedAt — The UTC wall clock instant the answer or failure was observed.
  • ReceivedTimestamp — The same instant on the monotonic timestamp scale, for ageing the values.
  • RoundTrip — The time from publishing the read to observing the answer, the provider's line queue included.
  • QueuedWait — The time the read took to reach the shared handler.
  • Outcome — How the read ended.

Methods:

  • Constructor — The per-read facts of one M-Bus read, handed to the success and the error callback.
    • ReceivedAt: The UTC wall clock instant the answer or failure was observed.
    • ReceivedTimestamp: The same instant on the monotonic timestamp scale, for ageing the values.
    • RoundTrip: The time from publishing the read to observing the answer, the provider's line queue included.
    • QueuedWait: The time the read took to reach the shared handler.
    • Outcome: How the read ended.

MBusRecord ​

One data record of a telegram: what it measures, which value of it, and the value, with its bytes as received.

A record carries at most one of Number, Timestamp and Text, and none when the meter reported an error for it or its data cannot be read as a value.

Properties:

  • Quantity — What the record measures, or null when its value information is outside the decoder's table.
  • Function — Which value of the quantity the record carries.
  • Storage — The storage number: 0 for the current value, higher for stored ones such as a due-day value.
  • Tariff — The tariff number, 0 when the record belongs to no tariff.
  • Subunit — The subunit (device unit) number, which a meter uses for phases, channels or registers.
  • Number — The value as a number, scaled into the unit Quantity is reported in; the raw number when the record has no quantity.
  • Timestamp — The value as a date, or a date and time, in the meter's own time.
  • Text — The value as text.
  • Dib — The data information block as received: the DIF and its DIFEs.
  • Vib — The value information block as received: the VIF and its VIFEs.
  • Data — The data bytes as received.
  • HasMeaningChangingExtension — Whether a value information extension changes what the record means, so that it is not the plain value of its quantity and is reached only by its code.
  • Code — The data and value information blocks together: what a selector by code names, and what makes one record shadow another.

MBusSelector ​

Names the record a logic block wants from a readout: by meaning with , or by its exact bytes with .

Declare selectors once, as static readonly fields, and the block reads like the meter's datasheet. A selector prints as the C# that constructs it, which is what hands an author to paste.

Properties:

  • Quantity — The quantity a selector by meaning names, or null for a selector by code.

Methods:

  • Equals(MBusSelector) — (no description)
  • Of(MBusQuantity, long, int, int, MBusFunction) — Names a record by meaning; the defaults name the current value. A record whose value information carries an extension that changes its meaning — a limit, a rate, a future value — is never matched here and is reached with .
    • quantity: What the record measures.
    • storage: The storage number: 0 for the current value, higher for stored ones.
    • tariff: The tariff number, 0 for none.
    • subunit: The subunit number, which a meter uses for phases, channels or registers.
    • function: Which value of the quantity: the current one, a maximum, a minimum, or the value during an error.
  • ByCode(string) — Names a record by its exact data and value information bytes, as a datasheet lists them: the DIF and its DIFEs, then the VIF and its VIFEs.
    • code: The bytes as hexadecimal text, such as "84 80 C0 40 05".
  • ToString — The C# that constructs this selector.
  • Equals(object) — (no description)
  • GetHashCode — (no description)

MBusStatus ​

The status byte of a meter's telegram header.

Properties:

  • Value — The status byte as received.
  • HasError — Whether the meter reports an error: its application status reads "any application error" or "abnormal condition", or its permanent or temporary error bit is set. The manufacturer-specific bits and the power-low bit do not count.

Methods:

  • Constructor — The status byte of a meter's telegram header.
    • Value: The status byte as received.

MBusTelegram ​

One variable data telegram (RSP_UD, CI 72h) as a meter sent it, decoded into its header and data records.

renders the whole frame as hexadecimal text that reads back, which is the form a test replays a capture in.

Properties:

  • Raw — The whole frame as received, from its start byte to its stop byte.
  • Header — The fixed header.
  • Records — The data records, in the order the telegram carries them.
  • Address — The address field: the primary address of the meter that answered.
  • AnnouncesMoreRecords — Whether the telegram ends on the marker that announces more records in a further telegram.

Methods:

  • Parse(string) — Decodes one telegram from hexadecimal text, such as a capture from a log or a datasheet.
    • hex: The frame from its start byte to its stop byte; whitespace between the bytes is ignored.
  • Describe — One line per record, as prints a readout of this telegram alone: the step from a captured telegram to the selectors a logic block declares.
  • ToString — The whole frame as hexadecimal text, two digits per byte separated by spaces.
  • Decode(byte[]) — (no description)
  • Check(byte[]) — The long-frame checks of EN 13757-2 — start bytes, the repeated length, checksum and stop byte — and the one control information this decoder reads, a variable data response with its long header.

MBusUnit ​

A unit converts a record's value into. Each unit belongs to one quantity's family, and only values of that family convert into it.

Fields/Values:

  • WattHour — Wh, for energy.
  • KilowattHour — kWh, for energy.
  • MegawattHour — MWh, for energy.
  • VarHour — varh, for reactive energy.
  • KilovarHour — kvarh, for reactive energy.
  • CubicMeter — m³, for volume.
  • Liter — L, for volume.
  • Watt — W, for power.
  • Kilowatt — kW, for power.
  • Var — var, for reactive power.
  • Kilovar — kvar, for reactive power.
  • VoltAmpere — VA, for apparent power.
  • KilovoltAmpere — kVA, for apparent power.
  • CubicMeterPerHour — m³/h, for volume flow.
  • LiterPerHour — L/h, for volume flow.
  • Volt — V, for voltage.
  • Ampere — A, for current.
  • Hertz — Hz, for frequency.
  • Hour — h, for operating time.
  • DegreeCelsius — °C, for flow and return temperature, never for a temperature difference.
  • Kelvin — K, for a temperature difference, never for an absolute temperature.

Vion.Dale.Sdk.Modbus.Core ​

ServiceCollectionExtensions ​

Extension methods for setting up Modbus core services in an IServiceCollection.

Methods:

  • AddDaleModbusCoreSdk(IServiceCollection) — Adds Modbus core services to the specified IServiceCollection.
    • serviceCollection: The IServiceCollection to add services to.

Vion.Dale.Sdk.Modbus.Core.Client ​

IModbusClient ​

The Modbus operations and link diagnostics every Dale Modbus client offers, whatever the transport.

Every read and write is non-blocking: the call returns immediately and the result arrives later on the logic block's own thread, through the dispatcher passed with the call. Pass this from inside a logic block. Both callbacks carry a ModbusReceipt — when the response was observed, how long it took on the wire, how long it waited before that, and how it ended. The instants are taken before the callback is handed to the block's mailbox, so they measure the transaction and not the block's own backlog. Ignore it with a discard where you do not need it: (values, _) =&gt; Power = values[0]. Link is the same information accumulated per client: the current verdict on the device, the last contact, and counts and latencies per outcome. It is a snapshot struct, readable at any time and publishable as a single [ServiceProperty]. A locally decided outcome — a full or backed-up queue, a bad unit id — never moves Link.State, so a congested client is distinguishable from a broken device. Which of them carry a lifetime counter is stated on ModbusLinkSummary. MaxQueuedAge bounds how stale a request may be when its turn finally comes. Past that age a request completes immediately with Outcome.Expired and the device is never contacted, so a queue that built up during an outage drains in microseconds instead of replaying minutes of dead work. It defaults to 30 seconds; set it to null to let every queued request through however old it is. DefaultOperationTimeout covers the wire only — from dispatch to the complete response. The wait before dispatch is MaxQueuedAge's business, and both appear separately on the receipt as RoundTrip and QueuedWait. What differs between the transports is inherent and is stated on each client type: Modbus TCP owns one socket and one request queue per client, so it also reports a connection summary and a queue depth, and defaults to a 1 second operation timeout. Modbus RTU goes through one runtime-wide handler shared by every binding, so its overflow limit and its 1 second expiry sweep are shared with other blocks, its queue depth is reported as zero, and it defaults to a 5 second operation timeout.

Properties:

  • IsEnabled — Gets or sets whether the client executes operations. Default is false.
  • DefaultOperationTimeout — Gets or sets the wire timeout used by operations that do not pass their own.
  • MaxQueuedAge — Gets or sets how stale a request may be when its turn comes. Default is 30 seconds; null disables the check.
  • Link — Gets a snapshot of the link to the device: current verdict, last contact, and counts per outcome.

Methods:

  • ReadDiscreteInputs(int, ushort, ushort, IActorDispatcher, Action<bool[], ModbusReceipt>, Action<Exception, ModbusReceipt>, TimeSpan?) — Reads discrete inputs (Function Code 2).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • quantity: The number of registers or bits to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the bits read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadCoils(int, ushort, ushort, IActorDispatcher, Action<bool[], ModbusReceipt>, Action<Exception, ModbusReceipt>, TimeSpan?) — Reads coils (Function Code 1).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • quantity: The number of registers or bits to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the bits read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteSingleCoil(int, ushort, bool, IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, TimeSpan?) — Writes one coil (Function Code 5).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • registerAddress: The address of the register or coil to write.
    • value: The value to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteMultipleCoils(int, ushort, bool[], IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, TimeSpan?) — Writes several consecutive coils (Function Code 15).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or coil to write.
    • values: The values to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadInputRegistersRaw(int, ushort, ushort, IActorDispatcher, Action<byte[], ModbusReceipt>, Action<Exception, ModbusReceipt>, TimeSpan?) — Reads input registers as raw bytes (Function Code 4).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • quantity: The number of registers or bits to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the raw response bytes and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadInputRegistersAsShort(int, ushort, ushort, IActorDispatcher, Action<short[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, TimeSpan?) — Reads input registers as signed 16-bit integers (Function Code 4).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • quantity: The number of registers or bits to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadInputRegistersAsUShort(int, ushort, ushort, IActorDispatcher, Action<ushort[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, TimeSpan?) — Reads input registers as unsigned 16-bit integers (Function Code 4).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • quantity: The number of registers or bits to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadInputRegistersAsInt(int, ushort, uint, IActorDispatcher, Action<int[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder32, TimeSpan?) — Reads input registers as signed 32-bit integers (Function Code 4).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadInputRegistersAsUInt(int, ushort, uint, IActorDispatcher, Action<uint[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder32, TimeSpan?) — Reads input registers as unsigned 32-bit integers (Function Code 4).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadInputRegistersAsFloat(int, ushort, uint, IActorDispatcher, Action<float[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder32, TimeSpan?) — Reads input registers as 32-bit floating point values (Function Code 4).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadInputRegistersAsLong(int, ushort, uint, IActorDispatcher, Action<long[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder64, TimeSpan?) — Reads input registers as signed 64-bit integers (Function Code 4).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadInputRegistersAsULong(int, ushort, uint, IActorDispatcher, Action<ulong[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder64, TimeSpan?) — Reads input registers as unsigned 64-bit integers (Function Code 4).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadInputRegistersAsDouble(int, ushort, uint, IActorDispatcher, Action<double[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder64, TimeSpan?) — Reads input registers as 64-bit floating point values (Function Code 4).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadInputRegistersAsString(int, ushort, ushort, IActorDispatcher, Action<string, ModbusReceipt>, Action<Exception, ModbusReceipt>, TextEncoding, TimeSpan?) — Reads input registers as text (Function Code 4).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • quantity: The number of registers or bits to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the decoded text and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • textEncoding: The character encoding of the register bytes.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadHoldingRegistersRaw(int, ushort, ushort, IActorDispatcher, Action<byte[], ModbusReceipt>, Action<Exception, ModbusReceipt>, TimeSpan?) — Reads holding registers as raw bytes (Function Code 3).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • quantity: The number of registers or bits to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the raw response bytes and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadHoldingRegistersAsShort(int, ushort, ushort, IActorDispatcher, Action<short[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, TimeSpan?) — Reads holding registers as signed 16-bit integers (Function Code 3).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • quantity: The number of registers or bits to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadHoldingRegistersAsUShort(int, ushort, ushort, IActorDispatcher, Action<ushort[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, TimeSpan?) — Reads holding registers as unsigned 16-bit integers (Function Code 3).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • quantity: The number of registers or bits to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadHoldingRegistersAsInt(int, ushort, uint, IActorDispatcher, Action<int[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder32, TimeSpan?) — Reads holding registers as signed 32-bit integers (Function Code 3).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadHoldingRegistersAsUInt(int, ushort, uint, IActorDispatcher, Action<uint[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder32, TimeSpan?) — Reads holding registers as unsigned 32-bit integers (Function Code 3).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadHoldingRegistersAsFloat(int, ushort, uint, IActorDispatcher, Action<float[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder32, TimeSpan?) — Reads holding registers as 32-bit floating point values (Function Code 3).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadHoldingRegistersAsLong(int, ushort, uint, IActorDispatcher, Action<long[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder64, TimeSpan?) — Reads holding registers as signed 64-bit integers (Function Code 3).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadHoldingRegistersAsULong(int, ushort, uint, IActorDispatcher, Action<ulong[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder64, TimeSpan?) — Reads holding registers as unsigned 64-bit integers (Function Code 3).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadHoldingRegistersAsDouble(int, ushort, uint, IActorDispatcher, Action<double[], ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder64, TimeSpan?) — Reads holding registers as 64-bit floating point values (Function Code 3).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • count: The number of values to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the values read and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • ReadHoldingRegistersAsString(int, ushort, ushort, IActorDispatcher, Action<string, ModbusReceipt>, Action<Exception, ModbusReceipt>, TextEncoding, TimeSpan?) — Reads holding registers as text (Function Code 3).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or bit to read.
    • quantity: The number of registers or bits to read.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the decoded text and the transaction's receipt.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • textEncoding: The character encoding of the register bytes.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteSingleHoldingRegister(int, ushort, short, IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, TimeSpan?) — Writes one holding register (Function Code 6).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • registerAddress: The address of the register or coil to write.
    • value: The value to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteSingleHoldingRegister(int, ushort, ushort, IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, TimeSpan?) — Writes one holding register (Function Code 6).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • registerAddress: The address of the register or coil to write.
    • value: The value to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteMultipleHoldingRegistersRaw(int, ushort, byte[], IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, TimeSpan?) — Writes consecutive holding registers from raw bytes (Function Code 16).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or coil to write.
    • values: The values to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteMultipleHoldingRegistersAsShort(int, ushort, short[], IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, TimeSpan?) — Writes consecutive holding registers as signed 16-bit integers (Function Code 16).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or coil to write.
    • values: The values to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteMultipleHoldingRegistersAsUShort(int, ushort, ushort[], IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, TimeSpan?) — Writes consecutive holding registers as unsigned 16-bit integers (Function Code 16).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or coil to write.
    • values: The values to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteMultipleHoldingRegistersAsInt(int, ushort, int[], IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder32, TimeSpan?) — Writes consecutive holding registers as signed 32-bit integers (Function Code 16).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or coil to write.
    • values: The values to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteMultipleHoldingRegistersAsUInt(int, ushort, uint[], IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder32, TimeSpan?) — Writes consecutive holding registers as unsigned 32-bit integers (Function Code 16).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or coil to write.
    • values: The values to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteMultipleHoldingRegistersAsFloat(int, ushort, float[], IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder32, TimeSpan?) — Writes consecutive holding registers as 32-bit floating point values (Function Code 16).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or coil to write.
    • values: The values to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteMultipleHoldingRegistersAsLong(int, ushort, long[], IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder64, TimeSpan?) — Writes consecutive holding registers as signed 64-bit integers (Function Code 16).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or coil to write.
    • values: The values to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteMultipleHoldingRegistersAsULong(int, ushort, ulong[], IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder64, TimeSpan?) — Writes consecutive holding registers as unsigned 64-bit integers (Function Code 16).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or coil to write.
    • values: The values to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteMultipleHoldingRegistersAsDouble(int, ushort, double[], IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, ByteOrder, WordOrder64, TimeSpan?) — Writes consecutive holding registers as 64-bit floating point values (Function Code 16).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or coil to write.
    • values: The values to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • byteOrder: The byte order of each register.
    • wordOrder: The order of the registers making up one value.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.
  • WriteMultipleHoldingRegistersAsString(int, ushort, string, IActorDispatcher, Action<ModbusReceipt>, Action<Exception, ModbusReceipt>, TextEncoding, TimeSpan?) — Writes consecutive holding registers as text (Function Code 16).
    • unitIdentifier: The unit identifier (slave address) of the device.
    • startingAddress: The address of the first register or coil to write.
    • value: The value to write.
    • dispatcher: The dispatcher that invokes the callbacks — pass the calling logic block (this).
    • successCallback: Invoked with the transaction's receipt when the device acknowledges the write.
    • errorCallback: Invoked with the failure and the transaction's receipt. Failures are logged whether or not this is set.
    • textEncoding: The character encoding of the register bytes.
    • operationTimeout: The time allowed on the wire before the operation is abandoned. null uses DefaultOperationTimeout.

Vion.Dale.Sdk.Modbus.Core.Conversion ​

ByteOrder ​

Specifies the byte order for multibyte values.

The Modbus protocol standard defines MsbToLsb (big-endian) as the standard byte order. However, not all devices respect this standard, so both byte orders are supported.

Fields/Values:

  • MsbToLsb — Most significant byte first (big-endian).
  • LsbToMsb — Least significant byte first (little-endian).

IModbusDataConverter ​

Provides data conversion operations for Modbus register and coil data.

Methods:

  • ConvertCountToQuantity(uint, int) — Converts a count of values to the number of registers required.
    • count: The number of values.
    • bytesPerCount: The number of bytes per value.
  • SwapBytes(Memory<byte>, ByteOrder) — Swaps bytes according to the specified byte order if it differs from the system's endianness.
    • bytes: The byte array to swap.
    • byteOrder: The byte order of the data. For reads, this is the order the data is currently in. For writes, this is the target order to convert to.
  • SwapWords(Memory<byte>, WordOrder32) — Swaps 16-bit words within 32-bit values according to the specified word order if it differs from the system's endianness.
    • bytes: The byte array containing 32-bit values.
    • wordOrder: The word order of the data. For reads, this is the order the data is currently in. For writes, this is the target order to convert to.
  • SwapWords(Memory<byte>, WordOrder64) — Swaps 16-bit words within 64-bit values according to the specified word order.
    • bytes: The byte array containing 64-bit values.
    • wordOrder: The word order of the data. For reads, this is the order the data is currently in. For writes, this is the target order to convert to.
  • ConvertBytesToString(Memory<byte>, TextEncoding) — Converts a byte array to a string using the specified text encoding.
    • bytes: The byte array to convert.
    • textEncoding: The text encoding to use.
  • ConvertStringToBytes(string, TextEncoding) — Converts a string to a byte array using the specified text encoding.
    • value: The string to convert.
    • textEncoding: The text encoding to use.
  • ConvertBitsToBools(Memory<byte>, ushort) — Converts packed bits into a boolean array, unpacking values starting from the least significant bit.
    • bytes: The byte array containing packed boolean values.
    • quantity: The number of boolean values to extract.
  • CastToBytes<T>(T[]) — Casts an array of unmanaged values to a byte array.
    • values: The values to cast.
  • CastFromBytes<T>(Memory<byte>) — Casts a byte array to an array of unmanaged values.
    • bytes: The byte array to cast.
  • GetBytes(short) — Converts a signed 16-bit integer to a byte array.
    • value: The value to convert.
  • GetBytes(ushort) — Converts an unsigned 16-bit integer to a byte array.
    • value: The value to convert.
  • ToByte(bool) — Converts a boolean value to a byte representation.
    • value: The boolean value to convert.

TextEncoding ​

Specifies the text encoding format for string conversion.

Fields/Values:

  • Ascii — ASCII encoding (7-bit character set).
  • Utf8 — UTF-8 encoding (variable-length, 1-4 bytes per character).
  • Utf16Le — UTF-16 Little Endian encoding (2 or 4 bytes per character).
  • Utf16Be — UTF-16 Big Endian encoding (2 or 4 bytes per character).

WordOrder32 ​

Specifies the word order for 32-bit values composed of two 16-bit words.

Fields/Values:

  • MswToLsw — Most significant word first (big-endian word order).
  • LswToMsw — Least significant word first (little-endian word order).

WordOrder64 ​

Specifies the word order for 64-bit values composed of four 16-bit words.

Fields/Values:

  • ABCD — Big-endian word order most significant word to least significant word (A is the most significant word).
  • DCBA — Little-endian word order least significant to most significant word (D is the least significant word).
  • CDAB — Mid-big-endian word order, big endian because when CD and AB are swapped it results in ABCD which is big-endian (A is the most significant word).
  • BADC — Mid-little-endian word order, little endian because when BA and DC are swapped it results in DCBA which is little-endian (D is the least significant word).

Vion.Dale.Sdk.Modbus.Core.Diagnostics ​

ModbusLinkState ​

The client's verdict on the link to its device, derived from the last transaction that reached the wire.

Fields/Values:

  • Unknown — No transaction has reached the wire yet.
  • Online — The device last answered — with data or with a Modbus exception code.
  • Faulted — The last attempt to reach the device timed out, failed on the transport, or returned an invalid response.

ModbusLinkSummary ​

A point-in-time summary of one Modbus client's link to its device: the current verdict, when the device was last heard from, lifetime counts per outcome, and latencies over a recent window and since the client started.

Read it whenever you want it — every read returns a consistent snapshot, taken without blocking the transaction that is updating it. Every field is a service-property-legal type, so the whole summary can be published as one [ServiceProperty], and every field carries a title and a description so it reads without a projection. It changes with every transaction, so a member publishing it whole sends a new value once per interval for as long as the client is in use: once every 30 s by default, or at the MinInterval the member assigns. When every change of the verdict matters, publish State — or a status derived from it — as its own member beside the summary, so the summary itself can stay slow. State moves only on outcomes that reached the wire: Success and DeviceError set Online; Timeout, TransportError and ProtocolError set Faulted. Locally decided outcomes — Expired, Dropped, BackedOff, Invalid, Cancelled — leave it alone: a full queue or a bad unit id is not evidence about the device. Every outcome sets LastFailureAt / LastFailureOutcome, but only eight of the ten carry a lifetime counter: the five that reached the wire, plus BackedOffCount, ExpiredCount and DroppedCount. Invalid and Cancelled have none — read them off LastFailureOutcome, or count them in the block from the receipt. State does not decay with time. A client that is polled once an hour and answered an hour ago is still Online here, because only the caller knows its own poll cadence. Build a freshness rule from LastContactAt, or from the monotonic stamp on the receipt of the value you care about. The Recent figures cover a window of the last 15 minutes on the client's clock — at least 15 and less than 16, or the client's whole life where that is shorter — and forget what falls out of it, so a spike that is not repeated leaves them within 16 minutes. Each carries the number of transactions it rests on. An empty window reads its mean and max as null and its count as zero. Round trip is taken only from transactions that reached the wire; queued wait from every transaction that was queued, which is all of them but Invalid. The two counts differ exactly when requests were backed off, expired, dropped or cancelled. The outcome counts and the two since start maxima are for the lifetime of the client instance and are never reset. A maximum's instant is when the transaction that set it was observed, and only a larger value moves it.

Properties:

  • State — The verdict of the last transaction that reached the wire.
  • LastContactAt — When the device last answered, with data or with a Modbus exception code.
  • LastFailureAt — When the last non-successful outcome was recorded, local ones included.
  • LastFailureOutcome — The outcome recorded at .
  • SuccessCount — Transactions the device answered with data.
  • DeviceErrorCount — Transactions the device answered with a Modbus exception code.
  • TimeoutCount — Transactions that got no answer in time.
  • TransportErrorCount — Transactions that failed on the socket or serial stream.
  • ProtocolErrorCount — Transactions whose answer was not a valid response for the request.
  • BackedOffCount — Transactions not attempted because the client was in connect backoff.
  • ExpiredCount — Transactions that aged past MaxQueuedAge before dispatch.
  • DroppedCount — Transactions evicted because the queue was full.
  • RecentRoundTripCount — Transactions that reached the wire in the last 15 minutes.
  • RecentMeanRoundTrip — The mean dispatch-to-response time over the last 15 minutes.
  • RecentMaxRoundTrip — The longest dispatch-to-response time in the last 15 minutes.
  • MaxRoundTrip — The longest dispatch-to-response time since the client started.
  • MaxRoundTripAt — When the transaction that set was observed.
  • RecentQueuedWaitCount — Requests queued in the last 15 minutes.
  • RecentMeanQueuedWait — The mean local wait before dispatch over the last 15 minutes.
  • RecentMaxQueuedWait — The longest local wait before dispatch in the last 15 minutes.
  • MaxQueuedWait — The longest local wait before dispatch since the client started.
  • MaxQueuedWaitAt — When the transaction that set was observed.
  • QueueDepth — Requests waiting to be dispatched right now.

Methods:

  • Constructor — A point-in-time summary of one Modbus client's link to its device: the current verdict, when the device was last heard from, lifetime counts per outcome, and latencies over a recent window and since the client started.
    • State: The verdict of the last transaction that reached the wire.
    • LastContactAt: When the device last answered, with data or with a Modbus exception code.
    • LastFailureAt: When the last non-successful outcome was recorded, local ones included.
    • LastFailureOutcome: The outcome recorded at .
    • SuccessCount: Transactions the device answered with data.
    • DeviceErrorCount: Transactions the device answered with a Modbus exception code.
    • TimeoutCount: Transactions that got no answer in time.
    • TransportErrorCount: Transactions that failed on the socket or serial stream.
    • ProtocolErrorCount: Transactions whose answer was not a valid response for the request.
    • BackedOffCount: Transactions not attempted because the client was in connect backoff.
    • ExpiredCount: Transactions that aged past MaxQueuedAge before dispatch.
    • DroppedCount: Transactions evicted because the queue was full.
    • RecentRoundTripCount: Transactions that reached the wire in the last 15 minutes.
    • RecentMeanRoundTrip: The mean dispatch-to-response time over the last 15 minutes.
    • RecentMaxRoundTrip: The longest dispatch-to-response time in the last 15 minutes.
    • MaxRoundTrip: The longest dispatch-to-response time since the client started.
    • MaxRoundTripAt: When the transaction that set was observed.
    • RecentQueuedWaitCount: Requests queued in the last 15 minutes.
    • RecentMeanQueuedWait: The mean local wait before dispatch over the last 15 minutes.
    • RecentMaxQueuedWait: The longest local wait before dispatch in the last 15 minutes.
    • MaxQueuedWait: The longest local wait before dispatch since the client started.
    • MaxQueuedWaitAt: When the transaction that set was observed.
    • QueueDepth: Requests waiting to be dispatched right now.

ModbusOutcome ​

How a single Modbus read or write ended.

The first five values are link verdicts: the request reached the wire (or should have), so the outcome says something about the device and the connection to it. The remaining values are decided locally — the request never reached the device — and therefore say nothing about link health. This split is what lets a block distinguish a backed-up local queue from a broken device or network: only the link verdicts move State. Every outcome is reported on the receipt and as LastFailureOutcome; Invalid and Cancelled are the two the summary keeps no lifetime counter for.

Fields/Values:

  • Success — The device answered with the requested data.
  • DeviceError — The device answered with a Modbus exception code — the link is up, the request was wrong.
  • Timeout — No answer arrived in time: an operation timeout, a connect timeout, or an expiry sweep.
  • TransportError — The socket or serial stream failed.
  • ProtocolError — An answer arrived but was not a valid response for the request.
  • BackedOff — Not attempted: the client is waiting out a connect backoff.
  • Expired — Not attempted: the request aged past MaxQueuedAge before dispatch.
  • Dropped — Not attempted: the request was evicted because the queue was full.
  • Invalid — Not attempted: the call itself was invalid — a bad unit id, a missing address, an unsupported conversion.
  • Cancelled — Not attempted, or abandoned: the client was disposed or the queue was cancelled.

ModbusReceipt ​

The per-transaction facts of one Modbus read or write, handed to the success and error callback of every operation.

The instants are taken the moment the response or failure was observed — on the queue consumer for Modbus TCP, in the RTU handler the moment the response arrives — and therefore before the callback is handed to the logic block's mailbox. A receipt is unaffected by how long the block then takes to process it, which is what makes it usable as the age of the value it accompanies. ReceivedAt is wall clock and is what you publish; ReceivedTimestamp is the same instant on the monotonic timestamp scale and is what you compare against later. Age a value with TimeProvider.GetElapsedTime(receipt.ReceivedTimestamp) — a wall clock can step backwards when the gateway's clock is corrected, a monotonic timestamp cannot. QueuedWait and RoundTrip split the total latency into the part you control and the part the device controls: QueuedWait is the wait before dispatch (Modbus TCP: time in the client's request queue; Modbus RTU: the hop from the block to the shared handler), RoundTrip is dispatch to response. A RoundTrip that includes a connection handshake is not separated out — subtract Connection.LastConnectDuration if that distinction matters. Ignoring a receipt is a discard: (values, _) =&gt; Power = values[0].

Properties:

  • ReceivedAt — The UTC wall clock instant the response or failure was observed.
  • ReceivedTimestamp — The same instant on the monotonic timestamp scale, for ageing the value.
  • RoundTrip — The time from dispatching the request to observing the response.
  • QueuedWait — The time the request waited locally before it was dispatched.
  • Outcome — How the operation ended.

Methods:

  • Constructor — The per-transaction facts of one Modbus read or write, handed to the success and error callback of every operation.
    • ReceivedAt: The UTC wall clock instant the response or failure was observed.
    • ReceivedTimestamp: The same instant on the monotonic timestamp scale, for ageing the value.
    • RoundTrip: The time from dispatching the request to observing the response.
    • QueuedWait: The time the request waited locally before it was dispatched.
    • Outcome: How the operation ended.

Vion.Dale.Sdk.Modbus.Core.Exceptions ​

InvalidBitQuantityException ​

Exception thrown when the requested quantity of bits exceeds the available bits in the byte array.

This occurs when fewer coils or discrete inputs are returned by the Modbus device than were requested.

Properties:

  • RequestedQuantity — Gets the requested quantity of bits.
  • AvailableBits — Gets the available number of bits.

Methods:

  • Constructor — Initializes a new instance of the InvalidBitQuantityException class.
    • requestedQuantity: The requested quantity of bits.
    • availableBits: The available number of bits in the byte array.

InvalidCountException ​

Exception thrown when a count value is invalid for a Modbus operation.

This occurs when the requested count of values results in a register quantity that is 0 or exceeds the maximum of 65535 registers. For example, requesting 17000 64-bit values requires 68000 registers.

Properties:

  • Count — Gets the invalid count value.

Methods:

  • Constructor — Initializes a new instance of the InvalidCountException class.
    • count: The invalid count value.
    • message: The error message.

InvalidServerAddressException ​

Thrown when a server-side register or bit access lies outside the declared extent of its area.

Methods:

  • Constructor — Initializes a new instance of the InvalidServerAddressException class.
    • area: The register area that was accessed.
    • startingAddress: The first address of the attempted access.
    • quantity: The number of registers or bits of the attempted access.
    • extent: The declared extent of the area (addresses 0 to extent - 1 are served).

InvalidUnitIdentifierException ​

Exception thrown when an invalid unit identifier is provided.

Properties:

  • UnitIdentifier — Gets the invalid unit identifier that caused the exception.

Methods:

  • Constructor — Initializes a new instance of the InvalidUnitIdentifierException class.
    • unitIdentifier: The invalid unit identifier.

ModbusException ​

Represents errors that occur during Modbus communication.

Properties:

  • ExceptionCode — The Modbus exception code the device reported. Meaningless unless HasExceptionCode is true.
  • HasExceptionCode — Whether the device reported an exception code. When false the failure is a frame or protocol fault, not a refusal by the device.

Methods:

  • Constructor — Initializes a new instance of the ModbusException class for a failure that carries no device exception code.
    • message: The error message that describes the Modbus communication failure.
  • Constructor — Initializes a new instance of the ModbusException class with a specified Modbus exception code and error message.
    • exceptionCode: The Modbus exception code identifying the type of failure.
    • message: The error message that describes the Modbus communication failure.

ModbusExceptionCode ​

Specifies the Modbus exception type.

Fields/Values:

  • Ok — Only used by the server to indicated that no exception should be returned to the client.
  • IllegalFunction — The function code received in the query is not an allowable action for the server.
  • IllegalDataAddress — The data address received in the query is not an allowable address for the server.
  • IllegalDataValue — A value contained in the query data field is not an allowable value for server.
  • ServerDeviceFailure — An unrecoverable error occurred while the server was attempting to perform the requested action.
  • Acknowledge — Specialized use in conjunction with programming commands. The server has accepted the request and is processing it, but a long duration of time will be required to do so.
  • ServerDeviceBusy — Specialized use in conjunction with programming commands. The engaged in processing a long–duration program command.
  • MemoryParityError — Specialized use in conjunction with function codes 20 and 21 and reference type 6, to indicate that the extended file area failed to pass a consistency check.
  • GatewayPathUnavailable — Specialized use in conjunction with gateways, indicates that the gateway was unable to allocate an internal communication path from the input port to the output port for processing the request.
  • GatewayTargetDeviceFailedToRespond — Specialized use in conjunction with gateways, indicates that no response was obtained from the target device.

ModbusResponseAlignmentException ​

Represents an exception thrown when a Modbus response does not have the correct byte alignment for the requested data type.

This occurs when the number of bytes received does not match the expected amount for the requested registers. For example, reading 2 registers expects 4 bytes; if 5 bytes are returned, this exception is thrown.

Properties:

  • UnitIdentifier — Gets the unit identifier (slave address) from which the response was received.
  • StartingAddress — Gets the starting address of the read operation.
  • ByteCount — Gets the number of bytes received in the response.
  • BytesPerValue — Gets the number of bytes per value that was expected.

Methods:

  • Constructor — Initializes a new instance of the ModbusResponseAlignmentException class.
    • unitIdentifier: The unit identifier (slave address).
    • startingAddress: The starting address of the read operation.
    • byteCount: The number of bytes received.
    • bytesPerValue: The expected number of bytes per value.

OperationTimeoutException ​

Exception thrown when a Modbus read or write operation does not complete within the specified timeout period.

Methods:

  • Constructor — Initializes a new instance of the OperationTimeoutException class.

RequestExpiredException ​

Thrown when a request waited longer than MaxQueuedAge before its turn came, so it was completed without contacting the device. This says nothing about the link — it means the client could not keep up with the rate requests were issued at, or was held up earlier by a fault.

Properties:

  • RequestName — Gets the name of the expired request.
  • QueuedWait — Gets how long the request had been waiting when it was discarded.
  • MaxQueuedAge — Gets the maximum queued age that was in force.

Methods:

  • Constructor — Initializes a new instance of the RequestExpiredException class.
    • requestName: The name of the request that expired.
    • queuedWait: How long the request had been waiting.
    • maxQueuedAge: The maximum queued age that was in force.

UnsupportedByteOrderException ​

Exception thrown when an unsupported byte order value is specified.

Properties:

  • ByteOrder — Gets the unsupported byte order value.

Methods:

  • Constructor — Initializes a new instance of the UnsupportedByteOrderException class.
    • byteOrder: The unsupported byte order value.

UnsupportedTextEncodingException ​

Exception thrown when an unsupported text encoding value is specified.

Properties:

  • TextEncoding — Gets the unsupported text encoding value.

Methods:

  • Constructor — Initializes a new instance of the UnsupportedTextEncodingException class.
    • textEncoding: The unsupported text encoding value.

UnsupportedWordOrder32Exception ​

Exception thrown when an unsupported 32-bit word order value is specified.

Properties:

  • WordOrder — Gets the unsupported 32-bit word order value.

Methods:

  • Constructor — Initializes a new instance of the UnsupportedWordOrder32Exception class.
    • wordOrder: The unsupported 32-bit word order value.

UnsupportedWordOrder64Exception ​

Exception thrown when an unsupported 64-bit word order value is specified.

Properties:

  • WordOrder — Gets the unsupported 64-bit word order value.

Methods:

  • Constructor — Initializes a new instance of the UnsupportedWordOrder64Exception class.
    • wordOrder: The unsupported 64-bit word order value.

Vion.Dale.Sdk.Modbus.Core.Server ​

IModbusBitAccessor ​

Typed access to one bit-addressed server area (coils or discrete inputs) inside a server snapshot.

Only valid inside the snapshot callback that provided it — the server lock is held for the duration of the callback and released afterwards. Do not capture accessors outside the callback.

Methods:

  • Read(ushort) — Reads a single bit.
    • address: The bit address to read.
  • Write(ushort, bool) — Writes a single bit.
    • address: The bit address to write.
    • value: The bit value to write.

IModbusRegisterAccessor ​

Typed access to one register-addressed server area (holding or input registers) inside a server snapshot.

Only valid inside the snapshot callback that provided it — the server lock is held for the duration of the callback and released afterwards. Do not capture accessors outside the callback. Method names, parameters, and defaults mirror the typed method family of the Modbus TCP client (Raw/As&lt;Type&gt;); all conversions are converter-backed, so byte and word order are explicit parameters and the underlying buffer is only ever touched in wire order.

Methods:

  • ReadRaw(ushort, ushort) — Reads registers as raw bytes in wire order (big-endian per 16-bit word).
    • startingAddress: The register address to start reading from.
    • quantity: The number of registers (16 bit per register) to read.
  • WriteRaw(ushort, byte[]) — Writes raw register bytes in wire order (big-endian per 16-bit word).
    • startingAddress: The register address to start writing at.
    • registerBytes: The register bytes to write (2 bytes per register).
  • ReadAsShort(ushort, ByteOrder) — Reads one register as a signed 16-bit integer.
    • startingAddress: The register address to read.
    • byteOrder: The byte order the data is stored in. Default is MsbToLsb.
  • WriteAsShort(ushort, short, ByteOrder) — Writes one register as a signed 16-bit integer.
    • startingAddress: The register address to write.
    • value: The value to write.
    • byteOrder: The byte order to store the data in. Default is MsbToLsb.
  • ReadAsUShort(ushort, ByteOrder) — Reads one register as an unsigned 16-bit integer.
    • startingAddress: The register address to read.
    • byteOrder: The byte order the data is stored in. Default is MsbToLsb.
  • WriteAsUShort(ushort, ushort, ByteOrder) — Writes one register as an unsigned 16-bit integer.
    • startingAddress: The register address to write.
    • value: The value to write.
    • byteOrder: The byte order to store the data in. Default is MsbToLsb.
  • ReadAsInt(ushort, ByteOrder, WordOrder32) — Reads two consecutive registers as a signed 32-bit integer.
    • startingAddress: The register address of the first register.
    • byteOrder: The byte order the data is stored in. Default is MsbToLsb.
    • wordOrder: The word order the data is stored in. Default is MswToLsw.
  • WriteAsInt(ushort, int, ByteOrder, WordOrder32) — Writes two consecutive registers as a signed 32-bit integer.
    • startingAddress: The register address of the first register.
    • value: The value to write.
    • byteOrder: The byte order to store the data in. Default is MsbToLsb.
    • wordOrder: The word order to store the data in. Default is MswToLsw.
  • ReadAsUInt(ushort, ByteOrder, WordOrder32) — Reads two consecutive registers as an unsigned 32-bit integer.
    • startingAddress: The register address of the first register.
    • byteOrder: The byte order the data is stored in. Default is MsbToLsb.
    • wordOrder: The word order the data is stored in. Default is MswToLsw.
  • WriteAsUInt(ushort, uint, ByteOrder, WordOrder32) — Writes two consecutive registers as an unsigned 32-bit integer.
    • startingAddress: The register address of the first register.
    • value: The value to write.
    • byteOrder: The byte order to store the data in. Default is MsbToLsb.
    • wordOrder: The word order to store the data in. Default is MswToLsw.
  • ReadAsFloat(ushort, ByteOrder, WordOrder32) — Reads two consecutive registers as a 32-bit floating-point number.
    • startingAddress: The register address of the first register.
    • byteOrder: The byte order the data is stored in. Default is MsbToLsb.
    • wordOrder: The word order the data is stored in. Default is MswToLsw.
  • WriteAsFloat(ushort, float, ByteOrder, WordOrder32) — Writes two consecutive registers as a 32-bit floating-point number.
    • startingAddress: The register address of the first register.
    • value: The value to write.
    • byteOrder: The byte order to store the data in. Default is MsbToLsb.
    • wordOrder: The word order to store the data in. Default is MswToLsw.
  • ReadAsLong(ushort, ByteOrder, WordOrder64) — Reads four consecutive registers as a signed 64-bit integer.
    • startingAddress: The register address of the first register.
    • byteOrder: The byte order the data is stored in. Default is MsbToLsb.
    • wordOrder: The word order the data is stored in. Default is ABCD.
  • WriteAsLong(ushort, long, ByteOrder, WordOrder64) — Writes four consecutive registers as a signed 64-bit integer.
    • startingAddress: The register address of the first register.
    • value: The value to write.
    • byteOrder: The byte order to store the data in. Default is MsbToLsb.
    • wordOrder: The word order to store the data in. Default is ABCD.
  • ReadAsULong(ushort, ByteOrder, WordOrder64) — Reads four consecutive registers as an unsigned 64-bit integer.
    • startingAddress: The register address of the first register.
    • byteOrder: The byte order the data is stored in. Default is MsbToLsb.
    • wordOrder: The word order the data is stored in. Default is ABCD.
  • WriteAsULong(ushort, ulong, ByteOrder, WordOrder64) — Writes four consecutive registers as an unsigned 64-bit integer.
    • startingAddress: The register address of the first register.
    • value: The value to write.
    • byteOrder: The byte order to store the data in. Default is MsbToLsb.
    • wordOrder: The word order to store the data in. Default is ABCD.
  • ReadAsDouble(ushort, ByteOrder, WordOrder64) — Reads four consecutive registers as a 64-bit floating-point number.
    • startingAddress: The register address of the first register.
    • byteOrder: The byte order the data is stored in. Default is MsbToLsb.
    • wordOrder: The word order the data is stored in. Default is ABCD.
  • WriteAsDouble(ushort, double, ByteOrder, WordOrder64) — Writes four consecutive registers as a 64-bit floating-point number.
    • startingAddress: The register address of the first register.
    • value: The value to write.
    • byteOrder: The byte order to store the data in. Default is MsbToLsb.
    • wordOrder: The word order to store the data in. Default is ABCD.
  • ReadAsString(ushort, ushort, TextEncoding) — Reads consecutive registers as a string.
    • startingAddress: The register address to start reading from.
    • quantity: The number of registers (16 bit per register) to read.
    • textEncoding: The text encoding of the stored data. Default is Ascii.
  • WriteAsString(ushort, string, TextEncoding) — Writes a string to consecutive registers.
    • startingAddress: The register address to start writing at.
    • value: The string to write.
    • textEncoding: The text encoding to store the data in. Default is Ascii.

IModbusServerSnapshot ​

A consistent view of all four register areas of a hosted Modbus server, valid for the duration of one synchronization callback.

The server lock is held for the whole callback and released afterwards: reads and writes across all areas within one callback are atomic with respect to client requests, so read-modify-publish patterns (e.g. echoing a master-written heartbeat into a feedback register) need no further coordination. Only valid inside the callback that provided it — do not capture the snapshot or its accessors.

Properties:

  • HoldingRegisters — The holding registers (client-writable setpoints; the server may seed defaults or echo feedback).
  • InputRegisters — The input registers (server-published telemetry; read-only for clients).
  • Coils — The coils (client-writable commands; the server may reset consumed command bits).
  • DiscreteInputs — The discrete inputs (server-published flags; read-only for clients).

ModbusServerArea ​

Identifies one of the four Modbus register areas a server serves.

Fields/Values:

  • HoldingRegisters — Holding registers (read/write for clients; function codes 3, 6, 16, 23).
  • InputRegisters — Input registers (read-only for clients; function code 4).
  • Coils — Coils (read/write for clients; function codes 1, 5, 15).
  • DiscreteInputs — Discrete inputs (read-only for clients; function code 2).

ModbusServerAreaExtents ​

The declared register-map extents of a Modbus server, per area.

Counts are extents, not sizes from an offset: addresses 0 to Count - 1 are served. A map that starts at an offset (e.g. a 10-register map at address 0x8000) declares offset + size (0x800A). A count of 0 means the area is not served at all. Extents drive request validation and accessor bounds checks — they do not size any buffer (the underlying server buffers always cover the full Modbus address range).

Properties:

  • HoldingRegisterCount — The number of addressable holding registers, starting at address 0.
  • InputRegisterCount — The number of addressable input registers, starting at address 0.
  • CoilCount — The number of addressable coils, starting at address 0.
  • DiscreteInputCount — The number of addressable discrete inputs, starting at address 0.

Methods:

  • Constructor — The declared register-map extents of a Modbus server, per area.
    • HoldingRegisterCount: The number of addressable holding registers, starting at address 0.
    • InputRegisterCount: The number of addressable input registers, starting at address 0.
    • CoilCount: The number of addressable coils, starting at address 0.
    • DiscreteInputCount: The number of addressable discrete inputs, starting at address 0.
  • Covers(ModbusServerArea, ushort, uint) — Determines whether the given address range lies fully inside the declared extent of an area.
    • area: The register area the range refers to.
    • startingAddress: The first address of the range.
    • quantity: The number of registers or bits in the range. Must be at least 1 to be coverable.

Vion.Dale.Sdk.Modbus.Core.Validation ​

ModbusProtocolLimits ​

The most a single Modbus request can carry, per function code. These are limits of the protocol's data unit, not of any device: no standard function code has a field wide enough to answer more.

A client refuses a read or write past its limit before the request reaches the wire, with an InvalidCountException and an Outcome.Invalid receipt. Split a larger span into several requests; the addresses stay contiguous, so the block sees one value either way.

Fields/Values:

  • MaxRegistersPerRead — Registers a single read of holding or input registers can return (function codes 3 and 4).
  • MaxRegistersPerWrite — Registers a single write of multiple holding registers can carry (function code 16).
  • MaxBitsPerRead — Bits a single read of coils or discrete inputs can return (function codes 1 and 2).
  • MaxBitsPerWrite — Bits a single write of multiple coils can carry (function code 15).

ModbusTimeoutLimits ​

The range a Modbus timeout may be configured in, and the one guard both transports apply to it.

The upper bound is the framework timer's, not a protocol limit: a longer duration is refused by the cancellation source every operation arms, and refusing it where the value is accepted is what keeps a mistyped duration from being reported later as a transport fault that closes the socket. Sharing the guard is deliberate — the two transports drifted apart the last time each carried its own.

Methods:

  • Validate(TimeSpan, string) — Refuses a timeout outside (0, MaxTimeout].
    • timeout: The duration to check.
    • subject: The property or parameter the duration was given for, named in the exception.

Fields/Values:

  • MaxTimeout — The longest a connect timeout, an operation timeout or a per-call timeout may be — just under 25 days. A value at the bound is accepted; it is the largest delay a cancellation source carries on every runtime a plugin built against this SDK can be loaded into.

Vion.Dale.Sdk.Modbus.Rtu.TestKit ​

IModbusRtuExtensions ​

Extension methods on IModbusRtu for simulating Modbus responses in tests.

Every simulated response is stamped from the test context's virtual clock, so the receipt the logic block receives reflects whatever time the test advanced between issuing the request and simulating the answer. The callbacks are dispatched the way production dispatches them — call LogicBlockTestContext.FlushPendingActions() to run them.

Methods:

  • SimulateReadResponse<T>(IModbusRtu, LogicBlockTestContext<T>, byte[], ushort?) — Simulates a successful read response by invoking the pending request's callback with the given data. The data bytes are processed through the same callback chain as in production (SwapBytes, CastFromBytes, etc.).
    • modbusRtu: The Modbus RTU contract instance.
    • testContext: The test context containing recorded messages.
    • responseData: The raw response bytes (big-endian by default, matching Modbus wire format).
    • startingAddress: Optional filter to match a specific request by starting address.
  • SimulateReadError<T>(IModbusRtu, LogicBlockTestContext<T>, Exception, ushort?, ModbusOutcome?) — Simulates a read error by invoking the pending request's callback with the given exception.
    • modbusRtu: The Modbus RTU contract instance.
    • testContext: The test context containing recorded messages.
    • exception: The failure to deliver to the block.
    • startingAddress: Optional filter to match a specific request by starting address.
    • outcome: The outcome to stamp on the receipt, or null to derive it from the exception.
  • SimulateWriteResponse<T>(IModbusRtu, LogicBlockTestContext<T>, ushort?) — Simulates a successful write response by invoking the pending request's callback with no error.
    • modbusRtu: The Modbus RTU contract instance.
    • testContext: The test context containing recorded messages.
    • address: Optional filter to match a specific request by address.
  • SimulateWriteError<T>(IModbusRtu, LogicBlockTestContext<T>, Exception, ushort?, ModbusOutcome?) — Simulates a write error by invoking the pending request's callback with the given exception.
    • modbusRtu: The Modbus RTU contract instance.
    • testContext: The test context containing recorded messages.
    • exception: The failure to deliver to the block.
    • address: Optional filter to match a specific request by address.
    • outcome: The outcome to stamp on the receipt, or null to derive it from the exception.

LogicBlockTestContextExtensions ​

Verification extension methods for asserting Modbus RTU messages in tests.

Methods:

  • VerifyModbusReadSent<T>(LogicBlockTestContext<T>, IModbusRtu, ushort?, ushort?, Times?) — Assert that a Modbus read request was sent.
    • testContext: The test context for the logic block.
    • modbusRtu: The Modbus RTU contract to filter by, or null for any.
    • startingAddress: The expected starting address, or null to skip verification.
    • quantity: The expected register/coil quantity, or null to skip verification.
    • times: The expected number of times, or null for once.
  • VerifyModbusWriteSent<T>(LogicBlockTestContext<T>, IModbusRtu, ushort?, Times?) — Assert that a Modbus write request was sent.
    • testContext: The test context for the logic block.
    • modbusRtu: The Modbus RTU contract to filter by, or null for any.
    • address: The expected write address, or null to skip verification.
    • times: The expected number of times, or null for once.

ModbusResponseBuilder ​

Helpers for constructing Modbus response byte arrays in big-endian (MSB-first) order, matching the default Modbus wire format (ByteOrder.MsbToLsb).

Methods:

  • FromFloats(float[]) — Converts float values to big-endian bytes (4 bytes each).
  • FromShorts(short[]) — Converts short values to big-endian bytes (2 bytes each).
  • FromUShorts(ushort[]) — Converts ushort values to big-endian bytes (2 bytes each).
  • FromInts(int[]) — Converts int values to big-endian bytes (4 bytes each).
  • FromDoubles(double[]) — Converts double values to big-endian bytes (8 bytes each).
  • FromBools(bool[]) — Packs boolean values into bytes using Modbus coil/discrete input bit packing. Each byte holds up to 8 coils, LSB first within each byte.

Vion.Dale.Sdk.Modbus.Rtu ​

DependencyInjection ​

Registers the Modbus RTU factory and its Modbus Core dependencies with the Dale runtime's service container. Discovered by the runtime via reflection at plugin load time. A development host has no plugin loader, so construct one and call it: this package ships no AddDaleModbusRtuSdk extension, and nothing else registers the RTU request factory.

Methods:

  • ConfigureServices(IServiceCollection) — (no description)

IModbusRtu ​

Provides Modbus RTU read and write operations.

The reads, writes and diagnostics are those of IModbusClient. Declare the binding as IModbusRtu — that is the type the runtime binds to a service provider contract — and then use it through IModbusClient wherever the code should work for either transport. Every instance shares one ModbusRtuHandler with every other Modbus RTU binding in the runtime. Requests from all of them are published in the order the handler receives them, and they share one pending-request limit of MaxPendingRequests: an outcome of Dropped here may have been caused by another logic block. Expiry is checked by a sweep that runs about once a second, so a timed-out operation can complete up to a second after its timeout. Compared with Modbus TCP: there is no socket to report on, so there is no connection summary; the queue is the shared handler's rather than this client's, so Link.QueueDepth is always zero; and the default operation timeout is 5 seconds rather than 1. Like TCP, the timeout covers the wire only — it starts when the handler publishes the request, and the hop before that is what MaxQueuedAge bounds and what the receipt reports as QueuedWait. The following exceptions may reach the error callback of any operation: InvalidUnitIdentifierException (unit identifier below 0 or above 255), PendingRequestsLimitReachedException (the shared pending-request limit was reached), ServiceProviderContractMappingNotFoundException (the binding is not mapped to a service provider contract), RequestExpiredException (the request aged past MaxQueuedAge before it was published), OperationTimeoutException (the device did not answer in time) and ModbusException (the device returned an error). Operation-specific ones are InvalidBitQuantityException (fewer coils or discrete inputs returned than requested), InvalidCountException (the resulting register quantity exceeds 65535) and ModbusResponseAlignmentException (the byte count does not match the registers requested).


PendingRequestsLimitReachedException ​

The exception that is thrown when the pending requests limit has been reached.

Methods:

  • Constructor — Initializes a new instance of the PendingRequestsLimitReachedException class.
    • maxPendingRequests: The maximum number of pending requests allowed.

ServiceProviderContractMappingNotFoundException ​

The exception that is thrown when no service provider contract mapping is found for a contract.

Properties:

  • LogicBlockContractId — Gets the LogicBlockContractId for which no mapping was found.

Methods:

  • Constructor — Initializes a new instance of the ServiceProviderContractMappingNotFoundException class.
    • logicBlockContractId: The contract ID for which no mapping was found.

Vion.Dale.Sdk.Modbus.Tcp.TestKit ​

ConnectionEvent ​

A single connect / disconnect event observed by the fake proxy.

Methods:

  • Constructor — A single connect / disconnect event observed by the fake proxy.

ConnectionEventKind ​

The kind of connection event recorded on ConnectionHistory.


FakeModbusTcpClientProxy ​

In-memory fake for IModbusTcpClientProxy. Stores register / coil contents in raw bytes per (unitId, address); the SDK's real ModbusTcpClientWrapper handles all byte / word-order conversion against them. Most tests should use FakeModbusTcpHarness rather than constructing this directly.

Properties:

  • ConnectionHistory — Ordered log of every ConnectAsync / Disconnect the fake observed.
  • ReadHistory — Ordered log of every read the SUT issued through the proxy layer.
  • WriteHistory — Ordered log of every write the SUT issued through the proxy layer.
  • Clock — The virtual clock ResponseDelay and ConnectDelay advance. Set it to the same FakeTimeProvider the harness and the test context use.
  • ResponseDelay — Virtual time every read and write consumes before answering. Default is zero. Makes the receipt's RoundTrip and the link summary's round-trip extremes assertable; a delay greater than zero requires Clock.
  • ConnectDelay — Virtual time every connection attempt consumes. Default is zero. Makes Connection.LastConnectDuration assertable; a delay greater than zero requires Clock.
  • IsConnected — True after ConnectAsync has been called and before Disconnect. The real wrapper calls ConnectAsync lazily on the first operation if disconnected.

Methods:

  • SetHoldingRegister(int, ushort, byte, byte) — Pre-populates one 16-bit holding register at (unitId, address) with two bytes + in standard Modbus big-endian wire order.
  • SetHoldingRegisters(int, ushort, byte[]) — Pre-populates a contiguous range of holding registers starting at . must be a multiple of 2 (one register = 2 bytes, big-endian).
  • SetInputRegister(int, ushort, byte, byte) — Pre-populates a single input register. Mirrors .
  • SetInputRegisters(int, ushort, byte[]) — Pre-populates a contiguous range of input registers. Mirrors .
  • SetCoil(int, ushort, bool) — Pre-populates a single coil value.
  • SetDiscreteInput(int, ushort, bool) — Pre-populates a single discrete input value.
  • EnqueueReadFault(int, ushort, Exception) — Queues an exception to throw on the next read at (unitId, startingAddress). Consumed FIFO — queue multiple to model "fail, fail, recover" sequences. Matches by the read's starting address (Modbus exceptions apply to the whole request, not per-register).
  • EnqueueWriteFault(int, ushort, Exception) — Queues an exception to throw on the next write at (unitId, address). Consumed FIFO.
  • EnqueueReadModbusException(int, ushort, ModbusExceptionCode, string) — Convenience: queues a Modbus protocol exception (e.g. IllegalDataAddress) to surface on the next read at (unitId, startingAddress).
  • EnqueueWriteModbusException(int, ushort, ModbusExceptionCode, string) — Convenience: queues a Modbus protocol exception (e.g. IllegalDataValue) to surface on the next write at (unitId, address).
  • EnqueueReadTimeout(int, ushort) — Convenience: queues an OperationTimeoutException to surface on the next read at (unitId, startingAddress). The synchronous test queue can't wait for a wall-clock timeout, so the exception fires immediately — observably identical to a real timeout from the SUT's point of view (same exception type via the same error callback).
  • EnqueueWriteTimeout(int, ushort) — Convenience: queues an OperationTimeoutException to surface on the next write at (unitId, address). Same immediate-fire behaviour as .
  • EnqueueConnectFailure(Exception) — Queues an exception to throw on the next ConnectAsync call. Consumed FIFO. The attempt is still recorded on ConnectionHistory with its target IP and port, so the SUT's reconnect target is verifiable even on failure.

FakeModbusTcpClientProxyExtensions ​

Verification extension methods for asserting Modbus TCP operations in tests.

Methods:

  • VerifyReadSent(FakeModbusTcpClientProxy, int?, ushort?, ushort?, ReadEventKind?, Times?) — Assert that a Modbus read was sent.
    • proxy: The fake proxy to inspect.
    • unitId: The expected unit identifier, or null for any.
    • startingAddress: The expected starting address, or null for any.
    • quantity: The expected register/coil quantity, or null for any.
    • kind: The expected Modbus function, or null for any.
    • times: The expected number of times, or null for once.
  • VerifyWriteSent(FakeModbusTcpClientProxy, int?, ushort?, byte[], WriteEventKind?, Times?) — Assert that a Modbus write was sent.
    • proxy: The fake proxy to inspect.
    • unitId: The expected unit identifier, or null for any.
    • address: The expected target address, or null for any.
    • expectedBytes: The expected wire-format payload (raw bytes), or null to skip byte verification.
    • kind: The expected write function, or null for any.
    • times: The expected number of times, or null for once.
  • VerifyConnectAttempted(FakeModbusTcpClientProxy, string, int?, Times?) — Assert that a ConnectAsync attempt was made.
    • proxy: The fake proxy to inspect.
    • ipAddress: The expected IP address (as a string), or null for any.
    • port: The expected port, or null for any.
    • times: The expected number of times, or null for once.
  • VerifyDisconnectCalled(FakeModbusTcpClientProxy, Times?) — Assert that Disconnect was called on the proxy.
    • proxy: The fake proxy to inspect.
    • times: The expected number of times, or null for once.

FakeModbusTcpHarness ​

Wires a FakeModbusTcpClientProxy and SynchronousRequestQueue into a real LogicBlockModbusTcpClient, so the SUT exercises real SDK byte / word-order conversion against the fake's in-memory state. var harness = new FakeModbusTcpHarness(); harness.Proxy.SetHoldingRegisters(unitId: 1, startingAddress: 40000, registerBytes: [0x12, 0x34, 0x56, 0x78]); var sut = new MyBlock(harness.Client, new Mock<ILogger>().Object); var ctx = sut.CreateTestContext().Build(); sut.Tick(); ctx.FlushPendingActions(); Assert.AreEqual(0x12345678u, sut.Power); Pass ctx.TimeProvider to put the client's receipts, link summary and MaxQueuedAge on the test's virtual clock.

Properties:

  • Proxy — The fake proxy — pre-populate registers, inject faults, inspect histories.
  • Queue — The queue the client runs on — set Hold and call Drain() to put virtual time between enqueue and execution.
  • Client — The fully wired client to inject into the SUT.

FakeModbusTcpServerClient ​

The test-side master view of a fake Modbus TCP server: drives the wire side of a server-fronted block without sockets. Method names follow the Modbus TCP client surface so wire-contract tests read like client code. Typed values are deliberately encoded with BinaryPrimitives (big-endian), independent of the SDK's converter — so a conversion bug cannot cancel itself out in a test.

The harness's view addresses no unit, which a server that declares no unit answers from its one map. A server that declares units needs the unit a master addresses: take that view with . Every member's exceptions then also include GatewayTargetDeviceFailedToRespond for a unit the server does not declare, and the unaddressed view throws InvalidOperationException on such a server.

Methods:

  • ForUnit(byte) — Gets a master view whose requests address .
    • unitId: The unit identifier every request of the returned view carries.
  • WriteSingleHoldingRegister(ushort, ushort) — Writes a single holding register (function code 6).
    • address: The register address to write.
    • value: The register value.
  • WriteMultipleHoldingRegistersRaw(ushort, byte[]) — Writes multiple holding registers from raw wire bytes (function code 16).
    • startingAddress: The register address to start writing at.
    • registerBytes: The register bytes in wire order (2 bytes per register).
  • WriteSingleCoil(ushort, bool) — Writes a single coil (function code 5).
    • address: The coil address to write.
    • value: The coil value.
  • ReadHoldingRegistersRaw(ushort, ushort) — Reads holding registers as raw wire bytes (function code 3).
    • startingAddress: The register address to start reading from.
    • quantity: The number of registers to read.
  • ReadInputRegistersRaw(ushort, ushort) — Reads input registers as raw wire bytes (function code 4).
    • startingAddress: The register address to start reading from.
    • quantity: The number of registers to read.
  • ReadCoils(ushort, ushort) — Reads coils (function code 1).
    • startingAddress: The coil address to start reading from.
    • quantity: The number of coils to read.
  • ReadDiscreteInputs(ushort, ushort) — Reads discrete inputs (function code 2).
    • startingAddress: The discrete input address to start reading from.
    • quantity: The number of discrete inputs to read.

FakeModbusTcpServerHarness ​

Wires a FakeModbusTcpServerProxy into a real LogicBlockModbusTcpServer, so the SUT exercises real SDK extent validation and byte / word-order conversion against the fake's in-memory register store — no sockets, no free-port dance. var harness = new FakeModbusTcpServerHarness(); var sut = new MyServerBlock(/* inject a factory returning */ harness.Server); harness.Client.WriteSingleHoldingRegister(address: 0, value: 42); // act as the master sut.Tick(); CollectionAssert.AreEqual(expectedWireBytes, harness.Client.ReadInputRegistersRaw(0, 2));

Properties:

  • Proxy — The fake proxy — inspect or pre-populate the register buffers, shape diagnostics.
  • Server — The fully wired server to inject into the SUT (or hand out via ServerFactory).
  • ServerFactory — A factory handing out Server — for blocks that are factory-injected.
  • Client — The test-side master view driving the wire side of the server.

Methods:

  • Constructor — Initializes a new instance of the FakeModbusTcpServerHarness class with a fresh fake proxy.
  • Constructor — Initializes a new instance of the FakeModbusTcpServerHarness class with the given fake proxy.
    • proxy: The fake proxy backing the server's register buffers.
  • Dispose — (no description)

FakeModbusTcpServerProxy ​

In-memory IModbusTcpServerProxy: full-range register buffers without any sockets. The simulate-client methods replay what a connected Modbus master would do, including the extent validation the real server performs (out-of-map access throws a ModbusException with IllegalDataAddress, mirroring the wire behavior) and the LastClientWriteAt bookkeeping.

A server that declares units gets a register map per unit here, as on the wire. The unit-addressed simulate-client overloads then answer from the addressed unit's map, and a unit the server did not declare with the GatewayTargetDeviceFailedToRespond exception a master receives. A master always sends some unit identifier, so the unaddressed overloads refuse on such a server. On a server that declares no unit, both kinds answer from its one map.

Properties:

  • Extents — The extents passed to the most recent call. Drives the simulate-client validation of a server that declares no unit.
  • TimeProvider — The clock stamping LastClientWriteAt on simulated client writes. Default is System; assign a FakeTimeProvider for deterministic tests.
  • IsListening — (no description)
  • ConnectionCount — The number of connected clients reported to the server. Settable so tests can shape diagnostics.
  • LastClientWriteAt — The last-client-write timestamp reported to the server. Set automatically by the simulate-client write methods (via TimeProvider); settable so tests can shape diagnostics directly.
  • Lock — (no description)

Methods:

  • Start(IPAddress, int, ModbusServerAreaExtents) — (no description)
  • Start(IPAddress, int, IReadOnlyDictionary<byte, ModbusServerAreaExtents>) — (no description)
  • Stop — (no description)
  • AddUnit(byte) — (no description)
  • GetLastClientWriteAt(byte) — (no description)
  • GetHoldingRegisterBuffer — (no description)
  • GetInputRegisterBuffer — (no description)
  • GetCoilBuffer — (no description)
  • GetDiscreteInputBuffer — (no description)
  • GetHoldingRegisterBuffer(byte) — (no description)
  • GetInputRegisterBuffer(byte) — (no description)
  • GetCoilBuffer(byte) — (no description)
  • GetDiscreteInputBuffer(byte) — (no description)
  • Dispose — (no description)
  • SimulateClientWriteHoldingRegisters(ushort, byte[]) — Simulates a connected master writing holding registers (function codes 6/16).
    • startingAddress: The register address to start writing at.
    • registerBytes: The register bytes in wire order (2 bytes per register).
  • SimulateClientWriteHoldingRegisters(byte, ushort, byte[]) — Simulates a connected master writing holding registers (function codes 6/16) at one unit identifier.
    • unitId: The unit identifier the request addresses.
    • startingAddress: The register address to start writing at.
    • registerBytes: The register bytes in wire order (2 bytes per register).
  • SimulateClientWriteSingleCoil(ushort, bool) — Simulates a connected master writing a single coil (function code 5).
    • address: The coil address to write.
    • value: The coil value to write.
  • SimulateClientWriteSingleCoil(byte, ushort, bool) — Simulates a connected master writing a single coil (function code 5) at one unit identifier.
    • unitId: The unit identifier the request addresses.
    • address: The coil address to write.
    • value: The coil value to write.
  • SimulateClientReadHoldingRegisters(ushort, ushort) — Simulates a connected master reading holding registers (function code 3).
    • startingAddress: The register address to start reading from.
    • quantity: The number of registers to read.
  • SimulateClientReadHoldingRegisters(byte, ushort, ushort) — Simulates a connected master reading holding registers (function code 3) at one unit identifier.
    • unitId: The unit identifier the request addresses.
    • startingAddress: The register address to start reading from.
    • quantity: The number of registers to read.
  • SimulateClientReadInputRegisters(ushort, ushort) — Simulates a connected master reading input registers (function code 4).
    • startingAddress: The register address to start reading from.
    • quantity: The number of registers to read.
  • SimulateClientReadInputRegisters(byte, ushort, ushort) — Simulates a connected master reading input registers (function code 4) at one unit identifier.
    • unitId: The unit identifier the request addresses.
    • startingAddress: The register address to start reading from.
    • quantity: The number of registers to read.
  • SimulateClientReadCoils(ushort, ushort) — Simulates a connected master reading coils (function code 1).
    • startingAddress: The coil address to start reading from.
    • quantity: The number of coils to read.
  • SimulateClientReadCoils(byte, ushort, ushort) — Simulates a connected master reading coils (function code 1) at one unit identifier.
    • unitId: The unit identifier the request addresses.
    • startingAddress: The coil address to start reading from.
    • quantity: The number of coils to read.
  • SimulateClientReadDiscreteInputs(ushort, ushort) — Simulates a connected master reading discrete inputs (function code 2).
    • startingAddress: The discrete input address to start reading from.
    • quantity: The number of discrete inputs to read.
  • SimulateClientReadDiscreteInputs(byte, ushort, ushort) — Simulates a connected master reading discrete inputs (function code 2) at one unit identifier.
    • unitId: The unit identifier the request addresses.
    • startingAddress: The discrete input address to start reading from.
    • quantity: The number of discrete inputs to read.
  • ResolveMap(byte?, ModbusServerArea, ushort, uint) — The map a simulated request is answered from, after the checks the real server makes before it reads one: listening, the unit addressed, then the range against that map's extents.

ReadEvent ​

A single read operation observed by the fake proxy.

Methods:

  • Constructor — A single read operation observed by the fake proxy.

ReadEventKind ​

The Modbus function family of a read recorded on ReadHistory.


SynchronousRequestQueue ​

Drop-in IRequestQueue that runs each request synchronously on the calling thread instead of dispatching to a background consumer. Success / error callbacks flow through IActorDispatcher.InvokeSynchronized just as in production and drain on the next LogicBlockTestContext.FlushPendingActions().

Set Hold to buffer enqueued requests instead of running them, advance the test's clock, then call to run them in order. That is how a test puts virtual time between enqueue and execution — which is what MaxQueuedAge measures. The age check itself lives in the request, so this queue applies it with no logic of its own.

Properties:

  • Hold — When true, enqueued requests are buffered instead of executed until is called. Default is false — every request runs on the calling thread.
  • QueuedRequestCount — The number of requests buffered by Hold and not yet drained.
  • MaxQueuedAge — (no description)

Methods:

  • Initialize(int, QueueOverflowPolicy, ModbusLinkAccumulator) — Records the accumulator. Capacity / overflow policy don't apply to the synchronous executor.
  • Drain — Executes every request buffered while Hold was set, in the order they were enqueued, and clears the buffer. Requests enqueued during the drain are buffered again if Hold is still set.

WriteEvent ​

A single write operation observed by the fake proxy. Bytes is the register payload in wire order, MSB-first per register — except for a multiple-coil write, which is recorded as one byte per coil (0x01 / 0x00) rather than the wire's bit packing, because one byte per coil is what makes an expected-bytes argument legible. A single-coil write records the wire's own 0xFF / 0x00. The read direction is not affected: a coil read answers the wire's bit packing.

Methods:

  • Constructor — A single write operation observed by the fake proxy. Bytes is the register payload in wire order, MSB-first per register — except for a multiple-coil write, which is recorded as one byte per coil (0x01 / 0x00) rather than the wire's bit packing, because one byte per coil is what makes an expected-bytes argument legible. A single-coil write records the wire's own 0xFF / 0x00. The read direction is not affected: a coil read answers the wire's bit packing.

WriteEventKind ​

The Modbus function family of a write recorded on WriteHistory.


Vion.Dale.Sdk.Modbus.Tcp ​

ServiceCollectionExtensions ​

Extension methods for setting up Modbus TCP services in an IServiceCollection.

Methods:

  • AddDaleModbusTcpSdk(IServiceCollection) — Adds Modbus TCP services to the specified IServiceCollection.
    • serviceCollection: The IServiceCollection to add services to.

Vion.Dale.Sdk.Modbus.Tcp.Client.LogicBlock ​

ILogicBlockModbusTcpClient ​

Provides non-blocking Modbus TCP client functionality for logic blocks.

The reads, writes and diagnostics are those of IModbusClient; this type adds what is specific to owning a socket and a request queue. The TCP connection is established lazily inside the first operation that needs one and is kept for subsequent operations. Set IpAddress before enabling the client; Port defaults to 502 and ConnectionTimeout to 3 seconds. Because the handshake happens inside an operation, that operation's RoundTrip includes it — see Connection, whose LastConnectDuration is how you separate the two. All operations are enqueued and executed one at a time: the underlying Modbus TCP library cannot run concurrent operations on one connection. The logic block is never blocked by this — results arrive through callbacks. Use for a second, independent connection and queue. The queue is created the first time the client is enabled via IsEnabled. QueueCapacity and QueueOverflowPolicy must be set before that and cannot be changed afterwards. MaxQueuedAge, in contrast, is read at dequeue and can be changed at any time. Dispose the client when it is no longer needed. Disposal closes the connection and the queue: subsequent operations are rejected with a RequestDroppedException whose Reason is ClientDisposed, and requests already queued or in flight are cancelled. Link policy. A timeout, transport error or protocol error on an established connection closes the socket, so the next operation reconnects: a peer that dropped and came back is reached again without operator action, and a stray response cannot be read as the next transaction's answer. Only failed connects drive the backoff — from the second consecutive one the client waits ConnectBackoff (1 second), doubling per further failure up to ConnectBackoffMax (30 seconds). Operations issued during that wait fail immediately with a LinkBackoffException and an Outcome.BackedOff receipt, so the queue drains instead of filling and the device is not contacted once per queued request. A successful connect, a changed IpAddress or Port, or re-enabling the client ends the wait, so a corrected address takes effect on the very next operation. Setting an address or port to the value already in force does nothing. No operation is ever retried automatically. Reads are re-polled by construction, and repeating a write after a fault is not safe to decide for the caller — a pulse would be written twice. Compared with Modbus RTU: this client owns its socket and its queue, so QueuedRequestCount is real, overflow is per client, and Connection exists. Its default operation timeout is 1 second. RTU has no link policy: there is no connection to back off from. For the exceptions that reach an error callback, see the documentation for IModbusTcpClientWrapper.

Properties:

  • QueueCapacity — Gets or sets the maximum number of requests that can be queued. Default is 256.
  • QueueOverflowPolicy — Gets or sets the policy for handling new requests when the queue is full. Default is DropOldest.
  • QueuedRequestCount — Gets the current number of requests queued for execution.
  • ConnectionTimeout — Gets or sets the timeout for connection attempts to the Modbus TCP server. Default is 3 seconds.
  • Port — Gets or sets the port number used to connect to the Modbus TCP server.
  • IpAddress — Gets or sets the IP address of the Modbus TCP server.
  • ConnectBackoff — Gets or sets how long the client waits after the second consecutive failed connect. Default is 1 second.
  • ConnectBackoffMax — Gets or sets the longest the client waits between connection attempts. Default is 30 seconds.
  • Connection — Gets a snapshot of the socket: whether it is up, and how connection attempts have gone.

Methods:

  • Disconnect(IActorDispatcher, Action, Action<Exception>) — Manually disconnects from the Modbus TCP server.
    • dispatcher: The dispatcher that will invoke the callbacks. Pass the logic block that should handle the callbacks (typically this when calling from within a logic block).
    • successCallback: The callback invoked when the operation succeeds.
    • errorCallback: The callback invoked when the operation fails. Errors are always logged, regardless of whether an error callback is specified.

ILogicBlockModbusTcpClientFactory ​

Factory for creating instances of ILogicBlockModbusTcpClient.

Methods:

  • Create — Creates a new instance of ILogicBlockModbusTcpClient.

Vion.Dale.Sdk.Modbus.Tcp.Client.Request ​

LinkBackoffException ​

Thrown when a request arrives while the client is waiting out a connect backoff. The device was never contacted, so this says nothing about the link beyond the failed connects that armed the backoff.

The backoff is armed from the second consecutive failed connect and is ended by a successful connect or by a changed IP address or port. Until then every request fails this way immediately instead of paying its own connection attempt.

Properties:

  • NextAttemptAt — Gets when the client will attempt to connect again.
  • ConsecutiveConnectFailures — Gets how many connection attempts have failed in a row.

Methods:

  • Constructor — Initializes a new instance of the LinkBackoffException class.
    • ipAddress: The address the failed attempts targeted.
    • port: The port the failed attempts targeted.
    • consecutiveConnectFailures: How many connection attempts have failed in a row.
    • nextAttemptAt: When the client will attempt to connect again.
    • untilNextAttempt: How much of the backoff is left.

QueueOverflowPolicy ​

Defines the behavior when the request queue is full.

Fields/Values:

  • DropOldest — Drops the oldest request in the queue when a new request is enqueued.
  • DropNewest — Drops the newest request in the queue (not the one being enqueued) when a new request is enqueued.
  • RejectNew — Rejects the new request being enqueued, invoking its error callback immediately.

RequestDropReason ​

Why a request was dropped before it could be executed.

Fields/Values:

  • QueueFull — The queue was at capacity and the overflow policy evicted this request.
  • ClientDisposed — The client was disposed, so the queue no longer accepts work.

RequestDroppedException ​

Thrown when a request is dropped before execution — because the queue was full, or because the client was disposed. The device was never contacted, so this says nothing about the link.

Properties:

  • RequestName — Gets the name of the dropped request.
  • Reason — Gets why the request was dropped.

Methods:

  • Constructor — Initializes a new instance of the RequestDroppedException class for a request the full queue evicted.
    • requestName: The name of the request that was dropped.
    • capacity: The capacity the queue was configured with.
    • overflowPolicy: The overflow policy that decided the eviction.
  • Constructor — Initializes a new instance of the RequestDroppedException class for a request enqueued after the client was disposed.
    • requestName: The name of the request that was dropped.

Vion.Dale.Sdk.Modbus.Tcp.Diagnostics ​

ModbusTcpConnectionState ​

The state of a Modbus TCP client's socket.

Fields/Values:

  • Disconnected — No socket: never connected, closed, or closed again after a fault.
  • Connected — A socket is open and no reconnect is pending.
  • BackingOff — The client is waiting out a backoff before attempting to connect again.

ModbusTcpConnectionSummary ​

A point-in-time summary of one Modbus TCP client's socket: whether it is up, and how its connection attempts have gone.

Separate from the link summary because it is about the transport rather than the device: a socket can be up while every request times out, and a device can be reachable across a socket that has been re-established several times. Every field is a service-property-legal type, so the whole summary can be published as one [ServiceProperty]. Published whole, it sends a new value once per interval while its counts move: once every 30 s by default, or at the MinInterval the member assigns. When every change of the socket's state matters, publish State — or a status derived from it — as its own member beside the summary, so the summary itself can stay slow. The connection is established lazily, inside the first operation that needs it, so LastConnectDuration is also part of that operation's RoundTrip — subtract it when you want the device's own response time. Counts are for the lifetime of the client instance and are never reset — except ConsecutiveConnectFailures, which is a run rather than a total. CurrentBackoff and NextAttemptAt are filled once the client is waiting between connection attempts, and State is BackingOff while that wait is still running. Both are cleared by a successful connect or by a configuration change that supersedes the failures.

Properties:

  • State — Whether a socket is currently open.
  • LastConnectedAt — When a socket was last established.
  • LastConnectFailureAt — When a connection attempt last failed.
  • ConnectAttemptCount — How many connection attempts have been made.
  • ConnectFailureCount — How many connection attempts have failed.
  • ConsecutiveConnectFailures — Failed attempts since the last successful one or the last configuration change.
  • LastConnectDuration — How long the last successful handshake took.
  • CurrentBackoff — How long the client is waiting before its next connection attempt.
  • NextAttemptAt — When the client will attempt to connect again.

Methods:

  • Constructor — A point-in-time summary of one Modbus TCP client's socket: whether it is up, and how its connection attempts have gone.
    • State: Whether a socket is currently open.
    • LastConnectedAt: When a socket was last established.
    • LastConnectFailureAt: When a connection attempt last failed.
    • ConnectAttemptCount: How many connection attempts have been made.
    • ConnectFailureCount: How many connection attempts have failed.
    • ConsecutiveConnectFailures: Failed attempts since the last successful one or the last configuration change.
    • LastConnectDuration: How long the last successful handshake took.
    • CurrentBackoff: How long the client is waiting before its next connection attempt.
    • NextAttemptAt: When the client will attempt to connect again.

Vion.Dale.Sdk.Modbus.Tcp.Server.LogicBlock ​

ILogicBlockModbusTcpServer ​

Hosts a Modbus TCP server (slave role) for logic blocks: external Modbus clients connect to the logic block and read or write its register map.

The server is configured via properties and gated by IsEnabled, exactly like the Modbus TCP client: configure while disabled, then enable. Configuration properties can only be changed while the server is disabled — to reconfigure, disable the server first, update the settings, then re-enable it (a port or address change is a rebind). It listens on all interfaces (0.0.0.0) unless told otherwise, because a logic-block-hosted server exists to be reached by Modbus masters elsewhere on the network. Set ListenAddress to bind one interface — loopback for a simulator that must not be reachable off the machine, or a specific NIC on a multi-homed device. All register access happens inside callbacks, which execute synchronously on the caller's thread while holding the server lock — client requests are served from the register buffers on background threads, and the lock makes each callback atomic with respect to them. No events or callbacks are ever delivered to the logic block from background threads. The block chooses its own cadence (a timer, a reactive trigger) and may use several independent cadences; each Sync call is atomic on its own. The register buffers exist independently of the listener: Sync also works while the server is disabled, so a block can seed default values before it starts listening. Buffer contents survive disable/enable cycles. A server that declares no unit accepts requests for any unit identifier, answers them from its one register map and echoes the request's unit identifier in the response — the endpoint behavior the Modbus TCP specification intends for directly connected servers. Client requests outside the declared register-map extents are answered with an IllegalDataAddress Modbus exception. A server that stands in for a device serving several unit identifiers behind one port — different values at the same addresses under each — declares each with instead, and configures and reads each unit through the handle it returns. A request to a unit identifier it did not declare is then answered with a GatewayTargetDeviceFailedToRespond Modbus exception, and the connection stays open. The server should be disposed when no longer needed. Disposal stops the listener and releases all resources; benign teardown races of the underlying server library are caught and logged, never thrown.

Properties:

  • IsEnabled — Gets or sets whether the server is enabled. Default is false.
  • ListenAddress — Gets or sets the local IP address the server listens on. Default is "0.0.0.0" (all interfaces).
  • Port — Gets or sets the local port the server listens on. Default is 502 (standard Modbus TCP port).
  • HoldingRegisterCount — Gets or sets the declared holding register extent: addresses 0 to count - 1 are served. Default is 0 (the area is not served).
  • InputRegisterCount — Gets or sets the declared input register extent: addresses 0 to count - 1 are served. Default is 0 (the area is not served).
  • CoilCount — Gets or sets the declared coil extent: addresses 0 to count - 1 are served. Default is 0 (the area is not served).
  • DiscreteInputCount — Gets or sets the declared discrete input extent: addresses 0 to count - 1 are served. Default is 0 (the area is not served).
  • IsListening — Gets a value indicating whether the server is currently listening for client connections.
  • ConnectionCount — Gets the number of currently connected clients.
  • LastClientWriteAt — Gets the time of the most recent client write to any register area, at any unit, or null when no client has written yet.

Methods:

  • AddUnit(byte) — Declares a unit identifier this server serves from a register map of its own, and returns the handle that configures and reads that map.
    • unitId: The unit identifier to serve, 0 to 255.
  • Sync(Action<IModbusServerSnapshot>) — Executes with a consistent view of all four register areas.
    • access: The callback receiving the snapshot. It runs synchronously on the caller's thread while the server lock is held — keep it short and free of blocking calls, and do not capture the snapshot outside the callback.
  • Sync<T>(Func<IModbusServerSnapshot, T>) — Executes with a consistent view of all four register areas and returns its result.
    • access: The callback receiving the snapshot. It runs synchronously on the caller's thread while the server lock is held — keep it short and free of blocking calls, and do not capture the snapshot outside the callback.

ILogicBlockModbusTcpServerFactory ​

Factory for creating instances of ILogicBlockModbusTcpServer.

Methods:

  • Create — Creates a new instance of ILogicBlockModbusTcpServer.

ILogicBlockModbusTcpServerUnit ​

One unit identifier a Modbus TCP server serves from a register map of its own, declared with .

A unit is configured and read exactly like the server's own map: four extents, set while the server is disabled, and all register access inside callbacks. A value written at one unit, by the block or by a client, is not seen at another. Every unit's Sync takes the same server lock as the server's own. A callback may call another unit's Sync to change several units atomically with respect to client requests.

Properties:

  • UnitId — Gets the unit identifier this map is served under.
  • HoldingRegisterCount — Gets or sets this unit's declared holding register extent: addresses 0 to count - 1 are served. Default is 0 (the area is not served).
  • InputRegisterCount — Gets or sets this unit's declared input register extent: addresses 0 to count - 1 are served. Default is 0 (the area is not served).
  • CoilCount — Gets or sets this unit's declared coil extent: addresses 0 to count - 1 are served. Default is 0 (the area is not served).
  • DiscreteInputCount — Gets or sets this unit's declared discrete input extent: addresses 0 to count - 1 are served. Default is 0 (the area is not served).
  • LastClientWriteAt — Gets the time of the most recent client write to any area of this unit, or null when no client has written to it yet.

Methods:

  • Sync(Action<IModbusServerSnapshot>) — Executes with a consistent view of this unit's four register areas.
    • access: The callback receiving the snapshot. It runs synchronously on the caller's thread while the server lock is held — keep it short and free of blocking calls, and do not capture the snapshot outside the callback.
  • Sync<T>(Func<IModbusServerSnapshot, T>) — Executes with a consistent view of this unit's four register areas and returns its result.
    • access: The callback receiving the snapshot. It runs synchronously on the caller's thread while the server lock is held — keep it short and free of blocking calls, and do not capture the snapshot outside the callback.

Vion.Dale.Sdk.Modbus.Tcp.Client.Implementation ​

ConnectionTimeoutException ​

Exception thrown when a connection attempt does not complete within the specified timeout period.

Methods:

  • Constructor — Initializes a new instance of the ConnectionTimeoutException class with the specified timeout duration.
    • seconds: The connection timeout limit in seconds that was exceeded.

IpAddressNotSetException ​

Exception thrown when attempting to connect without setting an IP address.

Methods:

  • Constructor — Initializes a new instance of the IpAddressNotSetException class.

Vion.Dale.Sdk.TestKit ​

Constants ​

Provides default constant values for logic block test setup.


EmissionPolicyMode ​

Controls whether the emission policy (attribute-driven throttling) is active when a logic block runs under the TestKit's controllable fake clock.

Fields/Values:

  • Off — Default. The emission policy is gated OFF: every service-property / measuring-point assignment flows straight through as a change message, so tests are not silently throttled by min-interval / min-change rules.
  • FromAttributes — Forces the emission policy ON from the block's [ServiceProperty] / [ServiceMeasuringPoint] throttle attributes, despite the fake clock. Use this to exercise throttling deterministically with .

ILoggerMockExtensions ​

Extension methods to verify log output on ILogger mocks.

Methods:

  • VerifyLogContains(Mock<ILogger>, string, LogLevel, Times) — Verifies that a log entry containing the specified string was logged at the specified log level the expected number of times.
  • VerifyLogContains<T>(Mock<ILogger<T>>, string, LogLevel, Times) — Verifies that a log entry containing the specified string was logged at the specified log level the expected number of times.

LogicBlockBaseExtensions ​

Extension methods to initialize logic blocks for testing with a fluent builder API.

Methods:

  • InitializeForTest<T>(T) — Initializes the given logic block for testing, returning a typed test context.
  • CreateTestContext<T>(T) — Creates a test context builder for the given logic block to allow test context customization. Call Build() at the end to get the test context.

LogicBlockTestContext ​

Test-friendly minimal actor context that records messages sent by the logic block. Use the provided query/assertion helpers to inspect recorded messages. testContext.VerifyServicePropertyChanged(lb => lb.Power, value => Assert.AreEqual(3.5, value)); Hosts a FakeTimeProvider as the virtual clock for both UtcNow reads (production code that depends on TimeProvider) and for the deadlines attached to InvokeSynchronized / InvokeSynchronizedAfter actions. Call to move the clock forward and fire actions whose deadlines have elapsed; call for the legacy clock-agnostic drain.

Threading: enqueue from any thread, drive from the test thread. Recording a message and queueing an action are safe from any thread, so a block whose I/O client completes on a background thread works under this context. Driving — , and the Verify helpers — is for the test thread only; driving from two threads at once is not supported.

Properties:

  • TimeProvider — The virtual clock backing this test context. Inject as TimeProvider into your logic block to make its UtcNow reads deterministic.
  • VirtualNow — Current virtual time. Shorthand for TimeProvider.GetUtcNow().UtcDateTime.
  • BuiltServiceProvider — The service provider the block was initialized with. Set by the builder after it has composed the container, so a test can assert which registrations the builder applied — the clock the block will resolve, or a service the test added through LogicBlockTestContextBuilder{TLogicBlock}.WithServices: var ctx = block.CreateTestContext().WithServices(s => s.AddSingleton(myService)).Build(); Assert.AreSame(myService, ctx.BuiltServiceProvider!.GetService<IMyService>());

Methods:

  • VerifySendCommand<T>(InterfaceId?, Action<T>, Times?) — Assert that a SendCommand call was made with the given target and message. testContext.VerifySendCommand<PingRequest>(mappedPong, msg => Assert.AreEqual(42, msg.Value));
  • VerifySendRequest<T>(InterfaceId?, Action<T>, Times?) — Assert that a SendRequest call was made with the given target and message. testContext.VerifySendRequest<PingRequest>(mappedPong, msg => Assert.AreEqual(42, msg.Value));
  • VerifySendStateUpdate<T>(Action<T>, Times?) — Assert that a SendStateUpdate call was made with the given message. testContext.VerifySendStateUpdate<MyState>(msg => Assert.AreEqual(expected, msg.Value));
  • VerifyServicePropertyChanged<T>(Expression<Func<T, T>>, Action<T>, Times?) — Assert that a service property change was recorded for the specified property. testContext.VerifyServicePropertyChanged(lb => lb.Power, value => Assert.AreEqual(3.5, value));
  • VerifyServicePropertyEmitted<T>(Expression<Func<T, T>>, Action<T>, Times?) — Assert on the emitted service-property values — the messages that survived the emission policy. Same shape and underlying stream as (it reads the recorded ServicePropertyValueChanged messages), but its name documents intent: under FromAttributes a held assignment is not an emission until its throttle interval elapses (drive that with ), and a sub-threshold assignment never emits at all. With the policy off it behaves identically to . testContext.VerifyServicePropertyEmitted(lb => lb.Power, value => Assert.AreEqual(3.5, value));
  • VerifyServiceMeasuringPointChanged<T>(Expression<Func<T, T>>, Action<T>, Times?) — Assert that a service measuring point change was recorded for the specified property. testContext.VerifyServiceMeasuringPointChanged(lb => lb.Temperature, value => Assert.AreEqual(22.5, value));
  • VerifyServiceMeasuringPointEmitted<T>(Expression<Func<T, T>>, Action<T>, Times?) — Assert on the emitted service-measuring-point values — the measuring-point analogue of . Reads the post-policy ServiceMeasuringPointValueChanged stream, so under FromAttributes a held assignment is not an emission until its throttle interval elapses (drive that with ). With the policy off it behaves identically to . testContext.VerifyServiceMeasuringPointEmitted(lb => lb.Frequency, value => Assert.AreEqual(50.0, value));
  • VerifyContractMessageSent<T>(string, string, Func<T, bool>, Times?) — Assert that a contract message of was recorded, optionally filtered by contract identifier and by a predicate over the message.
    • messageKind: A label naming this verification in its failure message. It filters nothing — the filters are , and — so any text a reader will recognise in a failure will do.
    • contractIdentifier: The contract to filter by, or null for any.
    • verifyMessage: A predicate the message must satisfy, or null for any.
    • times: The expected number of matches, or null for exactly once.
  • GetContractMessages<T>(string) — Returns all recorded contract messages of the specified data type, optionally filtered by contract identifier. Useful for TestKit extensions that need to extract pending requests for response simulation.
  • ClearRecordedMessages — Clear recorded messages, e.g. if the test arranging phase triggers messages, that should be ignored.
  • AdvanceTime(TimeSpan) — Advance the virtual clock by and dispatch every queued action whose deadline has elapsed, in deadline order. The clock is set to each action's deadline immediately before that action runs, so an action's own UtcNow read sees the time it was scheduled for (not the post-advance target). Actions queued during dispatch with a deadline still ≤ the target time fire in the same call (cascading); actions whose deadline lies beyond the target stay pending for a later AdvanceTime. The clock only ever moves forward: an action queued from a background thread can carry a deadline this call has already passed, and it runs at the current virtual time rather than rewinding the clock.
  • FlushPendingActions — Execute every action currently queued by or , ignoring their scheduled deadlines and ignoring the virtual clock. New code that wants deterministic time semantics should prefer ; this method exists for tests that just want to drain the queue without caring about elapsed simulated time. sut.OnTimer(); // sends requests, queues Calculate sut.HandleResponse(id, response); // feed response data testContext.FlushPendingActions(); // now Calculate() runs The drain is single-pass: actions queued by an action that runs during this call are deferred to the next FlushPendingActions call. A self-rescheduling tick will therefore fire exactly once per call, not loop until the queue is empty.
  • GetSentMessagesOfTypePublic<T> — Returns every recorded message of in send order. A public escape hatch for assertions that need a message type the typed Verify* helpers do not cover (e.g. ServicePropertyValueCleared for the clear-bypass path).
  • SetTimeProvider(FakeTimeProvider) — Internal swap point used by LogicBlockTestContextBuilder.WithTimeProvider so the same FakeTimeProvider can be passed to the block's constructor and then bound to the test context, instead of the two clocks drifting independently.

LogicBlockTestContextBuilder ​

Fluent test builder to initialize LogicBlock instances for unit tests.

Methods:

  • WithLogicInterfaceMapping<T>(Func<T, T>, InterfaceId) — Adds a mapping to another logic block using a specific (self or delegated) implementation of the interface. When is inferred as a concrete class (the common shape of WithLogicInterfaceMapping(lb =&gt; lb, id)), this method throws if the class implements more than one [LogicInterface]-decorated contract interface — without an explicit generic argument the mapping would silently route to whichever contract happens to come first in metadata order, and a second ambiguous mapping would land on the wrong sender. Pass the contract interface explicitly, e.g. WithLogicInterfaceMapping&lt;IContractA&gt;(lb =&gt; lb, id).
  • WithLogicInterfaceMapping<T>(InterfaceId) — Adds a mapping to another logic block using the logic block's own implementation of the interface.
  • WithPersistentValue<T>(Expression<Func<T, T>>, T) — Registers a persistent value to be restored after initialization, simulating a restart with previously saved state. var testContext = block.CreateTestContext() .WithPersistentValue(lb => lb.MaxPower, 42.0) .WithPersistentValue(lb => lb.Mode, OperatingMode.Manual) .Build();
  • WithInstantiationParameter<T>(Expression<Func<T, T>>, T) — Sets an [InstantiationParameter] value that is applied to the block before Configure (via the same JSON value channel the config payload uses), so Live-mode [IncludedWhen] gates resolve against it. Exercises the encode/decode path. Direct pre-Build() assignment also works when the property has a settable/init accessor (e.g. new MyBlock { PointCount = 2 } in the test's object initializer); this builder method additionally covers post-construction cases and the decode path. var ctx = block.CreateTestContext() .WithInstantiationParameter(lb => lb.ChargePointCount, 3) .Build();
  • WithServices(Action<IServiceCollection>) — Registers additional DI services for logic block initialization. Use this to register services required by contract types (e.g. Modbus RTU).
  • WithoutAutoStart — Prevents the logic block from being started after initialization. By default, the builder starts the block so that service property changes produce messages. Use this when testing initialization or pre-start behavior.
  • WithTimeProvider(FakeTimeProvider) — Bind the test context's virtual clock to a caller-owned FakeTimeProvider. Use this when the block's constructor takes a TimeProvider and the test needs to ensure the block and testContext.TimeProvider share the same instance. var clock = new FakeTimeProvider(new DateTimeOffset(2026, 1, 1, 0, 0, 0, TimeSpan.Zero)); var sut = new MyBlock(clock, loggerMock.Object); var ctx = sut.CreateTestContext().WithTimeProvider(clock).Build(); ctx.AdvanceTime(TimeSpan.FromSeconds(5)); // advances both sut's reads and ctx's deadlines
  • WithEmissionPolicy(EmissionPolicyMode) — Controls whether the emission policy runs under the TestKit's fake clock. By default (Off) the policy is gated off so every assignment surfaces as a change. Pass FromAttributes to force the policy on from the block's throttle attributes — the builder registers a marker the block reads at init (_forcePolicyFromAttributes), so drives the throttling deterministically. var ctx = block.CreateTestContext() .WithEmissionPolicy(EmissionPolicyMode.FromAttributes) .Build(); block.Power = 1.0; // first emit seeds the throttler block.Power = 1.5; // held by the 250 ms min-interval ctx.AdvanceTime(TimeSpan.FromMilliseconds(250)); // flushes the held value ctx.VerifyServicePropertyEmitted(lb => lb.Power, times: Times.Exactly(2));
  • Build — Initialize the logic block and apply any linked interfaces mapping. After this returns the logic block's Configure(...), Ready(), and Starting() will have been executed and the block is ready to process messages. Use to skip starting.
  • DiscoverContractIds — Discovers contract identifiers from properties whose type has [ServiceProviderContractType], minus those the block's [IncludedWhen] gates exclude. Generates a LogicBlockContractId for each so that contracts are fully initialized in tests. The gate is honoured because the mapping set is a claim about the deployment: a gated-out contract is never bound, and the cloud rejects a mapping for one at activation. A kit that mapped every property would let a gating test pass against a shape the deployment target refuses.
  • GuardAgainstAmbiguousMappingTarget(Type) — When is a class that implements more than one [LogicInterface]-decorated contract interface, the existing IsAssignableFrom+FirstOrDefault resolution in cannot tell which contract the caller meant. Two such mappings stack onto the same dictionary key, get routed to the first matching sender, and the second contract's sender silently receives zero mappings. Catch the ambiguity at registration time so the bug surfaces at the call site instead of as a missing verification later.
  • InitializeLogicBlock — Sends the InitializeLogicBlock message to the logic block to initialize it. Auto-discovers service identifiers from [Service] attributes so that service property and measuring point changes are routed correctly when the block is started.
  • LinkRuntimeActors — Sends LinkRuntimeActors so the logic block has its runtime actor refs populated. In production this is sent by dale's LogicSystemConfigurationInitializer.LinkRuntimeActors; in TestKit we use TestActorReference stand-ins (returned by the test context's IActorContext.LookupByName). Without this, LogicBlockBase's deferred-init path leaves Ready() and SendBindLogicBlockServices unfired.
  • RegisterContractAssemblyServices(IServiceCollection) — Auto-discovers contract properties on the logic block, finds IConfigureServices implementations in each contract assembly, and invokes them. Mirrors what the full Dale runtime does with shared assembly discovery.
  • InstantiationParameterContext — The [InstantiationParameter] values the block will hold once the configuration channel has applied them, which is what its Live-mode binders resolve the gates against: whatever each property carries now, overwritten by the values staged. Both sides come from PropertyValueCodec.ClrToJson off the same TypeRef, so the overlay is that shape without decoding onto the CLR properties a second time — which is the block's job and happens after this lookup is handed to it.
  • DiscoverServiceIds — Discovers service identifiers from the logic-block class name and from any property whose type carries service-bearing attributes. The dropped [Service] attribute no longer participates in discovery — class-name and property-name are canonical.
  • RestorePersistentState — If persistent values were registered, resolves their persistence keys and sends a RestorePersistentDataRequest.
  • ResolvePersistenceKey(string) — Resolves a C# property name to its persistence key by searching the service binder's bindings. Falls back to the opt-in key format (_direct.{PropertyName}) if not found as a service property.
  • StartLogicBlock — If auto-start was requested, sends StartLogicBlockRequest and clears the infrastructure messages produced during startup (initial state publishes, periodic save scheduling).
  • SetLinkedInterfaces — Sets the linked interfaces on the logic block based on the configured mappings with the help of some reflection.

LogicBlockTestHelper ​

Static helper methods to create logic block instances with mocked dependencies for testing.

Methods:

  • CreateLoggerMock — Creates a mock ILogger for logic blocks.
  • Create<T> — Creates a logic block instance with a default logger mock. The logic block must have a constructor that accepts ILogger. var block = LogicBlockTestHelper.Create<MyBlock>();
  • CreateWithLogger<T> — Creates a logic block instance and returns both the instance and the logger mock, for tests that need to verify log output. var (block, loggerMock) = LogicBlockTestHelper.CreateWithLogger<MyBlock>();
  • Construct<T>(Mock<ILogger>) — The one construction path both entry points take. Reflection's own refusals name the type and nothing else — "Constructor on type 'X' not found." is true of an abstract type, of a block taking a different constructor, and of nothing a caller can act on — so each shape is recognised before the call and told what it needs.

LogicBlockTimerExtensions ​

Extension methods for simulating timer ticks in unit tests. Uses reflection to access the internal timer callback dictionary on LogicBlockBase.

Methods:

  • FireTimer(LogicBlockBase, string) — Fires a timer callback by its identifier. The identifier is typically the method name unless overridden via [Timer(identifier: "custom")].
  • FireTimer<T>(T, Expression<Action<T>>) — Fires a timer callback using a method selector expression for type-safety. The method must be accessible from the test. block.FireTimer((MyBlock lb) => lb.OnTimer());
  • GetTimerInterval(LogicBlockBase, string) — Returns the configured interval for the specified timer.
  • GetTimerInterval<T>(T, Expression<Action<T>>) — Returns the configured interval for the specified timer using a method selector expression. var interval = block.GetTimerInterval((MyBlock lb) => lb.OnTimer());
  • RequireTimer(Dictionary<string, ValueTuple<TimeSpan, Action>>, string) — The one refusal both queries give. Naming the registered identifiers is most of the message's value — the mistake behind an unknown identifier is almost always a typo or a renamed method, and the answer is in the list — so neither query may give the short form.

TestActorReference ​

Mock actor reference implementation for testing without a real actor system.


TestKitVerificationException ​

Exception thrown when a TestKit verification assertion fails.


TimesExtensions ​

Extension methods to validate Moq Times constraints against actual invocation counts.

Methods:

  • AssertCount(Times, int, string) — Throws a TestKitVerificationException unless satisfies . Every occurrence-count form Moq expresses is honoured, because the check is Moq's own Times.Validate rather than a reading of the constraint's rendered text.

Vion.Dale.Sdk.Core ​

CommandAttribute ​

Marks a message as a command. The message is sent to a specific linked interface instance. The receiving side will not get the identifier of the sender.


ContractDirection ​

Defines the directional relationship between the two sides of a contract.

Fields/Values:

  • None — No specific direction. No arrows between "Between" and "And". No specific parent-child relationship.
  • Bidirectional — Bidirectional arrows between "Between" and "And". No specific parent-child relationship.
  • BetweenToAnd — Arrow from "Between" to "And". In a tree, "Between" would be the parent and "And" the child.
  • AndToBetween — Arrow from "And" to "Between". In a tree, "And" would be the parent and "Between" the child.

DefaultMinIntervalAttribute ​

The MinInterval a service property or measuring point of this struct type is published at when neither the member's own attribute nor its service interface's assigns one.

Put it on a struct that changes on nearly every update — a diagnostics summary whose counters move with every transaction. The dedup floor never holds such a value back and a struct has no deadband, so its interval is the only thing that limits how often it is published; this makes that interval slow unless the member asks for another. A MinInterval assigned on the member's attribute, or on the attribute of the service-interface property it implements, wins over this default. It applies to a member of the struct type and of its nullable form, never to an array of it. The value is a duration in the same format as MinInterval.

Properties:

  • MinInterval — The interval members of this type are published at when none is assigned.

Methods:

  • Constructor — (no description)
    • minInterval: A duration such as "30s", in the format MinInterval takes.

EnumLabelAttribute ​

Display label for an enum member. Surfaces in the dashboard via presentation.enumLabels.

Labels are translatable in the cloud, keyed by the enum's short type name (the namespace is not part of the key) and the C# member name — renaming either orphans the translations. Every member is cataloged, labeled or not; an unlabeled member is translatable too, with its raw member name as the source string. See docs/specs/introspection.md.

Properties:

  • Label — The label shown for this member. Translatable (see the remarks on this attribute).

Formats ​

Well-known values for Format. Two reserved sentinels (Relative, Humanize) plus shortcuts for the common moment.js / day.js format tokens. Open set — the renderer accepts any moment-compatible token string directly. These constants exist for discoverability and IntelliSense, not as a closed vocabulary.

Fields/Values:

  • Relative — Auto-updating relative date display. The renderer calls moment(value).fromNow() and refreshes on a timer. Locale-aware: "3 Minuten" in German, "il y a 3 minutes" in French.
  • Humanize — Humanized duration display. The renderer calls moment.duration(value).humanize() to produce rough natural-language output like "a few seconds" / "3 hours" / "2 days". Locale-aware.
  • LocaleFull — Locale-aware full date + time with weekday, e.g. "Monday, September 4, 1986 8:30 PM".
  • LocaleLong — Locale-aware date + time, e.g. "September 4, 1986 8:30 PM".
  • LocaleShort — Locale-aware short date + time, e.g. "Sep 4, 1986 8:30 PM".
  • LocaleDate — Locale-aware date only, e.g. "09/04/1986".
  • LocaleTime — Locale-aware time only with seconds, e.g. "8:30:25 PM".
  • Iso — "2026-05-13 14:32:05" — explicit ISO-ish date-time without millis.
  • IsoMillis — "2026-05-13 14:32:05.123" — explicit ISO-ish with millisecond precision.
  • Clock — "01:23:45" — clock-style duration without millis.
  • ClockMillis — "01:23:45.123" — clock-style duration with millisecond precision.

IConfigureServices ​

Plugin assemblies must contain an implementation of this interface. The host calls it at startup to add plugin logic blocks and services to DI.

Register each logic block by its own concrete type — that registration is what makes the block discoverable; its lifetime is not consulted, because a block is constructed for its actor rather than resolved, so every actor gets its own instance whatever lifetime is declared. The lifetime that does matter is that of the services a block injects: each block resolves them from a scope of its own that is disposed when its actor stops, so a transient or scoped registration yields one instance per block and reclaims it, while a singleton is shared by every block and outlives all of them.

Methods:

  • ConfigureServices(IServiceCollection) — Registers this plugin's logic blocks and the services they inject.

Importance ​

Declares the UI importance level of a service property or measuring point.

Fields/Values:

  • Normal — Shown only in detail views.
  • Primary — Shown prominently on dashboard tiles (large display).
  • Secondary — Shown on dashboard tiles (small display).
  • Hidden — Not shown in the UI.

IncludedWhenAttribute ​

Gates whether a member is part of the configured instance, based on the instance's InstantiationParameterAttribute values chosen at configuration time. The C# member always exists in code; what the gate controls is whether it is discoverable, wireable, bound, and published for a given instance. When the predicate is false the member is skipped entirely at bind time — never bound, never constructed (for contracts), never registered, no MQTT topic, no cloud read-model row, no editor slot. As if it were never declared. A member with no gate is unconditional (fully backward compatible). This is a hard, config-time existence gate — not display. Contrast VisibleWhen, which merely hides a still-existing, still-functioning member in the dashboard. Use [IncludedWhen] when the choice changes what the editor can wire or what topics exist; use VisibleWhen when the block merely behaves differently. Predicate. The shared dialect (docs/predicates.md, vion-contracts), with references restricted to InstantiationParameterAttribute properties of the same block (bare single-segment refs only — no Service.Property form). Evaluated strict / fail-closed: an unparseable predicate or a missing/null/type-mismatched parameter value fails Configure and the block reports unhealthy. DALE043 rejects a predicate that does not parse, a qualified ref, or a ref that does not resolve to an [InstantiationParameter]; DALE044 rejects a type/literal mismatch. Placement matrix (DALE043 enforces it; the rule is gateable = what the definition view exposes as a wireable/publishable member ): Gateable: a property-based interface binding ([LogicBlockInterfaceBinding] on a component implementing a [LogicInterface]); a contract-binding property ([ServiceProviderContractBinding]); a service-bearing component property (a type carrying [ServiceProperty]/[ServiceMeasuringPoint] members). Gating a component gates everything the binders derive from it — its interface binding and its whole service (all properties + measuring points). Not gateable: a scalar [ServiceProperty]/[ServiceMeasuringPoint] (it keeps existing and publishing — use VisibleWhen for display relevance); a [Timer] method (timers are not in the definition view — gate in code: if (ChargePointCount &lt; 3) return;); a class-implemented interface (no member to carry the attribute — use a property-based binding); the block class itself (whole-block existence = the operator adds the instance or not). Null-contract hazard (read carefully). An excluded contract property is never constructed by the binder, so it is null at runtime. Declare gated contract properties nullable (IDigitalOutput?) and gate your own fan-out code against the same parameter. (An excluded interface component stays non-null — the author's own new() — but is inert: unbound, never published, never wired.) Sibling-contract gating pattern. A per-plug station-level contract declared as a sibling property of the gated component must carry the same predicate, author-written — the platform cannot infer the grouping. Example: a Point2 gated with [IncludedWhen("ChargePointCount &gt;= 2")] and its ChargingPoint2Output contract carrying the identical gate. Inheritance: gates declared on a shared base logic-block class apply to every leaf. Re-declaring, changing, or removing the gate on an override/new member is rejected (DALE043) — declare the gate once, at the declaration the hierarchy shares.

Properties:

  • Predicate — The inclusion predicate. References InstantiationParameterAttribute scalars of the same block; evaluated strict / fail-closed at bind time.

Methods:

  • Constructor — Creates an inclusion gate over the given predicate in the shared dialect (docs/predicates.md), referencing InstantiationParameterAttribute properties of the same block.

InstantiationParameterAttribute ​

Marks a ServicePropertyAttribute as an instantiation parameter: a config-time scalar the operator picks in the Logic Editor when the block instance is added, the value an IncludedWhenAttribute gate reads to decide which members the configured instance actually has. A modifier on a real [ServiceProperty] (dual annotation, like [ServiceProperty] + [ServiceMeasuringPoint]): the value is chosen at configuration time, stored on the instance, applied to the block before Configure on every (re)instantiation, and is never settable at runtime. Parameters are independently useful as fixed setup scalars (e.g. a register base offset) — inclusion gates are just their most important consumer. Lifecycle availability. The value is applied between actor construction and the Configure call, so it is set and readable everywhere except the constructor: Site Value seen Constructor C# initializer default only — never branch on a parameter here. Configure (binding — where gates evaluate) Operator value (or the C# default when none was supplied). Ready(), persistence restore, Starting(), timers, later hooks Operator value — per-model defaults are ordinary C# here, no platform machinery. Placement. On a property of the logic-block class itself (own or a shared base class), root service only — never on a component type and never via a service interface. Must be paired with ServicePropertyAttribute. Enforced by DALE044. Types. Discrete scalars only — bool, enum, the integer kinds, and string (the same set inclusion predicates may reference). No double/ float (analog values must not drive structure), no structs/arrays, and never WriteOnly (a secret cannot be an editor-visible driver). Runtime immutability & honesty. The attribute forces the top-level schema.readOnly wire flag, so the dashboard renders it read-only and every SetPropertyValue is rejected — the operator changes the value by editing the config and re-activating (which recycles the block), not at runtime. The property must be an auto-property (no computed getter, so block code provably reads the value the gates evaluated) and block code must not assign it outside the constructor / object initializer; DALE044 enforces both regardless of accessor shape. { get; init; } is the recommended shape (the compiler then backstops the analyzer globally), but is not the mechanism — reflection application by the SDK works with both set and init. Persistence. Parameters are excluded from persistence auto-discovery — the config channel is their only source of truth, so a stale gateway-persisted value can never clobber the config-applied one after the gates already resolved. See IncludedWhenAttribute for the gate that consumes these values, and docs/predicates.md (vion-contracts) for the predicate dialect.


LinkMultiplicity ​

Multiplicity of a contract link. Consumer-side on a binding (LogicBlockInterfaceBindingAttribute / ServiceProviderContractBindingAttribute) and provider-side on [ServiceProviderContractType]. Declared by the SDK only; the SDK neither validates nor enforces it — enforcement is downstream (cloud-api at logic-configuration save/activate).

Fields/Values:

  • ExactlyOne — Required and single: exactly one counterpart must be linked (1..1).
  • ZeroOrOne — Optional and single: at most one counterpart may be linked (0..1). Provider-side, this expresses single-consumer exclusivity (e.g. a digital output that accepts at most one writer).
  • OneOrMore — Required and many: at least one counterpart must be linked (1..n).
  • ZeroOrMore — Optional and many: any number of counterparts may be linked (0..n). The unconstrained default — preserves the pre-multiplicity no-enforcement behaviour, so it is omitted from the introspection annotations rather than emitted.

LogicBlockAttribute ​

Block-level display metadata for a LogicBlock class.

Every display string this block declares is translatable in the cloud, under a key rooted in the block's full type name — namespace included. Renaming or moving the class orphans those translations. See docs/specs/introspection.md.

Properties:

  • Name — Human-readable name. Falls back to the C# class name. Translatable in the cloud (see the remarks on this attribute).
  • Icon — Icon identifier. Use Remixicon names without the "ri-" prefix (e.g. "charging-pile-line", "battery-2-line"). See https://remixicon.com. Dashboard renders a default fallback icon for unknown / missing values.
  • Groups — Order in which the dashboard renders group sections in the full block view. Values are the same string keys as Group — well-known constants from PropertyGroup and/or integrator-supplied custom keys. Groups not listed appear last in the platform default order. When unset, defaults to [Alarm, Status, Metric, Configuration, Diagnostics, Identity, None]. A custom key is also the translation key of its section label — editing it orphans that label's translations.

LogicBlockBase ​

Base class for all logic blocks. Provides actor lifecycle, service binding, persistence, and timer support.

A logic block is constructed for its actor and its dependencies are resolved from a scope of that actor's own, which is disposed when the actor terminates. The block itself is not: implementing IDisposable on a block gives it a method nothing calls, because disposing the block would have to run inside the same terminal step the runtime's stop grace period is measured against. is a block's only release hook.

Methods:

  • Ready — Called once after the block has been configured (attribute-driven bindings are in place) and is ready to run, but BEFORE the runtime has restored persisted ServicePropertyAttribute values, registered per-contract sender instances, or fired . The right place to attach event handlers to contract / interface elements and to do other block-local one-time setup that doesn't depend on SDK runtime state.
  • Starting — Called once after and after the runtime has restored persisted ServicePropertyAttribute values and registered per-contract sender instances. The right place for setup that depends on SDK runtime state: reading persisted property values, enumerating contract links via GetLinkedXxx(), scheduling first periodic ticks, and emitting initial cross-block contract state-updates.
  • Stopping — Called once before the block is removed, after the runtime processes a stop request. The right place to release resources acquired during the block's lifetime: detach event handlers attached in , cancel in-flight operations, dispose clients the block created itself. A final safe-state device write can be issued here, but only best-effort — it may not reach the device.
  • Configure(ILogicBlockConfigurationBuilder) — Binds this logic block's interfaces, contracts, services and timers from their declarative attributes. Internal infrastructure invoked by the runtime; not an extension point.
  • BoundInterfaceIdentifiers — The interface endpoints this instance bound, by identifier. The block announces its bound services in BindLogicBlockServices, but nothing on the wire carries the bound interface set — so a test that needs it has this seam rather than reflection (testing-conventions.md section 7). Internal, so the published surface does not move.
  • RecordingConfigurationFailures(Action) — Runs one part of the configuration phase, recording why it failed before letting the failure out. Both arms go through here because the phase can finish on either: when LinkRuntimeActors arrives after the configuration message, the announcement and Ready() are deferred to it, so a block that refuses to become ready fails from that arm and would otherwise be refused a retry with no reason.
  • CompleteConfiguration — The tail of the configuration phase: announce the bound services and tell the block it is ready. Runs inline when the runtime actors are already linked, and from the LinkRuntimeActors arm when they are not.
  • ApplyLinkedInterfaces(Dictionary<InterfaceId, Dictionary<InterfaceId, IActorReference>>) — Points each bound interface at the actors it was linked to. A mapping may target an interface gated out by [IncludedWhen] on this block, so it was never bound and is absent — skip and warn rather than fail the handler on a missing key, which would take the whole block down.
  • RequireActorContext(string) — Refuses a dispatcher call made before the block has received its first message, when there is no actor to schedule onto. Without it the caller gets a bare null-reference exception that the middleware swallows, naming neither the block nor what to do about it.
  • BoundedDelay(TimeSpan, string) — The delay a scheduled action is actually armed with. A negative span is the caller asking for something already due, which is what a zero delay means — the same treatment the emission gate's flush gives a deadline in the past. A span longer than a real clock can wait is refused, because arming it throws from inside the actor's handler, where the middleware swallows it and the action is lost with no trace: the bound is the one a scenario's durations already carry. The refusal names the dispatcher member the same way does — the parameter name alone tells a block author nothing about which of its own calls to edit.
  • ApplyConfiguration(InitializeLogicBlock, IActorContext) — The configuration phase, in the order the runtime depends on: parameter values applied, the declarative binders run against them, emission gates built, contract mappings resolved, persistence initialised, and the block told it is ready. Extracted so the caller can record why it failed, since a failure spends the instance and a retry has to be told what to fix.
  • ApplyInstantiationParameters(List<InstantiationParameterValue>) — Applies the operator-chosen [InstantiationParameter] values from the config payload onto this block's CLR properties by reflection, before runs the Live-mode binders that read them to resolve inclusion gates. The decode schema is built from each property's PropertyInfo via (binder / PropertyMetadataBuilder output does not exist pre-bind), then decoded with . Fail-closed: an unknown identifier or a decode failure throws, failing block initialization (sync-status Failed) rather than resolving gates against a wrong or default value.
  • BuildThrottlers — constructs one Throttler per bound service property and per bound measuring point from its declarative emission attributes, into the matching stream collection (_servicePropertyThrottlers / _measuringPointThrottlers) keyed by (ServiceIdentifier, member name). A dual-annotated member thus gets one gate per stream, so the two streams don't cross-suppress. The knobs are resolved one by one by from the implementing property and the interface property; the value type comes from TargetPropertyType.
  • ResetThrottlerPending(Dictionary<ValueTuple<string, string>, Throttler>, ValueTuple<string, string>) — discards a throttler's pending held flush (and its emitted state) on a value-clear, so the cleared edge is not undone by a later trailing flush. Reconstructs the gate from its own Policy via a fresh Throttler — there is no in-place cancel on the gate. The caller passes the member's stream collection.
  • ResetThrottlers — rebuilds every property and measuring-point throttler from its Policy, clearing emitted/pending state so the next offer for each member is a fresh leading-edge force-emit. Used on an operational reconnect (PublishServiceState): the throttlers' last-emitted values can be ahead of what the broker actually received (publishes during the disconnect were dropped), so the current state must be re-asserted unconditionally rather than deduplicated against it.
  • ScheduleEmissionFlush(DateTimeOffset) — ensures one trailing-edge flush is scheduled at the earliest pending deadline across all throttlers. Mirrors — a single idiomatic self-send via the pause-gated / stepper-aware self-scheduling path. The flush body () coalesces and reschedules the next-earliest, so an extra wakeup at worst finds nothing due and reschedules. The flush is dispatched as an InvokeSynchronized action rather than a bespoke self-message: the action wrapper is what both the production actor loop and the TestKit's virtual clock (AdvanceTime / FlushPendingActions) actually pump, so the trailing flush is observable under deterministic tests. A raw self-message would be delivered in production but silently dropped by the TestKit, which never re-dispatches non-action self-messages.
  • OnEmissionFlushDue — flushes every throttler whose hold deadline has elapsed, emitting its pending value, then reschedules a single wakeup for the earliest still-pending deadline (if any).
  • DrainThrottlers — on stop, emit each throttled member's exact current value if it differs from the throttler's last-emitted value — bypassing throttle and deadband — so the final retained state is exact. Reads the current value straight from the binding getter.
  • InvokeActionMessage.#ctor(Action) — Represents a message that contains an action to be executed in the context of the actor. This is not serializable, therefore only usable locally, usually within one actor

Fields/Values:

  • MaxScheduledDelay — The longest delay a scheduled action can be armed with — the bound a real clock can wait, the same one a scenario's durations carry (AC-SCEN-003.2), measured rather than recalled. Repeated here rather than shared because the SDK cannot reference the development host that declares it.

LogicBlockContractAttribute ​

Marks a class as a contract container grouping messages (CommandAttribute, StateUpdateAttribute, RequestResponseAttribute) exchanged between two LogicBlock interfaces.

The role names below are translatable in the cloud, but not keyed on this contract: each block that binds one of these interfaces carries its own copy, keyed by that block's LogicBlockInterfaceBindingAttribute identifier. See docs/specs/introspection.md.

Properties:

  • BetweenDefaultName — Human-readable name for the BetweenInterface role. Translatable per binding block (see the remarks on this attribute).
  • AndDefaultName — Human-readable name for the AndInterface role. Translatable per binding block (see the remarks on this attribute).

LogicBlockInterfaceBindingAttribute ​

Metadata for an implementation of a logic-block interface. Applies to a class (when the LB implements the interface directly) OR a property (when the property's value implements the interface, e.g. an inner ChargingPoint instance). Both cases are "metadata for an existing interface relationship". AllowMultiple = true to handle properties whose type implements multiple interfaces (each LogicBlockInterfaceBindingAttribute targets one interface via ForInterface).

DefaultName — and the contract's role names (BetweenDefaultName / AndDefaultName) — are translatable in the cloud, keyed by the block's full type name and this binding's Identifier, which defaults to a C# name. Pin Identifier to rename the property, interface or class without orphaning the translations. See docs/specs/introspection.md.

Properties:

  • ForInterface — The interface this binding metadata applies to.
  • Identifier — Stable identifier for this interface binding. Defaults to {PropertyName}_{InterfaceName} (property-bound) or the bare interface name (class-implemented); pin it to rename without changing the identifier.
  • DefaultName — Human-readable name for the interface endpoint. Translatable (see the remarks on this attribute).
  • Multiplicity — Consumer-side link multiplicity for this interface binding. Default ZeroOrMore (unconstrained — preserves the pre-multiplicity behaviour). Declared only; enforced downstream.

MeasuringPointKind ​

Time-series shape of a measuring point. Mirrors the wire enum in Vion.Contracts.TypeRef; mapped at the introspection boundary so integrators only reference Vion.Dale.Sdk.Core.

Fields/Values:

  • Measurement — Instantaneous value at a moment in time. Each sample is independent of previous samples — reflects current state, not running aggregate. Examples: active power (kW), voltage, temperature, state of charge (%). Chart default: line. Aggregation: avg per bucket.
  • Total — Cumulative running aggregate that can both increase and decrease (without a hardware reset). Each sample is the absolute cumulative value at that moment. Examples: battery stored energy (kWh, absolute), water tank volume, daily energy import (resets at midnight). Chart default: cumulative line. Aggregation: last per bucket.
  • TotalIncreasing — Monotonically-increasing counter. Only goes up; a drop is anomalous (overflow or hardware/firmware reset) and the platform applies correction (clamp to zero). Examples: lifetime energy meter, odometer, total operating hours, cycle count. Chart default: derivative (rate per bucket). Aggregation: last - first.

PersistentAttribute ​

Controls persistence behavior for properties. - On writable service properties: Use [Persistent(Exclude = true)] to opt-out - On other properties: Use [Persistent] to opt-in

Properties:

  • Exclude — Set to true to exclude a writable service property from persistence

PresentationAttribute ​

UI-side presentation hints for a service property or a measuring point. Routes into the per-property presentation sibling document. Open for preset inheritance — integrators subclass to ship their own domain vocabulary.

Properties only. Nothing reads this attribute off a method: the introspection builds the presentation document from a member's PropertyInfo, and every diagnostic that judges a hint against its member's type is registered on properties — so a declaration on a method compiled, emitted nothing and warned about nothing.

Properties:

  • DisplayName — Override the displayed label. Falls back to schema.title (primitives) or the C# property name. For enum-/struct-typed properties (where schema.title is identity-bearing), this is the only way to set a UI label distinct from the CLR type name. Translatable in the cloud under the member's title key (see the remarks on ServicePropertyAttribute).
  • Group — Group key. The dashboard renders all properties with the same Group key in one section. Well-known keys are constants in PropertyGroup; integrators may supply their own string keys (e.g. "acme.powertrain") which the dashboard renders as a generic section with the raw key as the header. Section order is set by [LogicBlock(Groups = ...)]; default order is the platform-defined order. Within-group order is by Order. A custom key is also the translation key of its section label — editing it orphans that label's translations. Well-known PropertyGroup keys are translated by the platform itself.
  • Order — Sort hint within a group. Ascending; properties without an explicit value sort between explicit values, stable-by-default (base-class first, declaration order within each class). Used for finer ordering than the group level. MinValue means "unset" (attribute parameter types can't be nullable; PropertyMetadataBuilder converts the sentinel to null in the codec-side Presentation.Order).
  • Importance — Tile composition rank. Primary/Secondary surface on the auto-generated LogicBlock tile; Normal renders in detail views only; Hidden suppresses the property entirely.
  • StatusIndicator — Marks this property as an operational status indicator for the LogicBlock. A block can carry multiple — distinct status dimensions (e.g. operating mode + connection state + activity status). Must be enum-typed (or nullable enum). Per-member severity comes from [Severity]; per-member display labels from [EnumLabel].
  • Decimals — Display precision for numeric values. MinValue (default) means "unset" and uses sensible per-type defaults (attribute parameter types can't be nullable; PropertyMetadataBuilder converts the sentinel to null in the codec-side Presentation.Decimals). Ignored for non-numeric schemas (analyzer warning DALE021).
  • UiHint — Routing key for the dashboard's generic renderer and for custom widget templates. Open string; unrecognized values are silently ignored. Well-known platform values are constants in UiHints. The "statusIndicator" value is auto-emitted from StatusIndicator — don't set directly.
  • Format — Format-token string for date / duration / numeric renderers. Type-orthogonal — a separate concern from UiHint (which selects the widget) and Decimals (which controls numeric precision). The renderer (dashboard / DevHost) consumes the value as a moment.js / day.js compatible format-token string when the property's CLR type is DateTime or TimeSpan. Two reserved sentinel values short-circuit the token interpreter: "relative" → auto-updating "3 minutes ago"-style date display "humanize" → humanized duration like "3 hours" Common tokens (see Formats for shortcuts): "LLLL" → "Wednesday, May 13, 2026 2:32 PM" (locale full + weekday) "LLL" → "May 13, 2026 2:32 PM" (locale long) "YYYY-MM-DD HH:mm:ss" → "2026-05-13 14:32:05" "YYYY-MM-DD HH:mm:ss.SSS" → with millisecond precision "HH:mm:ss" → "01:23:45" (typical for durations) Token reference: .
  • VisibleWhen — Conditional-visibility predicate. When set, this member is hidden from the dashboard form whenever the predicate evaluates false, and shown otherwise. Evaluated reactively in the UI only, against the live values of sibling service properties of the same logic-block instance . The member keeps existing and functioning everywhere else — runtime, MQTT, cloud DB, introspection — so this is a pure display hint, never an existence or behavior gate (contrast [IncludedWhen], [ExistsWhen], which removes the member across every layer). A property with no VisibleWhen is always shown (backward compatible). Evaluation is fail-open: a broken or unresolvable predicate shows the member. Grammar (in brief). A typed subset of the dashboard's widget-expression dialect: comparisons — == != (bool / enum / string / integer refs), &lt; &lt;= &gt; &gt;= (integer refs only); membership — ref in [literal, …] (enum / string / integer, homogeneous list); boolean combinators — &amp;&amp; || ! and parentheses; a bare ref must be bool; ! applies only to a bool ref or a parenthesized predicate (write !(A == 5), not !A == 5); literals — integers (int32 range), true / false, and strings. Enum members are quoted strings (Mode == 'Eco'). Single quotes are the recommended style (no escaping inside a C# attribute string). Refs sit on the left of every comparison (no Yoda conditions). Arithmetic, the ternary, function calls, and pipes are rejected by the analyzer. The canonical grammar and semantics live in the shared docs/predicates.md (vion-contracts), pinned by Predicates/predicate-conformance.json. Reference scope and addressing. Referenced targets must be [ServiceProperty]s of type bool, enum, integer, or string (never double/float, WriteOnly, or measuring-point-only members): Bare ref (DirectMeasurement) — a property on the same service as the annotated member. Qualified ref (Service.Property) — a property on a sibling service of the same logic-block instance . Service identifiers are those the introspection uses (invisible in source, so spelled out here): the component-service identifier is the holding property's name (a ChargingPoint ChargingPoint1 { get; } property forms service ChargingPoint1), and the root-service identifier is the logic-block class name (address the root's own IsExternallyLocked as MyBlockClassName.IsExternallyLocked). Renaming the class therefore breaks root-qualified predicates in the same compilation — the analyzer (DALE041/DALE042) catches it at build. nameof() concatenation is supported: VisibleWhen = nameof(DirectMeasurement) + " == false".

PropertyGroup ​

Well-known property-group keys for Group. The platform ships these; integrators may define their own constants in their own static classes (e.g. Acme.Vion.Conventions.PropertyGroup.Powertrain = "acme.powertrain") and the dashboard renders unknown keys as a generic section with the raw key as the header.

Fields/Values:

  • None — Ungrouped — renders without a section header (fallback bucket).
  • Identity — Static identification information — manufacturer, model number, serial number, firmware version. Typically rendered in a header / about area.
  • Status — Current live operational state — read-only values that reflect what the system is doing right now.
  • Configuration — Anything the operator can write — long-term settings, runtime controls, action triggers (UiHint = UiHints.Trigger). Render type within the section is driven by UiHint, not by group.
  • Metric — Counters, totals, accumulated values. Often rendered prominently for energy / billing-style data.
  • Diagnostics — Troubleshooting and health information — last error, response time, connectivity. Usually a collapsed / secondary section.
  • Alarm — Active alarm state, fault codes. Rendered with elevated visual treatment (banner / alert list) when active.

RequestResponseAttribute ​

Marks a message as a request message. The message is sent to a specific linked interface instance. The receiving/responding side will need to return the response message. The responding side will not get the identifier of the sender. The requesting side will receive the identifier of the responder with the response.


ServiceInterfaceAttribute ​

Declare a service interface as a C# interface. Use the ServiceProperty and ServiceMeasuringPoint attributes on properties.


ServiceMeasuringPointAttribute ​

Define a measuring point on a service interface or logic block property. The optional properties become annotations in the introspection schema document. A property MAY also carry ServicePropertyAttribute — the two are independent. Each publishes to its own retained MQTT stream (…/measuring-point/state vs …/property/state) and is throttled / deadbanded separately; neither suppresses the other. Common for telemetry charted in the cloud that is also surfaced as live state (e.g. grid-meter power).

Title and Description are translatable in the cloud, keyed by the block's full type name plus two C# names: the owning service (the logic-block class name, or the holding property's name for a component service) and this property's name. There is no Identifier override — renaming any of them orphans the translations. See docs/specs/introspection.md.

Properties:

  • Title — Display label for the measuring point. Translatable (see the remarks on this attribute).
  • Description — Long-form description for tooltips, search, and accessibility. Routes into schema.description. Independent of Title, and separately translatable (see the remarks on this attribute).
  • StringFormat — Advisory JSON-Schema format for a string measuring point (e.g. Ipv4). Routes into schema.format; drives a specialized input + soft-validation in the dashboard / DevHost. Never enforced on the wire. String-only and not a type-kind format (date-time / duration / uuid) — see DALE033.
  • Kind — Semantic classification of the measuring point's time-series shape — drives default chart rendering, aggregation, and storage strategy. Routes into schema.x-kind. Defaults to Measurement (instantaneous samples).
  • MinInterval — Minimum spacing between two emitted values for this measuring point, as a duration string (e.g. "250ms", "1s", "500us") — a number with an optional us/ms/s/m/h suffix; a bare number is milliseconds. Drives the emission gate. "0" / "0ms" disables interval throttling. Reads "250ms" when not assigned; the member then takes the interface's interval, else its value type's DefaultMinIntervalAttribute, else 250 ms. Validated by analyzers DALE036 (format) / DALE037 (1 ms floor).
  • MinChange — Optional deadband: the minimum change a new value must clear (relative to the last emitted value) before it is emitted. The format depends on the measuring point's type — for the built-in numeric types (double, float, decimal, int, long) it is an invariant-culture number (e.g. "0.1"); for TimeSpan it is a duration (e.g. "1s"). Any other type must register an IChangeThreshold&lt;T&gt; that defines its format; bool has no magnitude and is not supported. null or "" means no deadband — only the value-equality dedup floor runs. When not assigned, the member takes the interface's deadband, else none. Validated by analyzers DALE034 (type) / DALE035 (format).
  • Immediate — When true, every observed change of this measuring point is emitted immediately, bypassing the interval and change gates. When not assigned, the member takes the interface's value, else false.

ServicePropertyAttribute ​

Describe a service property on a service interface or logic block property. The optional properties become annotations in the introspection schema document. A property MAY also carry ServiceMeasuringPointAttribute — the two are independent. Each publishes to its own retained MQTT stream (…/property/state vs …/measuring-point/state) and is throttled / deadbanded separately; neither suppresses the other. Declaring both surfaces the same value as live state AND a charted time series — common for telemetry (e.g. grid-meter power).

Title and Description are translatable in the cloud, keyed by the block's full type name plus two C# names: the owning service (the logic-block class name, or the holding property's name for a component service) and this property's name. There is no Identifier override — renaming any of them orphans the translations. See docs/specs/introspection.md.

Properties:

  • Title — Display label for the property. Translatable (see the remarks on this attribute).
  • Description — Long-form description for tooltips, search, and accessibility. Routes into schema.description. Independent of Title, and separately translatable (see the remarks on this attribute).
  • StringFormat — Advisory JSON-Schema format for a string value (e.g. Ipv4). Routes into schema.format; drives a specialized input + soft-validation in the dashboard / DevHost. Never enforced on the wire. String-only and not a type-kind format (date-time / duration / uuid) — see DALE033.
  • WriteOnly — Marks a writable property as a secret on the wire. The host runtime publishes and answers it as the redaction sentinel ("***"), a null staying null, and keeps the value it holds when a client echoes the sentinel back; the DevHost does the same on what it serves a browser. The block holds the real value, and it is persisted unencrypted unless excluded with [Persistent(Exclude = true)]. No SDK log line carries it; a block that logs it, or hands it to a library that does, publishes it. A measuring point is never redacted, so never also declare a secret [ServiceMeasuringPoint]. Restricted to string / string? properties in v1. Routes into schema.writeOnly.
  • ReadOnly — Marks the property as read-only on the wire even when the C# property has a public setter. Use this when a cross-assembly helper needs to assign the value (requires the public setter) but the cloud must not be able to SetPropertyValue it back. Routes into schema.readOnly — same wire flag that a private setter or a [ServiceMeasuringPoint] would set, so the dashboard groups it with metrics.
  • MinInterval — Minimum spacing between two emitted values for this property, as a duration string (e.g. "250ms", "1s", "500us") — a number with an optional us/ms/s/m/h suffix; a bare number is milliseconds. Drives the emission gate. "0" / "0ms" disables interval throttling. Reads "250ms" when not assigned; the member then takes the interface's interval, else its value type's DefaultMinIntervalAttribute, else 250 ms. Validated by analyzers DALE036 (format) / DALE037 (1 ms floor).
  • MinChange — Optional deadband: the minimum change a new value must clear (relative to the last emitted value) before it is emitted. The format depends on the property's type — for the built-in numeric types (double, float, decimal, int, long) it is an invariant-culture number (e.g. "0.1"); for TimeSpan it is a duration (e.g. "1s"). Any other type must register an IChangeThreshold&lt;T&gt; that defines its format; bool has no magnitude and is not supported. null or "" means no deadband — only the value-equality dedup floor runs. When not assigned, the member takes the interface's deadband, else none. Validated by analyzers DALE034 (type) / DALE035 (format).
  • Immediate — When true, every observed change of this property is emitted immediately, bypassing the interval and change gates. When not assigned, the member takes the interface's value, else false.

ServiceProviderContractBindingAttribute ​

Binds a LogicBlock property to a hardware service-provider function (HAL: IAnalogOutput, IDigitalOutput, IModbusClient, …). The property type is the hardware contract; the attribute carries the identity / link-multiplicity metadata for the binding. Structurally the matched twin of LogicBlockInterfaceBindingAttribute — distinct only because the two are consumed by different binders (in-process actor link vs MQTT service-provider adapter).

DefaultName is translatable in the cloud, keyed by the block's full type name and this binding's Identifier — which defaults to the annotated property's name, so renaming that property orphans the translations unless Identifier is pinned. See docs/specs/introspection.md.

Properties:

  • Identifier — Stable identifier for this contract binding. Defaults to the annotated property's name; pin it to rename the property without changing the identifier.
  • DefaultName — Human-readable name for the contract. Translatable (see the remarks on this attribute).
  • Multiplicity — Consumer-side link multiplicity for this contract binding. Default ZeroOrMore (unconstrained — preserves the pre-multiplicity behaviour). Declared only; enforced downstream.

ServiceRelationAttribute ​

Declares that wiring this contract between two logic blocks is a service relation of the given type — a typed edge between the two blocks' services, published as topology metadata. Declare it once, here on the contract: every block implementing either of the contract's two interfaces then takes part automatically, on whichever side it implements. Relations describe the graph; they carry no runtime behaviour and change nothing about how messages flow. Which side is which. OutwardsInterface names the subordinate, providing side — the start of the arrow. The contract's other interface is the inwards, aggregating side — the end of the arrow. A block may implement both sides; each is treated independently. A component must be a service to take part. The relation attaches to the service that owns the interface: the block's own service when the block class implements it, or the component's service when a property's type does. A component type with no service surface (no ServiceInterfaceAttribute, no ServicePropertyAttribute or ServiceMeasuringPointAttribute members) is not a service, so nothing is emitted for it — the interface still binds and wires as usual. Give the component one service property to let it take part, or implement the interface on the block class for an edge at block granularity. Both sides need the declaration. Each package resolves relations at build time against the contract assembly it was compiled against, so a block built against an older contract simply contributes nothing for that pair — a missing edge, never an error.

Properties:

  • RelationType — Names the kind of edge this relation is. Opaque and compared verbatim, and it is what both the API and the UI key on — so treat it as a public identifier: choose it deliberately, and expect a rename to break every consumer. Must be unique among the declarations on one contract.
  • OutwardsInterface — Which of the contract's two interfaces is the outwards — subordinate, providing — side. Must be spelled exactly like the corresponding BetweenInterface or AndInterface; any other value is rejected.

ServiceRelationDirection ​

Which side of a service relation a service sits on. Outwards is the side named by OutwardsInterface; the contract's other interface is Inwards.

Fields/Values:

  • Inwards — This service is the target (end) of the relation — the aggregating / managing side.
  • Outwards — This service is the source (start) of the relation — the subordinate / providing side.

SeverityAttribute ​

Per-enum-member severity used with [Presentation(StatusIndicator = true)]. The dashboard reads severity for each enum member to color the status pill. Companion to EnumLabelAttribute which supplies the display label.


StateUpdateAttribute ​

Marks a message as a state update. The message is sent to all linked interfaces. The receiving side will get the identifier of the sender


StatusSeverity ​

Severity level for status indicator enum values.

Fields/Values:

  • Success — Indicates a healthy or successful state.
  • Info — Informational status.
  • Warning — Indicates a potential issue.
  • Error — Indicates a failure or critical issue.
  • Neutral — No specific severity.

StringFormats ​

Well-known JSON-Schema format values for string properties, set via StringFormat on ServicePropertyAttribute / StructFieldAttribute. Open set — integrators may pass any value; UIs recognize these and fall back to a plain text input for unknown ones. Advisory only: the runtime never rejects on format. Do NOT use these for DateTime / TimeSpan / Guid values — those are CLR types whose format is derived (date-time / duration / uuid); see DALE033.

Fields/Values:

  • Ipv4 — IPv4 dotted-quad address, e.g. 192.168.1.10.
  • Ipv6 — IPv6 address.
  • Hostname — DNS hostname (RFC 1123 label form).
  • Email — Email address.
  • Uri — URI / URL string.

StructFieldAttribute ​

Per-field annotations for a field of a flat struct used as a service-element value — a positional record-struct constructor parameter.

Constructor parameters only. Both readers of this attribute walk the struct's positional constructor, and no diagnostic registers on a property, so a declaration on the generated property compiled, emitted nothing and warned about nothing. Title and Description are translatable in the cloud, keyed by the struct's short type name (the namespace is not part of the key) and the field's camelCase wire name — the constructor parameter's name, first letter lower-cased. Renaming either orphans the translations. See docs/specs/introspection.md.

Properties:

  • Title — Display label for the field. Translatable (see the remarks on this attribute).
  • Description — Long-form description for the field. Separately translatable, like Title.
  • StringFormat — Advisory JSON-Schema format for a string field (e.g. Ipv4). Routes into the field's schema.format. String-only — see DALE033.
  • WriteOnly — Marks this field as a secret on the wire, while the struct's other fields stay visible. Where the struct is a service property's type, the host runtime publishes and answers this field as the redaction sentinel ("***"), a null staying null, and keeps the value it holds when a client writes the struct back with the sentinel in this field; the DevHost does the same on what it serves a browser. The block holds the real value, and it is persisted unencrypted unless the property is excluded with [Persistent(Exclude = true)]. A measuring point is never redacted. Restricted to string / string? fields in v1. Routes into the field's schema.writeOnly.

TimerAttribute ​

Declare a timer method that should be called at regular intervals. If the identifier is not set, the method name is used.


UiHints ​

Well-known UiHint values for UiHint. Open set — the dashboard ignores unknown values and falls back to the default renderer for the property's schema kind.

Fields/Values:

  • StatusIndicator — Auto-emitted when StatusIndicator is true. Do not set directly; use the boolean field. Tile renders as a status pill / badge.
  • Trigger — Renders a writable bool property as a button instead of a toggle. Click commits true; the property's getter should always return false. Bridge for operator-triggered actions until a first-class action primitive ships. Forbidden with [Persistent].
  • Sparkline — Inline sparkline rendering for numeric arrays or numeric measuring points.
  • Multiline — Renders a writable string property as a multi-line textarea.
  • Json — Renders a writable string property as a code editor with JSON syntax highlighting. Implies multi-line.
  • Slider — Renders a writable numeric property with bounded Minimum AND Maximum as a slider control.

Vion.Dale.Sdk.Emission ​

IChangeThreshold ​

Decides whether a candidate value differs from the last-emitted value by at least a configured threshold. Implementations are pure and stateless; the threshold string is the raw MinChange token from the attribute (e.g. "2", "0.5", "250ms").

Methods:

  • Exceeds(0@, 0@, string) — Returns when differs from by at least the parsed .

Vion.Dale.Sdk.Abstractions ​

DevelopmentOnlyHandlerAttribute ​

Marks a ServiceProviderHandlerBase as development surface, so a production host can leave it out of handler registration by reading the type alone. Declare it on the handler of a provider face — the contract a simulator binds to stand in for equipment that is not there. Such a handler has no hardware behind it: it subscribes to no MQTT topic and moves no message, and a host that stands it up anyway registers an empty routing key, which is a live hazard wherever handlers are matched by prefix or substring. The development host discovers provider handlers by their ScenarioWireAttribute as before; this marker is what a production host filters on. It is a declaration about the handler and carries no runtime behaviour. It deliberately does not depend on the contract type the handler services — no such link exists at the type level — so declare it beside the contract type's own [ServiceProviderContractType(…, DevelopmentOnly = true)], and keep the two in step. [DevelopmentOnlyHandler] [ScenarioWire(Inbound = typeof(SetDigitalOutput), Outbound = typeof(DigitalOutputChanged))] public class DigitalOutputProviderHandler : ServiceProviderHandlerBase


ScenarioWireAttribute ​

Marks a ServiceProviderHandlerBase with the wire struct its contract carries, so the DevHost can drive (serviceProviderSet) and assert (serviceProviderExpect) that contract from a committed scenario through the generic service-provider handler. Scenario-testing / DevHost only. The production runtime reaches hardware over MQTT and never reads this — it carries no runtime behaviour. It is a declarative marker the DevHost discovers (the same assembly scan the runtime uses to find handlers) to build the contract message from a JSON scenario value. Declare the inbound struct the service provider delivers (SP → block, driven by a scenario), and/or the outbound command struct the block writes (block → SP, asserted by a scenario). Declaring BOTH makes one contract identifier drivable and assertable in the same scenario — a bidirectional contract, or an output whose provider confirms back what it applied. A handler carries exactly ONE of these; the attribute is not stackable. An input — a digital/analog input, a PPC demand: [ScenarioWire(Inbound = typeof(DigitalInputChanged))] An output that is confirmed back: [ScenarioWire(Inbound = typeof(DigitalOutputChanged), Outbound = typeof(SetDigitalOutput))] Bidirectional — one contract identifier, both directions: [ScenarioWire(Inbound = typeof(PpcDemandReceived), Outbound = typeof(PpcMeasurementSet))] A contract with no declared inbound cannot be driven; one with no declared outbound has nothing to assert.

Properties:

  • Inbound — The wire struct a scenario DRIVES into the block (an input contract); a scenario value maps to it.
  • Outbound — The command struct the block writes and a scenario ASSERTS (an output contract).

ServiceProviderHandlerBase ​

Base class for all service provider handler actors (DI, DO, AI, AO, Modbus, custom). Owns the actor lifecycle (registration, contract linking) and provides helpers for common operations.

is implemented explicitly so subclasses cannot override it. Messages are routed to: — for MQTT messages from the broker — for contract messages from logic blocks Subclasses can schedule delayed callbacks using , which are dispatched transparently by the base class (same pattern as LogicBlockBase).

Properties:

  • ActorContext — The current actor context. Set on each message dispatch. Available for use in callbacks.
  • Logger — Logger available to subclasses.
  • ContractLogicBlockActorReferences — The contract-to-logic-block actor mappings, set during the linking phase.

Methods:

  • Constructor — Initializes a new instance of the handler.
  • Vion#Dale#Sdk#Abstractions#IActorReceiver#HandleMessageAsync(object, IActorContext) — (no description)
  • GetMqttRegistration — Returns the MQTT routing key and action path suffixes for this handler. The base class prepends the service provider wildcard prefix (/+/+/+) to each action path to form the full subscription topics.
  • HandleMqttMessage(ServiceProviderMqttMessage) — Handles an MQTT message received from the broker. The message contains the pre-parsed ContractId and CorrelationId. Use ActorContext for actor communication.
  • HandleContractMessage(IContractMessage) — Handles a contract message from a logic block (e.g., set commands, read/write requests). Use ActorContext for actor communication.
  • OnContractActorsLinked(LinkLogicBlockContractActors) — Called after contract actor references are linked. Override to perform additional setup (e.g., building per-contract lookup dictionaries).
  • InvokeSynchronizedAfter(Action, TimeSpan) — Schedules an action to be invoked after a delay, dispatched through the actor's message loop. Same pattern as LogicBlockBase.InvokeSynchronizedAfter.
  • Publish(string, byte[], string, string, Guid?, string, bool) — Publishes an MQTT message with the standard protocol conventions (correlation ID, schema user property, content type). Returns the correlation ID used.
    • topic: The full MQTT topic to publish to.
    • payload: The serialized payload bytes.
    • schemaName: The schema name set as an MQTT user property (identifies the payload type).
    • contentType: The MQTT content type, such as MessageMimeTypes.Json or MessageMimeTypes.FlatBuffer.
    • correlationId: An existing correlation ID to use. If null, a new one is generated.
    • responseTopic: Optional response topic for request-response patterns.
    • retain: Whether the message should be retained by the broker.
  • Publish(string, byte[], string, string, DateTimeOffset, Guid?, string, bool) — Publishes an MQTT message as does, with a deadline from which a host that honours it makes no further attempt at it.
    • topic: The full MQTT topic to publish to.
    • payload: The serialized payload bytes.
    • schemaName: The schema name set as an MQTT user property (identifies the payload type).
    • contentType: The MQTT content type, such as MessageMimeTypes.Json or MessageMimeTypes.FlatBuffer.
    • deadline: The instant from which the message is of no use to its receiver.
    • correlationId: An existing correlation ID to use. If null, a new one is generated.
    • responseTopic: Optional response topic for request-response patterns.
    • retain: Whether the message should be retained by the broker.
  • PublishJson<T>(string, T, string, Guid?, string, bool) — Serializes the payload as JSON and publishes it with application/json content type.
    • topic: The full MQTT topic to publish to.
    • payload: The value to serialize as the message body.
    • schemaName: The schema name set as an MQTT user property (identifies the payload type).
    • correlationId: An existing correlation ID to use. If null, a new one is generated.
    • responseTopic: Optional response topic for request-response patterns.
    • retain: Whether the message should be retained by the broker.
  • PublishJson<T>(string, T, string, DateTimeOffset, Guid?, string, bool) — Serializes the payload as JSON and publishes it with application/json content type, with a deadline from which a host that honours it makes no further attempt at it.
    • topic: The full MQTT topic to publish to.
    • payload: The value to serialize as the message body.
    • schemaName: The schema name set as an MQTT user property (identifies the payload type).
    • deadline: The instant from which the message is of no use to its receiver.
    • correlationId: An existing correlation ID to use. If null, a new one is generated.
    • responseTopic: Optional response topic for request-response patterns.
    • retain: Whether the message should be retained by the broker.
  • PublishJson<T>(string, T, JsonTypeInfo<T>, string, Guid?, string, bool) — Serializes the payload through the supplied source-generated type metadata — such as HwJsonContext.Default.SetDoPayload, which carries the naming policy and converters in place of DefaultOptions — and publishes it with application/json content type.
    • topic: The full MQTT topic to publish to.
    • payload: The value to serialize as the message body.
    • typeInfo: The source-generated metadata is serialized through.
    • schemaName: The schema name set as an MQTT user property (identifies the payload type).
    • correlationId: An existing correlation ID to use. If null, a new one is generated.
    • responseTopic: Optional response topic for request-response patterns.
    • retain: Whether the message should be retained by the broker.
  • PublishJson<T>(string, T, JsonTypeInfo<T>, string, DateTimeOffset, Guid?, string, bool) — Serializes the payload through the supplied source-generated type metadata and publishes it with application/json content type, with a deadline from which a host that honours it makes no further attempt at it.
    • topic: The full MQTT topic to publish to.
    • payload: The value to serialize as the message body.
    • typeInfo: The source-generated metadata is serialized through.
    • schemaName: The schema name set as an MQTT user property (identifies the payload type).
    • deadline: The instant from which the message is of no use to its receiver.
    • correlationId: An existing correlation ID to use. If null, a new one is generated.
    • responseTopic: Optional response topic for request-response patterns.
    • retain: Whether the message should be retained by the broker.
  • ForwardToLogicBlocks<T>(ServiceProviderContractId, T) — Forwards a state-changed message to all logic block actors mapped to the given service provider contract.
  • FindMappedServiceProviderContracts(LogicBlockContractId) — Finds all service provider contracts that a logic block contract is mapped to. Used by output handlers to reverse-lookup the target when a logic block sends a set command.

Fields/Values:

  • ServiceProviderTopicPrefix — The wildcard prefix prepended to all subscription action paths. Matches the /{serviceProviderIdentifier}/{service}/{contract} routing prefix in the topic structure. Centralized here to enforce the convention and enable programmatic broker ACL configuration.

ServiceProviderMqttMessage ​

A parsed MQTT message for service provider handlers. Provides pre-extracted routing information and typed payload access, hiding the internal MqttMessageReceived type.

Properties:

  • ContractId — The service provider contract this message targets, parsed from the topic.
  • CorrelationId — The correlation ID from the MQTT message headers. Empty if no correlation data was present or the format was not recognized.
  • Topic — The full MQTT topic of the received message.
  • ResponseTopic — The MQTT 5.0 response topic, if present. Used in request-response patterns.
  • Schema — The payload type's schema name as the publisher labelled it, or null when unlabelled.
  • RawPayload — The raw payload bytes for custom deserialization.

Methods:

  • GetJsonPayload<T>(JsonSerializerOptions) — Deserializes the payload as JSON.
    • serializerOptions: Optional JSON serializer options. If null, DefaultOptions are used.
  • GetJsonPayload<T>(JsonTypeInfo<T>) — Deserializes the payload as JSON through the supplied type metadata.
    • typeInfo: The source-generated metadata for , such as HwJsonContext.Default.DiStatePayload. It carries the naming policy and converters, so DefaultOptions is not consulted.
  • GetFlatBufferPayload — Returns the payload as a FlatBuffer ByteBuffer for deserialization.
  • GetPayloadBytes — Returns the raw payload as a byte array. Use RawPayload to avoid the copy when possible.

Vion.Dale.Sdk.Configuration.Contract ​

LogicBlockContractBase ​

Base class for all logic block contract implementations (e.g., DigitalInput, DigitalOutput, ModbusRtu). A contract represents a binding between a logic block and a service provider endpoint. It receives state updates from the service provider handler and can send commands back to it.

Subclasses must: Set ContractHandlerActorName to the name of the handler actor (e.g., nameof(DigitalInputHandler)) Implement to dispatch incoming messages (state changes, responses) Subclasses that send commands to the handler (output contracts, request-response contracts) use to send messages to the linked handler actor.

Properties:

  • LogicBlockContractId — The identity of this contract within its owning logic block. Set during initialization.
  • ContractHandlerActorName — The name of the handler actor this contract communicates with. Must match the actor name registered in the runtime (e.g., nameof(DigitalInputHandler)).
  • Identifier — The contract identifier as declared on the logic block property (e.g., "di0").
  • MetaData — Metadata for this contract (default name, tags, cardinality, sharing). Populated from attributes during introspection.

Methods:

  • Constructor — Initializes a new instance of the contract.
    • identifier: The contract identifier (matches the property name on the logic block).
    • actorContext: The actor context used to send messages to the handler actor.
  • SetLogicBlockContractId(LogicBlockContractId) — Sets the full logic block contract identity. Called by the runtime during initialization to associate this contract with its owning logic block.
    • logicBlockContractId: The full contract identity including the logic block ID.
  • SetLinkedContractHandler(IActorReference) — Links this contract to its handler actor. Called by the runtime during initialization.
    • contractHandlerActorRef: A reference to the handler actor.
  • HandleContractMessage(IContractMessage) — Dispatches an incoming contract message (e.g., state change, response) to the appropriate handler logic. Called by the runtime when a message from the handler actor targets this contract.
    • contractMessage: The incoming contract message.
  • SendToContractHandler<T>(T) — Sends a message to the linked handler actor (e.g., a set command or a read request). If the contract has no mapping (no linked logic block), the message is silently dropped.
    • message: The message to send.

Vion.Dale.Sdk.Mqtt ​

RegistrationSecret ​

Generates and persists registration secrets for service providers. The secret is used as an MQTT topic segment during the registration handshake.

Methods:

  • Generate — Generates a new registration secret suitable for use as an MQTT topic segment. Returns a 32-character lowercase hex string (UUID v4 without hyphens).
  • LoadOrCreate(string) — Loads an existing secret from , or generates a new one and persists it. Subsequent calls with the same path return the same secret.
    • filePath: The file path to read from or write to.