Class ProtoDeviceClientBuilder
The typed devices and protocol catalogs of one device client.
public sealed class ProtoDeviceClientBuilder
- Inheritance
-
ProtoDeviceClientBuilder
- Inherited Members
- Extension Methods
Properties
Name
The client's name, as the context accessor addresses it.
public string Name { get; }
Property Value
Methods
AddDevice<TDevice>()
Registers a typed device the client can create; no address or id is configured here.
public ProtoDeviceClientBuilder AddDevice<TDevice>() where TDevice : ProtoDevice
Returns
Type Parameters
TDevice
AddProtocol(IProtoDeviceProtocol)
Registers a protocol catalog instance, such as a DeviceMessageProtocol built from message types. Pass the same instance to DeviceCoverageCollector to report its gaps.
public ProtoDeviceClientBuilder AddProtocol(IProtoDeviceProtocol protocol)
Parameters
protocolIProtoDeviceProtocol
Returns
AddProtocol<TProtocol>()
Registers a protocol catalog so a matched expectation contributes its message kind and the coverage report can name the kinds no test asserted.
public ProtoDeviceClientBuilder AddProtocol<TProtocol>() where TProtocol : class, IProtoDeviceProtocol
Returns
Type Parameters
TProtocol
WithAddressKeys(params string[])
Declares the configuration keys the client's address can come from, so the client's device and
transport capabilities are declared only while a key can actually provide an address - a
configured value or a key a registered infrastructure piece declares, exactly like
AddCapabilityWhenProvided. A client whose address is provided in code (an explicit
address or a resolver) declares no keys and keeps its capabilities unconditional. A backend
whose address is configuration-driven calls this; the MQTT transport names
ProtoTest:Devices:Mqtt:Broker.
public ProtoDeviceClientBuilder WithAddressKeys(params string[] keys)
Parameters
keysstring[]
Returns
Exceptions
- ArgumentException
keysholds no non-blank key.
WithFramer(IDeviceFramer)
Declares how a stream transport (TCP, serial) cuts this client's bytes into frames, for example
DeviceFramers.Lines("\r\n"). Each device's endpoint carries it; message transports ignore it.
public ProtoDeviceClientBuilder WithFramer(IDeviceFramer framer)
Parameters
framerIDeviceFramer
Returns
WithSetting(string, string?)
Adds a transport setting every device of this client carries on its endpoint. The transport
names its own keys and reads them through Setting(string); {deviceId}
in a value is filled from the id passed to For, escaped like an address template, and a
repeated key replaces the earlier value. A credential belongs here rather than in the address,
which the trace records.
public ProtoDeviceClientBuilder WithSetting(string key, string? value)