Esempio n. 1
0
        private static void MQTT()
        {
            // read data sets configuration and data points from XML file
            ReadConfiguration configReader  = new ReadConfiguration(Settings.Simulation.InputFile);
            ParsedData        configuration = configReader.Read();

            if (configuration == null)
            {
                return;
            }

            // replace publisher ID with entry in from settings.json
            if (!string.IsNullOrWhiteSpace(Settings.Simulation.PublisherID))
            {
                configuration.CommonConfig.PublisherID = Settings.Simulation.PublisherID;
            }
            else
            {
                // PublisherID is not overridden in settings.json, use the value from the configuration
                Settings.Simulation.PublisherID = configuration.CommonConfig.PublisherID;
            }
            CreateClient();


            // delay before start?
            if (Settings.Simulation.WaitBeforeStarting > 0)
            {
                Thread.Sleep(Settings.Simulation.WaitBeforeStarting);
            }

            // Broker CA certificate
            if (Settings.Client.UseTls)
            {
                if (SettingManager.TryGetCertificateAsArray(Settings.Simulation.BrokerCACertDER, out byte[] brokerCaCert))