Skip to content

Input events test page#190

Draft
vicocz wants to merge 9 commits into
defaultfrom
local/input-events-test-page
Draft

Input events test page#190
vicocz wants to merge 9 commits into
defaultfrom
local/input-events-test-page

Conversation

@vicocz

@vicocz vicocz commented Dec 23, 2025

Copy link
Copy Markdown
Owner

Allow BLE devices with input capability, such as LEGO Controller, to present their events on Device Test Page.
image

Copilot AI left a comment

Copy link
Copy Markdown

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 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 / IDynamicInputDevice to connect devices to a consumer that can receive input events.
  • Updates RemoteControl to act as a dynamic input device and raise button events through the connector.
  • Extends DevicePageViewModel + DevicePage.xaml to 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.

@vicocz vicocz changed the title [PoC] Input events test page Input events test page Jun 10, 2026
@vicocz vicocz requested a review from Copilot June 10, 2026 20:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

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();
}
@vicocz vicocz added this to the 2026.2 milestone Jun 10, 2026
Vit Nemecky added 2 commits June 10, 2026 22:56
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.

3 participants