Skip to content

Conversation

@lemrey
Copy link
Contributor

@lemrey lemrey commented Nov 26, 2025

Extend SoftDevice handler documentation.

@lemrey lemrey requested review from a team as code owners November 26, 2025 14:24
@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 Nov 26, 2025
@github-actions
Copy link

You can find the documentation preview for this PR here.

@lemrey lemrey force-pushed the sdh-doc branch 3 times, most recently from 02292f2 to 6df3bcb Compare November 27, 2025 14:08
Extend SoftDevice handler documentation.

Signed-off-by: Emanuele Di Santo <[email protected]>
Usage
*****

The SoftDevice handler API can be used to declare observers, changing the SoftDevice state, and enabling the SoftDevice Bluetooth stack.
Copy link

Choose a reason for hiding this comment

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

Suggested change
The SoftDevice handler API can be used to declare observers, changing the SoftDevice state, and enabling the SoftDevice Bluetooth stack.
You can use the SoftDevice handler API to declare observers, change the SoftDevice state, and enable the SoftDevice Bluetooth stack.

Declaring observers
===================

You can declare an observer in any part of your application by using a macro and specifying an event handler function, an optional parameter and a priority.
Copy link

Choose a reason for hiding this comment

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

Suggested change
You can declare an observer in any part of your application by using a macro and specifying an event handler function, an optional parameter and a priority.
You can declare an observer in any part of your application by using a macro and specifying an event handler function, an optional parameter, and a priority.

* :c:enumerator:`NRF_SDH_STATE_EVT_ENABLED` - SoftDevice is enabled.
* :c:enumerator:`NRF_SDH_STATE_EVT_BLE_ENABLED` - Bluetooth is enabled.
* :c:enumerator:`NRF_SDH_STATE_EVT_DISABLE_PREPARE` - SoftDevice is going to be disabled.
* :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` - SoftDevice is disabled
Copy link

Choose a reason for hiding this comment

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

Suggested change
* :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` - SoftDevice is disabled
* :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` - SoftDevice is disabled.


A state observer is declared using the :c:macro:`NRF_SDH_STATE_EVT_OBSERVER` macro.

The following snippet shows how to declare a state observer.
Copy link

Choose a reason for hiding this comment

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

Suggested change
The following snippet shows how to declare a state observer.
The following snippet shows how to declare a state observer:


A Bluetooth observer is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro.

The following snippet shows how to declare a Bluetooth observer.
Copy link

Choose a reason for hiding this comment

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

Suggested change
The following snippet shows how to declare a Bluetooth observer.
The following snippet shows how to declare a Bluetooth observer:

The observers can return ``0`` from the event handler to let the SoftDevice change the state, or return a non-zero value to halt the SoftDevice state change.
When an observer returns non-zero to the :c:enumerator:`NRF_SDH_STATE_EVT_DISABLE_PREPARE` event, it must call the :c:func:`nrf_sdh_observer_ready` function when it becomes ready for the SoftDevice state change.

When the last state observer becomes ready for the SoftDevice state change, the SoftDevice changes the state and the :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` event is sent.
Copy link

Choose a reason for hiding this comment

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

Suggested change
When the last state observer becomes ready for the SoftDevice state change, the SoftDevice changes the state and the :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` event is sent.
When the last state observer is ready for the SoftDevice state change, the state is changed and the :c:enumerator:`NRF_SDH_STATE_EVT_DISABLED` event is sent.

Fault handling
==============

You can override the SoftDevice fault handler function by defining the following function, as shown in the snippet below:
Copy link

Choose a reason for hiding this comment

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

Suggested change
You can override the SoftDevice fault handler function by defining the following function, as shown in the snippet below:
You can override the SoftDevice fault handler function by defining the following function:

Comment on lines +133 to +135
A Bluetooth observer receives Bluetooth events coming from the SoftDevice.

A Bluetooth observer is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro.
Copy link

Choose a reason for hiding this comment

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

Suggested change
A Bluetooth observer receives Bluetooth events coming from the SoftDevice.
A Bluetooth observer is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro.
A Bluetooth observer receives Bluetooth events coming from the SoftDevice and is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro.

Comment on lines +153 to +155
An SoC observer receives SoC events coming from the SoftDevice.

An SoC observer is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro.
Copy link

Choose a reason for hiding this comment

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

Suggested change
An SoC observer receives SoC events coming from the SoftDevice.
An SoC observer is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro.
An SoC observer receives SoC events coming from the SoftDevice and is declared using the :c:macro:`NRF_SDH_BLE_OBSERVER` macro.

Comment on lines +82 to +84
The SoftDevice handler has several options to control the clock configuration passed to the :c:func:`sd_softdevice_enable` function.

These options are used automatically when you enable the SoftDevice by calling the :c:func:`nrf_sdh_enable_request` function.
Copy link

Choose a reason for hiding this comment

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

Suggested change
The SoftDevice handler has several options to control the clock configuration passed to the :c:func:`sd_softdevice_enable` function.
These options are used automatically when you enable the SoftDevice by calling the :c:func:`nrf_sdh_enable_request` function.
The SoftDevice handler has several options to control the clock configuration passed to the :c:func:`sd_softdevice_enable` function.
These options are used automatically when you enable the SoftDevice by calling the :c:func:`nrf_sdh_enable_request` function.

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants