Skip to content

[PoC] Orientation Sensor as input device#228

Draft
vicocz wants to merge 4 commits into
defaultfrom
local/oriontation-sensor-device
Draft

[PoC] Orientation Sensor as input device#228
vicocz wants to merge 4 commits into
defaultfrom
local/oriontation-sensor-device

Conversation

@vicocz
Copy link
Copy Markdown
Owner

@vicocz vicocz commented May 26, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a proof-of-concept orientation sensor integration so the device’s orientation can be treated as an input device, with a Settings toggle to enable/disable it via persisted preferences.

Changes:

  • Introduces OrientationSensorController + InputSensorService to publish Pitch/Roll/Yaw as axis events via the existing input-device manager.
  • Exposes sensor support/enabled state on SettingsPageViewModel and adds corresponding UI to SettingsPage.xaml.
  • Extends DI/input-device plumbing with a generic IInputDeviceService<TInputDevice> and a DI registration helper overload.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
BrickController2/BrickController2/UI/ViewModels/SettingsPageViewModel.cs Injects sensor input-device service and exposes IsOrientationSensorSupported/Enabled for bindings.
BrickController2/BrickController2/UI/Pages/SettingsPage.xaml Adds a Settings row (label + switch) for the orientation sensor.
BrickController2/BrickController2/Resources/TranslationResources.resx Adds OrientationSensor translation key.
BrickController2/BrickController2/PlatformServices/InputDeviceService/InputDeviceServiceBase.cs Adds convenience overload to remove the first matching input device.
BrickController2/BrickController2/PlatformServices/InputDeviceService/IInputDeviceService.cs Adds generic IInputDeviceService<TInputDevice> with IsSupported/IsEnabled.
BrickController2/BrickController2/InputDeviceManagement/Sensors/OrientationSensorController.cs New controller converting quaternion readings to Pitch/Roll/Yaw axis events.
BrickController2/BrickController2/InputDeviceManagement/Sensors/InputSensorService.cs New service that conditionally registers the orientation sensor controller based on prefs/support.
BrickController2/BrickController2/InputDeviceManagement/DI/InputDeviceManagementModule.cs Registers the new sensor input-device service in Autofac.
BrickController2/BrickController2/Extensions/ContainerBuilderExtensions.cs Adds DI helper overload to register typed input-device services.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

using BrickController2.UI.Services.Dialog;
using BrickController2.UI.Services.Localization;
using BrickController2.UI.Services.Navigation;
using BrickController2.UI.Services.Preferences;
where TInputDeviceService : IInputDeviceService<TInputDevice>, IStartable
where TInputDevice : class, IInputDevice
{
var registrationBuilder = RegisterInputDeviceService<TInputDeviceService>(builder)
Comment on lines +51 to +57
private void RaiseEvents((string eventName, float value)[] axisEvents)
{
var events = axisEvents
.Where(e => HasValueChanged(e.eventName, e.value))
.ToDictionary(e => (InputDeviceEventType.Axis, e.eventName), e => e.value);

RaiseEvent(events);
@vicocz vicocz changed the title [PoC] Orionetation Sensor as input device [PoC] Orientation Sensor as input device May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants