-
Notifications
You must be signed in to change notification settings - Fork 3
iOS advertiser for MouldKing MK4 and MK6 #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an iOS advertiser for the MouldKing MK4 and MK6 devices and refactors the related protocol and device management logic to support cross-platform functionality.
- Updated README to remove Android-only restrictions for Mould King modules.
- Refactored MKProtocol’s GetRfPayload method to support dynamic payload lengths and renamed constants for clarity.
- Modified MK device classes and implemented platform-specific MKPlatformService for iOS, WinUI, and Android.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Removed Android-only notes for Mould King modules to reflect cross-platform support. |
| BrickController2/BrickController2/Protocols/MKProtocol.cs | Refactored GetRfPayload method with updated parameters and renaming of constants/arrays. |
| MKBaseNible.cs & MKBaseByte.cs | Updated constructors to inject an IMKPlatformService dependency. |
| MK6.cs & MK4.cs | Updated device constructors to accept an IMKPlatformService instance. |
| IMKPlatformService.cs | Added interface for platform-specific MouldKing functionality. |
| MKPlatformService.cs (iOS, WinUI, Android) | Implemented platform-specific methods to generate RF payloads. |
| PlatformServicesModule.cs (iOS, WinUI, Android) | Registered MKPlatformService as a singleton in dependency injection. |
| BluetoothLEAdvertiserDevice.cs | Implemented iOS advertiser device returning a non-null instance. |
Comments suppressed due to low confidence (3)
BrickController2/BrickController2/iOS/PlatformServices/DeviceManagement/MouldKing/MKPlatformService.cs:4
- The namespace in this iOS-specific file references 'Windows' which appears inconsistent; please update it to reflect the iOS project structure.
namespace BrickController2.Windows.DeviceManagement.DI;
BrickController2/BrickController2/Protocols/MKProtocol.cs:41
- The GetRfPayload method now returns a dynamic payload length instead of a fixed value; ensure that all consumers of this API handle variable lengths appropriately and update corresponding documentation.
public static int GetRfPayload(byte[] seed, byte[] data, int headerOffset, byte ctxValue1, byte ctxValue2, byte[] rfPayload)
BrickController2/BrickController2/Android/PlatformServices/DeviceManagement/MouldKing/MKPlatformService.cs:9
- The Android implementation uses a PayloadLength of 24 while other platforms use 26; please confirm that this discrepancy is intentional and document any platform-specific differences.
private const int PayloadLength = 24;
...r2/BrickController2.Android/PlatformServices/DeviceManagement/MouldKing/MKPlatformService.cs
Outdated
Show resolved
Hide resolved
...ler2/BrickController2.WinUI/PlatformServices/DeviceManagement/MouldKing/MKPlatformService.cs
Outdated
Show resolved
Hide resolved
...Controller2/BrickController2.iOS/PlatformServices/BluetoothLE/BluetoothLEAdvertiserDevice.cs
Show resolved
Hide resolved
|
Do you think this pull request is ready to review and merge? |
Yes, I did not see any serious issue at all, so I will have a look tonight. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds iOS advertiser support for the MouldKing MK4 and MK6 devices by updating the protocol encryption logic, modifying device initialization classes to use platform‐specific services, and implementing the necessary platform service and BLE advertiser components.
- Updated README to advertise iOS support
- Modified MKProtocol encryption parameters and refactored related methods
- Updated device management classes and added platform‐specific MKPlatformService implementations for iOS, WinUI, and Android
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Removed “Android only” qualifiers to include iOS support for Mould King modules |
| BrickController2/BrickController2/Protocols/MKProtocol.cs | Updated encryption constants, parameter names, and array handling for the new payload structure |
| BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseNible.cs | Updated constructor to accept IMKPlatformService and replaced direct protocol calls |
| BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseByte.cs | Updated constructor to accept IMKPlatformService and replaced direct protocol calls |
| BrickController2/BrickController2/DeviceManagement/MouldKing/MK6.cs | Updated constructor signature to include MKPlatformService dependency |
| BrickController2/BrickController2/DeviceManagement/MouldKing/MK4.cs | Updated constructor signature to include MKPlatformService dependency |
| BrickController2/BrickController2/DeviceManagement/MouldKing/IMKPlatformService.cs | Added interface declaration for platform-specific functionality |
| BrickController2/BrickController2.iOS/PlatformServices/DeviceManagement/MouldKing/MKPlatformService.cs | iOS-specific implementation of MKPlatformService using updated MKProtocol |
| BrickController2/BrickController2.iOS/PlatformServices/BluetoothLE/BluetoothLEAdvertiserDevice.cs | Implemented BLE advertiser device functionality with new C# array initializer syntax |
| BrickController2/BrickController2.WinUI/PlatformServices/DeviceManagement/MouldKing/MKPlatformService.cs | WinUI-specific implementation of MKPlatformService |
| BrickController2/BrickController2.WinUI/PlatformServices/DI/PlatformServicesModule.cs | Registered MKPlatformService for WinUI in DI |
| BrickController2/BrickController2.Android/PlatformServices/DeviceManagement/MouldKing/MKPlatformService.cs | Android-specific implementation of MKPlatformService |
| BrickController2/BrickController2.Android/PlatformServices/DI/PlatformServicesModule.cs | Registered MKPlatformService for Android in DI |
|
Thx for this feature, good job with hacking the protocol. |
Thank you, you're welcome :) |
I've added the iOS advertiser for MK4 and MK6.
Please have a look... :)