Quellcode durchsuchen

Expose PacketIdentifier in PublishResult.

release/3.x.x
Christian Kratky vor 5 Jahren
Ursprung
Commit
d4c6fb44c9
4 geänderte Dateien mit 14 neuen und 9 gelöschten Zeilen
  1. +1
    -0
      Build/MQTTnet.nuspec
  2. +2
    -0
      Source/MQTTnet/Client/Publishing/MqttClientPublishResult.cs
  3. +1
    -0
      Source/MQTTnet/Formatter/V3/MqttV310DataConverter.cs
  4. +10
    -9
      Source/MQTTnet/Formatter/V5/MqttV500DataConverter.cs

+ 1
- 0
Build/MQTTnet.nuspec Datei anzeigen

@@ -25,6 +25,7 @@
* [Client] Fixed issues in QoS 2 handling which leads to message loss.
* [Client] Replaced all events with proper async compatible handlers (BREAKING CHANGE!).
* [Client] Added more configuration values to TCP endpoint options.
* [Client] Added used PacketIdentifier to publish result.
* [ManagedClient] Replaced all events with proper async compatible handlers (BREAKING CHANGE!).
* [ManagedClient] The log ID is now propagated to the internal client (thanks to @vbBerni).
* [ManagedClient] Added validation of topics before publishing.


+ 2
- 0
Source/MQTTnet/Client/Publishing/MqttClientPublishResult.cs Datei anzeigen

@@ -6,6 +6,8 @@ namespace MQTTnet.Client.Publishing
{
public class MqttClientPublishResult
{
public ushort? PacketIdentifier { get; set; }

public MqttClientPublishReasonCode ReasonCode { get; set; } = MqttClientPublishReasonCode.Success;

public string ReasonString { get; set; }


+ 1
- 0
Source/MQTTnet/Formatter/V3/MqttV310DataConverter.cs Datei anzeigen

@@ -199,6 +199,7 @@ namespace MQTTnet.Formatter.V3
{
return new MqttClientPublishResult
{
PacketIdentifier = pubAckPacket?.PacketIdentifier,
ReasonCode = MqttClientPublishReasonCode.Success
};
}


+ 10
- 9
Source/MQTTnet/Formatter/V5/MqttV500DataConverter.cs Datei anzeigen

@@ -189,21 +189,22 @@ namespace MQTTnet.Formatter.V5

public MqttClientPublishResult CreatePublishResult(MqttPubAckPacket pubAckPacket)
{
var reasonCode = MqttClientPublishReasonCode.Success;
if (pubAckPacket != null)
{
// QoS 0 has no response. So we treat it as a success always.
reasonCode = (MqttClientPublishReasonCode)pubAckPacket.ReasonCode;
}

var result = new MqttClientPublishResult
{
// Both enums share the same values.
ReasonCode = reasonCode,
ReasonCode = MqttClientPublishReasonCode.Success,
ReasonString = pubAckPacket?.Properties?.ReasonString,
UserProperties = pubAckPacket?.Properties?.UserProperties
};

if (pubAckPacket != null)
{
// QoS 0 has no response. So we treat it as a success always.
// Both enums have the same values. So it can be easily converted.
result.ReasonCode = (MqttClientPublishReasonCode)pubAckPacket.ReasonCode;

result.PacketIdentifier = pubAckPacket.PacketIdentifier;
}
return result;
}



Laden…
Abbrechen
Speichern