Пример #1
0
        public string start_topic_import(string uid, PythonDictionary parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            var topicImportParameters = new MqttImportTopicParameters
            {
                Server   = Convert.ToString(parameters.get("server")),
                Port     = Convert.ToInt32(parameters.get("port", 1883)),
                UseTls   = Convert.ToBoolean(parameters.get("tls", false)),
                Username = Convert.ToString(parameters.get("username")),
                Password = Convert.ToString(parameters.get("password")),
                ClientId = Convert.ToString(parameters.get("client_id", Guid.NewGuid().ToString("N"))),
                Topic    = Convert.ToString(parameters.get("topic")),
                QualityOfServiceLevel = (MqttQualityOfServiceLevel)Convert.ToInt32(parameters.get("qos"))
            };

            return(_mqttService.StartTopicImport(uid, topicImportParameters));
        }
Пример #2
0
 public MqttTopicImporter(MqttImportTopicParameters parameters, MqttService mqttService, ILogger logger)
 {
     _parameters  = parameters ?? throw new ArgumentNullException(nameof(parameters));
     _mqttService = mqttService ?? throw new ArgumentNullException(nameof(mqttService));
     _logger      = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Пример #3
0
 public Task <string> StartTopicImport(string uid, MqttImportTopicParameters parameters)
 {
     return(_topicImportManager.StartTopicImport(uid, parameters));
 }