merge: MQTT browser+contracts review findings resolved (Driver.Mqtt.Browser-002..-005, Driver.Mqtt.Contracts-004..-007)
This commit is contained in:
@@ -65,6 +65,14 @@ public sealed class MqttSubscriptionManager
|
||||
/// </summary>
|
||||
public const int DefaultMaxPayloadBytes = 1024 * 1024;
|
||||
|
||||
/// <summary>
|
||||
/// Subscription QoS applied when neither the tag nor the driver's <c>Plain</c> section authored
|
||||
/// one. Mirrors <see cref="MqttPlainOptions.DefaultQos"/>' own default — duplicated rather than
|
||||
/// referenced because that value is an instance property, and this is the fallback for the case
|
||||
/// where the whole section is absent.
|
||||
/// </summary>
|
||||
public const int DefaultQos = 1;
|
||||
|
||||
// OPC UA status codes (values verified against Opc.Ua.StatusCodes, not recalled).
|
||||
private const uint StatusGood = 0x00000000u;
|
||||
|
||||
@@ -137,7 +145,13 @@ public sealed class MqttSubscriptionManager
|
||||
|
||||
MaxPayloadBytes = maxPayloadBytes > 0 ? maxPayloadBytes : DefaultMaxPayloadBytes;
|
||||
_mode = options.Mode;
|
||||
_defaultQos = options.Plain?.DefaultQos ?? 1;
|
||||
// Clamped here for the same reason MaxPayloadBytes is: this constructor is the single
|
||||
// enforcement point for the driver options the manager captures, and MQTT defines exactly three
|
||||
// QoS levels — an out-of-range value would otherwise ride into BuildFilters and out onto the
|
||||
// SUBSCRIBE verbatim. Clamp rather than fall back to the default, matching what
|
||||
// MqttDriverFormModel.Normalize already persists, so the authoring surface and the driver cannot
|
||||
// reach different answers for the same authored number.
|
||||
_defaultQos = Math.Clamp(options.Plain?.DefaultQos ?? DefaultQos, 0, 2);
|
||||
_driverId = driverId;
|
||||
_transport = transport;
|
||||
_logger = logger;
|
||||
|
||||
Reference in New Issue
Block a user