public HueLightButton(IGameBox gameBox, IHueClient hueClient, Light light, ILightableButton lightableButton) { this.gameBox = gameBox; this.hueClient = hueClient; this.light = light; this.lightableButton = lightableButton; }
/// <summary> /// Constructor /// </summary> /// <param name="hueClient">The client to use for communication with the Philips Hue</param> public VisualNotificationController(IHueClient hueClient) { _hueClient = hueClient; _lamps = new List <string> { "1" }; }
public void Initialize() { string ip = ConfigurationManager.AppSettings["ip"].ToString(); string key = ConfigurationManager.AppSettings["key"].ToString(); _client = new HueClient(ip, key); }
public static void UpdateLights(IHueClient client, IList<Light> list) { Parallel.ForEach(list, light => { Light initLight = client.GetLightAsync(light.Id).Result; initLight.Id = light.Id; list[list.IndexOf(light)] = initLight; }); }
//hue connection public async void InitializeHue() { string ip = ConfigurationManager.AppSettings["ip"].ToString(); string key = ConfigurationManager.AppSettings["key"].ToString(); HueKey = key; if (ip.Length == 0 || key.Length == 0) { await GetConfig(); } while (key.Length == 0) { //do nothing } _client = new LocalHueClient(ip, key); }
public async Task InitializeAsync() { List <LocatedBridge> bridges = await HueBridgeDiscovery.FastDiscoveryAsync(TimeSpan.FromSeconds(5)); LocatedBridge locatedBridge = bridges.First(); if (string.IsNullOrEmpty(_appKey)) { throw new NotImplementedException("Registering application is not yet implemented"); } LocalHueClient hueClient = new LocalHueClient(locatedBridge.IpAddress, _appKey); if (!await hueClient.CheckConnection()) { throw new Exception("Could not establish connection to bridge"); } _hueClient = hueClient; }
public LightsManager(IClient hueClient) { _hueClient = hueClient.GetClient(); }
public HomeController(IHueClient hueClient) { _hueClient = hueClient; }
public LightsController(IHueClient hueClient, IList<Light> lightList) { _hueClient = hueClient; _lightList = lightList; }
protected async override void OnAppearing() { CrossDeviceMotion.Current.SensorValueChanged += (sender, e) => { CompassLabel.Text = "" + e.Value; }; CrossCompass.Current.CompassChanged += async(sender, e) => { CompassLabel.Text = "" + e.Heading; if (Math.Abs(e.Heading - lastHeading) < 5) { return; } lastHeading = e.Heading; try{ if (e.Heading > 180 && e.Heading < 360) { var quadracticValue = (e.Heading - 360) * (e.Heading - 180) * -1 / 8100.0; var command = GetBrightnesCommand((byte)(quadracticValue * 255)); var idx = LightList.SelectedIndex; await client.SendCommandAsync(command, new [] { MyLights.ElementAt(idx).Id }); } else { var command = GetBrightnesCommand(0); await client.SendCommandAsync(command, new [] { "4" }); } }catch (Exception ayy) { CrossTextToSpeech.Current.Speak("Hey! Slow down. Bro."); } }; if (client == null) { client = await GetClient(); if (client == null) { return; } } #if !DEBUG if (MyScenes == null) { MyScenes = await client.GetScenesAsync(); foreach (var light in MyScenes) { SceneList.Items.Add(light.Name); } SceneList.SelectedIndex = 0; SceneList.SelectedIndexChanged += async(object sender, EventArgs e) => { var scene = MyScenes.ElementAt(SceneList.SelectedIndex); }; } #endif if (MyLights == null) { MyLights = await client.GetLightsAsync(); foreach (var light in MyLights) { LightList.Items.Add(light.Name); } LightList.SelectedIndex = 0; CrossCompass.Current.Start(); //CrossDeviceMotion.Current.Start(MotionSensorType.Gyroscope, MotionSensorDelay.Ui); } }
public ReleaseNightScenario(IHueClient hueClient) { _hueClient = hueClient; }
public LightsController(IHueClient hueClient, IEnumerable<string> lightList) { _hueClient = hueClient; _lightList = lightList; }
public static void UpdateLight(IHueClient client, Light light) { light = client.GetLightAsync(light.Id).Result; }
public void InValidHueIpTest() { _client = new HueClient("//127.0.0@@.1in.v.alid"); }
public void ValidHueIpTest() { _client = new HueClient("127.0.0.1"); Assert.IsNotNull(_client); }
public RedAlertScenario(IHueClient hueClient) { _hueClient = hueClient; }
public ActionProcessor(IHueClient hueClient) { _hueClient = hueClient; }