Skip to content

Conversation

@J0EK3R
Copy link

@J0EK3R J0EK3R commented May 20, 2025

I've added the iOS advertiser for MK4 and MK6.

Please have a look... :)

Copy link

Copilot AI left a 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;

@vicocz vicocz added the enhancement New feature or request label May 20, 2025
@vicocz vicocz added this to the 2025.3 milestone May 20, 2025
@J0EK3R
Copy link
Author

J0EK3R commented May 21, 2025

Do you think this pull request is ready to review and merge?

@vicocz
Copy link
Owner

vicocz commented May 21, 2025

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.

@J0EK3R J0EK3R marked this pull request as ready for review May 21, 2025 18:22
@vicocz vicocz requested a review from Copilot May 21, 2025 21:01
Copy link

Copilot AI left a 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

@vicocz vicocz merged commit fdd2469 into vicocz:default May 21, 2025
2 checks passed
@vicocz
Copy link
Owner

vicocz commented May 21, 2025

Thx for this feature, good job with hacking the protocol.

@J0EK3R
Copy link
Author

J0EK3R commented May 22, 2025

Thx for this feature, good job with hacking the protocol.

Thank you, you're welcome :)

@J0EK3R J0EK3R deleted the iOSAdvertiser branch May 22, 2025 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants