From e7bb03893094d43098e3dd5bbd25703c3ba60747 Mon Sep 17 00:00:00 2001 From: J0EK3R Date: Sun, 5 Jul 2026 11:43:59 +0200 Subject: [PATCH 1/2] bugfix - interface is needed for DI --- .../MouldKing/IMouldKingDeviceManager.cs | 11 +++++++++++ .../DeviceManagement/MouldKing/MK3_8.cs | 2 +- .../DeviceManagement/MouldKing/MK4.cs | 2 +- .../DeviceManagement/MouldKing/MK5.cs | 2 +- .../DeviceManagement/MouldKing/MK6.cs | 2 +- .../DeviceManagement/MouldKing/MKBaseByte.cs | 2 +- .../DeviceManagement/MouldKing/MKBaseNibble.cs | 2 +- .../DeviceManagement/MouldKing/MouldKing.cs | 1 + .../MouldKing/MouldKingDeviceManager.cs | 3 ++- 9 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 BrickController2/BrickController2/DeviceManagement/MouldKing/IMouldKingDeviceManager.cs diff --git a/BrickController2/BrickController2/DeviceManagement/MouldKing/IMouldKingDeviceManager.cs b/BrickController2/BrickController2/DeviceManagement/MouldKing/IMouldKingDeviceManager.cs new file mode 100644 index 00000000..f45f4b88 --- /dev/null +++ b/BrickController2/BrickController2/DeviceManagement/MouldKing/IMouldKingDeviceManager.cs @@ -0,0 +1,11 @@ +using System; + +namespace BrickController2.DeviceManagement.MouldKing; + +/// +/// interface for MouldKingMDeviceanager devices +/// +public interface IMouldKingDeviceManager +{ + ReadOnlyMemory GetAppId(); +} diff --git a/BrickController2/BrickController2/DeviceManagement/MouldKing/MK3_8.cs b/BrickController2/BrickController2/DeviceManagement/MouldKing/MK3_8.cs index 870c7fc7..cdd5dc72 100644 --- a/BrickController2/BrickController2/DeviceManagement/MouldKing/MK3_8.cs +++ b/BrickController2/BrickController2/DeviceManagement/MouldKing/MK3_8.cs @@ -33,7 +33,7 @@ internal class MK3_8 : MKBaseNibble, IDeviceType /// protected override ushort ManufacturerId => MKProtocol.ManufacturerID; - public MK3_8(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, MouldKingDeviceManager mkDeviceManager) + public MK3_8(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, IMouldKingDeviceManager mkDeviceManager) : base(name, address, deviceData, deviceRepository, bleService, mkPlatformService, mkDeviceManager, 0, Telegram_Connect, Telegram_Base) { } diff --git a/BrickController2/BrickController2/DeviceManagement/MouldKing/MK4.cs b/BrickController2/BrickController2/DeviceManagement/MouldKing/MK4.cs index 5bedcb7b..fd062dbd 100644 --- a/BrickController2/BrickController2/DeviceManagement/MouldKing/MK4.cs +++ b/BrickController2/BrickController2/DeviceManagement/MouldKing/MK4.cs @@ -38,7 +38,7 @@ internal class MK4 : MKBaseNibble, IDeviceType /// private static BluetoothAdvertisingDeviceHandler? bluetoothAdvertisingDeviceHandler; - public MK4(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, MouldKingDeviceManager mkDeviceManager) + public MK4(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, IMouldKingDeviceManager mkDeviceManager) : base(name, address, deviceData, deviceRepository, bleService, mkPlatformService, mkDeviceManager, GetInstanceNo(address), Telegram_Connect, Telegram_Base) { } diff --git a/BrickController2/BrickController2/DeviceManagement/MouldKing/MK5.cs b/BrickController2/BrickController2/DeviceManagement/MouldKing/MK5.cs index 09e78b0c..e2aaf860 100644 --- a/BrickController2/BrickController2/DeviceManagement/MouldKing/MK5.cs +++ b/BrickController2/BrickController2/DeviceManagement/MouldKing/MK5.cs @@ -39,7 +39,7 @@ internal class MK5 : MKBaseNibble, IDeviceType /// private byte _turret_lock_Nibble = TURRET_UNLOCKED_NIBBLE; - public MK5(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, MouldKingDeviceManager mkDeviceManager) + public MK5(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, IMouldKingDeviceManager mkDeviceManager) : base(name, address, deviceData, deviceRepository, bleService, mkPlatformService, mkDeviceManager, 0, Telegram_Connect, Telegram_Base) { } diff --git a/BrickController2/BrickController2/DeviceManagement/MouldKing/MK6.cs b/BrickController2/BrickController2/DeviceManagement/MouldKing/MK6.cs index b162c7e0..b3eb8e31 100644 --- a/BrickController2/BrickController2/DeviceManagement/MouldKing/MK6.cs +++ b/BrickController2/BrickController2/DeviceManagement/MouldKing/MK6.cs @@ -53,7 +53,7 @@ internal class MK6 : MKBaseByte, IDeviceType /// protected override int BaseTelegram_ChannelStartOffset => 3; - public MK6(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, MouldKingDeviceManager mkDeviceManager) + public MK6(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, IMouldKingDeviceManager mkDeviceManager) : base(name, address, deviceData, deviceRepository, bleService, mkPlatformService, mkDeviceManager, 3, MK6.Telegram_Connect, MK6.GetTelegramBase(address)) { } diff --git a/BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseByte.cs b/BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseByte.cs index da20feab..ea9c470e 100644 --- a/BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseByte.cs +++ b/BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseByte.cs @@ -30,7 +30,7 @@ internal abstract class MKBaseByte : BluetoothAdvertisingDevice protected readonly int _channelStartOffset; - protected MKBaseByte(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, MouldKingDeviceManager mkDeviceManager,int channelStartOffset, byte[] telegram_Connect, byte[] telegram_Base) + protected MKBaseByte(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, IMouldKingDeviceManager mkDeviceManager,int channelStartOffset, byte[] telegram_Connect, byte[] telegram_Base) : base(name, address, deviceData, deviceRepository, bleService) { _channelStartOffset = channelStartOffset; diff --git a/BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseNibble.cs b/BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseNibble.cs index b90723bb..ed3f91f3 100644 --- a/BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseNibble.cs +++ b/BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseNibble.cs @@ -44,7 +44,7 @@ internal abstract class MKBaseNibble : BluetoothAdvertisingDevice /// protected readonly int _instanceNo; - protected MKBaseNibble(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, MouldKingDeviceManager mkDeviceManager, int instanceNo, byte[] telegram_Connect, byte[] telegram_Base) + protected MKBaseNibble(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, IMouldKingDeviceManager mkDeviceManager, int instanceNo, byte[] telegram_Connect, byte[] telegram_Base) : base(name, address, deviceData, deviceRepository, bleService) { _telegram_Connect = telegram_Connect; diff --git a/BrickController2/BrickController2/DeviceManagement/MouldKing/MouldKing.cs b/BrickController2/BrickController2/DeviceManagement/MouldKing/MouldKing.cs index e5c78f34..6fca8aea 100644 --- a/BrickController2/BrickController2/DeviceManagement/MouldKing/MouldKing.cs +++ b/BrickController2/BrickController2/DeviceManagement/MouldKing/MouldKing.cs @@ -35,6 +35,7 @@ protected override void Register(VendorBuilder builder) // device manager builder.RegisterDeviceManager() + .As() .SingleInstance(); } } diff --git a/BrickController2/BrickController2/DeviceManagement/MouldKing/MouldKingDeviceManager.cs b/BrickController2/BrickController2/DeviceManagement/MouldKing/MouldKingDeviceManager.cs index 6ee506a6..73e56323 100644 --- a/BrickController2/BrickController2/DeviceManagement/MouldKing/MouldKingDeviceManager.cs +++ b/BrickController2/BrickController2/DeviceManagement/MouldKing/MouldKingDeviceManager.cs @@ -7,7 +7,8 @@ namespace BrickController2.DeviceManagement.MouldKing; /// /// Manager for MouldKing devices /// -public class MouldKingDeviceManager : BluetoothDeviceManagerBase +public class MouldKingDeviceManager : BluetoothDeviceManagerBase, + IMouldKingDeviceManager { private const int AppIdentifierLength = 2; // MouldKing protocol defines 2 bytes for the app identifier From ad98d8887d90ebb24b191a82f5ccfbc627c4258a Mon Sep 17 00:00:00 2001 From: Vit Nemecky Date: Sun, 5 Jul 2026 21:27:42 +0200 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../DeviceManagement/MouldKing/IMouldKingDeviceManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BrickController2/BrickController2/DeviceManagement/MouldKing/IMouldKingDeviceManager.cs b/BrickController2/BrickController2/DeviceManagement/MouldKing/IMouldKingDeviceManager.cs index f45f4b88..d0ac2c48 100644 --- a/BrickController2/BrickController2/DeviceManagement/MouldKing/IMouldKingDeviceManager.cs +++ b/BrickController2/BrickController2/DeviceManagement/MouldKing/IMouldKingDeviceManager.cs @@ -3,7 +3,7 @@ namespace BrickController2.DeviceManagement.MouldKing; /// -/// interface for MouldKingMDeviceanager devices +/// Interface for MouldKingDeviceManager. /// public interface IMouldKingDeviceManager {