tests: unit: bluetooth: add unit tests for HRS client service#639
Open
lemrey wants to merge 10 commits intonrfconnect:mainfrom
Open
tests: unit: bluetooth: add unit tests for HRS client service#639lemrey wants to merge 10 commits intonrfconnect:mainfrom
lemrey wants to merge 10 commits intonrfconnect:mainfrom
Conversation
|
You can find the documentation preview for this PR here. |
tests/unit/subsys/bluetooth/services/ble_hrs_client/src/unity_test.c
Outdated
Show resolved
Hide resolved
tests/unit/subsys/bluetooth/services/ble_hrs_client/src/unity_test.c
Outdated
Show resolved
Hide resolved
tests/unit/subsys/bluetooth/services/ble_hrs_client/src/unity_test.c
Outdated
Show resolved
Hide resolved
Add unit tests for ble_hrs_client. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Use byteorder macros from Zephyr. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
e6337b1 to
15fe185
Compare
Check hvx length before accessing its data. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Add a function to disable notifications, with tests. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Enforce a valid GATT queue and event handler during initialization. Remove redundant checks and update tests. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Assert when database discovery events are NULL. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Check the ID of the event in a switch; omit the default case so that when new events are added, a compiler warning is emitted to remind us to handle it here. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Check whether there is a valid connection handle and CCCD handle. This prevents queuing up a bogus write operation that would eventually fail with an error code that we'd need to trace back to this error condition. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Trim log strings. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Refactor function to exit early and reduce indentation. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Contributor
Author
|
@nrfconnect/ncs-bm-doc please have a look here :) |
eivindj-nordic
approved these changes
Feb 13, 2026
Comment on lines
92
to
99
| if (!(flags & HRM_FLAG_MASK_HR_16BIT)) { | ||
| /* 8-bit heart rate value received. */ | ||
| ble_hrs_client_evt.params.hrm.hr_value = | ||
| hvx->data[index++]; | ||
| ble_hrs_client_evt.params.hrm.hr_value = hvx->data[index++]; | ||
| } else { | ||
| /* 16-bit heart rate value received. */ | ||
| ble_hrs_client_evt.params.hrm.hr_value = | ||
| sys_get_le16(&hvx->data[index]); | ||
| ble_hrs_client_evt.params.hrm.hr_value = sys_get_le16(&hvx->data[index]); | ||
| index += sizeof(uint16_t); | ||
| } |
Contributor
There was a problem hiding this comment.
Flip the if check to make it a bit more readable (remove the negation)?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add unit tests for ble_hrs_client.