@@ -182,14 +182,21 @@ int dult_id_read_state_cb_register(const struct dult_user *user,
182
182
*/
183
183
int dult_id_read_state_enter (const struct dult_user * user );
184
184
185
- /** Minimum duration in milliseconds for the DULT sound action. */
186
- #define DULT_SOUND_DURATION_MIN_MS (5000U)
185
+ /** Minimum duration in milliseconds for the DULT sound action originating from the Bluetooth
186
+ * accessory non-owner service (see @ref DULT_SOUND_SRC_BT_GATT).
187
+ */
188
+ #define DULT_SOUND_DURATION_BT_GATT_MIN_MS (5000U)
187
189
188
190
/** DULT sound source types. */
189
191
enum dult_sound_src {
190
192
/** Sound source type originating from the Bluetooth accessory non-owner service. */
191
193
DULT_SOUND_SRC_BT_GATT ,
192
194
195
+ /** Sound source type originating from the Motion detector.
196
+ * Used only when the @kconfig{CONFIG_DULT_MOTION_DETECTOR} is enabled.
197
+ */
198
+ DULT_SOUND_SRC_MOTION_DETECTOR ,
199
+
193
200
/** External source type originating from the unknown location to the DULT module. */
194
201
DULT_SOUND_SRC_EXTERNAL ,
195
202
};
@@ -204,7 +211,8 @@ struct dult_sound_cb {
204
211
* structure), it then calls the @ref dult_sound_state_update API.
205
212
*
206
213
* @param src Sound source type. Only the DULT internal sources are
207
- * used in this callback: @ref DULT_SOUND_SRC_BT_GATT.
214
+ * used in this callback: @ref DULT_SOUND_SRC_BT_GATT,
215
+ * @ref DULT_SOUND_SRC_MOTION_DETECTOR.
208
216
*/
209
217
void (* sound_start )(enum dult_sound_src src );
210
218
@@ -215,8 +223,9 @@ struct dult_sound_cb {
215
223
* response to this request (as described by the @ref dult_sound_state_param
216
224
* structure), it then calls the @ref dult_sound_state_update API.
217
225
*
218
- * @param src Sound source type. Only the DULT internal sources are
219
- * used in this callback: @ref DULT_SOUND_SRC_BT_GATT.
226
+ * @param src Sound source type. Only the DULT internal source originating
227
+ * from the Bluetooth accessory non-owner service
228
+ * (@ref DULT_SOUND_SRC_BT_GATT) is used in this callback.
220
229
*/
221
230
void (* sound_stop )(enum dult_sound_src src );
222
231
};
@@ -279,6 +288,63 @@ struct dult_sound_state_param {
279
288
int dult_sound_state_update (const struct dult_user * user ,
280
289
const struct dult_sound_state_param * param );
281
290
291
+ /** @brief Motion detector callback structure.
292
+ *
293
+ * Used only when the @kconfig{CONFIG_DULT_MOTION_DETECTOR} Kconfig option is enabled.
294
+ */
295
+ struct dult_motion_detector_cb {
296
+ /** @brief Request the user to start the motion detector.
297
+ *
298
+ * This callback is called to start the motion detector
299
+ * activity. From now on, the motion detector events are polled
300
+ * periodically with the @ref period_expired API.
301
+ * The motion detector activity stops when the
302
+ * @ref stop is called.
303
+ */
304
+ void (* start )(void );
305
+
306
+ /** @brief Notify the user that the motion detector period has expired.
307
+ *
308
+ * This callback is called at the end of each
309
+ * motion detector period. The @ref start function
310
+ * indicates the beginning of the first motion detector period.
311
+ * The next period is started as soon as the previous period expires.
312
+ * The user should notify the DULT module if motion was detected
313
+ * in the previous period. The return value of this callback
314
+ * is used to pass this information.
315
+ *
316
+ * @return true to indicate detected motion in the last period,
317
+ * otherwise false.
318
+ */
319
+ bool (* period_expired )(void );
320
+
321
+ /** @brief Notify the user that the motion detector can be stopped.
322
+ *
323
+ * This callback is called to notify the user that the motion
324
+ * detector is no longer used by the DULT module. It concludes
325
+ * the motion detector activity that was started by the
326
+ * @ref start callback.
327
+ */
328
+ void (* stop )(void );
329
+ };
330
+
331
+ /** @brief Register motion detector callbacks.
332
+ *
333
+ * This function registers callbacks to handle motion detector activities defined
334
+ * in the Motion detector feature from the DULT specification. This API can only
335
+ * be used when the @kconfig{CONFIG_DULT_MOTION_DETECTOR} Kconfig option is
336
+ * enabled. If this configuration is active, this function must be called after
337
+ * registering the DULT user with @ref dult_user_register and before enabling
338
+ * DULT with @ref dult_enable function.
339
+ *
340
+ * @param user User structure used to authenticate the user.
341
+ * @param cb Motion detector callback structure.
342
+ *
343
+ * @return 0 if the operation was successful. Otherwise, a (negative) error code is returned.
344
+ */
345
+ int dult_motion_detector_cb_register (const struct dult_user * user ,
346
+ const struct dult_motion_detector_cb * cb );
347
+
282
348
/** Modes of the DULT near-owner state. */
283
349
enum dult_near_owner_state_mode {
284
350
/** Separated mode of the near-owner state. */
0 commit comments