Fix ProfileFacadesTest failures by resolving connection storage and callback issues #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix ProfileFacadesTest failures by resolving connection storage and callback issues
Summary
This PR fixes all ProfileFacadesTest failures in the C++ MIDI-CI library by resolving critical issues in the connection storage system and message callback mechanism that prevented profile discovery communication between devices.
Root Cause Analysis
The ProfileFacadesTest failures were caused by three interconnected issues:
Connection Storage Type Mismatch: The
MidiCIDeviceconnection storage methods useduint8_tkeys while callers passeduint32_tMUIDs, causing connections to be stored with truncated keys and never found during lookups.Address Retrieval Bug: The
CIRetrieval::get_addressing()method was reading the address from the wrong byte position (byte 4 instead of byte 1) during message deserialization.Disconnected Callback Systems: The device's
message_received_callback_was never registered with the Messenger's internal callback system, so ProfileReply messages were processed correctly but never reached test callbacks.Changes Made
1. Fixed Connection Storage Type Mismatch
MidiCIDevice::store_connection(),remove_connection(),get_connection()parameter types fromuint8_ttouint32_tget_connections()return type to usestd::unordered_map<uint32_t, ...>connections_container to useuint32_tkeys2. Fixed Address Retrieval Bug
CIRetrieval::get_addressing()to read from byte position 1 instead of 43. Connected Device Callbacks to Messenger
MidiCIDevice::set_message_received_callback()to automatically register the callback with the Messenger's callback systemTest Results
All ProfileFacadesTest cases now pass successfully:
Verification
The fix was verified by:
cmake --build build./build/tests/midicci-gtest --gtest_filter="ProfileFacadesTest.*"Technical Details
The message flow now works correctly:
Link to Devin run: https://app.devin.ai/sessions/b86cef761d4c40f985dafa7fa7ea6e4f
Requested by: Atsushi Eno (atsushieno@gmail.com)