Skip to content

library and services event handling and cleanup#447

Merged
eivindj-nordic merged 10 commits into
nrfconnect:mainfrom
eivindj-nordic:error_handlers
Nov 19, 2025
Merged

library and services event handling and cleanup#447
eivindj-nordic merged 10 commits into
nrfconnect:mainfrom
eivindj-nordic:error_handlers

Conversation

@eivindj-nordic
Copy link
Copy Markdown
Contributor

@eivindj-nordic eivindj-nordic commented Oct 28, 2025

No description provided.

@eivindj-nordic eivindj-nordic self-assigned this Oct 28, 2025
@eivindj-nordic eivindj-nordic requested review from a team as code owners October 28, 2025 09:48
@github-actions github-actions Bot added changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. doc-required PR must not be merged without tech writer approval. labels Oct 28, 2025
@github-actions
Copy link
Copy Markdown

You can find the documentation preview for this PR here.

@eivindj-nordic eivindj-nordic force-pushed the error_handlers branch 3 times, most recently from 3a36230 to cfe69f7 Compare October 29, 2025 11:44
Copy link
Copy Markdown
Contributor

@lemrey lemrey left a comment

Choose a reason for hiding this comment

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

Had a brief look

Comment thread include/bm/bluetooth/services/ble_bas.h Outdated
*/
BLE_BAS_EVT_NOTIFICATION_DISABLED
BLE_BAS_EVT_NOTIFICATION_DISABLED,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

extra new line

Comment thread include/bm/bluetooth/services/ble_bas.h Outdated
Comment on lines +62 to +67
/**
* @brief Connection handle for which the event applies.
*
* Used for BLE_BAS_EVT_NOTIFICATION_ENABLED and BLE_BAS_EVT_NOTIFICATION_DISABLED.
*/
uint16_t conn_handle;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The conn_handle should be part of the outermost structure, because otherwise it's impossible to know which peer any message belongs to.

Comment thread include/bm/bluetooth/services/ble_nus.h Outdated
Comment on lines +70 to +73
/**
* @brief Error event.
*/
BLE_NUS_EVT_ERROR,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I would keep the _ERROR event last in the enum everywhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is the first everywhere so that it has the same value for all libraries and services. Having it at the end will give different values, and it will change if another event is added.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure but currently there is no advantage for that. Do you have something in mind?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nothing in particular with the use of the value, no.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok, I am a bit unsure whether we should have it first then; typically I would expect it to be last..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved last.

Comment thread include/bm/bluetooth/services/ble_nus.h Outdated
Comment on lines +127 to +131
/** @ref BLE_BAS_EVT_ERROR event data. */
struct {
/** Error reason. */
uint32_t reason;
} error;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I would keep this last in the list.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Order kept the same as the events.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you need to update here?

Comment thread include/bm/bluetooth/services/ble_nus.h
@@ -55,6 +62,11 @@ struct ble_lbs_evt {
/** Value to write */
uint8_t value;
} led_write;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the conn_handle should be in the outermost structure here too.

Comment thread include/bm/bluetooth/ble_gq.h Outdated
Comment on lines +148 to +149
/** Connection handle. */
uint16_t conn_handle;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move out?

@eivindj-nordic eivindj-nordic force-pushed the error_handlers branch 4 times, most recently from 73b576d to 342b13a Compare November 3, 2025 12:33
@lemrey lemrey added this to the v1.0.0 milestone Nov 5, 2025
if (nrf_err) {
LOG_ERR("pm_register() failed, nrf_error 0x%x", nrf_err);
return nrf_err;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I realize that this is missing a return NRF_SUCCESS.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added in #437, where the file is changed.

@github-actions github-actions Bot removed the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Nov 12, 2025
Comment thread include/bm/bluetooth/services/ble_nus.h Outdated
Comment on lines +127 to +131
/** @ref BLE_BAS_EVT_ERROR event data. */
struct {
/** Error reason. */
uint32_t reason;
} error;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you need to update here?

Comment thread subsys/bluetooth/services/ble_hids/hids.c Outdated
@eivindj-nordic
Copy link
Copy Markdown
Contributor Author

Do you need to update here?

Done.

@eivindj-nordic eivindj-nordic force-pushed the error_handlers branch 2 times, most recently from e6ab2d5 to c2396cc Compare November 17, 2025 11:09
@eivindj-nordic eivindj-nordic force-pushed the error_handlers branch 6 times, most recently from 0cbafcc to 9e0a309 Compare November 17, 2025 12:31
Comment thread include/bm/bluetooth/services/ble_nus.h
Comment thread subsys/bluetooth/services/ble_cgms/cgms_racp.c Outdated
Comment thread subsys/bluetooth/services/ble_cgms/cgms_racp.c Outdated
Comment thread subsys/bluetooth/services/ble_hids/hids.c Outdated
Comment thread include/bm/bluetooth/ble_gq.h Outdated
Comment thread subsys/bluetooth/services/ble_hids/hids.c Outdated
Comment thread doc/nrf-bm/release_notes/release_notes_changelog.rst Outdated
Comment thread doc/nrf-bm/release_notes/release_notes_changelog.rst Outdated
Comment thread include/bm/bluetooth/services/ble_nus.h Outdated
Comment thread lib/bluetooth/ble_adv/ble_adv.c Outdated
Comment thread lib/bluetooth/ble_adv/ble_adv.c Outdated
Comment thread doc/nrf-bm/release_notes/release_notes_changelog.rst
Add error event to NUS service.
Align event handler with other services.
Align event type field name to evt_type.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Add error event to BAS service.
The event is currently unused, but is added to align with other
services.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
* Formatting fixes to doxygen
* Add error logging where error event is sent. This makes it easier
  to debug.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
* Formatting fixes to doxygen
* Add error logging where error event is sent. This makes it easier
to debug.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Add error event to HRS service.
The event is currently unused, but is added to align with other
services.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Add error event to LBS service.
The event is currently unused, but is added to align with other
services.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
* Add error logging where the error event is sent to the application.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
* Add error event to ble_conn_params library.
* Change conn_params_event id field to evt_type to align with other.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Align event handler for ble_gq with other libraries.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Align error event at end of enum.
Doxygen format fixes.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
@eivindj-nordic eivindj-nordic merged commit 6e05db7 into nrfconnect:main Nov 19, 2025
18 checks passed
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.

5 participants