mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 11:45:43 +08:00
Refactor namings of serializers etc.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Packets.Properties;
|
||||
using MQTTnet.Protocol;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
/// <summary>
|
||||
/// Added in MQTTv5.0.0.
|
||||
/// </summary>
|
||||
public class MqttAuthPacket : MqttBasePacket
|
||||
{
|
||||
public MqttAuthenticateReasonCode ReasonCode { get; set; }
|
||||
|
||||
public List<IProperty> Properties { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,15 @@
|
||||
namespace MQTTnet.Packets
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Packets.Properties;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
public class MqttBasePublishPacket : MqttBasePacket, IMqttPacketWithIdentifier
|
||||
{
|
||||
public ushort? PacketIdentifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Added in MQTTv5.0.0.
|
||||
/// </summary>
|
||||
public List<IProperty> Properties { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,53 @@
|
||||
using MQTTnet.Protocol;
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Protocol;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
public class MqttConnAckPacket : MqttBasePacket
|
||||
{
|
||||
public MqttConnectReturnCode ConnectReturnCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Added in MQTTv3.1.1.
|
||||
/// </summary>
|
||||
public bool IsSessionPresent { get; set; }
|
||||
|
||||
public MqttConnectReturnCode ConnectReturnCode { get; set; }
|
||||
#region Added in MQTTv5
|
||||
|
||||
public uint? SessionExpiryIntervalProperty { get; set; }
|
||||
|
||||
// TODO: Add enum
|
||||
public byte? ReceiveMaximumProperty { get; set; }
|
||||
|
||||
public bool? RetainAvailableProperty { get; set; }
|
||||
|
||||
public uint? MaximumPacketSizeProperty { get; set; }
|
||||
|
||||
public string AssignedClientIdentifierProperty { get; set; }
|
||||
|
||||
public ushort? TopicAliasMaximumProperty { get; set; }
|
||||
|
||||
public string ReasonStringProperty { get; set; }
|
||||
|
||||
public List<MqttUserProperty> UserPropertiesProperty { get; set; }
|
||||
|
||||
public bool? WildcardSubscriptionAvailableProperty { get; set; }
|
||||
|
||||
public bool? SubscriptionIdentifiersAvailableProperty { get; set; }
|
||||
|
||||
public bool? SharedSubscriptionAvailableProperty { get; set; }
|
||||
|
||||
public ushort? ServerKeepAliveProperty { get; set; }
|
||||
|
||||
public string ResponseInformationProperty { get; set; }
|
||||
|
||||
public string ServerReferenceProperty { get; set; }
|
||||
|
||||
public string AuthenticationMethodProperty { get; set; }
|
||||
|
||||
public byte[] AuthenticationDataProperty { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Packets.Properties;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
@@ -24,7 +23,29 @@ namespace MQTTnet.Packets
|
||||
|
||||
public MqttApplicationMessage WillMessage { get; set; }
|
||||
|
||||
public List<IProperty> Properties { get; set; }
|
||||
#region Added in MQTTv5
|
||||
|
||||
public uint? WillDelayIntervalProperty { get; set; }
|
||||
|
||||
public uint? SessionExpiryIntervalProperty { get; set; }
|
||||
|
||||
public string AuthenticationMethodProperty { get; set; }
|
||||
|
||||
public byte[] AuthenticationDataProperty { get; set; }
|
||||
|
||||
public bool? RequestProblemInformationProperty { get; set; }
|
||||
|
||||
public bool? RequestResponseInformationProperty { get; set; }
|
||||
|
||||
public ushort? ReceiveMaximumProperty { get; set; }
|
||||
|
||||
public ushort? TopicAliasMaximumProperty { get; set; }
|
||||
|
||||
public uint? MaximumPacketSizeProperty { get; set; }
|
||||
|
||||
public List<MqttUserProperty> UserPropertiesProperty { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
namespace MQTTnet.Packets
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Packets.Properties;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
public class MqttDisconnectPacket : MqttBasePacket
|
||||
{
|
||||
/// <summary>
|
||||
/// Added in MQTTv5.0.0.
|
||||
/// </summary>
|
||||
public List<IProperty> Properties { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Disconnect";
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using MQTTnet.Protocol;
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Packets.Properties;
|
||||
using MQTTnet.Protocol;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
@@ -14,6 +16,11 @@ namespace MQTTnet.Packets
|
||||
|
||||
public byte[] Payload { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Added in MQTTv5.0.0.
|
||||
/// </summary>
|
||||
public List<IProperty> Properties { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Publish: [Topic=" + Topic + "]" +
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MQTTnet.Packets.Properties;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
@@ -9,6 +10,11 @@ namespace MQTTnet.Packets
|
||||
|
||||
public IList<TopicFilter> TopicFilters { get; set; } = new List<TopicFilter>();
|
||||
|
||||
/// <summary>
|
||||
/// Added in MQTTv5.0.0.
|
||||
/// </summary>
|
||||
public List<IProperty> Properties { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var topicFiltersText = string.Join(",", TopicFilters.Select(f => f.Topic + "@" + f.QualityOfServiceLevel));
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
public class MqttUserProperty
|
||||
{
|
||||
public MqttUserProperty(string name, string value)
|
||||
{
|
||||
Name = name ?? throw new ArgumentNullException(nameof(name));
|
||||
Value = value ?? throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string Value { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
namespace MQTTnet.Packets.Properties
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class AssignedClientIdentifierProperty : StringProperty
|
||||
{
|
||||
public AssignedClientIdentifierProperty(string value)
|
||||
: base((byte)PropertyID.AssignedClientIdentifer, value)
|
||||
: base((byte)MqttMessagePropertyID.AssignedClientIdentifer, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class AuthenticationDataProperty : BinaryDataProperty
|
||||
{
|
||||
public AuthenticationDataProperty(ArraySegment<byte> data)
|
||||
: base((byte)PropertyID.AuthenticationData, data)
|
||||
: base((byte)MqttMessagePropertyID.AuthenticationData, data)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
namespace MQTTnet.Packets.Properties
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class AuthenticationMethodProperty : StringProperty
|
||||
{
|
||||
public AuthenticationMethodProperty(string value)
|
||||
: base((byte)PropertyID.AuthenticationMethod, value)
|
||||
: base((byte)MqttMessagePropertyID.AuthenticationMethod, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using MQTTnet.Serializer;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
public class BinaryDataProperty : IProperty
|
||||
{
|
||||
@@ -24,6 +24,7 @@ namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
writer.Write(Id);
|
||||
writer.Write((ushort)Data.Count);
|
||||
writer.Write(Data);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using MQTTnet.Serializer;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
public class ByteProperty : IProperty
|
||||
{
|
||||
@@ -18,7 +18,8 @@ namespace MQTTnet.Packets.Properties
|
||||
public void WriteTo(MqttPacketWriter writer)
|
||||
{
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
|
||||
writer.Write(Id);
|
||||
writer.Write(Value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using MQTTnet.Serializer;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
@@ -20,6 +20,7 @@ namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
// TODO: Check if order must be reversed like for ushort.
|
||||
writer.Write(Id);
|
||||
var bytes = BitConverter.GetBytes(Value);
|
||||
writer.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using MQTTnet.Serializer;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
public class StringProperty : IProperty
|
||||
{
|
||||
@@ -19,6 +19,7 @@ namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
writer.Write(Id);
|
||||
writer.WriteWithLengthPrefix(Value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using MQTTnet.Serializer;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
@@ -19,6 +19,7 @@ namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
writer.Write(Id);
|
||||
writer.Write(Value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using MQTTnet.Serializer;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
@@ -20,6 +20,8 @@ namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
var buffer = MqttPacketWriter.EncodeVariableByteInteger(Value);
|
||||
|
||||
writer.Write(Id);
|
||||
writer.Write(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
namespace MQTTnet.Packets.Properties
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ContentTypeProperty : StringProperty
|
||||
{
|
||||
public ContentTypeProperty(string value)
|
||||
: base((byte)PropertyID.ContentType, value)
|
||||
: base((byte)MqttMessagePropertyID.ContentType, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class CorrelationDataProperty : BinaryDataProperty
|
||||
{
|
||||
public CorrelationDataProperty(ArraySegment<byte> data)
|
||||
: base((byte)PropertyID.CorrelationData, data)
|
||||
: base((byte)MqttMessagePropertyID.CorrelationData, data)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MQTTnet.Serializer;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class MaximumPacketSizeProperty : FourByteIntegerValue
|
||||
{
|
||||
public MaximumPacketSizeProperty(uint value)
|
||||
: base((byte)MqttMessagePropertyID.MaximumPacketSize, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class MaximumQoSProperty : ByteProperty
|
||||
{
|
||||
public MaximumQoSProperty(byte value)
|
||||
: base((byte)MqttMessagePropertyID.MaximumQoS, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MQTTnet.Packets.Properties
|
||||
public class MessageExpiryIntervalProperty : FourByteIntegerValue
|
||||
{
|
||||
public MessageExpiryIntervalProperty(uint value)
|
||||
: base((byte)PropertyID.MessageExpiryInterval, value)
|
||||
: base((byte)MqttMessagePropertyID.MessageExpiryInterval, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public enum PropertyID
|
||||
public enum MqttMessagePropertyID
|
||||
{
|
||||
PayloadFormatIndicator = 1,
|
||||
MessageExpiryInterval = 2,
|
||||
@@ -1,9 +1,11 @@
|
||||
namespace MQTTnet.Packets.Properties
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class PayloadFormatIndicatorProperty : ByteProperty
|
||||
{
|
||||
public PayloadFormatIndicatorProperty(byte value)
|
||||
: base((byte)PropertyID.PayloadFormatIndicator, value)
|
||||
: base((byte)MqttMessagePropertyID.PayloadFormatIndicator, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ReasonStringProperty : StringProperty
|
||||
{
|
||||
public ReasonStringProperty(string value)
|
||||
: base((byte)MqttMessagePropertyID.ReasonString, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ReceiveMaximumProperty : TwoByteIntegerProperty
|
||||
{
|
||||
public ReceiveMaximumProperty(ushort value)
|
||||
: base((byte)MqttMessagePropertyID.ReceiveMaximum, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
namespace MQTTnet.Packets.Properties
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class RequestProblemInformationProperty : ByteProperty
|
||||
{
|
||||
public RequestProblemInformationProperty(byte value)
|
||||
: base((byte)PropertyID.RequestProblemInformation, value)
|
||||
: base((byte)MqttMessagePropertyID.RequestProblemInformation, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
namespace MQTTnet.Packets.Properties
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class RequestResponseInformationProperty : ByteProperty
|
||||
{
|
||||
public RequestResponseInformationProperty(byte value)
|
||||
: base((byte)PropertyID.RequestResponseInformation, value)
|
||||
: base((byte)MqttMessagePropertyID.RequestResponseInformation, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ResponseInformationProperty : StringProperty
|
||||
{
|
||||
public ResponseInformationProperty(string value)
|
||||
: base((byte)MqttMessagePropertyID.ResponseInformation, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
namespace MQTTnet.Packets.Properties
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ResponseTopicProperty : StringProperty
|
||||
{
|
||||
public ResponseTopicProperty(string value)
|
||||
: base((byte)PropertyID.ResponseTopic, value)
|
||||
: base((byte)MqttMessagePropertyID.ResponseTopic, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class RetainAvailableProperty : ByteProperty
|
||||
{
|
||||
public RetainAvailableProperty(byte value)
|
||||
: base((byte)MqttMessagePropertyID.RetainAvailable, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MQTTnet.Packets.Properties
|
||||
public class ServerKeepAliveProperty : TwoByteIntegerProperty
|
||||
{
|
||||
public ServerKeepAliveProperty(ushort value)
|
||||
: base((byte)PropertyID.ServerKeepAlive, value)
|
||||
: base((byte)MqttMessagePropertyID.ServerKeepAlive, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ServerReferenceProperty : StringProperty
|
||||
{
|
||||
public ServerReferenceProperty(string value)
|
||||
: base((byte)MqttMessagePropertyID.ServerReference, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MQTTnet.Packets.Properties
|
||||
public class SessionExpiryIntervalProperty : FourByteIntegerValue
|
||||
{
|
||||
public SessionExpiryIntervalProperty(uint value)
|
||||
: base((byte)PropertyID.SessionExpiryInterval, value)
|
||||
: base((byte)MqttMessagePropertyID.SessionExpiryInterval, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class SharedSubscriptionAvailableProperty : ByteProperty
|
||||
{
|
||||
public SharedSubscriptionAvailableProperty(byte value)
|
||||
: base((byte)MqttMessagePropertyID.SharedSubscriptionAvailable, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class SubscriptionIdentifierAvailable : ByteProperty
|
||||
{
|
||||
public SubscriptionIdentifierAvailable(byte value)
|
||||
: base((byte)MqttMessagePropertyID.SubscriptionIdentifierAvailable, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MQTTnet.Packets.Properties
|
||||
public class SubscriptionIdentifierProperty : VariableByteIntegerProperty
|
||||
{
|
||||
public SubscriptionIdentifierProperty(uint value)
|
||||
: base((byte)PropertyID.SubscriptionIdentifier, value)
|
||||
: base((byte)MqttMessagePropertyID.SubscriptionIdentifier, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class TopicAliasMaximumProperty : TwoByteIntegerProperty
|
||||
{
|
||||
public TopicAliasMaximumProperty(ushort value)
|
||||
: base((byte)MqttMessagePropertyID.TopicAliasMaximum, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class TopicAliasProperty : TwoByteIntegerProperty
|
||||
{
|
||||
public TopicAliasProperty(ushort value)
|
||||
: base((byte)MqttMessagePropertyID.TopicAlias, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class UserPropertyProperty : IProperty
|
||||
{
|
||||
public UserPropertyProperty(string name, string value)
|
||||
{
|
||||
Name = name ?? throw new ArgumentNullException(nameof(name));
|
||||
Value = value ?? throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
public byte Id { get; } = (byte)MqttMessagePropertyID.UserProperty;
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string Value { get; }
|
||||
|
||||
public void WriteTo(MqttPacketWriter writer)
|
||||
{
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
writer.Write(Id);
|
||||
writer.WriteWithLengthPrefix(Name);
|
||||
writer.WriteWithLengthPrefix(Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class WildcardSubscriptionAvailableProperty : ByteProperty
|
||||
{
|
||||
public WildcardSubscriptionAvailableProperty(byte value)
|
||||
: base((byte)MqttMessagePropertyID.WildcardSubscriptionAvailable, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MQTTnet.Packets.Properties
|
||||
public class WillDelayIntervalProperty : FourByteIntegerValue
|
||||
{
|
||||
public WillDelayIntervalProperty(uint value)
|
||||
: base((byte)PropertyID.WillDelayInterval, value)
|
||||
: base((byte)MqttMessagePropertyID.WillDelayInterval, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user