Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

36 строки
1.1 KiB

  1. using MQTTnet.Packets;
  2. namespace MQTTnet.Internal
  3. {
  4. public 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. }