Input events test page#190
Draft
vicocz wants to merge 9 commits into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a PoC “input events” view on the existing Device page by wiring certain Device implementations (e.g., LEGO Remote Control) into a connector interface that can push live input events into the UI.
Changes:
- Introduces
IInputDeviceConnector/IDynamicInputDeviceto connect devices to a consumer that can receive input events. - Updates
RemoteControlto act as a dynamic input device and raise button events through the connector. - Extends
DevicePageViewModel+DevicePage.xamlto connect/disconnect and render a live list of input events.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| BrickController2/BrickController2/UI/ViewModels/DevicePageViewModel.cs | Connects to IDynamicInputDevice on page lifecycle and maintains an observable list of input events for UI display. |
| BrickController2/BrickController2/UI/Pages/DevicePage.xaml | Adds an “Input events” section showing the live event list when the device supports input events. |
| BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs | Makes the base input-device implementation also an IInputDeviceConnector so devices can call back into it. |
| BrickController2/BrickController2/PlatformServices/InputDevice/IInputDeviceConnector.cs | Adds a connector interface used by devices to filter changes and raise input events. |
| BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs | Adds an interface for Device types that can attach/detach an input-event controller. |
| BrickController2/BrickController2/DeviceManagement/Lego/RemoteControl.cs | Implements IDynamicInputDevice and forwards remote button events to the currently connected connector. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+149
to
+171
| void IInputDeviceConnector.RaiseEvent(IDictionary<(InputDeviceEventType, string), float> events) | ||
| { | ||
| foreach (KeyValuePair<(InputDeviceEventType EventType, string EventCode), float> inputEvent in events) | ||
| { | ||
| var item = InputEventList.FirstOrDefault(x => x.EventCode == inputEvent.Key.EventCode && | ||
| x.EventType == inputEvent.Key.EventType); | ||
|
|
||
| if (item is null) | ||
| { | ||
| InputEventList.Add(new InputDeviceEventViewModel(inputEvent.Key.EventType, | ||
| inputEvent.Key.EventCode, | ||
| inputEvent.Value)); | ||
| } | ||
| else if (AXIS_DELTA_VALUE >= Math.Abs(inputEvent.Value)) | ||
| { | ||
| InputEventList.Remove(item); | ||
| } | ||
| else | ||
| { | ||
| item.Value = inputEvent.Value; | ||
| } | ||
| } | ||
| } |
Comment on lines
408
to
414
| private void OnDeviceDisconnected(Device device) | ||
| { | ||
| // clear input events | ||
| ResetInputEvents(); | ||
| // update command enablement | ||
| UpdateCommandsAvailability(); | ||
| } |
added 2 commits
June 10, 2026 22:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow BLE devices with input capability, such as LEGO Controller, to present their events on Device Test Page.
