Skip to content

Commit acd5ad8

Browse files
Damian-Nordicnordicjm
authored andcommitted
bluetooth: services: improve doxygen for init functions
The doxygen comments for functions responsible for initializing GATT services did not make it clear that GATT services are registered statically and the init functions are just for initializing the service dependencies. JIRA: KRKNWK-21046 Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
1 parent af22468 commit acd5ad8

File tree

8 files changed

+61
-45
lines changed

8 files changed

+61
-45
lines changed

‎include/bluetooth/services/bms.h‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,15 @@ struct bt_bms_init_params {
101101

102102
/** @brief Initialize the BMS Service.
103103
*
104-
* Initialize the BMS Service by specifying a list of supported operations.
105-
* If any operation is configured as authorized, you need to provide
106-
* authorize() callback.
104+
* Initializes the module with the list of supported operations.
105+
* If any operation is configured as authorized, the authorize() callback must be provided.
107106
*
108-
* @param init_params Initialization parameters.
107+
* @note The GATT service is defined and registered statically at compile time.
108+
*
109+
* @param init_params Initialization parameters. Must not be NULL.
109110
*
110111
* @retval 0 If the operation was successful.
111-
* Otherwise, a (negative) error code is returned.
112+
* Otherwise, a negative error code is returned.
112113
*/
113114
int bt_bms_init(const struct bt_bms_init_params *init_params);
114115

‎include/bluetooth/services/cgms.h‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,14 @@ int bt_cgms_measurement_add(struct bt_cgms_measurement measurement);
112112

113113
/** @brief Initialize Continuous Glucose Monitoring service.
114114
*
115-
* This will initialize components used in CGMS.
115+
* Initializes the module with the given initialization parameters.
116116
*
117-
* @param[in] init_params The parameter used to initialize the corresponding
118-
* values of CGMS module.
117+
* @note The GATT service is defined and registered statically at compile time.
119118
*
120-
* @return Zero in case of success and error code in case of error.
119+
* @param[in] init_params Initialization parameters. Must not be NULL.
120+
*
121+
* @retval 0 If the operation was successful.
122+
* Otherwise, a negative error code is returned.
121123
*/
122124
int bt_cgms_init(struct bt_cgms_init_param *init_params);
123125

‎include/bluetooth/services/ddfs.h‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ struct bt_ddfs_init_params {
208208
const struct bt_ddfs_cb *cb;
209209
};
210210

211-
/** @brief Function for sending Distance Measurement value.
211+
/** @brief Send Distance Measurement value.
212212
*
213213
* The application calls this function after having performed a Distance Measurement.
214214
* If notification has been enabled, the measurement data is encoded and sent to the client.
@@ -222,7 +222,7 @@ struct bt_ddfs_init_params {
222222
int bt_ddfs_distance_measurement_notify(struct bt_conn *conn,
223223
const struct bt_ddfs_distance_measurement *measurement);
224224

225-
/** @brief Function for sending Azimuth Measurement value.
225+
/** @brief Send Azimuth Measurement value.
226226
*
227227
* The application calls this function after having performed an Azimuth Measurement.
228228
* If notification has been enabled, the measurement data is encoded and sent to the client.
@@ -236,7 +236,7 @@ int bt_ddfs_distance_measurement_notify(struct bt_conn *conn,
236236
int bt_ddfs_azimuth_measurement_notify(struct bt_conn *conn,
237237
const struct bt_ddfs_azimuth_measurement *measurement);
238238

239-
/** @brief Function for sending Elevation Measurement value.
239+
/** @brief Send Elevation Measurement value.
240240
*
241241
* The application calls this function after having performed an Elevation Measurement.
242242
* If notification has been enabled, the measurement data is encoded and sent to the client.
@@ -250,9 +250,13 @@ int bt_ddfs_azimuth_measurement_notify(struct bt_conn *conn,
250250
int bt_ddfs_elevation_measurement_notify(struct bt_conn *conn,
251251
const struct bt_ddfs_elevation_measurement *measurement);
252252

253-
/** @brief Function for initializing the Direction and Distance Finding Service.
253+
/** @brief Initialize the Direction and Distance Finding Service.
254254
*
255-
* @param[in] init Initialization parameters.
255+
* Initializes the module with the given initialization parameters.
256+
*
257+
* @note The GATT service is defined and registered statically at compile time.
258+
*
259+
* @param[in] init Initialization parameters. Must not be NULL.
256260
*
257261
* @retval 0 If the operation was successful.
258262
* Otherwise, a negative error code is returned.

‎include/bluetooth/services/latency.h‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,20 @@ struct bt_latency {
6363
/** @brief UUID of the Latency Characteristic. **/
6464
#define BT_UUID_LATENCY_CHAR BT_UUID_DECLARE_128(BT_UUID_LATENCY_CHAR_VAL)
6565

66-
/** @brief Initialize the GATT latency service.
66+
/** @brief Initialize the GATT Latency Service instance.
67+
*
68+
* Marks the instance as initialized and stores the given callbacks.
69+
*
70+
* @note The GATT service is defined and registered statically at compile time.
6771
*
6872
* @param[in] latency Latency service instance.
69-
* @param[in] cb Callbacks.
73+
* @param[in] cb Struct containing pointers to callback functions.
74+
* Can be NULL if no callbacks are defined.
7075
*
7176
* @retval 0 If the operation was successful.
7277
* Otherwise, a negative error code is returned.
73-
* @retval (-EINVAL) Special error code used when the input
74-
* parameters are invalid.
75-
* @retval (-EALREADY) Special error code used when the latency
76-
* service has been initialed.
78+
* @retval -EINVAL Input parameters are invalid.
79+
* @retval -EALREADY Latency service has already been initialized.
7780
*/
7881
int bt_latency_init(struct bt_latency *latency,
7982
const struct bt_latency_cb *cb);

‎include/bluetooth/services/lbs.h‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,17 @@ struct bt_lbs_cb {
5252

5353
/** @brief Initialize the LBS Service.
5454
*
55-
* This function registers a GATT service with two characteristics: Button
56-
* and LED.
57-
* Send notifications for the Button Characteristic to let connected peers know
58-
* when the button state changes.
59-
* Write to the LED Characteristic to change the state of the LED on the
60-
* board.
55+
* Initializes the module with the given callbacks, used when:
56+
* - The LED characteristic is written to by a remote device.
57+
* - The button characteristic is read by a remote device.
6158
*
62-
* @param[in] callbacks Struct containing pointers to callback functions
63-
* used by the service. This pointer can be NULL
64-
* if no callback functions are defined.
59+
* @note The GATT service is defined and registered statically at compile time.
6560
*
61+
* @param[in] callbacks Struct containing pointers to callback functions.
62+
* Can be NULL if no callbacks are defined.
6663
*
67-
* @retval 0 If the operation was successful.
68-
* Otherwise, a (negative) error code is returned.
64+
* @retval 0 If the operation was successful.
65+
* Otherwise, a negative error code is returned.
6966
*/
7067
int bt_lbs_init(struct bt_lbs_cb *callbacks);
7168

‎include/bluetooth/services/nus.h‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@ struct bt_nus_cb {
8181

8282
};
8383

84-
/**@brief Initialize the service.
84+
/**@brief Initialize the NUS Service.
8585
*
86-
* @details This function registers a GATT service with two characteristics,
87-
* TX and RX. A remote device that is connected to this service
88-
* can send data to the RX Characteristic. When the remote enables
89-
* notifications, it is notified when data is sent to the TX
90-
* Characteristic.
86+
* Initializes the module with the given callbacks, used when:
87+
* - The RX characteristic is written to by a remote device.
88+
* - The TX characteristic notification state changes.
89+
* - The notification has been sent to a remote device.
9190
*
92-
* @param[in] callbacks Struct with function pointers to callbacks for service
93-
* events. If no callbacks are needed, this parameter can
94-
* be NULL.
91+
* @note The GATT service is defined and registered statically at compile time.
92+
*
93+
* @param[in] callbacks Struct containing pointers to callback functions.
94+
* Can be NULL if no callbacks are defined.
9595
*
9696
* @retval 0 If initialization is successful.
9797
* Otherwise, a negative value is returned.

‎include/bluetooth/services/rscs.h‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ struct bt_rscs_measurement {
161161
uint32_t total_distance;
162162
};
163163

164-
/** @brief Function for sending Running Speed and Cadence measurement.
164+
/** @brief Sending Running Speed and Cadence measurement.
165165
*
166166
* The application calls this function after having performed a Running Speed and Cadence
167167
* measurement. If notification has been enabled, the measurement data is encoded
@@ -175,9 +175,13 @@ struct bt_rscs_measurement {
175175
*/
176176
int bt_rscs_measurement_send(struct bt_conn *conn, const struct bt_rscs_measurement *measurement);
177177

178-
/** @brief Function for initializing the Running Speed and Cadence Service.
178+
/** @brief Initialize the Running Speed and Cadence Service.
179179
*
180-
* @param[in] init Initialization parameters.
180+
* Initializes the module with the given initialization parameters.
181+
*
182+
* @note The GATT service is defined and registered statically at compile time.
183+
*
184+
* @param[in] init Initialization parameters. Must not be NULL.
181185
*
182186
* @retval 0 If the operation was successful.
183187
* Otherwise, a negative error code is returned.

‎include/bluetooth/services/throughput.h‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,15 @@ struct bt_throughput {
9393
#define BT_UUID_THROUGHPUT \
9494
BT_UUID_DECLARE_128(BT_UUID_THROUGHPUT_VAL)
9595

96-
/** @brief Initialize the GATT Throughput Service.
96+
/** @brief Initialize the GATT Throughput Service instance.
97+
*
98+
* Initializes the instance with the given callbacks.
99+
100+
* @note The GATT service is defined and registered statically at compile time.
97101
*
98102
* @param[in] throughput Throughput Service instance.
99-
* @param[in] cb Callbacks.
103+
* @param[in] cb Struct containing pointers to callback functions.
104+
* Can be NULL if no callbacks are defined.
100105
*
101106
* @retval 0 If the operation was successful.
102107
* Otherwise, a negative error code is returned.

0 commit comments

Comments
 (0)