Beispiel #1
0
        public static void Main(string[] args)
        {
            var config = ReadConfig();

            LightService.ShellName = config.Shell;

            // Start web services
            SetupServices(config.Lamps);

            // Run until Ctrl+C
            var endEvent = new ManualResetEvent(false);

            Console.WriteLine("HippoCmdLightDaemon started");

            Console.CancelKeyPress += (sender, e) =>
            {
                Console.WriteLine("HippoCmdLightDaemon stopped");

                LightService.DisposeAll();                  // Stop all web servers

                endEvent.Set();
            };

            endEvent.WaitOne();
        }
Beispiel #2
0
 public static void SetupServices(ConfigObject[] objects)
 {
     foreach (var o in objects)
     {
         var svc = new LightService(o);
         svc.StartWebserver();
         svc.RegisterMDNS();
     }
 }
Beispiel #3
0
        public LampDataObject GetStatus()
        {
            LightService   svc = CurrentService;
            LampDataObject obj = new LampDataObject
            {
                burn = svc.On
            };

            return(obj);
        }
Beispiel #4
0
        public void SetStatus(LampDataObject obj)
        {
            LightService svc = CurrentService;

            svc.On = obj.burn;
        }