-
Notifications
You must be signed in to change notification settings - Fork 3k
BLE: fix use of invalid cccd index #8318
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
|
||
// return if the update does not have to be propagated to peers | ||
if (local_only || !has_cccd(att_handle)) { | ||
if (local_only || !get_cccd_index_by_value_handle(att_handle, cccd_index)) { |
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.
this call makes the cccd_index valid in this scope
// Check to see if this is a CCCD | ||
uint8_t cccd_index; | ||
if (get_cccd_id(att_handle, cccd_index)) { | ||
if (get_cccd_index_by_cccd_handle(att_handle, cccd_index)) { |
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.
the cccd_index is only valid within the scope of the if statement
/morph build |
Build : SUCCESSBuild number : 3233 Triggering tests/morph test |
License issue for IAR /morph mbed2-build |
Test : SUCCESSBuild number : 3036 |
/morph export-build |
Exporter Build : SUCCESSBuild number : 2830 |
Description
There was an error in gatt server where the cccd index variable was being used outside of its valid scope. This fix updates the variable to its correct value in the outside scope.
I also renamed the functions to explicitly state what they do to avoid ambiguity. There index is the same but the handle used to get it is different. This is now reflected in the names.
Pull request type