LCOV - code coverage report
Current view: top level - zephyr/bluetooth/classic - hfp_hf.h Hit Total Coverage
Test: new.info Lines: 18 25 72.0 %
Date: 2024-12-22 00:14:23

          Line data    Source code
       1           1 : /** @file
       2             :  *  @brief Handsfree Profile handling.
       3             :  */
       4             : 
       5             : /*
       6             :  * Copyright (c) 2015-2016 Intel Corporation
       7             :  *
       8             :  * SPDX-License-Identifier: Apache-2.0
       9             :  */
      10             : #ifndef ZEPHYR_INCLUDE_BLUETOOTH_HFP_HF_H_
      11             : #define ZEPHYR_INCLUDE_BLUETOOTH_HFP_HF_H_
      12             : 
      13             : /**
      14             :  * @brief Hands Free Profile (HFP)
      15             :  * @defgroup bt_hfp Hands Free Profile (HFP)
      16             :  * @ingroup bluetooth
      17             :  * @{
      18             :  */
      19             : 
      20             : #include <zephyr/bluetooth/bluetooth.h>
      21             : 
      22             : #ifdef __cplusplus
      23             : extern "C" {
      24             : #endif
      25             : 
      26             : /* AT Commands */
      27           0 : enum bt_hfp_hf_at_cmd {
      28             :         BT_HFP_HF_ATA,
      29             :         BT_HFP_HF_AT_CHUP,
      30             : };
      31             : 
      32             : /*
      33             :  * Command complete types for the application
      34             :  */
      35           0 : #define HFP_HF_CMD_OK             0
      36           0 : #define HFP_HF_CMD_ERROR          1
      37           0 : #define HFP_HF_CMD_CME_ERROR      2
      38           0 : #define HFP_HF_CMD_UNKNOWN_ERROR  4
      39             : 
      40             : /** @brief HFP HF Command completion field */
      41           1 : struct bt_hfp_hf_cmd_complete {
      42             :         /* Command complete status */
      43           0 :         uint8_t type;
      44             :         /* CME error number to be added */
      45           0 :         uint8_t cme;
      46             : };
      47             : 
      48             : /** @brief HFP profile application callback */
      49           1 : struct bt_hfp_hf_cb {
      50             :         /** HF connected callback to application
      51             :          *
      52             :          *  If this callback is provided it will be called whenever the
      53             :          *  connection completes.
      54             :          *
      55             :          *  @param conn Connection object.
      56             :          */
      57           1 :         void (*connected)(struct bt_conn *conn);
      58             :         /** HF disconnected callback to application
      59             :          *
      60             :          *  If this callback is provided it will be called whenever the
      61             :          *  connection gets disconnected, including when a connection gets
      62             :          *  rejected or cancelled or any error in SLC establishment.
      63             :          *
      64             :          *  @param conn Connection object.
      65             :          */
      66           1 :         void (*disconnected)(struct bt_conn *conn);
      67             :         /** HF SCO/eSCO connected Callback
      68             :          *
      69             :          *  If this callback is provided it will be called whenever the
      70             :          *  SCO/eSCO connection completes.
      71             :          *
      72             :          *  @param conn Connection object.
      73             :          *  @param sco_conn SCO/eSCO Connection object.
      74             :          */
      75           1 :         void (*sco_connected)(struct bt_conn *conn, struct bt_conn *sco_conn);
      76             :         /** HF SCO/eSCO disconnected Callback
      77             :          *
      78             :          *  If this callback is provided it will be called whenever the
      79             :          *  SCO/eSCO connection gets disconnected.
      80             :          *
      81             :          *  @param conn Connection object.
      82             :          *  @param reason BT_HCI_ERR_* reason for the disconnection.
      83             :          */
      84           1 :         void (*sco_disconnected)(struct bt_conn *sco_conn, uint8_t reason);
      85             :         /** HF indicator Callback
      86             :          *
      87             :          *  This callback provides service indicator value to the application
      88             :          *
      89             :          *  @param conn Connection object.
      90             :          *  @param value service indicator value received from the AG.
      91             :          */
      92           1 :         void (*service)(struct bt_conn *conn, uint32_t value);
      93             :         /** HF indicator Callback
      94             :          *
      95             :          *  This callback provides call indicator value to the application
      96             :          *
      97             :          *  @param conn Connection object.
      98             :          *  @param value call indicator value received from the AG.
      99             :          */
     100           1 :         void (*call)(struct bt_conn *conn, uint32_t value);
     101             :         /** HF indicator Callback
     102             :          *
     103             :          *  This callback provides call setup indicator value to the application
     104             :          *
     105             :          *  @param conn Connection object.
     106             :          *  @param value call setup indicator value received from the AG.
     107             :          */
     108           1 :         void (*call_setup)(struct bt_conn *conn, uint32_t value);
     109             :         /** HF indicator Callback
     110             :          *
     111             :          *  This callback provides call held indicator value to the application
     112             :          *
     113             :          *  @param conn Connection object.
     114             :          *  @param value call held indicator value received from the AG.
     115             :          */
     116           1 :         void (*call_held)(struct bt_conn *conn, uint32_t value);
     117             :         /** HF indicator Callback
     118             :          *
     119             :          *  This callback provides signal indicator value to the application
     120             :          *
     121             :          *  @param conn Connection object.
     122             :          *  @param value signal indicator value received from the AG.
     123             :          */
     124           1 :         void (*signal)(struct bt_conn *conn, uint32_t value);
     125             :         /** HF indicator Callback
     126             :          *
     127             :          *  This callback provides roaming indicator value to the application
     128             :          *
     129             :          *  @param conn Connection object.
     130             :          *  @param value roaming indicator value received from the AG.
     131             :          */
     132           1 :         void (*roam)(struct bt_conn *conn, uint32_t value);
     133             :         /** HF indicator Callback
     134             :          *
     135             :          *  This callback battery service indicator value to the application
     136             :          *
     137             :          *  @param conn Connection object.
     138             :          *  @param value battery indicator value received from the AG.
     139             :          */
     140           1 :         void (*battery)(struct bt_conn *conn, uint32_t value);
     141             :         /** HF incoming call Ring indication callback to application
     142             :          *
     143             :          *  If this callback is provided it will be called whenever there
     144             :          *  is an incoming call.
     145             :          *
     146             :          *  @param conn Connection object.
     147             :          */
     148           1 :         void (*ring_indication)(struct bt_conn *conn);
     149             :         /** HF notify command completed callback to application
     150             :          *
     151             :          *  The command sent from the application is notified about its status
     152             :          *
     153             :          *  @param conn Connection object.
     154             :          *  @param cmd structure contains status of the command including cme.
     155             :          */
     156           1 :         void (*cmd_complete_cb)(struct bt_conn *conn,
     157             :                               struct bt_hfp_hf_cmd_complete *cmd);
     158             : };
     159             : 
     160             : /** @brief Register HFP HF profile
     161             :  *
     162             :  *  Register Handsfree profile callbacks to monitor the state and get the
     163             :  *  required HFP details to display.
     164             :  *
     165             :  *  @param cb callback structure.
     166             :  *
     167             :  *  @return 0 in case of success or negative value in case of error.
     168             :  */
     169           1 : int bt_hfp_hf_register(struct bt_hfp_hf_cb *cb);
     170             : 
     171             : /** @brief Handsfree client Send AT
     172             :  *
     173             :  *  Send specific AT commands to handsfree client profile.
     174             :  *
     175             :  *  @param conn Connection object.
     176             :  *  @param cmd AT command to be sent.
     177             :  *
     178             :  *  @return 0 in case of success or negative value in case of error.
     179             :  */
     180           1 : int bt_hfp_hf_send_cmd(struct bt_conn *conn, enum bt_hfp_hf_at_cmd cmd);
     181             : 
     182             : #ifdef __cplusplus
     183             : }
     184             : #endif
     185             : 
     186             : /**
     187             :  * @}
     188             :  */
     189             : 
     190             : #endif /* ZEPHYR_INCLUDE_BLUETOOTH_HFP_HF_H_ */

Generated by: LCOV version 1.14