LCOV - code coverage report
Current view: top level - zephyr/bluetooth/services - ias.h Coverage Total Hit
Test: new.info Lines: 76.9 % 13 10
Test Date: 2025-09-05 20:47:19

            Line data    Source code
       1            0 : /*
       2              :  * Copyright (c) 2022 Codecoup
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : #ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_IAS_H_
       8              : #define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_IAS_H_
       9              : 
      10              : /**
      11              :  * @brief Immediate Alert Service (IAS)
      12              :  * @defgroup bt_ias Immediate Alert Service (IAS)
      13              :  * @ingroup bluetooth
      14              :  * @{
      15              :  *
      16              :  * [Experimental] Users should note that the APIs can change
      17              :  * as a part of ongoing development.
      18              :  */
      19              : 
      20              : #include <zephyr/bluetooth/conn.h>
      21              : #include <zephyr/sys/iterable_sections.h>
      22              : 
      23              : #ifdef __cplusplus
      24              : extern "C" {
      25              : #endif
      26              : 
      27            0 : enum bt_ias_alert_lvl {
      28              :         /** No alerting should be done on device */
      29              :         BT_IAS_ALERT_LVL_NO_ALERT,
      30              : 
      31              :         /** Device shall alert */
      32              :         BT_IAS_ALERT_LVL_MILD_ALERT,
      33              : 
      34              :         /** Device should alert in strongest possible way */
      35              :         BT_IAS_ALERT_LVL_HIGH_ALERT,
      36              : };
      37              : 
      38              : /** @brief Immediate Alert Service callback structure. */
      39            1 : struct bt_ias_cb {
      40              :         /**
      41              :          * @brief Callback function to stop alert.
      42              :          *
      43              :          * This callback is called when peer commands to disable alert.
      44              :          */
      45            1 :         void (*no_alert)(void);
      46              : 
      47              :         /**
      48              :          * @brief Callback function for alert level value.
      49              :          *
      50              :          * This callback is called when peer commands to alert.
      51              :          */
      52            1 :         void (*mild_alert)(void);
      53              : 
      54              :         /**
      55              :          * @brief Callback function for alert level value.
      56              :          *
      57              :          * This callback is called when peer commands to alert in the strongest possible way.
      58              :          */
      59            1 :         void (*high_alert)(void);
      60              : };
      61              : 
      62              : /** @brief Method for stopping alert locally
      63              :  *
      64              :  *  @return Zero in case of success and error code in case of error.
      65              :  */
      66            1 : int bt_ias_local_alert_stop(void);
      67              : 
      68              : /**
      69              :  *  @brief Register a callback structure for immediate alert events.
      70              :  *
      71              :  *  @param _name Name of callback structure.
      72              :  */
      73            1 : #define BT_IAS_CB_DEFINE(_name)                                                                    \
      74              :         static const STRUCT_SECTION_ITERABLE(bt_ias_cb, _CONCAT(bt_ias_cb_, _name))
      75              : 
      76            0 : struct bt_ias_client_cb {
      77              :         /** @brief Callback function for bt_ias_discover.
      78              :          *
      79              :          *  This callback is called when discovery procedure is complete.
      80              :          *
      81              :          *  @param conn Bluetooth connection object.
      82              :          *  @param err 0 on success, ATT error or negative errno otherwise
      83              :          */
      84            1 :         void (*discover)(struct bt_conn *conn, int err);
      85              : };
      86              : 
      87              : /** @brief Set alert level
      88              :  *
      89              :  *  @param conn Bluetooth connection object
      90              :  *  @param bt_ias_alert_lvl Level of alert to write
      91              :  *
      92              :  *  @return Zero in case of success and error code in case of error.
      93              :  */
      94            1 : int bt_ias_client_alert_write(struct bt_conn *conn, enum bt_ias_alert_lvl);
      95              : 
      96              : /** @brief Discover Immediate Alert Service
      97              :  *
      98              :  *  @param conn Bluetooth connection object
      99              :  *
     100              :  *  @return Zero in case of success and error code in case of error.
     101              :  */
     102            1 : int bt_ias_discover(struct bt_conn *conn);
     103              : 
     104              : /** @brief Register Immediate Alert Client callbacks
     105              :  *
     106              :  *  @param cb The callback structure
     107              :  *
     108              :  *  @return Zero in case of success and error code in case of error.
     109              :  */
     110            1 : int bt_ias_client_cb_register(const struct bt_ias_client_cb *cb);
     111              : 
     112              : #ifdef __cplusplus
     113              : }
     114              : #endif
     115              : 
     116              : /**
     117              :  * @}
     118              :  */
     119              : 
     120              : #endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_IAS_H_ */
        

Generated by: LCOV version 2.0-1