Namespace ProtoTest.Devices
Classes
- Crc16Modbus
The Modbus RTU CRC-16 (polynomial 0xA001, initial 0xFFFF), appended low byte first.
- DeviceBinaryMessageAttribute
Declares a binary message: fixed-size fields after optional leading bytes, such as a slave address and a function code. Numbers are big-endian unless BigEndian is false.
- DeviceChecksumAttribute
The checksum a message carries, as DeviceChecksumAttribute<TChecksum> declares it.
- DeviceChecksumAttribute<TChecksum>
Declares the message's checksum: an IDeviceMessageChecksum for a text message, such as NmeaChecksum, or an IDeviceBinaryChecksum for a binary one, such as Crc16Modbus.
- DeviceCoverageCollector
Coverage of a device protocol: every message kind the suite asserted counts as covered, and every kind a registered IProtoDeviceProtocol declares but no test asserted is reported as a gap - the OpenAPI treatment for a device protocol.
- DeviceEndpoint
Where a device lives: its id, the address its transport connects to, and the per-client settings the registration filled for it (device model, credentials, transport keys). A transport reads the keys it owns through Setting(string); a value that must not reach the trace - a credential - belongs here rather than in the address.
- DeviceFieldAttribute
How one field is written and read. On a positional record the field order is the parameter order; on a class with settable properties, Order sets it.
- DeviceFormatAttribute
The formatter a field uses, as DeviceFormatAttribute<TFormatter> declares it.
- DeviceFormatAttribute<TFormatter>
Declares how a field converts, for values a format string cannot express: a scaled number, hex, Unix time, or a device's own encoding.
TFormatterimplements IDeviceFieldFormatter<T> for a text message or IDeviceBinaryFieldFormatter<T> for a binary one, whereTis the field's type.
- DeviceFormatters
Formatters for values devices encode in their own way. Use one with
[DeviceFormat<DeviceFormatters.Hundredths>], or derive from a base here for another scale.
- DeviceFormatters.Bcd
A whole number in packed BCD, two digits per byte, most significant first: with 3 bytes,
12345is01 23 45. Byte order does not apply.
- DeviceFormatters.BinaryUnixSeconds
A moment as a 32-bit unsigned count of seconds since 1970-01-01 UTC.
- DeviceFormatters.Hex
A whole number in uppercase hexadecimal:
255isFF.
- DeviceFormatters.Hundredths
Two decimal places as a whole number:
12.50is1250.
- DeviceFormatters.ScaledDecimal
A decimal sent as a whole number scaled by 10^decimals: with 2,
12.50is1250.
- DeviceFormatters.ScaledInt16
A decimal stored as a signed 16-bit register scaled by 10^decimals, as many Modbus devices do.
- DeviceFormatters.ScaledInt32
A decimal stored as a signed 32-bit value scaled by 10^decimals.
- DeviceFormatters.Tenths
One decimal place as a whole number:
12.5is125.
- DeviceFormatters.Thousandths
Three decimal places as a whole number:
12.500is12500.
- DeviceFormatters.UnixMilliseconds
A moment as whole milliseconds since 1970-01-01 UTC.
- DeviceFormatters.UnixSeconds
A moment as whole seconds since 1970-01-01 UTC.
- DeviceFramers
The framers most device protocols need. A protocol with its own envelope implements IDeviceFramer.
- DeviceMessage
Writes a message type to what the device sends and reads it back, so a test builds
new MeterReading("M-1", 12.5m)instead of concatenating"$MTR,M-1,12.50*4B". A type with DeviceBinaryMessageAttribute is a fixed-layout byte block; any other type is a line of text. Text values use the invariant culture.
- DeviceMessageAttribute
Declares a text message: an optional leading token and the field separator. Without the attribute a message has no prefix and separates its fields with commas. A checksum goes in DeviceChecksumAttribute<TChecksum>.
- DeviceMessageFormatException
A data string or byte block that does not match its message type: the prefix, a field, the length or the checksum.
- DeviceMessageProtocol
A protocol catalog built from message types: each type is one message kind, named after the type. A matched
ExpectMessageAsynccounts toward its kind, and DeviceCoverageCollector reports the types no test expected.
- DeviceProtocolEntry
One message kind a device protocol supports.
- NmeaChecksum
The NMEA 0183 checksum:
*and two uppercase hex digits, the XOR of every character after a leading$or!.
- ProtoDevice
One typed device a suite talks to - a charger, a meter, a sensor. Derive from it, add the domain methods your scenario reads (
BootAsync,PlugInAsync), and compose the protected protocol primitives; the instance is created per test byProto.Context.Devices().For<TDevice>("id")and released with the test.
- ProtoDeviceAddress
Builds the address resolvers device clients are declared with: a template, or an application's address plus a path.
- ProtoDeviceBuilder
Configures the device clients a suite talks to, mirroring the REST and GraphQL builders: a named client is declared once with how its addresses resolve, and the typed devices that use it hang off the client.
- ProtoDeviceClient
The devices of one named client, for the current test. For<TDevice>(string) creates one typed instance per (client, type, id) and test, resolves its address, attaches it to the client's transport and releases it with the test.
- ProtoDeviceClientBuilder
The typed devices and protocol catalogs of one device client.
- ProtoDeviceConnect
Runs one device transport connect under its configured timeout - the rule every shipped device transport shares: the attempt token is the timeout authority, so any failure that surfaces after it fires - an OperationCanceledException or a transport that aborts the connect another way - is reported as a TimeoutException naming the target. A caller's own cancellation is never reclassified, and the caller keeps ownership of the connection it created.
- ProtoDeviceDiagnostics
The names ProtoTest.Devices records under.
- ProtoExecutionContextExtensions
Reaches the current test's device clients.
- ProtoHostBuilderExtensions
Registers the device clients a suite talks to, on the host or under an application.
- RequiresDeviceAttribute<TDevice>
Skips a test when the environment does not provide a device of this type.
- StreamDeviceConnection
A device connection over a byte stream, framed by an IDeviceFramer. The TCP and serial transports use it, and a hand-written transport over any other stream (a Bluetooth socket, a USB bridge) can wrap its stream the same way.
- Sum8Checksum
A one-byte sum of every body byte, modulo 256.
- Xor8Checksum
A one-byte XOR of every body byte.
Structs
- DeviceFrame
One device frame, as bytes plus a media type. OCPP is text JSON, MQTT payloads are binary, so bytes are the neutral unit; the text helpers cover the common protocol.
Interfaces
- IDeviceBinaryChecksum
A checksum a binary message carries after its body, such as Modbus RTU's CRC-16.
- IDeviceBinaryFieldFormatter<T>
Converts one binary field of type
Tto and from a fixed number of bytes.
- IDeviceFieldFormatter<T>
Converts one text field of type
Tto and from its text in the message.
- IDeviceFramer
Cuts a byte stream into device frames and writes frames back. A stream transport (TCP, serial) has no message boundaries of its own, so the framer is the one piece of protocol knowledge it carries; what a frame means stays in the device class.
- IDeviceMessageChecksum
A checksum a text message carries after its body, such as NMEA's
*hh.
- IProtoDeviceConnection
One open connection to a device; frames in, frames out.
- IProtoDeviceListener
A device connection that waits for the device to connect to the test, as a listening TCP transport does. ListenAddress is the address to hand the system under test.
- IProtoDeviceProtocol
What a transport's messages mean, for tracing and coverage: the protocol's message kinds and how a frame is classified to one of them. The WebSocket backend ships the OCPP subset this way; the coverage collector reports every entry covered or not, so an untested message kind shows as a gap.
- IProtoDeviceTransport
A protocol backend: the WebSocket implementation lives in its own package, and a test transport can stand in for it. A transport only moves frames; the device classes above it own the conversation.
- IProtoInProcessDeviceTransport
A transport for endpoints hosted inside the test process. A client prefers it over its named transport whenever it applies, so one client registration works in-process and against an address without the suite branching.