Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

MqttFactoryExtensions.cs 890 B

123456789101112131415161718192021222324
  1. using System;
  2. using MQTTnet.Client;
  3. using MQTTnet.Diagnostics;
  4. namespace MQTTnet.Extensions.ManagedClient
  5. {
  6. public static class MqttFactoryExtensions
  7. {
  8. public static IManagedMqttClient CreateManagedMqttClient(this IMqttClientFactory factory)
  9. {
  10. if (factory == null) throw new ArgumentNullException(nameof(factory));
  11. return new ManagedMqttClient(factory.CreateMqttClient(), new MqttNetLogger().CreateChildLogger());
  12. }
  13. public static IManagedMqttClient CreateManagedMqttClient(this IMqttClientFactory factory, IMqttNetLogger logger)
  14. {
  15. if (factory == null) throw new ArgumentNullException(nameof(factory));
  16. if (logger == null) throw new ArgumentNullException(nameof(logger));
  17. return new ManagedMqttClient(factory.CreateMqttClient(), logger.CreateChildLogger());
  18. }
  19. }
  20. }