From 6ef7657c0e7cb0a16722708e5321cb27a6e12afb Mon Sep 17 00:00:00 2001 From: Vit Nemecky Date: Mon, 22 Dec 2025 23:44:10 +0100 Subject: [PATCH 1/4] PoC - input events on Test Page --- .../GameController/GameControllerService.cs | 8 +++---- .../GameController/GameControllerService.cs | 2 +- .../GameController/GamepadController.cs | 2 +- .../GameController/GameControllerService.cs | 2 +- .../GameController/GamepadController.cs | 2 +- .../DeviceManagement/Lego/Lego.cs | 5 ++++- .../Lego/LegoRemoteController.cs | 10 ++++----- .../DeviceManagement/Lego/RemoteControl.cs | 8 +++---- .../InputDevice/IDynamicInputDevice.cs | 15 +++++++++++++ .../InputDevice/IInputDevice.cs | 18 +++++++++++++++- .../InputDevice/InputDeviceBase.cs | 16 +++++++------- .../BrickController2/UI/Pages/DevicePage.xaml | 21 +++++++++++++++++++ .../UI/ViewModels/DevicePageViewModel.cs | 16 ++++++++++++++ 13 files changed, 98 insertions(+), 27 deletions(-) create mode 100644 BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs diff --git a/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs b/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs index 5433707a..ecade061 100644 --- a/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs +++ b/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs @@ -38,7 +38,7 @@ internal void MainActivityOnInputDeviceAdded(int deviceId) /// deviceId of InputDevice internal void MainActivityOnInputDeviceRemoved(int deviceId) { - if (TryRemoveInputDevice(x => x.InputDeviceDevice.Id == deviceId, out var controller)) + if (TryRemoveInputDevice(x => x.SourceInputDevice.Id == deviceId, out var controller)) { _logger.LogInformation("InputDeviceDevice has been removed DeviceId:{id}, InputDeviceId:{controllerId}", deviceId, controller.InputDeviceId); @@ -66,12 +66,12 @@ internal void MainActivityOnInputDeviceChanged(int deviceId) else if (controller != null) { // handle change - remove and then add it again - TryRemoveInputDevice(x => x.InputDeviceDevice.Id == deviceId, out _); + TryRemoveInputDevice(x => x.SourceInputDevice.Id == deviceId, out _); } AddGameControllerDevice(device); } } - else if (TryRemoveInputDevice(x => x.InputDeviceDevice.Id == deviceId, out var controller)) + else if (TryRemoveInputDevice(x => x.SourceInputDevice.Id == deviceId, out var controller)) { _logger.LogInformation("InputDeviceDevice has been removed DeviceId:{id}, InputDeviceId:{controllerId}", deviceId, controller.InputDeviceId); @@ -127,7 +127,7 @@ private void AddGameControllerDevice(InputDevice gamepad) } private bool TryGetControllerByDeviceId(int deviceId, [MaybeNullWhen(false)] out GamepadController controller) - => TryGetInputDevice(x => x.InputDeviceDevice.Id == deviceId, out controller); + => TryGetInputDevice(x => x.SourceInputDevice.Id == deviceId, out controller); private static bool TryGetGamepadDevice(int deviceId, [MaybeNullWhen(false)] out InputDevice device) { diff --git a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs index 84c77338..1c1e4681 100644 --- a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs +++ b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs @@ -51,7 +51,7 @@ private void Gamepad_GamepadRemoved(object? sender, Gamepad gamepad) // ensure stopped in UI thread _ = _mainThreadService.RunOnMainThread(() => { - if (TryRemoveInputDevice(x => x.InputDeviceDevice == gamepad, out var controller)) + if (TryRemoveInputDevice(x => x.SourceInputDevice == gamepad, out var controller)) { _logger.LogInformation("Controller device has been removed InputDeviceId:{controllerId}", controller.InputDeviceId); } diff --git a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs index 989d332a..0f95bec5 100644 --- a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs +++ b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs @@ -52,7 +52,7 @@ public override void Stop() private void Timer_Tick(object? sender, object e) { - var currentReading = InputDeviceDevice.GetCurrentReading(); + var currentReading = SourceInputDevice.GetCurrentReading(); var currentEvents = currentReading .Enumerate() diff --git a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs index cea0cc82..41270b8c 100644 --- a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs +++ b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs @@ -66,7 +66,7 @@ private void ControllerRemoved(GCController controller) { lock (_lockObject) { - if (TryRemoveInputDevice(x => x.InputDeviceDevice == controller, out var controllerDevice)) + if (TryRemoveInputDevice(x => x.SourceInputDevice == controller, out var controllerDevice)) { _logger.LogInformation("Controller device has been removed InputDeviceId:{controllerId}", controllerDevice.InputDeviceId); } diff --git a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs index e118df10..8d8e7559 100644 --- a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs +++ b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs @@ -35,7 +35,7 @@ public GamepadController(IInputDeviceEventServiceInternal service, GCController public void Dispose() { - InputDeviceDevice.Dispose(); + SourceInputDevice.Dispose(); } private void SetupController(GCController gameController, GameControllerType gameControllerType) diff --git a/BrickController2/BrickController2/DeviceManagement/Lego/Lego.cs b/BrickController2/BrickController2/DeviceManagement/Lego/Lego.cs index e39d46ec..deb06b80 100644 --- a/BrickController2/BrickController2/DeviceManagement/Lego/Lego.cs +++ b/BrickController2/BrickController2/DeviceManagement/Lego/Lego.cs @@ -1,6 +1,8 @@ -using BrickController2.DeviceManagement.DI; +using Autofac; +using BrickController2.DeviceManagement.DI; using BrickController2.DeviceManagement.Vendors; using BrickController2.Extensions; +using BrickController2.PlatformServices.InputDevice; namespace BrickController2.DeviceManagement.Lego; @@ -24,6 +26,7 @@ protected override void Register(VendorBuilder builder) // input devices builder.ContainerBuilder.RegisterDevice(DeviceType.RemoteControl); + builder.ContainerBuilder.RegisterType().Keyed(DeviceType.RemoteControl); builder.ContainerBuilder.RegisterInputDeviceService(); // device manager diff --git a/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs b/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs index ef506a5f..d9426419 100644 --- a/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs +++ b/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs @@ -27,7 +27,7 @@ public override void Start() { base.Start(); // link Lego RemoteControl and connect - InputDeviceDevice.ConnectInputController(this); + SourceInputDevice.ConnectInputController(this); // trigger device connection, but do not wait here _ = ConnectInputDeviceAsync(); } @@ -36,7 +36,7 @@ public override void Stop() { base.Stop(); // trigger device disconnection, but do not wait here - _ = InputDeviceDevice.DisconnectAsync().ContinueWith(t => + _ = SourceInputDevice.DisconnectAsync().ContinueWith(t => { if (t.Exception != null) { @@ -44,18 +44,18 @@ public override void Stop() } }, TaskContinuationOptions.OnlyOnFaulted); // reset Lego RemoteControl link - InputDeviceDevice.DisconnectInputController(); + SourceInputDevice.DisconnectInputController(); } private async Task ConnectInputDeviceAsync(CancellationToken token = default) { try { - await InputDeviceDevice.ConnectAsync(false, + await SourceInputDevice.ConnectAsync(false, (d) => { // reset events on random disconnection - InputDeviceDevice?.ResetEvents(); + SourceInputDevice?.ResetEvents(); }, channelConfigurations: [], startOutputProcessing: false, diff --git a/BrickController2/BrickController2/DeviceManagement/Lego/RemoteControl.cs b/BrickController2/BrickController2/DeviceManagement/Lego/RemoteControl.cs index a8f8fb3e..d2ec1ed7 100644 --- a/BrickController2/BrickController2/DeviceManagement/Lego/RemoteControl.cs +++ b/BrickController2/BrickController2/DeviceManagement/Lego/RemoteControl.cs @@ -15,13 +15,13 @@ namespace BrickController2.DeviceManagement.Lego; /// /// Represents a LEGO® Powered Up 88010 Remote Control /// -internal class RemoteControl : BluetoothDevice +internal class RemoteControl : BluetoothDevice, IDynamicInputDevice { private const string ENABLED_SETTING_NAME = "RemoteControlEnabled"; private const bool DEFAULT_ENABLED = false; private IGattCharacteristic? _characteristic; - private InputDeviceBase? _inputController; + private IInputDevice? _inputController; public RemoteControl(string name, string address, IEnumerable settings, IDeviceRepository deviceRepository, IBluetoothLEService bleService) : base(name, address, deviceRepository, bleService) @@ -41,12 +41,12 @@ public RemoteControl(string name, string address, IEnumerable sett public override void SetOutput(int channel, float value) => throw new InvalidOperationException(); - internal void ConnectInputController(TController inputController) where TController : InputDeviceBase + public void ConnectInputController(IInputDevice inputController) { _inputController = inputController; } - internal void DisconnectInputController() + public void DisconnectInputController() { _inputController = default; } diff --git a/BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs b/BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs new file mode 100644 index 00000000..0c232a7c --- /dev/null +++ b/BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace BrickController2.PlatformServices.InputDevice; + +public interface IDynamicInputDevice +{ +} + + +public interface IDynamicInputDevice : IDynamicInputDevice + where TDevice : class +{ + void ConnectInputController(IInputDevice controller); + void DisconnectInputController(); +} \ No newline at end of file diff --git a/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs b/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs index d072e662..1d4d4155 100644 --- a/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs +++ b/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs @@ -1,4 +1,6 @@ -namespace BrickController2.PlatformServices.InputDevice; +using System.Collections.Generic; + +namespace BrickController2.PlatformServices.InputDevice; public interface IInputDevice { @@ -28,3 +30,17 @@ public interface IInputDevice /// void Stop(); } + + +public interface IInputDevice : IInputDevice + where TDevice : class +{ + /// + /// Instance of source input device + /// + TDevice SourceInputDevice { get; } + + internal bool HasValueChanged(string axisName, float value); + + internal void RaiseEvent(IDictionary<(InputDeviceEventType, string), float> events); +} diff --git a/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs b/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs index eb213228..e6c413b6 100644 --- a/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs +++ b/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs @@ -8,9 +8,9 @@ namespace BrickController2.PlatformServices.InputDevice; /// /// abstract base class for input devices /// -/// Type of native instance of inputdevice device -public abstract class InputDeviceBase : IInputDevice - where TInputDeviceDevice : class +/// Type of native instance of inputdevice device +public abstract class InputDeviceBase : IInputDevice + where TSourceInputDevice : class { /// stored last value per axis to detect changes private readonly Dictionary _lastAxisValues = []; @@ -19,10 +19,10 @@ public abstract class InputDeviceBase : IInputDevice private readonly IInputDeviceEventServiceInternal _inputDeviceManagerService; protected InputDeviceBase(IInputDeviceEventServiceInternal inputDeviceManagerService, - TInputDeviceDevice inputDeviceDevice) + TSourceInputDevice sourceInputDevice) { _inputDeviceManagerService = inputDeviceManagerService; - InputDeviceDevice = inputDeviceDevice; + SourceInputDevice = sourceInputDevice; } /// @@ -44,7 +44,7 @@ protected InputDeviceBase(IInputDeviceEventServiceInternal inputDeviceManagerSer /// /// Native instance of inputdevice device /// - public TInputDeviceDevice InputDeviceDevice { get; } + public TSourceInputDevice SourceInputDevice { get; } /// /// start the inputdevice and publishing of its events @@ -66,7 +66,7 @@ public virtual void Stop() protected bool ContainsAxisValue(string axisName) => _lastAxisValues.ContainsKey(axisName); - protected internal bool HasValueChanged(string axisName, float value) + public bool HasValueChanged(string axisName, float value) { // get last reported value or the default one _lastAxisValues.TryGetValue(axisName, out float lastValue); @@ -80,7 +80,7 @@ protected internal bool HasValueChanged(string axisName, float value) return true; } - protected internal void RaiseEvent(IDictionary<(InputDeviceEventType, string), float> events) + public void RaiseEvent(IDictionary<(InputDeviceEventType, string), float> events) { if (!events.Any()) { diff --git a/BrickController2/BrickController2/UI/Pages/DevicePage.xaml b/BrickController2/BrickController2/UI/Pages/DevicePage.xaml index a65f72db..c5475454 100644 --- a/BrickController2/BrickController2/UI/Pages/DevicePage.xaml +++ b/BrickController2/BrickController2/UI/Pages/DevicePage.xaml @@ -133,6 +133,27 @@ + + + + + + + + + + + + + + + + diff --git a/BrickController2/BrickController2/UI/ViewModels/DevicePageViewModel.cs b/BrickController2/BrickController2/UI/ViewModels/DevicePageViewModel.cs index a4515b61..cde0fb9f 100644 --- a/BrickController2/BrickController2/UI/ViewModels/DevicePageViewModel.cs +++ b/BrickController2/BrickController2/UI/ViewModels/DevicePageViewModel.cs @@ -1,13 +1,16 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Windows.Input; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Maui.Controls; using BrickController2.CreationManagement; using BrickController2.DeviceManagement; using BrickController2.Helpers; +using BrickController2.PlatformServices.InputDevice; using BrickController2.UI.Commands; using BrickController2.UI.Services.Navigation; using BrickController2.UI.Services.Dialog; @@ -32,6 +35,7 @@ public DevicePageViewModel( ITranslationService translationService, IDeviceManager deviceManager, IDialogService dialogService, + IServiceProvider serviceProvider, NavigationParameters parameters) : base(navigationService, translationService) { @@ -45,6 +49,8 @@ public DevicePageViewModel( .Range(0, Device.NumberOfChannels) .Select(channel => new DeviceOutputViewModel(navigationService, Device, channel)) .ToArray(); + // get optional linked input device, if exists + InputDevice = serviceProvider.GetKeyedService(Device.DeviceType); RenameCommand = new SafeCommand(async () => await RenameDeviceAsync()); BuWizzOutputLevelChangedCommand = new SafeCommand(outputLevel => SetBuWizzOutputLevel(outputLevel)); @@ -57,6 +63,7 @@ public DevicePageViewModel( } public Device Device { get; } + public IInputDevice? InputDevice { get; } public bool IsBuWizzDevice => Device.DeviceType == DeviceType.BuWizz; public bool IsBuWizz2Device => Device.DeviceType == DeviceType.BuWizz2; public bool CanBePowerSource => Device.CanBePowerSource; @@ -70,6 +77,8 @@ public DevicePageViewModel( public bool IsAdvertisingDevice => Device is BluetoothAdvertisingDevice; + public bool IsInputDevice => Device is IDynamicInputDevice; + public bool IsServoOrStepperSupported => DeviceOutputs.Any(x => x.IsServoOrStepperSupported); public ICommand RenameCommand { get; } @@ -84,6 +93,8 @@ public DevicePageViewModel( public IEnumerable DeviceOutputs { get; } + public ObservableCollection InputEventList { get; } = new(); + public override async void OnAppearing() { _isDisappearing = false; @@ -104,6 +115,11 @@ await _dialogService.ShowMessageBoxAsync( } } + if (InputDevice is not null) + { + //InputDevice.InputEventReceived += OnInputDeviceEventReceived; + } + _connectionTokenSource = new CancellationTokenSource(); _connectionTask = ConnectAsync(); } From 1f1284398366cbe605aeda2c54be5b652c696d6c Mon Sep 17 00:00:00 2001 From: Vit Nemecky Date: Tue, 23 Dec 2025 23:13:03 +0100 Subject: [PATCH 2/4] Show button events for lego controller on Test Page --- .../GameController/GameControllerService.cs | 8 +-- .../GameController/GameControllerService.cs | 2 +- .../GameController/GamepadController.cs | 2 +- .../GameController/GameControllerService.cs | 2 +- .../GameController/GamepadController.cs | 2 +- .../Lego/LegoRemoteController.cs | 10 ++-- .../DeviceManagement/Lego/RemoteControl.cs | 16 +++--- .../InputDevice/IDynamicInputDevice.cs | 14 ++--- .../InputDevice/IInputDevice.cs | 14 ----- .../InputDevice/IInputDeviceConnector.cs | 10 ++++ .../InputDevice/InputDeviceBase.cs | 6 +-- .../UI/ViewModels/DevicePageViewModel.cs | 54 +++++++++++++++---- 12 files changed, 82 insertions(+), 58 deletions(-) create mode 100644 BrickController2/BrickController2/PlatformServices/InputDevice/IInputDeviceConnector.cs diff --git a/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs b/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs index ecade061..248e42c8 100644 --- a/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs +++ b/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs @@ -38,7 +38,7 @@ internal void MainActivityOnInputDeviceAdded(int deviceId) /// deviceId of InputDevice internal void MainActivityOnInputDeviceRemoved(int deviceId) { - if (TryRemoveInputDevice(x => x.SourceInputDevice.Id == deviceId, out var controller)) + if (TryRemoveInputDevice(x => x.InputInputDevice.Id == deviceId, out var controller)) { _logger.LogInformation("InputDeviceDevice has been removed DeviceId:{id}, InputDeviceId:{controllerId}", deviceId, controller.InputDeviceId); @@ -66,12 +66,12 @@ internal void MainActivityOnInputDeviceChanged(int deviceId) else if (controller != null) { // handle change - remove and then add it again - TryRemoveInputDevice(x => x.SourceInputDevice.Id == deviceId, out _); + TryRemoveInputDevice(x => x.InputInputDevice.Id == deviceId, out _); } AddGameControllerDevice(device); } } - else if (TryRemoveInputDevice(x => x.SourceInputDevice.Id == deviceId, out var controller)) + else if (TryRemoveInputDevice(x => x.InputInputDevice.Id == deviceId, out var controller)) { _logger.LogInformation("InputDeviceDevice has been removed DeviceId:{id}, InputDeviceId:{controllerId}", deviceId, controller.InputDeviceId); @@ -127,7 +127,7 @@ private void AddGameControllerDevice(InputDevice gamepad) } private bool TryGetControllerByDeviceId(int deviceId, [MaybeNullWhen(false)] out GamepadController controller) - => TryGetInputDevice(x => x.SourceInputDevice.Id == deviceId, out controller); + => TryGetInputDevice(x => x.InputInputDevice.Id == deviceId, out controller); private static bool TryGetGamepadDevice(int deviceId, [MaybeNullWhen(false)] out InputDevice device) { diff --git a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs index 1c1e4681..c194a685 100644 --- a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs +++ b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs @@ -51,7 +51,7 @@ private void Gamepad_GamepadRemoved(object? sender, Gamepad gamepad) // ensure stopped in UI thread _ = _mainThreadService.RunOnMainThread(() => { - if (TryRemoveInputDevice(x => x.SourceInputDevice == gamepad, out var controller)) + if (TryRemoveInputDevice(x => x.InputInputDevice == gamepad, out var controller)) { _logger.LogInformation("Controller device has been removed InputDeviceId:{controllerId}", controller.InputDeviceId); } diff --git a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs index 0f95bec5..db70032f 100644 --- a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs +++ b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs @@ -52,7 +52,7 @@ public override void Stop() private void Timer_Tick(object? sender, object e) { - var currentReading = SourceInputDevice.GetCurrentReading(); + var currentReading = InputInputDevice.GetCurrentReading(); var currentEvents = currentReading .Enumerate() diff --git a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs index 41270b8c..31b6754b 100644 --- a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs +++ b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs @@ -66,7 +66,7 @@ private void ControllerRemoved(GCController controller) { lock (_lockObject) { - if (TryRemoveInputDevice(x => x.SourceInputDevice == controller, out var controllerDevice)) + if (TryRemoveInputDevice(x => x.InputInputDevice == controller, out var controllerDevice)) { _logger.LogInformation("Controller device has been removed InputDeviceId:{controllerId}", controllerDevice.InputDeviceId); } diff --git a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs index 8d8e7559..a6d6f243 100644 --- a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs +++ b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs @@ -35,7 +35,7 @@ public GamepadController(IInputDeviceEventServiceInternal service, GCController public void Dispose() { - SourceInputDevice.Dispose(); + InputInputDevice.Dispose(); } private void SetupController(GCController gameController, GameControllerType gameControllerType) diff --git a/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs b/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs index d9426419..d24b51c7 100644 --- a/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs +++ b/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs @@ -27,7 +27,7 @@ public override void Start() { base.Start(); // link Lego RemoteControl and connect - SourceInputDevice.ConnectInputController(this); + InputInputDevice.ConnectInputController(this); // trigger device connection, but do not wait here _ = ConnectInputDeviceAsync(); } @@ -36,7 +36,7 @@ public override void Stop() { base.Stop(); // trigger device disconnection, but do not wait here - _ = SourceInputDevice.DisconnectAsync().ContinueWith(t => + _ = InputInputDevice.DisconnectAsync().ContinueWith(t => { if (t.Exception != null) { @@ -44,18 +44,18 @@ public override void Stop() } }, TaskContinuationOptions.OnlyOnFaulted); // reset Lego RemoteControl link - SourceInputDevice.DisconnectInputController(); + InputInputDevice.DisconnectInputController(); } private async Task ConnectInputDeviceAsync(CancellationToken token = default) { try { - await SourceInputDevice.ConnectAsync(false, + await InputInputDevice.ConnectAsync(false, (d) => { // reset events on random disconnection - SourceInputDevice?.ResetEvents(); + InputInputDevice?.ResetEvents(); }, channelConfigurations: [], startOutputProcessing: false, diff --git a/BrickController2/BrickController2/DeviceManagement/Lego/RemoteControl.cs b/BrickController2/BrickController2/DeviceManagement/Lego/RemoteControl.cs index d2ec1ed7..c125b773 100644 --- a/BrickController2/BrickController2/DeviceManagement/Lego/RemoteControl.cs +++ b/BrickController2/BrickController2/DeviceManagement/Lego/RemoteControl.cs @@ -15,13 +15,13 @@ namespace BrickController2.DeviceManagement.Lego; /// /// Represents a LEGO® Powered Up 88010 Remote Control /// -internal class RemoteControl : BluetoothDevice, IDynamicInputDevice +internal class RemoteControl : BluetoothDevice, IDynamicInputDevice { private const string ENABLED_SETTING_NAME = "RemoteControlEnabled"; private const bool DEFAULT_ENABLED = false; private IGattCharacteristic? _characteristic; - private IInputDevice? _inputController; + private IInputDeviceConnector? _inputDeviceConnector; public RemoteControl(string name, string address, IEnumerable settings, IDeviceRepository deviceRepository, IBluetoothLEService bleService) : base(name, address, deviceRepository, bleService) @@ -41,14 +41,14 @@ public RemoteControl(string name, string address, IEnumerable sett public override void SetOutput(int channel, float value) => throw new InvalidOperationException(); - public void ConnectInputController(IInputDevice inputController) + public void ConnectInputController(IInputDeviceConnector inputController) { - _inputController = inputController; + _inputDeviceConnector = inputController; } public void DisconnectInputController() { - _inputController = default; + _inputDeviceConnector = default; } internal void ResetEvents() => RaiseButtonEvents( @@ -156,16 +156,16 @@ private void OnButtonEvents(string plus, string stop, string minus, ReadOnlySpan private void RaiseButtonEvents((string eventName, float value)[] buttonEvents) { - if (_inputController is null) + if (_inputDeviceConnector is null) { return; } var events = buttonEvents - .Where(e => _inputController.HasValueChanged(e.eventName, e.value)) + .Where(e => _inputDeviceConnector.HasValueChanged(e.eventName, e.value)) .ToDictionary(e => (InputDeviceEventType.Button, e.eventName), e => e.value); - _inputController.RaiseEvent(events); + _inputDeviceConnector.RaiseEvent(events); } private static float GetButtonValue(byte flag) => flag != 0 ? BUTTON_PRESSED : BUTTON_RELEASED; diff --git a/BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs b/BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs index 0c232a7c..751366c5 100644 --- a/BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs +++ b/BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs @@ -1,15 +1,7 @@ -using System.Collections.Generic; +namespace BrickController2.PlatformServices.InputDevice; -namespace BrickController2.PlatformServices.InputDevice; - -public interface IDynamicInputDevice -{ -} - - -public interface IDynamicInputDevice : IDynamicInputDevice - where TDevice : class +internal interface IDynamicInputDevice { - void ConnectInputController(IInputDevice controller); + void ConnectInputController(IInputDeviceConnector controller); void DisconnectInputController(); } \ No newline at end of file diff --git a/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs b/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs index 1d4d4155..d3e39cdb 100644 --- a/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs +++ b/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs @@ -30,17 +30,3 @@ public interface IInputDevice /// void Stop(); } - - -public interface IInputDevice : IInputDevice - where TDevice : class -{ - /// - /// Instance of source input device - /// - TDevice SourceInputDevice { get; } - - internal bool HasValueChanged(string axisName, float value); - - internal void RaiseEvent(IDictionary<(InputDeviceEventType, string), float> events); -} diff --git a/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDeviceConnector.cs b/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDeviceConnector.cs new file mode 100644 index 00000000..67bc615e --- /dev/null +++ b/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDeviceConnector.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace BrickController2.PlatformServices.InputDevice; + +internal interface IInputDeviceConnector +{ + internal bool HasValueChanged(string axisName, float value); + + internal void RaiseEvent(IDictionary<(InputDeviceEventType, string), float> events); +} diff --git a/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs b/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs index e6c413b6..323c41c6 100644 --- a/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs +++ b/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs @@ -9,7 +9,7 @@ namespace BrickController2.PlatformServices.InputDevice; /// abstract base class for input devices /// /// Type of native instance of inputdevice device -public abstract class InputDeviceBase : IInputDevice +public abstract class InputDeviceBase : IInputDevice, IInputDeviceConnector where TSourceInputDevice : class { /// stored last value per axis to detect changes @@ -22,7 +22,7 @@ protected InputDeviceBase(IInputDeviceEventServiceInternal inputDeviceManagerSer TSourceInputDevice sourceInputDevice) { _inputDeviceManagerService = inputDeviceManagerService; - SourceInputDevice = sourceInputDevice; + InputInputDevice = sourceInputDevice; } /// @@ -44,7 +44,7 @@ protected InputDeviceBase(IInputDeviceEventServiceInternal inputDeviceManagerSer /// /// Native instance of inputdevice device /// - public TSourceInputDevice SourceInputDevice { get; } + public TSourceInputDevice InputInputDevice { get; } /// /// start the inputdevice and publishing of its events diff --git a/BrickController2/BrickController2/UI/ViewModels/DevicePageViewModel.cs b/BrickController2/BrickController2/UI/ViewModels/DevicePageViewModel.cs index cde0fb9f..964eed4b 100644 --- a/BrickController2/BrickController2/UI/ViewModels/DevicePageViewModel.cs +++ b/BrickController2/BrickController2/UI/ViewModels/DevicePageViewModel.cs @@ -5,7 +5,6 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Input; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Maui.Controls; using BrickController2.CreationManagement; using BrickController2.DeviceManagement; @@ -17,13 +16,15 @@ using BrickController2.UI.Services.Translation; using Device = BrickController2.DeviceManagement.Device; using static BrickController2.CreationManagement.ControllerDefaults; +using static BrickController2.PlatformServices.InputDevice.InputDevices; namespace BrickController2.UI.ViewModels { - public class DevicePageViewModel : PageViewModelBase + public class DevicePageViewModel : PageViewModelBase, IInputDeviceConnector { private readonly IDeviceManager _deviceManager; private readonly IDialogService _dialogService; + private readonly Dictionary _lastAxisValues = []; private CancellationTokenSource? _connectionTokenSource; private Task? _connectionTask; @@ -49,8 +50,6 @@ public DevicePageViewModel( .Range(0, Device.NumberOfChannels) .Select(channel => new DeviceOutputViewModel(navigationService, Device, channel)) .ToArray(); - // get optional linked input device, if exists - InputDevice = serviceProvider.GetKeyedService(Device.DeviceType); RenameCommand = new SafeCommand(async () => await RenameDeviceAsync()); BuWizzOutputLevelChangedCommand = new SafeCommand(outputLevel => SetBuWizzOutputLevel(outputLevel)); @@ -63,7 +62,7 @@ public DevicePageViewModel( } public Device Device { get; } - public IInputDevice? InputDevice { get; } + internal IDynamicInputDevice? InputDevice => Device as IDynamicInputDevice; public bool IsBuWizzDevice => Device.DeviceType == DeviceType.BuWizz; public bool IsBuWizz2Device => Device.DeviceType == DeviceType.BuWizz2; public bool CanBePowerSource => Device.CanBePowerSource; @@ -115,10 +114,8 @@ await _dialogService.ShowMessageBoxAsync( } } - if (InputDevice is not null) - { - //InputDevice.InputEventReceived += OnInputDeviceEventReceived; - } + // connect input device if available + InputDevice?.ConnectInputController(this); _connectionTokenSource = new CancellationTokenSource(); _connectionTask = ConnectAsync(); @@ -128,6 +125,9 @@ public override async void OnDisappearing() { base.OnDisappearing(); + // disconnect input device if available + InputDevice?.DisconnectInputController(); + if (_connectionTokenSource is not null && _connectionTask is not null) { _connectionTokenSource?.Cancel(); @@ -137,6 +137,42 @@ public override async void OnDisappearing() await Device.DisconnectAsync(); } + + bool IInputDeviceConnector.HasValueChanged(string axisName, float value) + { + // get last reported value or the default one + _lastAxisValues.TryGetValue(axisName, out float lastValue); + // skip value if there is no change + if (AreAlmostEqual(value, lastValue)) + { + return false; + } + // persist + _lastAxisValues[axisName] = value; + return true; + } + + void IInputDeviceConnector.RaiseEvent(IDictionary<(InputDeviceEventType, string), float> events) + { + foreach (var inputDeviceEvent in events) + { + var item = InputEventList.FirstOrDefault(x => x.EventCode == inputDeviceEvent.Key.Item2); + + if (AXIS_DELTA_VALUE >= Math.Abs(inputDeviceEvent.Value)) + { + InputEventList.Remove(item); + } + else if (item != null) + { + item.Value = inputDeviceEvent.Value; + } + else + { + InputEventList.Add(new InputDeviceEventViewModel(inputDeviceEvent.Key.Item1, inputDeviceEvent.Key.Item2, inputDeviceEvent.Value)); + } + } + } + private async Task RenameDeviceAsync() { try From a09939cf0182d5d1737dc3e3dd1dd7a7803c0bc9 Mon Sep 17 00:00:00 2001 From: Vit Nemecky Date: Tue, 23 Dec 2025 23:16:48 +0100 Subject: [PATCH 3/4] revert naming change --- .../GameController/GameControllerService.cs | 8 ++++---- .../GameController/GameControllerService.cs | 2 +- .../GameController/GamepadController.cs | 2 +- .../GameController/GameControllerService.cs | 2 +- .../GameController/GamepadController.cs | 2 +- .../DeviceManagement/Lego/LegoRemoteController.cs | 10 +++++----- .../PlatformServices/InputDevice/InputDeviceBase.cs | 12 ++++++------ 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs b/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs index 248e42c8..5433707a 100644 --- a/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs +++ b/BrickController2/BrickController2.Android/PlatformServices/GameController/GameControllerService.cs @@ -38,7 +38,7 @@ internal void MainActivityOnInputDeviceAdded(int deviceId) /// deviceId of InputDevice internal void MainActivityOnInputDeviceRemoved(int deviceId) { - if (TryRemoveInputDevice(x => x.InputInputDevice.Id == deviceId, out var controller)) + if (TryRemoveInputDevice(x => x.InputDeviceDevice.Id == deviceId, out var controller)) { _logger.LogInformation("InputDeviceDevice has been removed DeviceId:{id}, InputDeviceId:{controllerId}", deviceId, controller.InputDeviceId); @@ -66,12 +66,12 @@ internal void MainActivityOnInputDeviceChanged(int deviceId) else if (controller != null) { // handle change - remove and then add it again - TryRemoveInputDevice(x => x.InputInputDevice.Id == deviceId, out _); + TryRemoveInputDevice(x => x.InputDeviceDevice.Id == deviceId, out _); } AddGameControllerDevice(device); } } - else if (TryRemoveInputDevice(x => x.InputInputDevice.Id == deviceId, out var controller)) + else if (TryRemoveInputDevice(x => x.InputDeviceDevice.Id == deviceId, out var controller)) { _logger.LogInformation("InputDeviceDevice has been removed DeviceId:{id}, InputDeviceId:{controllerId}", deviceId, controller.InputDeviceId); @@ -127,7 +127,7 @@ private void AddGameControllerDevice(InputDevice gamepad) } private bool TryGetControllerByDeviceId(int deviceId, [MaybeNullWhen(false)] out GamepadController controller) - => TryGetInputDevice(x => x.InputInputDevice.Id == deviceId, out controller); + => TryGetInputDevice(x => x.InputDeviceDevice.Id == deviceId, out controller); private static bool TryGetGamepadDevice(int deviceId, [MaybeNullWhen(false)] out InputDevice device) { diff --git a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs index c194a685..84c77338 100644 --- a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs +++ b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GameControllerService.cs @@ -51,7 +51,7 @@ private void Gamepad_GamepadRemoved(object? sender, Gamepad gamepad) // ensure stopped in UI thread _ = _mainThreadService.RunOnMainThread(() => { - if (TryRemoveInputDevice(x => x.InputInputDevice == gamepad, out var controller)) + if (TryRemoveInputDevice(x => x.InputDeviceDevice == gamepad, out var controller)) { _logger.LogInformation("Controller device has been removed InputDeviceId:{controllerId}", controller.InputDeviceId); } diff --git a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs index db70032f..989d332a 100644 --- a/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs +++ b/BrickController2/BrickController2.WinUI/PlatformServices/GameController/GamepadController.cs @@ -52,7 +52,7 @@ public override void Stop() private void Timer_Tick(object? sender, object e) { - var currentReading = InputInputDevice.GetCurrentReading(); + var currentReading = InputDeviceDevice.GetCurrentReading(); var currentEvents = currentReading .Enumerate() diff --git a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs index 31b6754b..cea0cc82 100644 --- a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs +++ b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GameControllerService.cs @@ -66,7 +66,7 @@ private void ControllerRemoved(GCController controller) { lock (_lockObject) { - if (TryRemoveInputDevice(x => x.InputInputDevice == controller, out var controllerDevice)) + if (TryRemoveInputDevice(x => x.InputDeviceDevice == controller, out var controllerDevice)) { _logger.LogInformation("Controller device has been removed InputDeviceId:{controllerId}", controllerDevice.InputDeviceId); } diff --git a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs index a6d6f243..e118df10 100644 --- a/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs +++ b/BrickController2/BrickController2.iOS/PlatformServices/GameController/GamepadController.cs @@ -35,7 +35,7 @@ public GamepadController(IInputDeviceEventServiceInternal service, GCController public void Dispose() { - InputInputDevice.Dispose(); + InputDeviceDevice.Dispose(); } private void SetupController(GCController gameController, GameControllerType gameControllerType) diff --git a/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs b/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs index d24b51c7..ef506a5f 100644 --- a/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs +++ b/BrickController2/BrickController2/DeviceManagement/Lego/LegoRemoteController.cs @@ -27,7 +27,7 @@ public override void Start() { base.Start(); // link Lego RemoteControl and connect - InputInputDevice.ConnectInputController(this); + InputDeviceDevice.ConnectInputController(this); // trigger device connection, but do not wait here _ = ConnectInputDeviceAsync(); } @@ -36,7 +36,7 @@ public override void Stop() { base.Stop(); // trigger device disconnection, but do not wait here - _ = InputInputDevice.DisconnectAsync().ContinueWith(t => + _ = InputDeviceDevice.DisconnectAsync().ContinueWith(t => { if (t.Exception != null) { @@ -44,18 +44,18 @@ public override void Stop() } }, TaskContinuationOptions.OnlyOnFaulted); // reset Lego RemoteControl link - InputInputDevice.DisconnectInputController(); + InputDeviceDevice.DisconnectInputController(); } private async Task ConnectInputDeviceAsync(CancellationToken token = default) { try { - await InputInputDevice.ConnectAsync(false, + await InputDeviceDevice.ConnectAsync(false, (d) => { // reset events on random disconnection - InputInputDevice?.ResetEvents(); + InputDeviceDevice?.ResetEvents(); }, channelConfigurations: [], startOutputProcessing: false, diff --git a/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs b/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs index 323c41c6..3fec0527 100644 --- a/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs +++ b/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs @@ -8,9 +8,9 @@ namespace BrickController2.PlatformServices.InputDevice; /// /// abstract base class for input devices /// -/// Type of native instance of inputdevice device -public abstract class InputDeviceBase : IInputDevice, IInputDeviceConnector - where TSourceInputDevice : class +/// Type of native instance of inputdevice device +public abstract class InputDeviceBase : IInputDevice, IInputDeviceConnector + where TInputDeviceDevice : class { /// stored last value per axis to detect changes private readonly Dictionary _lastAxisValues = []; @@ -19,10 +19,10 @@ public abstract class InputDeviceBase : IInputDevice, IInput private readonly IInputDeviceEventServiceInternal _inputDeviceManagerService; protected InputDeviceBase(IInputDeviceEventServiceInternal inputDeviceManagerService, - TSourceInputDevice sourceInputDevice) + TInputDeviceDevice sourceInputDevice) { _inputDeviceManagerService = inputDeviceManagerService; - InputInputDevice = sourceInputDevice; + InputDeviceDevice = sourceInputDevice; } /// @@ -44,7 +44,7 @@ protected InputDeviceBase(IInputDeviceEventServiceInternal inputDeviceManagerSer /// /// Native instance of inputdevice device /// - public TSourceInputDevice InputInputDevice { get; } + public TInputDeviceDevice InputDeviceDevice { get; } /// /// start the inputdevice and publishing of its events From 8dd262bd7ce4e5a6d1473339f6eac841702f02ba Mon Sep 17 00:00:00 2001 From: Vit Nemecky Date: Tue, 23 Dec 2025 23:23:27 +0100 Subject: [PATCH 4/4] revert not needed changes --- .../BrickController2/DeviceManagement/Lego/Lego.cs | 5 +---- .../PlatformServices/InputDevice/IDynamicInputDevice.cs | 2 +- .../PlatformServices/InputDevice/IInputDevice.cs | 4 +--- .../PlatformServices/InputDevice/InputDeviceBase.cs | 4 ++-- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/BrickController2/BrickController2/DeviceManagement/Lego/Lego.cs b/BrickController2/BrickController2/DeviceManagement/Lego/Lego.cs index deb06b80..e39d46ec 100644 --- a/BrickController2/BrickController2/DeviceManagement/Lego/Lego.cs +++ b/BrickController2/BrickController2/DeviceManagement/Lego/Lego.cs @@ -1,8 +1,6 @@ -using Autofac; -using BrickController2.DeviceManagement.DI; +using BrickController2.DeviceManagement.DI; using BrickController2.DeviceManagement.Vendors; using BrickController2.Extensions; -using BrickController2.PlatformServices.InputDevice; namespace BrickController2.DeviceManagement.Lego; @@ -26,7 +24,6 @@ protected override void Register(VendorBuilder builder) // input devices builder.ContainerBuilder.RegisterDevice(DeviceType.RemoteControl); - builder.ContainerBuilder.RegisterType().Keyed(DeviceType.RemoteControl); builder.ContainerBuilder.RegisterInputDeviceService(); // device manager diff --git a/BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs b/BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs index 751366c5..3b84c938 100644 --- a/BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs +++ b/BrickController2/BrickController2/PlatformServices/InputDevice/IDynamicInputDevice.cs @@ -4,4 +4,4 @@ internal interface IDynamicInputDevice { void ConnectInputController(IInputDeviceConnector controller); void DisconnectInputController(); -} \ No newline at end of file +} diff --git a/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs b/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs index d3e39cdb..d072e662 100644 --- a/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs +++ b/BrickController2/BrickController2/PlatformServices/InputDevice/IInputDevice.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace BrickController2.PlatformServices.InputDevice; +namespace BrickController2.PlatformServices.InputDevice; public interface IInputDevice { diff --git a/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs b/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs index 3fec0527..822485d9 100644 --- a/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs +++ b/BrickController2/BrickController2/PlatformServices/InputDevice/InputDeviceBase.cs @@ -19,10 +19,10 @@ public abstract class InputDeviceBase : IInputDevice, IInput private readonly IInputDeviceEventServiceInternal _inputDeviceManagerService; protected InputDeviceBase(IInputDeviceEventServiceInternal inputDeviceManagerService, - TInputDeviceDevice sourceInputDevice) + TInputDeviceDevice inputDeviceDevice) { _inputDeviceManagerService = inputDeviceManagerService; - InputDeviceDevice = sourceInputDevice; + InputDeviceDevice = inputDeviceDevice; } ///