Пример #1
0
 public LifxBulb(LifxData d, LifxClient c)
 {
     _captureMode  = DataUtil.GetItem <int>("captureMode");
     Data          = d ?? throw new ArgumentException("Invalid Data");
     _client       = c;
     B             = new LightBulb(d.HostName, d.MacAddress, d.Service, (uint)d.Port);
     _targetSector = d.TargetSector - 1;
     Brightness    = d.Brightness;
     Id            = d.Id;
     IpAddress     = d.IpAddress;
 }
Пример #2
0
        public LifxData GetBulbInfo(LightBulb b)
        {
            var state = _client.GetLightStateAsync(b).Result;
            var d     = new LifxData(b)
            {
                Power        = _client.GetLightPowerAsync(b).Result,
                Hue          = state.Hue,
                Saturation   = state.Saturation,
                Brightness   = state.Brightness,
                Kelvin       = state.Kelvin,
                TargetSector = -1
            };

            return(d);
        }