-
Notifications
You must be signed in to change notification settings - Fork 33
bluetooth: services: misc cleanup and changes #585
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
base: main
Are you sure you want to change the base?
Conversation
|
You can find the documentation preview for this PR here. |
92761c1 to
1b81cd8
Compare
f01a41e to
ad177b5
Compare
09cfa57 to
29fae85
Compare
Remove stray doxygen comment. Signed-off-by: Emanuele Di Santo <[email protected]>
29fae85 to
444ec99
Compare
8663a9b to
b451cef
Compare
b451cef to
fa25d23
Compare
Remove outdated doxygen documentation. Signed-off-by: Emanuele Di Santo <[email protected]>
Remove unnecessary cast. Signed-off-by: Emanuele Di Santo <[email protected]>
Remove unnecessary cast. Signed-off-by: Emanuele Di Santo <[email protected]>
Do not translate the errors from SoftDevice calls, instead return those directly. Signed-off-by: Emanuele Di Santo <[email protected]>
SoftDevice will return an error if they are not, no need to check that ourselves in the service implementation. Signed-off-by: Emanuele Di Santo <[email protected]>
Use compound literal for the notification size. Signed-off-by: Emanuele Di Santo <[email protected]>
fa25d23 to
1499b96
Compare
This function is mostly called automatically by the SoftDevice handler, so only assert if the parameters are NULL. Signed-off-by: Emanuele Di Santo <[email protected]>
Remove NULL checks in the BLE event handler. This handler is mostly called by the SoftDevice handler automatically, just use asserts. Signed-off-by: Emanuele Di Santo <[email protected]>
Rename to `nus_instance` for clarity and consistency with other services. Signed-off-by: Emanuele Di Santo <[email protected]>
Remove checks on the parameters to the SoftDevice _hvx() call. All SoftDevice APIs implement error checking already, just call the SoftDevice function directly. Signed-off-by: Emanuele Di Santo <[email protected]>
Remove error translation for the SoftDevice _hvx() call. Return the SoftDevice error directly. The return value of the call invoking _hvx() is anyway only checked against zero, its actual value is not used. Signed-off-by: Emanuele Di Santo <[email protected]>
1499b96 to
64ddc08
Compare
| case NRF_SUCCESS: | ||
| if (hvx_len != len) { | ||
| LOG_ERR("Notified %d of %d bytes", hvx_len, len); | ||
| return NRF_ERROR_INVALID_PARAM; | ||
| } | ||
| return NRF_SUCCESS; |
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 is a change in behavior, where earlier we returned an error now we return success.
| if (*len > BLE_NUS_MAX_DATA_LEN) { | ||
| return NRF_ERROR_INVALID_PARAM; | ||
| } | ||
|
|
||
| if (conn_handle == BLE_CONN_HANDLE_INVALID) { | ||
| return NRF_ERROR_NOT_FOUND; | ||
| } | ||
|
|
||
| ctx = ble_nus_client_context_get(nus, conn_handle); | ||
| if (ctx == NULL) { | ||
| return NRF_ERROR_NOT_FOUND; | ||
| } | ||
|
|
||
| if (!ctx->is_notification_enabled) { | ||
| return NRF_ERROR_INVALID_PARAM; | ||
| } |
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 is also gone and a change in behavior
lemrey
left a comment
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.
There will be a follow up PR to update samples not to send notifications blindly. There were a bunch of checks in the application and in the service to ignore / override errors. This patch removes such checks in the services.
No description provided.