这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Implement getProfileRepliesForInquiry() function

This PR implements the Messenger::getProfileRepliesForInquiry() function in C++ by porting the functionality from the Kotlin implementation in the ktmidi project.

Changes Made

  • Replaced stub implementation with proper logic that mirrors the Kotlin version
  • Added address iteration logic that handles MIDI_CI_ADDRESS_FUNCTION_BLOCK specially by getting all distinct addresses from profiles
  • Used ProfileHostFacade to access the ObservableProfileList and get matching profiles using get_matching_profiles()
  • Created ProfileReply objects for each address with enabled and disabled profiles
  • Added necessary include for <set> to support unique address collection

Implementation Details

The function now:

  1. Gets all addresses to process (either all distinct profile addresses for FUNCTION_BLOCK or the single inquiry address)
  2. For each address, retrieves enabled and disabled profiles using get_matching_profiles(address, enabled)
  3. Creates a ProfileReply with the proper Common header and profile data
  4. Returns a vector of all replies

This matches the Kotlin implementation logic:

  • Uses the same address handling pattern as getAllAddresses() in Kotlin
  • Calls equivalent of localProfiles.getMatchingProfiles() through C++ ProfileHostFacade
  • Returns sequence of ProfileReply messages for each address

Testing

  • ✅ Project builds successfully without compilation errors
  • ✅ Implementation follows existing C++ code patterns and conventions
  • ✅ Logic matches the Kotlin reference implementation

Link to Devin run

https://app.devin.ai/sessions/077230b20bad457b81fa82b2a5f8889e

Requested by: Atsushi Eno (atsushieno@gmail.com)

devin-ai-integration bot and others added 2 commits June 19, 2025 12:25
Port logic from Kotlin implementation to handle profile inquiry responses:
- Handle ADDRESS_FUNCTION_BLOCK by getting all distinct profile addresses
- Use ProfileHostFacade to access ObservableProfileList
- Get enabled/disabled profiles for each address using get_matching_profiles()
- Create ProfileReply messages with proper Common header

This replaces the previous stub implementation that returned empty profile lists.

Co-Authored-By: Atsushi Eno <atsushieno@gmail.com>
- Add MidiCIProfileDetails struct for profile-specific data
- Implement get_profile_details() method to retrieve profile data by profile and target
- Implement update_profile_target() method using existing ObservableProfileList::update
- Add callback system with add_on_profile_set_callback() for profile state changes
- Implement get_profile_details_entries() accessors for managing profile details
- Update enable/disable methods to trigger callbacks matching Kotlin behavior

This completes feature parity between C++ and Kotlin ProfileHostFacade implementations.

Co-Authored-By: Atsushi Eno <atsushieno@gmail.com>
@atsushieno atsushieno merged commit 76e2955 into main Jun 19, 2025
2 of 3 checks passed
@atsushieno atsushieno deleted the devin/1750335594-implement-profile-replies-inquiry branch June 19, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants