Exemple #1
0
        public MqttClient(IMqttClientAdapterFactory channelFactory, IMqttNetLogger logger)
        {
            _adapterFactory = channelFactory ?? throw new ArgumentNullException(nameof(channelFactory));
            _logger         = logger ?? throw new ArgumentNullException(nameof(logger));

            _packetDispatcher = new MqttPacketDispatcher(logger);
        }
Exemple #2
0
        public LowLevelMqttClient(IMqttClientAdapterFactory clientAdapterFactory, IMqttNetLogger logger)
        {
            _clientAdapterFactory = clientAdapterFactory ?? throw new ArgumentNullException(nameof(clientAdapterFactory));

            _rootLogger = logger ?? throw new ArgumentNullException(nameof(logger));
            _logger     = logger.WithSource(nameof(LowLevelMqttClient));
        }
Exemple #3
0
        public IMqttClient CreateMqttClient(IMqttClientAdapterFactory clientAdapterFactory)
        {
            if (clientAdapterFactory == null)
            {
                throw new ArgumentNullException(nameof(clientAdapterFactory));
            }

            return(new MqttClient(clientAdapterFactory, DefaultLogger));
        }
Exemple #4
0
        public IMqttClient CreateMqttClient(IMqttClientAdapterFactory adapterFactory)
        {
            if (adapterFactory == null)
            {
                throw new ArgumentNullException(nameof(adapterFactory));
            }

            return(new MqttClient(adapterFactory, new MqttNetLogger()));
        }
Exemple #5
0
        public MqttClient(IMqttClientAdapterFactory channelFactory, IMqttNetLogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _adapterFactory = channelFactory ?? throw new ArgumentNullException(nameof(channelFactory));
            _logger         = logger.CreateScopedLogger(nameof(MqttClient));
        }
Exemple #6
0
        public LowLevelMqttClient(IMqttClientAdapterFactory clientAdapterFactory, IMqttNetLogger logger)
        {
            _clientAdapterFactory = clientAdapterFactory ?? throw new ArgumentNullException(nameof(clientAdapterFactory));

            if (logger is null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            _logger = logger.CreateScopedLogger(nameof(LowLevelMqttClient));
        }
Exemple #7
0
        public ILowLevelMqttClient CreateLowLevelMqttClient(IMqttNetLogger logger, IMqttClientAdapterFactory clientAdapterFactory)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (clientAdapterFactory == null)
            {
                throw new ArgumentNullException(nameof(clientAdapterFactory));
            }

            return(new LowLevelMqttClient(_clientAdapterFactory, logger));
        }
Exemple #8
0
        public IMqttClient CreateMqttClient(IMqttNetLogger logger, IMqttClientAdapterFactory mqttClientAdapterFactory)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (mqttClientAdapterFactory == null)
            {
                throw new ArgumentNullException(nameof(mqttClientAdapterFactory));
            }

            return(new MqttClient(mqttClientAdapterFactory, logger));
        }
Exemple #9
0
 public CollectionMqttClient(IMqttClientAdapterFactory factory,
                             IMqttNetLogger mqttLogger,
                             ISendProtocolFactory sendProtocolFactory,
                             IOptionsMonitor <Setting> kj1012Setting,
                             ILogger <CollectionMqttClient> logger) : base(factory, mqttLogger)
 {
     _sendProtocolFactory = sendProtocolFactory;
     _logger                     = logger;
     _kj1012Setting              = kj1012Setting;
     Connected                  += MqttClient_Connected;
     Disconnected               += MqttClient_Disconnected;
     ApplicationMessageReceived += MqttClient_ApplicationMessageReceived;;
 }
Exemple #10
0
 public IMqttFactory UseClientAdapterFactory(IMqttClientAdapterFactory clientAdapterFactory)
 {
     _clientAdapterFactory = clientAdapterFactory ?? throw new ArgumentNullException(nameof(clientAdapterFactory));
     return(this);
 }
Exemple #11
0
 public MqttFactory(IMqttNetLogger logger)
 {
     DefaultLogger         = logger ?? throw new ArgumentNullException(nameof(logger));
     _clientAdapterFactory = new MqttClientAdapterFactory(logger);
 }
Exemple #12
0
 public MqttClient(IMqttClientAdapterFactory channelFactory, IMqttNetLogger logger)
 {
     _adapterFactory = channelFactory ?? throw new ArgumentNullException(nameof(channelFactory));
     _rootLogger     = logger ?? throw new ArgumentNullException(nameof(logger));
     _logger         = logger.WithSource(nameof(MqttClient));
 }