Ejemplo n.º 1
0
        protected async Task GetLampStatus(LampClient lamp)
        {
            RuntimeMonitor.Monitor.RegisterCall("GetLampStatus");

            // Assume the lamp is online and get its state
            lamp.Online = true;

            try
            {
                await lamp.GetState();
            }
            catch (Exception)
            {
                lamp.Online = false;
            }
        }
Ejemplo n.º 2
0
        private async Task UpdateSingleLamp(DatabaseClient db, LampNode lamp)
        {
            RuntimeMonitor.Monitor.RegisterCall("UpdateSingleLamp");

            var lampClient = new LampClient(lamp);

            try
            {
                await lampClient.GetState();

                db.AddOrUpdate(lampClient.Node);
            }
            catch
            {
                // Error is ok; if the lamp is not seen, it will be removed
            }
        }