private void detectTimer_Tick(object sender, EventArgs e) { try { detectTimer.Enabled = false; var vrSet = new PSVR(Settings.Instance.EnableUDPBroadcast); PSVRController.DeviceConnected(vrSet); vrSet.SensorDataUpdate += VrSet_SensorDataUpdate; vrSet.Removed += VrSet_Removed; Task.Run(() => { PSVRController.HeadsetOn(); PSVRController.EnableVRMode(); Thread.Sleep(1500); PSVRController.EnableCinematicMode(); Thread.Sleep(1500); PSVRController.ApplyCinematicSettings(); }); lblStatus.Text = "VR set found"; grpFunctions.Enabled = true; grpCinematic.Enabled = true; grpLeds.Enabled = true; } catch (Exception ex) { detectTimer.Enabled = true; } }
private void detectTimer_Tick(object sender, EventArgs e) { try { detectTimer.Enabled = false; var vrSet = new PSVR(Settings.Instance.EnableUDPBroadcast); PSVRController.DeviceConnected(vrSet); vrSet.SensorDataUpdate += VrSet_SensorDataUpdate; vrSet.Removed += VrSet_Removed; vrSet.INReport += VrSet_CommandResponse; ThreadPool.QueueUserWorkItem((a) => { PSVRController.RequestDeviceInfo(); PSVRController.HeadsetOn(); PSVRController.EnableVRMode(); Thread.Sleep(1500); PSVRController.EnableCinematicMode(); Thread.Sleep(1500); PSVRController.ApplyCinematicSettings(); }); lblStatus.Text = "VR set found"; grpFunctions.Enabled = true; grpCinematic.Enabled = true; grpLeds.Enabled = true; } catch { detectTimer.Enabled = true; } }
private void HookedEvents_KeyDown(object sender, KeyEventArgs e) { try { var settings = Settings.Instance; if (settings.ControlModifier != e.Control || settings.ShiftModifier != e.Shift || settings.AltModifier != e.Alt) { return; } if (e.KeyCode == settings.HeadSetOn) { PSVRController.HeadsetOn(); e.Handled = true; } else if (e.KeyCode == settings.HeadSetOff) { PSVRController.HeadsetOff(); e.Handled = true; } else if (e.KeyCode == settings.EnableVRAndTracking) { PSVRController.EnableVRTracking(); e.Handled = true; } else if (e.KeyCode == settings.EnableVR) { PSVRController.EnableVRMode(); e.Handled = true; } else if (e.KeyCode == settings.EnableTheater) { PSVRController.EnableCinematicMode(); e.Handled = true; } else if (e.KeyCode == settings.Recenter) { PSVRController.Recenter(); e.Handled = true; } else if (e.KeyCode == settings.Shutdown) { PSVRController.Shutdown(); e.Handled = true; } } catch { } }
private void button4_Click(object sender, EventArgs e) { PSVRController.EnableVRMode(); }
private void ProcessCommand(RemoteCommand cmd) { switch (cmd.Command) { case "HeadsetOn": PSVRController.HeadsetOn(); break; case "HeadsetOff": PSVRController.HeadsetOff(); break; case "EnableVRTracking": PSVRController.EnableVRTracking(); break; case "EnableVRMode": PSVRController.EnableVRMode(); break; case "EnableCinematicMode": PSVRController.EnableCinematicMode(); break; case "Recenter": PSVRController.Recenter(); break; case "Shutdown": PSVRController.Shutdown(); break; case "CinematicSettings": CinematicSettingsCommand ccmd = cmd as CinematicSettingsCommand; if (ccmd != null) { bool apply = false; if (ccmd.Brightness != null && ccmd.Brightness.HasValue) { var bright = ccmd.Brightness.Value; if (bright > 32) { return; } Settings.Instance.Brightness = bright; apply = true; } if (ccmd.Size != null && ccmd.Size.HasValue) { var siz = ccmd.Size.Value + 26; if (siz > 80) { Settings.ReadSettings(); return; } Settings.Instance.ScreenSize = (byte)siz; apply = true; } if (ccmd.Distance != null && ccmd.Distance.HasValue) { var dist = ccmd.Distance.Value + 2; if (dist > 50) { Settings.ReadSettings(); return; } Settings.Instance.ScreenDistance = (byte)dist; apply = true; } if (apply) { PSVRController.ApplyCinematicSettings(); } } break; case "LedSettings": LEDSettingsCommand lcmd = cmd as LEDSettingsCommand; if (lcmd != null) { bool apply = false; if (lcmd.LedA != null && lcmd.LedA.HasValue) { if (lcmd.LedA.Value > 100) { return; } Settings.Instance.LedAIntensity = lcmd.LedA.Value; apply = true; } if (lcmd.LedB != null && lcmd.LedB.HasValue) { if (lcmd.LedB.Value > 100) { Settings.ReadSettings(); return; } Settings.Instance.LedBIntensity = lcmd.LedB.Value; apply = true; } if (lcmd.LedC != null && lcmd.LedC.HasValue) { if (lcmd.LedC.Value > 100) { Settings.ReadSettings(); return; } Settings.Instance.LedCIntensity = lcmd.LedC.Value; apply = true; } if (lcmd.LedD != null && lcmd.LedD.HasValue) { if (lcmd.LedD.Value > 100) { Settings.ReadSettings(); return; } Settings.Instance.LedDIntensity = lcmd.LedD.Value; apply = true; } if (lcmd.LedE != null && lcmd.LedE.HasValue) { if (lcmd.LedE.Value > 100) { Settings.ReadSettings(); return; } Settings.Instance.LedEIntensity = lcmd.LedE.Value; apply = true; } if (lcmd.LedF != null && lcmd.LedF.HasValue) { if (lcmd.LedF.Value > 100) { Settings.ReadSettings(); return; } Settings.Instance.LedFIntensity = lcmd.LedF.Value; apply = true; } if (lcmd.LedG != null && lcmd.LedG.HasValue) { if (lcmd.LedG.Value > 100) { Settings.ReadSettings(); return; } Settings.Instance.LedGIntensity = lcmd.LedG.Value; apply = true; } if (lcmd.LedH != null && lcmd.LedH.HasValue) { if (lcmd.LedH.Value > 100) { Settings.ReadSettings(); return; } Settings.Instance.LedHIntensity = lcmd.LedH.Value; apply = true; } if (lcmd.LedI != null && lcmd.LedI.HasValue) { if (lcmd.LedI.Value > 100) { Settings.ReadSettings(); return; } Settings.Instance.LedIIntensity = lcmd.LedI.Value; apply = true; } if (apply) { PSVRController.ApplyLedSettings(); } } break; case "StoreSettings": Settings.SaveSettings(); break; case "DiscardSettings": Settings.ReadSettings(); break; } }