[Bugfix] get remote characteristic by uuid returning the wrong instance.#1132
[Bugfix] get remote characteristic by uuid returning the wrong instance.#1132
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughArrr — The characteristic discovery flow was refactored: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/NimBLERemoteService.cpp`:
- Around line 154-161: The callback currently overwrites pTaskData->m_pBuf on
every discovered characteristic and uses the (C++17-only) return value of
emplace_back(), which causes inconsistent behavior and may not compile; fix by
only setting pTaskData->m_pBuf the first time a matching characteristic is
stored (i.e., check if m_pBuf is null before assigning) and replace the
emplace_back assignment with two steps: call pSvc->m_vChars.emplace_back(new
NimBLERemoteCharacteristic(pSvc, chr)); then set pTaskData->m_pBuf =
pSvc->m_vChars.back(); also ensure the insertion branch still assigns m_pBuf
when it was previously null (use (*pSvc->m_vChars.insert(...)) to get the
iterator result and set m_pBuf = *inserted_it if needed).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cc21dbaa-c550-4cd1-b5b2-fa71b5c29193
📒 Files selected for processing (2)
src/NimBLERemoteService.cppsrc/NimBLERemoteService.h
This fixes a bug introduced when sorting the characteristic vector where the last item on in the vector was returned but the characteristc wasn't at the end anymore. This reverts the previous sorting of the vector after retrieval and instead sorts as the characteristics are found and also provides a pointer to the characteristic from the retrieval callback.
This fixes a bug introduced when sorting the characteristic vector where the last item on in the vector was returned but the characteristc wasn't at the end anymore.
This reverts the previous sorting of the vector after retrieval and instead sorts as the characteristics are found and also provides a pointer to the characteristic from the retrieval callback.
Summary by CodeRabbit