• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef CSADPHFP
16 #define CSADPHFP
17 /*chipsea_ohos proguard begin*/
18 #include "cs_proguard.h"
19 /*chipsea_ohos proguard end*/
20 
21 #include "cs_adp_type.h"
22 
23 enum Active_Profile{
24     HANDSFREE     = 0,
25     HANDSFREE_AG     ,
26 };
27 
28 typedef U8 bt_hfp_adp_state;
29 #define HFP_ADP_STATE_IDLE                    0
30 #define HFP_ADP_STATE_PENDING                 1
31 #define HFP_ADP_STATE_CONNECTED               2
32 
33 typedef U32 bt_hfp_adp_call_status;
34 #define BT_CALL_STATUS_NONE             0x0000
35 #define BT_CALL_STATUS_ACTIVE           0x0001
36 #define BT_CALL_STATUS_INCOMING         0x0010
37 #define BT_CALL_STATUS_OUTGOING         0x0020
38 #define BT_CALL_STATUS_ALERT            0x0030
39 
40 typedef U8 AppHfHoldAction;
41 #define APP_HF_HOLD_RELEASE_HELD_CALLS   0
42 #define APP_HF_HOLD_RELEASE_ACTIVE_CALLS 1
43 #define APP_HF_HOLD_HOLD_ACTIVE_CALLS    2
44 #define APP_HF_HOLD_ADD_HELD_CALL        3
45 #define APP_HF_HOLD_CALL_TRANSFER        4
46 
47 typedef U8 bt_hfp_adp_callhold_status;
48 
49 #define BT_CALL_HELD_NONE      0
50 #define BT_CALL_HELD_ACTIVE    1
51 #define BT_CALL_HELD_NO_ACTIVE 2
52 
53 typedef U8 bt_hfp_adp_siri_status;
54 
55 #define BT_CALL_SIRI_OFF       0
56 #define BT_CALL_SIRI_ON        1
57 
58 #define MAX_HANDLE_HFP_DATA 32
59 
60 typedef struct _CS_ADP_HFP_AUDIO_DATA{
61     U16 len;
62     U8 *data;
63 }CS_ADP_HFP_AUDIO_DATA;
64 
65 typedef struct {
66     bt_err_type reason;
67 }Hfp_Con_t;
68 
69 typedef struct {
70     bt_err_type reason;
71 }Hfp_Disc_t;
72 
73 typedef struct {
74     bt_err_type reason;
75     U16 negotiated_codec;
76 }Hfp_Sco_t;
77 
78 typedef struct {
79     CS_ADP_HFP_AUDIO_DATA * buff;
80 }Hfp_DataSend_t;
81 
82 typedef struct {
83     CS_ADP_HFP_AUDIO_DATA * buff;
84 }Hfp_DataInd_t;
85 
86 typedef struct {
87     bt_hfp_adp_call_status callS;
88 }Hfp_CallStatus_t;
89 
90 typedef struct {
91     bt_hfp_adp_call_status callS;
92 }Hfp_CallSetUpStatus_t;
93 
94 typedef struct {
95     bt_hfp_adp_callhold_status callholdS;
96 }Hfp_CallHold_t;
97 
98 typedef struct {
99     bt_hfp_adp_siri_status siriS;
100 }Hfp_SiriStatus_t;
101 
102 typedef struct {
103     char phonenum[MAX_HANDLE_HFP_DATA];
104 }Hfp_CallNum_t;
105 
106 typedef struct {
107     U8 volume;
108 }Hfp_CallVolume_t;
109 
110 typedef struct {
111     char *at_result;
112 }Hfp_ComATResult_t;
113 
114 typedef struct _CS_ADP_HFP_EVENT_{
115     BT_ADDR bdaddr;
116     enum Active_Profile role;
117     union {
118         Hfp_Con_t conP;
119         Hfp_Disc_t discP;
120         Hfp_Sco_t scoP;
121         Hfp_DataSend_t datasendP;
122         Hfp_DataInd_t dataindP;
123         Hfp_CallStatus_t callP;
124         Hfp_CallSetUpStatus_t callsetupP;
125         Hfp_CallHold_t callholdP;
126         Hfp_SiriStatus_t siriP;
127         Hfp_CallNum_t callnumP;
128         Hfp_CallVolume_t volP;
129         Hfp_ComATResult_t atP;
130     }p;
131 }CS_ADP_HFP_EVENT;
132 
133 void cs_adp_hfp_init(enum Active_Profile prf);
134 enum Active_Profile cs_adp_hfp_get_active_prf(void);
135 void cs_adp_hfp_register(void);
136 Status_BTDef cs_adp_hfp_send_siri_report(BT_ADDR bdaddr );
137 Status_BTDef cs_adp_hfp_send_voice_recognition(BT_ADDR bdaddr , bool en);
138 Status_BTDef cs_adp_hfp_send_volume(BT_ADDR bdaddr ,uint8_t Gain);
139 Status_BTDef cs_adp_hfp_disable_NREC(BT_ADDR bdaddr );
140 Status_BTDef cs_adp_hfp_call_answer(BT_ADDR bdaddr );
141 Status_BTDef cs_adp_hfp_call_redial(BT_ADDR bdaddr );
142 void cs_adp_hfp_call_release(BT_ADDR bdaddr);
143 Status_BTDef cs_adp_hfp_list_current_calls(BT_ADDR bdaddr);
144 
145 Status_BTDef cs_adp_hfp_call_hold(BT_ADDR bdaddr ,AppHfHoldAction action ,U8 index);
146 Status_BTDef cs_adp_hfp_send_sco_data(BT_ADDR bdaddr , CS_ADP_HFP_AUDIO_DATA *buffer);
147 BOOL cs_adp_hf_sco_state(BT_ADDR bdaddr );
148 Status_BTDef cs_adp_hfg_connect(BT_ADDR bdaddr);
149 Status_BTDef cs_adp_hf_connect(BT_ADDR bdaddr);
150 Status_BTDef cs_adp_hf_disconnect(BT_ADDR bdaddr);
151 Status_BTDef cs_adp_hf_sco_connect(BT_ADDR bdaddr);
152 Status_BTDef cs_adp_hf_sco_disconnect(BT_ADDR bdaddr);
153 U16 cs_adp_hfp_get_scohandle_by_addr(BT_ADDR bdaddr);
154 U16 cs_adp_hfp_get_negotiated_codec_by_addr(BT_ADDR bdaddr);
155 void cs_adp_hfp_set_battery_level(uint8_t level);
156 void cs_adp_hfp_battery_report_proc(void);
157 BOOL cs_adp_hfp_get_voicerecognition_state(BT_ADDR bdaddr);
158 Status_BTDef cs_adp_hfp_send_at_cclk(BT_ADDR bdaddr);
159 Status_BTDef cs_adp_hfp_send_raw_data(BT_ADDR bdaddr,char *at_string);
160 
161 #endif
162 
163