Esempio n. 1
0
        public MqttClient(MqttMessageCatching.MqttMessageCatcher catcherObj, string clientId)
        {
            mqttMessageCapturingObj = catcherObj;
            var factory = new MqttFactory();

            mqttClient = factory.CreateMqttClient();
            options    = new MqttClientOptionsBuilder()
                         .WithClientId(clientId)
                         .WithTcpServer(Options.MqttServerIp, Options.MqttServerPort)
                         .WithCredentials(Options.MqttServerUser, Options.MqttServerPw)
                         .WithCleanSession()
                         .Build();
        }
Esempio n. 2
0
        public static async Task Main()
        {
            Options.LoadSettings();

            var captureToProcessChannel = new MeasurementsChannel();
            var mqttMessageCapturingObj = new MqttMessageCatching.MqttMessageCatcher(captureToProcessChannel);
            var mqttClientObj           = new MqttClient(mqttMessageCapturingObj);
            var evaluator = new Evaluation.Evaluator(captureToProcessChannel);

            evaluator.StartEvaluation();
            await mqttClientObj.SetupAndRunMqttClient();

            while (true)
            {
                await Task.Delay(10_000);
            }
        }
Esempio n. 3
0
 public MqttClient(MqttMessageCatching.MqttMessageCatcher catcherObj) : this(catcherObj, Guid.NewGuid().ToString())
 {
 }