Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.userprefs
8 changes: 7 additions & 1 deletion MqttLib/Core/Messages/MqttExtendedackMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public MqttExtendedackMessage(ulong msgID, byte commondId, string payloadStr)
base.variableHeaderLength = 11 + _payload.Length;
}

public MqttExtendedackMessage(ulong msgID, string topic, byte[] payload, QoS qos, int ttl, string apn_json)
public MqttExtendedackMessage(ulong msgID, string topic, byte[] payload, QoS qos, int ttl, string apn_json, string third_party_push)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里原有接口被删除,实际上并不符合我们的sdk规范,使用新sdk的客户需要独立适配

: base(MessageType.EXTENDEDACK, 8, msgID)
{
_commondId = 7;
Expand Down Expand Up @@ -63,6 +63,12 @@ public MqttExtendedackMessage(ulong msgID, string topic, byte[] payload, QoS qos
WriteToStream(pay, apn_json);
}

if (third_party_push != null)
{
pay.WriteByte(8);
WriteToStream(pay, third_party_push);
}

byte[] paybytes = pay.ToArray();
if (paybytes.Length <= 65535)
{
Expand Down
5 changes: 3 additions & 2 deletions MqttLib/IMqttExtend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface IMqttExtend
/// <param name="ttl">Time for message will be stored on server, in seconds. If set 0, the message will be forever on the server.</param>
/// <param name="apn_json">APNS</param>
/// <returns>Message ID</returns>
ulong Publish2(string topic, MqttPayload payload, QoS qos, int ttl, string apn_json);
ulong Publish2(string topic, MqttPayload payload, QoS qos, int ttl, string apn_json, string third_party_push);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同样的问题,原有接口被删除


/// <summary>
/// Publish a message to a specific client with alias and some options
Expand All @@ -26,7 +26,8 @@ public interface IMqttExtend
/// <param name="ttl">Time for message will be stored on server, in seconds. If set 0, the message will be forever on the server.</param>
/// <param name="apn_json">APNS</param>
/// <returns>Message ID</returns>
ulong Publish2Alias(string alias, MqttPayload payload, QoS qos, int ttl, string apn_json);
ulong Publish2Alias(string alias, MqttPayload payload, QoS qos, int ttl, string apn_json, string third_party_push);
ulong Publish2ToAliasWithToken(string alias, string token, MqttPayload payload, QoS qos, int ttl, string apn_json, string third_party_push);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原有接口被删除。并且token应该已经不再使用,因为yam似乎并没有真正上线


/// <summary>
/// Request the client's alias
Expand Down
42 changes: 37 additions & 5 deletions MqttLib/IMqttPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,43 @@ public interface IMqttPublisher
/// </summary>
/// <param name="alias">alias name</param>
/// <returns>Message ID</returns>
ulong SetAlias(string alias);
ulong SetAlias(string alias);

/// <summary>
/// Fired when receipt of publication is confirmed
/// </summary>
event CompleteDelegate Published;
/// <summary>
/// Publish a message to the MQTT message broker under Yunba-AccessManager control
/// </summary>
/// <param name="topic">Destination of message</param>
/// <param name="token">grant from Yunba yam server</param>
/// <param name="payload">Message body</param>
/// <param name="qos">QoS level</param>
/// <param name="retained">Whether the message is retained by the broker</param>
/// <returns>Message ID</returns>
ulong PublishWithToken(string topic, string token, MqttPayload payload, QoS qos, bool retained);

/// <summary>
/// Publish a message to the MQTT message broker under Yunba-AccessManager control
/// </summary>
/// <param name="topic">Destination of message</param>
/// <param name="token">grant from Yunba yam server</param>
/// <param name="payload">Message body</param>
/// <param name="qos">QoS level</param>
/// <param name="retained">Whether the message is retained by the broker</param>
/// <returns>Message ID</returns>
ulong SetAliasWithToken(string alias, string token);
ulong Publish2WithToken(string topic, string token, MqttPayload payload, QoS qos, int ttl, string apn_json);
/// <summary>
/// Publish a message to the MQTT message broker under Yunba-AccessManager control
/// </summary>
/// <param name="topic">Destination of message</param>
/// <param name="token">grant from Yunba yam server</param>
/// <param name="payload">Message body</param>
/// <param name="qos">QoS level</param>
/// <param name="retained">Whether the message is retained by the broker</param>
/// <returns>Message ID</returns>
ulong PublishToAliasWithToken(string alias, string token, MqttPayload payload, QoS qos, bool retained);
/// <summary>
/// Fired when receipt of publication is confirmed
/// </summary>
event CompleteDelegate Published;
}
}
4 changes: 4 additions & 0 deletions MqttLib/IMqttSubscriber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public interface IMqttSubscriber
/// <param name="topics">Topic Name</param>
/// <returns>Message ID</returns>
ulong Unsubscribe(string[] topics);
ulong SubscribeWithToken(Subscription[] subscriptions, string token);
ulong SubscribeWithToken(Subscription subscription, string token);
ulong SubscribeWithToken(string topic, string token, QoS qos);
ulong UnsubscribeWithToken(string[] topics, string token);

/// <summary>
/// Fired when the Topic the MQTT client is subscribed to receives a message
Expand Down
Loading