Ejemplo n.º 1
0
        public static void Main()
        {
            var        sensorConfiguration = new SensorConfiguration();
            DhcpSensor sensor = new DhcpSensor(sensorConfiguration);

            Console.WriteLine("Press [Enter] to exit");
            Console.ReadLine();
            sensor.Stop();
        }
Ejemplo n.º 2
0
        private bool ValidateAndLogConfiguration(SensorConfiguration configuration)
        {
            Console.WriteLine("messageQueueExchangeName: " + configuration.MessageQueueExchangeName);

            Console.WriteLine("messageQueueHost: " + configuration.MessageQueueHost);
            if (string.IsNullOrEmpty(configuration.MessageQueueHost))
            {
                Console.WriteLine("messageQueueHost address empty, using localhost");
            }
            Console.WriteLine("enableMessaging: " + configuration.EnableMessaging);
            return(true);
        }
Ejemplo n.º 3
0
        public DhcpSensor(SensorConfiguration configuration)
        {
            bool valid = ValidateAndLogConfiguration(configuration);

            if (!valid)
            {
                Console.WriteLine("Configuration is not valid. Sensor cannot start.");
                return;
            }
            this.configuration = configuration;
            Task.Run(() => {
                SensorLoop();
            });
        }