Exemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     HueBridge = new PhilipsHue(textBox1.Text, textBox2.Text);
     SimplePhilipsHueLibTestApp.Properties.Settings.Default.ip       = textBox1.Text;
     SimplePhilipsHueLibTestApp.Properties.Settings.Default.username = textBox2.Text;
     SimplePhilipsHueLibTestApp.Properties.Settings.Default.Save();
 }
Exemplo n.º 2
0
        private void Alarmed()
        {
            Logger.AddEvent(Self.Path.Name + " alarmed!");
            _physicalWebcam.Alarm();
            PhilipsHue.LightsOff();
            _pushBullet.PushNote("Webcam from home", "The webcam has been alarmed.");

            Receive <Disconnected>(connected => Become(Disalarmed));
        }
Exemplo n.º 3
0
 public RGBSDKWrapper()
 {
     _synapseController = new RazerSynapse();
     _cueController     = new CorsairCue();
     _hueController     = new PhilipsHue();
     Console.WriteLine("Initializing SDK's...");
     _synapseController.Initialize();
     _cueController.Initialize();
     _hueController.Initialize();
     Console.WriteLine("Initialization done");
 }
Exemplo n.º 4
0
 private void Disalarmed()
 {
     if (!_firstTime)
     {
         Logger.AddEvent(Self.Path.Name + " disalarmed!");
         _physicalWebcam.Disalarm();
         PhilipsHue.LightsOn();
     }
     else
     {
         _firstTime = false;
     }
     Receive <Connected>(connected => Become(Alarmed));
 }
Exemplo n.º 5
0
        void ChangePhilipsHueStatus()
        {
            if ((philipsHue == null) ||
                ((philipsHue != null) &&
                 (philipsHue.IsConnected == false)))
            {
                string deviceName = string.Empty;
                string hueAppKey  = string.Empty;

                gameLayer.GamePaused = true;

                if (String.IsNullOrWhiteSpace(userDefaults.StringForKey(DEVICE_NAME)) == false)
                {
                    deviceName = userDefaults.StringForKey(DEVICE_NAME);
                }

                if (String.IsNullOrWhiteSpace(userDefaults.StringForKey(HUE_APP_KEY_KEY)) == false)
                {
                    hueAppKey = userDefaults.StringForKey(HUE_APP_KEY_KEY);
                }

                if (String.IsNullOrWhiteSpace(userDefaults.StringForKey(HUE_NOTIFICATION_SHOWED_KEY)) == true)
                {
                    UIAlertController philipsHueConnectionAlert = UIAlertController.Create("Philips Hue Connection",
                                                                                           "Connecting the app to Philips Hue color bulbs adds an extra dimension to the gameplay. If you own one, " +
                                                                                           "press the link button on your Philips Hue bridge within " + HUE_BRIDGE_LOCATOR_TIMEOUT.ToString() + " seconds to check it out!",
                                                                                           UIAlertControllerStyle.Alert);

                    philipsHueConnectionAlert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, (connectionOK) =>
                    {
                        philipsHue = new PhilipsHue(APP_NAME, deviceName, hueAppKey, HUE_BRIDGE_LOCATOR_TIMEOUT);

                        ShowActivityIndicator(true);
                        philipsHue.Connect(PhilipsHueConnectionAttemptComplete);
                        philipsHueConnectionAlert.DismissViewController(true, null);
                    }));

                    philipsHueConnectionAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Default, (connectionCancel) =>
                    {
                        philipsHueConnectionAlert.DismissViewController(true, null);
                        ControlMenu("Show");

                        gameLayer.GamePaused = false;
                    }));

                    PresentViewController(philipsHueConnectionAlert, true, null);
                }
                else
                {
                    philipsHue = new PhilipsHue(APP_NAME, deviceName, hueAppKey, HUE_BRIDGE_LOCATOR_TIMEOUT);

                    ShowActivityIndicator(true);
                    philipsHue.Connect(PhilipsHueConnectionAttemptComplete);
                }
            }
            else if ((philipsHue != null) &&
                     (philipsHue.IsConnected == true))
            {
                philipsHue.Disconnect();
                ChangePhilipsHueButton("Off");
                ControlMenu("Show");
            }
        }