Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace BrickController2.DeviceManagement.MouldKing;

/// <summary>
/// Interface for MouldKingDeviceManager.
/// </summary>
public interface IMouldKingDeviceManager
{
ReadOnlyMemory<byte> GetAppId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal class MK3_8 : MKBaseNibble, IDeviceType<MK3_8>
/// </summary>
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)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal class MK4 : MKBaseNibble, IDeviceType<MK4>
/// </summary>
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)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal class MK5 : MKBaseNibble, IDeviceType<MK5>
/// </summary>
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)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ internal class MK6 : MKBaseByte, IDeviceType<MK6>
/// </summary>
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))
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal abstract class MKBaseNibble : BluetoothAdvertisingDevice
/// </summary>
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ protected override void Register(VendorBuilder<MouldKing> builder)

// device manager
builder.RegisterDeviceManager<MouldKingDeviceManager>()
.As<IMouldKingDeviceManager>()
.SingleInstance();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace BrickController2.DeviceManagement.MouldKing;
/// <summary>
/// Manager for MouldKing devices
/// </summary>
public class MouldKingDeviceManager : BluetoothDeviceManagerBase
public class MouldKingDeviceManager : BluetoothDeviceManagerBase,
IMouldKingDeviceManager
{
private const int AppIdentifierLength = 2; // MouldKing protocol defines 2 bytes for the app identifier

Expand Down
Loading