mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 11:45:43 +08:00
Refactor property definition for packets.
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Packets.Properties;
|
||||
using MQTTnet.Protocol;
|
||||
using MQTTnet.Protocol;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
@@ -10,7 +8,5 @@ namespace MQTTnet.Packets
|
||||
public class MqttAuthPacket : MqttBasePacket
|
||||
{
|
||||
public MqttAuthenticateReasonCode ReasonCode { get; set; }
|
||||
|
||||
public List<IProperty> Properties { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Packets.Properties;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
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,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Protocol;
|
||||
using MQTTnet.Protocol;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
@@ -14,38 +13,9 @@ namespace MQTTnet.Packets
|
||||
|
||||
#region Added in MQTTv5
|
||||
|
||||
public uint? SessionExpiryIntervalProperty { get; set; }
|
||||
public MqttConnectReasonCode? ConnectReasonCode { 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; }
|
||||
public MqttConnAckPacketProperties Properties { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
public class MqttConnAckPacketProperties
|
||||
{
|
||||
public uint? SessionExpiryInterval { get; set; }
|
||||
|
||||
// TODO: Add enum
|
||||
public ushort? ReceiveMaximum { get; set; }
|
||||
|
||||
public bool? RetainAvailable { get; set; }
|
||||
|
||||
public uint? MaximumPacketSize { get; set; }
|
||||
|
||||
public string AssignedClientIdentifier { get; set; }
|
||||
|
||||
public ushort? TopicAliasMaximum { get; set; }
|
||||
|
||||
public string ReasonString { get; set; }
|
||||
|
||||
public List<MqttUserProperty> UserProperties { get; set; }
|
||||
|
||||
public bool? WildcardSubscriptionAvailable { get; set; }
|
||||
|
||||
public bool? SubscriptionIdentifiersAvailable { get; set; }
|
||||
|
||||
public bool? SharedSubscriptionAvailable { get; set; }
|
||||
|
||||
public ushort? ServerKeepAlive { get; set; }
|
||||
|
||||
public string ResponseInformation { get; set; }
|
||||
|
||||
public string ServerReference { get; set; }
|
||||
|
||||
public string AuthenticationMethod { get; set; }
|
||||
|
||||
public byte[] AuthenticationData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
public class MqttConnectPacket : MqttBasePacket
|
||||
{
|
||||
public string ProtocolName { get; set; }
|
||||
|
||||
public byte ProtocolLevel { get; set; }
|
||||
public byte? ProtocolLevel { get; set; }
|
||||
|
||||
public string ClientId { get; set; }
|
||||
|
||||
@@ -25,25 +23,7 @@ namespace MQTTnet.Packets
|
||||
|
||||
#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; }
|
||||
public MqttConnectPacketProperties Properties { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
public class MqttConnectPacketProperties
|
||||
{
|
||||
public uint? WillDelayInterval { get; set; }
|
||||
|
||||
public uint? SessionExpiryInterval { get; set; }
|
||||
|
||||
public string AuthenticationMethod { get; set; }
|
||||
|
||||
public byte[] AuthenticationData { get; set; }
|
||||
|
||||
public bool? RequestProblemInformation { get; set; }
|
||||
|
||||
public bool? RequestResponseInformation { get; set; }
|
||||
|
||||
public ushort? ReceiveMaximum { get; set; }
|
||||
|
||||
public ushort? TopicAliasMaximum { get; set; }
|
||||
|
||||
public uint? MaximumPacketSize { get; set; }
|
||||
|
||||
public List<MqttUserProperty> UserProperties { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Packets.Properties;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
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,10 +1,20 @@
|
||||
namespace MQTTnet.Packets
|
||||
using MQTTnet.Protocol;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
public class MqttPubAckPacket : MqttBasePublishPacket
|
||||
{
|
||||
#region Added in MQTTv5
|
||||
|
||||
public MqttPubAckReasonCode? ConnectReasonCode { get; set; }
|
||||
|
||||
public MqttPubAckPacketProperties Properties { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"PubAck [PacketIdentifier={PacketIdentifier}]";
|
||||
return $"PubAck: [PacketIdentifier={PacketIdentifier}] [ConnectReasonCode={ConnectReasonCode}]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
public class MqttPubAckPacketProperties
|
||||
{
|
||||
public string ReasonString { get; set; }
|
||||
|
||||
public List<MqttUserProperty> UserProperties { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Packets.Properties;
|
||||
using MQTTnet.Protocol;
|
||||
using MQTTnet.Protocol;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
@@ -16,10 +14,11 @@ namespace MQTTnet.Packets
|
||||
|
||||
public byte[] Payload { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Added in MQTTv5.0.0.
|
||||
/// </summary>
|
||||
public List<IProperty> Properties { get; set; }
|
||||
#region Added in MQTTv5
|
||||
|
||||
public MqttPublishPacketProperties Properties { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
public class MqttPublishPacketProperties
|
||||
{
|
||||
public byte? PayloadFormatIndicator { get; set; }
|
||||
|
||||
public uint? MessageExpiryInterval { get; set; }
|
||||
|
||||
public ushort? TopicAlias { get; set; }
|
||||
|
||||
public string ResponseTopic { get; set; }
|
||||
|
||||
public byte[] CorrelationData { get; set; }
|
||||
|
||||
public List<MqttUserProperty> UserProperties { get; set; }
|
||||
|
||||
public uint? SubscriptionIdentifier { get; set; }
|
||||
|
||||
public string ContentType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MQTTnet.Packets.Properties;
|
||||
|
||||
namespace MQTTnet.Packets
|
||||
{
|
||||
@@ -10,11 +9,6 @@ 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));
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class AssignedClientIdentifierProperty : StringProperty
|
||||
{
|
||||
public AssignedClientIdentifierProperty(string value)
|
||||
: base((byte)MqttMessagePropertyID.AssignedClientIdentifer, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class AuthenticationDataProperty : BinaryDataProperty
|
||||
{
|
||||
public AuthenticationDataProperty(ArraySegment<byte> data)
|
||||
: base((byte)MqttMessagePropertyID.AuthenticationData, data)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class AuthenticationMethodProperty : StringProperty
|
||||
{
|
||||
public AuthenticationMethodProperty(string value)
|
||||
: base((byte)MqttMessagePropertyID.AuthenticationMethod, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
public class BinaryDataProperty : IProperty
|
||||
{
|
||||
public BinaryDataProperty(byte id, ArraySegment<byte> data)
|
||||
{
|
||||
if (data.Array == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
|
||||
Id = id;
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public byte Id { get; }
|
||||
|
||||
public ArraySegment<byte> Data { get; }
|
||||
|
||||
public void WriteTo(MqttPacketWriter writer)
|
||||
{
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
writer.Write(Id);
|
||||
writer.Write((ushort)Data.Count);
|
||||
writer.Write(Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
public class ByteProperty : IProperty
|
||||
{
|
||||
public ByteProperty(byte id, byte value)
|
||||
{
|
||||
Id = id;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public byte Id { get; }
|
||||
|
||||
public byte Value { get; }
|
||||
|
||||
public void WriteTo(MqttPacketWriter writer)
|
||||
{
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
writer.Write(Id);
|
||||
writer.Write(Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
public class FourByteIntegerValue : IProperty
|
||||
{
|
||||
public FourByteIntegerValue(byte id, uint value)
|
||||
{
|
||||
Id = id;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public byte Id { get; }
|
||||
|
||||
public uint Value { get; }
|
||||
|
||||
public void WriteTo(MqttPacketWriter writer)
|
||||
{
|
||||
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,26 +0,0 @@
|
||||
using System;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
public class StringProperty : IProperty
|
||||
{
|
||||
public StringProperty(byte id, string value)
|
||||
{
|
||||
Id = id;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public byte Id { get; }
|
||||
|
||||
public string Value { get; }
|
||||
|
||||
public void WriteTo(MqttPacketWriter writer)
|
||||
{
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
writer.Write(Id);
|
||||
writer.WriteWithLengthPrefix(Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
public class TwoByteIntegerProperty : IProperty
|
||||
{
|
||||
public TwoByteIntegerProperty(byte id, ushort value)
|
||||
{
|
||||
Id = id;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public byte Id { get; }
|
||||
|
||||
public ushort Value { get; }
|
||||
|
||||
public void WriteTo(MqttPacketWriter writer)
|
||||
{
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
writer.Write(Id);
|
||||
writer.Write(Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties.BaseTypes
|
||||
{
|
||||
public class VariableByteIntegerProperty : IProperty
|
||||
{
|
||||
public VariableByteIntegerProperty(byte id, uint value)
|
||||
{
|
||||
Id = id;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public byte Id { get; }
|
||||
|
||||
public uint Value { get; }
|
||||
|
||||
public void WriteTo(MqttPacketWriter writer)
|
||||
{
|
||||
if (writer == null) throw new ArgumentNullException(nameof(writer));
|
||||
|
||||
var buffer = MqttPacketWriter.EncodeVariableByteInteger(Value);
|
||||
|
||||
writer.Write(Id);
|
||||
writer.Write(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ContentTypeProperty : StringProperty
|
||||
{
|
||||
public ContentTypeProperty(string value)
|
||||
: base((byte)MqttMessagePropertyID.ContentType, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class CorrelationDataProperty : BinaryDataProperty
|
||||
{
|
||||
public CorrelationDataProperty(ArraySegment<byte> data)
|
||||
: base((byte)MqttMessagePropertyID.CorrelationData, data)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using MQTTnet.Formatter;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public interface IProperty
|
||||
{
|
||||
byte Id { get; }
|
||||
|
||||
void WriteTo(MqttPacketWriter writer);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class MaximumPacketSizeProperty : FourByteIntegerValue
|
||||
{
|
||||
public MaximumPacketSizeProperty(uint value)
|
||||
: base((byte)MqttMessagePropertyID.MaximumPacketSize, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class MaximumQoSProperty : ByteProperty
|
||||
{
|
||||
public MaximumQoSProperty(byte value)
|
||||
: base((byte)MqttMessagePropertyID.MaximumQoS, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class MessageExpiryIntervalProperty : FourByteIntegerValue
|
||||
{
|
||||
public MessageExpiryIntervalProperty(uint value)
|
||||
: base((byte)MqttMessagePropertyID.MessageExpiryInterval, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public enum MqttMessagePropertyID
|
||||
{
|
||||
PayloadFormatIndicator = 1,
|
||||
MessageExpiryInterval = 2,
|
||||
ContentType = 3,
|
||||
ResponseTopic = 8,
|
||||
CorrelationData = 9,
|
||||
SubscriptionIdentifier = 11,
|
||||
SessionExpiryInterval = 17,
|
||||
AssignedClientIdentifer = 18,
|
||||
ServerKeepAlive = 19,
|
||||
AuthenticationMethod = 21,
|
||||
AuthenticationData = 22,
|
||||
RequestProblemInformation = 23,
|
||||
WillDelayInterval = 24,
|
||||
RequestResponseInformation = 25,
|
||||
ResponseInformation = 26,
|
||||
ServerReference = 28,
|
||||
ReasonString = 31,
|
||||
ReceiveMaximum = 33,
|
||||
TopicAliasMaximum = 34,
|
||||
TopicAlias = 35,
|
||||
MaximumQoS = 36,
|
||||
RetainAvailable = 37,
|
||||
UserProperty = 38,
|
||||
MaximumPacketSize = 39,
|
||||
WildcardSubscriptionAvailable = 40,
|
||||
SubscriptionIdentifierAvailable = 41,
|
||||
SharedSubscriptionAvailable = 42
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class PayloadFormatIndicatorProperty : ByteProperty
|
||||
{
|
||||
public PayloadFormatIndicatorProperty(byte value)
|
||||
: base((byte)MqttMessagePropertyID.PayloadFormatIndicator, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ReasonStringProperty : StringProperty
|
||||
{
|
||||
public ReasonStringProperty(string value)
|
||||
: base((byte)MqttMessagePropertyID.ReasonString, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ReceiveMaximumProperty : TwoByteIntegerProperty
|
||||
{
|
||||
public ReceiveMaximumProperty(ushort value)
|
||||
: base((byte)MqttMessagePropertyID.ReceiveMaximum, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class RequestProblemInformationProperty : ByteProperty
|
||||
{
|
||||
public RequestProblemInformationProperty(byte value)
|
||||
: base((byte)MqttMessagePropertyID.RequestProblemInformation, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class RequestResponseInformationProperty : ByteProperty
|
||||
{
|
||||
public RequestResponseInformationProperty(byte value)
|
||||
: base((byte)MqttMessagePropertyID.RequestResponseInformation, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ResponseInformationProperty : StringProperty
|
||||
{
|
||||
public ResponseInformationProperty(string value)
|
||||
: base((byte)MqttMessagePropertyID.ResponseInformation, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ResponseTopicProperty : StringProperty
|
||||
{
|
||||
public ResponseTopicProperty(string value)
|
||||
: base((byte)MqttMessagePropertyID.ResponseTopic, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class RetainAvailableProperty : ByteProperty
|
||||
{
|
||||
public RetainAvailableProperty(byte value)
|
||||
: base((byte)MqttMessagePropertyID.RetainAvailable, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ServerKeepAliveProperty : TwoByteIntegerProperty
|
||||
{
|
||||
public ServerKeepAliveProperty(ushort value)
|
||||
: base((byte)MqttMessagePropertyID.ServerKeepAlive, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class ServerReferenceProperty : StringProperty
|
||||
{
|
||||
public ServerReferenceProperty(string value)
|
||||
: base((byte)MqttMessagePropertyID.ServerReference, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class SessionExpiryIntervalProperty : FourByteIntegerValue
|
||||
{
|
||||
public SessionExpiryIntervalProperty(uint value)
|
||||
: base((byte)MqttMessagePropertyID.SessionExpiryInterval, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class SharedSubscriptionAvailableProperty : ByteProperty
|
||||
{
|
||||
public SharedSubscriptionAvailableProperty(byte value)
|
||||
: base((byte)MqttMessagePropertyID.SharedSubscriptionAvailable, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class SubscriptionIdentifierAvailable : ByteProperty
|
||||
{
|
||||
public SubscriptionIdentifierAvailable(byte value)
|
||||
: base((byte)MqttMessagePropertyID.SubscriptionIdentifierAvailable, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class SubscriptionIdentifierProperty : VariableByteIntegerProperty
|
||||
{
|
||||
public SubscriptionIdentifierProperty(uint value)
|
||||
: base((byte)MqttMessagePropertyID.SubscriptionIdentifier, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class TopicAliasMaximumProperty : TwoByteIntegerProperty
|
||||
{
|
||||
public TopicAliasMaximumProperty(ushort value)
|
||||
: base((byte)MqttMessagePropertyID.TopicAliasMaximum, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class TopicAliasProperty : TwoByteIntegerProperty
|
||||
{
|
||||
public TopicAliasProperty(ushort value)
|
||||
: base((byte)MqttMessagePropertyID.TopicAlias, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class WildcardSubscriptionAvailableProperty : ByteProperty
|
||||
{
|
||||
public WildcardSubscriptionAvailableProperty(byte value)
|
||||
: base((byte)MqttMessagePropertyID.WildcardSubscriptionAvailable, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MQTTnet.Packets.Properties.BaseTypes;
|
||||
|
||||
namespace MQTTnet.Packets.Properties
|
||||
{
|
||||
public class WillDelayIntervalProperty : FourByteIntegerValue
|
||||
{
|
||||
public WillDelayIntervalProperty(uint value)
|
||||
: base((byte)MqttMessagePropertyID.WillDelayInterval, value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user