1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 #ifndef __APP_HFP_H__
5 #define __APP_HFP_H__
6 
7 #include "bluetooth.h"
8 #include "btapp.h"
9 
10 #define HF_VOICE_DISABLE  0
11 #define HF_VOICE_ENABLE   1
12 
13 #define HF_SENDBUFF_SIZE (320)
14 #define HF_SENDBUFF_MEMPOOL_NUM (2)
15 
16 struct hf_sendbuff_control {
17     struct {
18         btif_bt_packet_t packet;
19         uint8_t buffer[HF_SENDBUFF_SIZE];
20     } mempool[HF_SENDBUFF_MEMPOOL_NUM];
21     uint8_t index;
22 };
23 
24 
25 #ifndef _SCO_BTPCM_CHANNEL_
26 extern struct hf_sendbuff_control  hf_sendbuff_ctrl;
27 #endif
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif                          /*  */
32 
33 #if defined(SUPPORT_BATTERY_REPORT) || defined(SUPPORT_HF_INDICATORS)
34 int app_hfp_battery_report(uint8_t level);
35 bt_status_t app_hfp_send_at_command(const char *cmd);
36 #else
37 static inline int app_hfp_battery_report(uint8_t level) {return 0;}
38 #endif
39 
40 uint8_t btapp_hfp_get_call_state(void);
41 
42 uint8_t btapp_hfp_incoming_calls(void);
43 
44 bool btapp_hfp_is_call_active(void);
45 
46 bool btapp_hfp_is_sco_active(void);
47 
48 void btapp_hfp_report_speak_gain(void);
49 
50 bool btapp_hfp_mic_need_skip_frame(void);
51 
52 uint8_t btapp_hfp_need_mute(void);
53 
54 #ifdef __INTERCONNECTION__
55 uint8_t ask_is_selfdefined_battery_report_AT_command_support(void);
56 
57 uint8_t send_selfdefined_battery_report_AT_command(void);
58 #endif
59 
60 uint8_t  app_hfp_get_chnl_via_remDev(hf_chan_handle_t * p_hfp_chnl);
61 bool app_hfp_curr_audio_up(hf_chan_handle_t hfp_chnl);
62 int hfp_volume_set(enum BT_DEVICE_ID_T id, int vol);
63 
64 
65 #ifdef __cplusplus
66 }
67 #endif                          /*  */
68 #endif /*__APP_HFP_H__*/
69 
70