You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 rivejä
823 B

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