您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

35 行
1.0 KiB

  1. using MQTTnet.Core.Packets;
  2. namespace MQTTnet.Core.Internal
  3. {
  4. internal static class MqttApplicationMessageExtensions
  5. {
  6. public static MqttApplicationMessage ToApplicationMessage(this MqttPublishPacket publishPacket)
  7. {
  8. return new MqttApplicationMessage(
  9. publishPacket.Topic,
  10. publishPacket.Payload,
  11. publishPacket.QualityOfServiceLevel,
  12. publishPacket.Retain
  13. );
  14. }
  15. public static MqttPublishPacket ToPublishPacket(this MqttApplicationMessage applicationMessage)
  16. {
  17. if (applicationMessage == null)
  18. {
  19. return null;
  20. }
  21. return new MqttPublishPacket
  22. {
  23. Topic = applicationMessage.Topic,
  24. Payload = applicationMessage.Payload,
  25. QualityOfServiceLevel = applicationMessage.QualityOfServiceLevel,
  26. Retain = applicationMessage.Retain,
  27. Dup = false
  28. };
  29. }
  30. }
  31. }