Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 

36 rindas
1.1 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. {
  10. Topic = publishPacket.Topic,
  11. Payload = publishPacket.Payload,
  12. QualityOfServiceLevel = publishPacket.QualityOfServiceLevel,
  13. Retain = publishPacket.Retain
  14. };
  15. }
  16. public static MqttPublishPacket ToPublishPacket(this MqttApplicationMessage applicationMessage)
  17. {
  18. if (applicationMessage == null)
  19. {
  20. return null;
  21. }
  22. return new MqttPublishPacket
  23. {
  24. Topic = applicationMessage.Topic,
  25. Payload = applicationMessage.Payload,
  26. QualityOfServiceLevel = applicationMessage.QualityOfServiceLevel,
  27. Retain = applicationMessage.Retain,
  28. Dup = false
  29. };
  30. }
  31. }
  32. }