Skip to content

Comments

tests: unit: bluetooth: add unit tests for HRS client service#639

Open
lemrey wants to merge 10 commits intonrfconnect:mainfrom
lemrey:hrsc-unit
Open

tests: unit: bluetooth: add unit tests for HRS client service#639
lemrey wants to merge 10 commits intonrfconnect:mainfrom
lemrey:hrsc-unit

Conversation

@lemrey
Copy link
Contributor

@lemrey lemrey commented Feb 9, 2026

Add unit tests for ble_hrs_client.

@lemrey lemrey requested review from a team as code owners February 9, 2026 13:39
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Feb 9, 2026
@github-actions
Copy link

github-actions bot commented Feb 9, 2026

You can find the documentation preview for this PR here.

@lemrey lemrey removed the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Feb 9, 2026
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Feb 9, 2026
@lemrey lemrey removed the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Feb 9, 2026
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>
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Feb 13, 2026
@lemrey lemrey force-pushed the hrsc-unit branch 2 times, most recently from e6337b1 to 15fe185 Compare February 13, 2026 09:22
@lemrey lemrey removed the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Feb 13, 2026
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>
@lemrey lemrey requested a review from a team as a code owner February 13, 2026 09:31
@github-actions github-actions bot added the doc-required PR must not be merged without tech writer approval. label Feb 13, 2026
@lemrey
Copy link
Contributor Author

lemrey commented Feb 13, 2026

@nrfconnect/ncs-bm-doc please have a look here :)

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);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flip the if check to make it a bit more readable (remove the negation)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-required PR must not be merged without tech writer approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants