13
13
14
14
15
15
/**
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
18
18
*
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.
20
21
*
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.
21
30
* @{
22
31
*/
23
32
@@ -36,11 +45,13 @@ struct subscriber_conn_state {
36
45
struct hid_report_provider_api {
37
46
/** @brief Send report to the currently connected subscriber.
38
47
*
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).
44
55
*
45
56
* @param[in] report_id Report ID.
46
57
* @param[in] force Force send report to refresh state.
@@ -66,7 +77,8 @@ struct hid_report_provider_api {
66
77
/** @brief Report subscriber connection state change to the HID provider.
67
78
*
68
79
* @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.
70
82
*/
71
83
void (* connection_state_changed )(uint8_t report_id , const struct subscriber_conn_state * cs );
72
84
@@ -85,8 +97,9 @@ struct hid_report_provider_api {
85
97
struct hid_state_api {
86
98
/** @brief Trigger sending HID report to the currently connected subscriber.
87
99
*
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.
90
103
*
91
104
* @param[in] report_id Report ID.
92
105
*
@@ -96,7 +109,16 @@ struct hid_state_api {
96
109
int (* trigger_report_send )(uint8_t report_id );
97
110
};
98
111
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
+ */
100
122
struct hid_report_provider_event {
101
123
struct app_event_header header ; /**< Event header. */
102
124
0 commit comments