Skip to content

Commit 08c636a

Browse files
MarekPietakapi-no
authored andcommitted
applications: nrf_desktop: Update HID report provider event docs
Change updates documentation of the HID report provider event and adds the event under `api.rst` to generate doxygen documentation. Jira: NCSDK-35005 Signed-off-by: Marek Pieta <[email protected]> Signed-off-by: Pekka Niskanen <[email protected]>
1 parent 282c5a7 commit 08c636a

File tree

2 files changed

+42
-12
lines changed

2 files changed

+42
-12
lines changed

applications/nrf_desktop/api.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ HID reports
1717
1818
.. doxygengroup:: nrf_desktop_hid_reports
1919

20+
HID report provider events
21+
**************************
22+
23+
| Header file: :file:`applications/nrf_desktop/src/events/hid_report_provider_event.h`
24+
| Source file: :file:`applications/nrf_desktop/src/events/hid_report_provider_event.c`
25+
26+
.. doxygengroup:: nrf_desktop_hid_report_provider_event
27+
2028
LED states
2129
**********
2230

applications/nrf_desktop/src/events/hid_report_provider_event.h

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,20 @@
1313

1414

1515
/**
16-
* @brief HID Report Provider Events
17-
* @defgroup hid_report_provider_event HID Report Provider Events
16+
* @brief HID report provider events
17+
* @defgroup nrf_desktop_hid_report_provider_event HID report provider events
1818
*
19-
* File defines a set of events used to link HID report provider and HID state.
19+
* The @ref hid_report_provider_event is used to link the HID report provider and the HID state
20+
* during boot.
2021
*
22+
* The HID state module tracks the state of HID report subscribers (HID transports) and notifies the
23+
* HID report providers when the HID report subscription state changes. The HID state also
24+
* determines the active HID report subscriber (based on HID subscriber priorities) and limits the
25+
* number of HID reports that are processed by a HID transport at a given time.
26+
*
27+
* The HID report providers aggregate data related to user input, form the HID input reports, and
28+
* forward the HID input reports to HID transports as a @ref hid_report_event when requested by the
29+
* HID state.
2130
* @{
2231
*/
2332

@@ -36,11 +45,13 @@ struct subscriber_conn_state {
3645
struct hid_report_provider_api {
3746
/** @brief Send report to the currently connected subscriber.
3847
*
39-
* The HID provider should send HID report and return true only if HID report data requires
40-
* update (there is user input waiting). Otherwise the HID provider should skip sending HID
41-
* report and return false unless force flag is set. If the force flag is set, HID provider
42-
* needs to always send a HID report (even if the report would contain no new information)
43-
* and return true.
48+
* The HID provider must send the HID report as a @ref hid_report_event only if the HID
49+
* report data requires an update (there is user input waiting). Otherwise, the HID provider
50+
* must skip sending the HID report unless a force flag is set.
51+
*
52+
* If the force flag is set, the HID provider needs to always send a HID report (even if the
53+
* report would contain no new information). The HID state sets the force flag if the
54+
* connected subscriber requires an update (to refresh the state).
4455
*
4556
* @param[in] report_id Report ID.
4657
* @param[in] force Force send report to refresh state.
@@ -66,7 +77,8 @@ struct hid_report_provider_api {
6677
/** @brief Report subscriber connection state change to the HID provider.
6778
*
6879
* @param[in] report_id Report ID.
69-
* @param[in] cs HID subscriber connection state.
80+
* @param[in] cs HID subscriber connection state. The value under the pointer
81+
* may not be valid after the function returns.
7082
*/
7183
void (*connection_state_changed)(uint8_t report_id, const struct subscriber_conn_state *cs);
7284

@@ -85,8 +97,9 @@ struct hid_report_provider_api {
8597
struct hid_state_api {
8698
/** @brief Trigger sending HID report to the currently connected subscriber.
8799
*
88-
* The function should be used to notify HID state that new data is available (for example
89-
* on user input).
100+
* The function is used to notify the HID state that new data is available (for example on
101+
* user input). The HID provider needs to wait with submitting a @ref hid_report_event until
102+
* the HID state requests it through the send_report callback.
90103
*
91104
* @param[in] report_id Report ID.
92105
*
@@ -96,7 +109,16 @@ struct hid_state_api {
96109
int (*trigger_report_send)(uint8_t report_id);
97110
};
98111

99-
/** @brief HID report provider event. */
112+
/** @brief HID report provider event.
113+
*
114+
* The HID report provider submits the event to pass a HID report ID and provider API to the HID
115+
* state. While processing the event, the HID state remembers the data received from the HID report
116+
* provider and fills the HID state API. The HID report provider must process the event after the
117+
* HID state to receive the HID state API.
118+
*
119+
* The exchanged API structures allow for direct function calls between the application modules at
120+
* runtime (without using application events). The direct calls are used to ensure high performance.
121+
*/
100122
struct hid_report_provider_event {
101123
struct app_event_header header; /**< Event header. */
102124

0 commit comments

Comments
 (0)