1 /*
2  * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef __ESP_HF_DEFS_H__
8 #define __ESP_HF_DEFS_H__
9 
10 #include "esp_bt_defs.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /// profile states
17 typedef enum {
18     ESP_HF_INIT_SUCCESS = 0,                /*!< Indicate init successful */
19     ESP_HF_INIT_ALREADY,                    /*!< Indicate init repeated */
20     ESP_HF_INIT_FAIL,                       /*!< Indicate init fail */
21     ESP_HF_DEINIT_SUCCESS,                  /*!< Indicate deinit successful */
22     ESP_HF_DEINIT_ALREADY,                  /*!< Indicate deinit repeated */
23     ESP_HF_DEINIT_FAIL,                     /*!< Indicate deinit fail */
24 } esp_hf_prof_state_t;
25 
26 /// in-band ring tone state
27 typedef enum {
28     ESP_HF_IN_BAND_RINGTONE_NOT_PROVIDED = 0,
29     ESP_HF_IN_BAND_RINGTONE_PROVIDED,
30 } esp_hf_in_band_ring_state_t;
31 
32 /// voice recognition state
33 typedef enum {
34     ESP_HF_VR_STATE_DISABLED = 0,           /*!< voice recognition disabled */
35     ESP_HF_VR_STATE_ENABLED,                /*!< voice recognition enabled */
36 } esp_hf_vr_state_t;
37 
38 /// Bluetooth HFP audio volume control target
39 typedef enum {
40     ESP_HF_VOLUME_CONTROL_TARGET_SPK = 0,             /*!< speaker */
41     ESP_HF_VOLUME_CONTROL_TARGET_MIC,                 /*!< microphone */
42 } esp_hf_volume_control_target_t;
43 
44 /// Bluetooth HFP audio connection status
45 typedef enum {
46     ESP_HF_AUDIO_STATE_DISCONNECTED = 0,          /*!< audio connection released */
47     ESP_HF_AUDIO_STATE_CONNECTING,                /*!< audio connection has been initiated */
48     ESP_HF_AUDIO_STATE_CONNECTED,                 /*!< audio connection is established */
49     ESP_HF_AUDIO_STATE_CONNECTED_MSBC,            /*!< mSBC audio connection is established */
50 } esp_hf_audio_state_t;
51 
52 typedef enum {
53     ESP_HF_VOLUME_TYPE_SPK = 0,
54     ESP_HF_VOLUME_TYPE_MIC
55 } esp_hf_volume_type_t;
56 
57 /// +CIND network service availability status
58 typedef enum
59 {
60     ESP_HF_NETWORK_STATE_NOT_AVAILABLE = 0,
61     ESP_HF_NETWORK_STATE_AVAILABLE
62 } esp_hf_network_state_t;
63 
64 /// +CIEV report type
65 typedef enum {
66     ESP_HF_IND_TYPE_CALL = 1,       /*!< position of call indicator */
67     ESP_HF_IND_TYPE_CALLSETUP,      /*!< position of callsetup indicator */
68     ESP_HF_IND_TYPE_SERVICE,        /*!< position of service indicator */
69     ESP_HF_IND_TYPE_SIGNAL,         /*!< position of signal strength indicator, range: 0-5  */
70     ESP_HF_IND_TYPE_ROAM,           /*!< position of roaming indicator */
71     ESP_HF_IND_TYPE_BATTCHG,        /*!< position of battery charge indicator, range: 0-5 */
72     ESP_HF_IND_TYPE_CALLHELD        /*!< position of callheld indicator */
73 } esp_hf_ciev_report_type_t;
74 
75 /** +CIEV Service type */
76 typedef enum
77 {
78     ESP_HF_SERVICE_TYPE_HOME = 0,
79     ESP_HF_SERVICE_TYPE_ROAMING
80 } esp_hf_service_type_t;
81 
82 /// +CIND call status indicator values
83 typedef enum {
84     ESP_HF_CALL_STATUS_NO_CALLS = 0,                  /*!< no call in progress */
85     ESP_HF_CALL_STATUS_CALL_IN_PROGRESS = 1,          /*!< call is present(active or held) */
86 } esp_hf_call_status_t;
87 
88 /// +CIND call setup status indicator values
89 typedef enum {
90     ESP_HF_CALL_SETUP_STATUS_IDLE = 0,                /*!< no call setup in progress */
91     ESP_HF_CALL_SETUP_STATUS_INCOMING = 1,            /*!< incoming call setup in progress */
92     ESP_HF_CALL_SETUP_STATUS_OUTGOING_DIALING = 2,    /*!< outgoing call setup in dialing state */
93     ESP_HF_CALL_SETUP_STATUS_OUTGOING_ALERTING = 3,   /*!< outgoing call setup in alerting state */
94 } esp_hf_call_setup_status_t;
95 
96 /// +CIND roaming status indicator values
97 typedef enum {
98     ESP_HF_ROAMING_STATUS_INACTIVE = 0,               /*!< roaming is not active */
99     ESP_HF_ROAMING_STATUS_ACTIVE,                     /*!< a roaming is active */
100 } esp_hf_roaming_status_t;
101 
102 /// +CIND call held indicator values
103 typedef enum {
104     ESP_HF_CALL_HELD_STATUS_NONE = 0,                 /*!< no calls held */
105     ESP_HF_CALL_HELD_STATUS_HELD_AND_ACTIVE = 1,      /*!< both active and held call */
106     ESP_HF_CALL_HELD_STATUS_HELD = 2,                 /*!< call on hold, no active call*/
107 } esp_hf_call_held_status_t;
108 
109 /// +CLCC status of the call
110 typedef enum {
111     ESP_HF_CURRENT_CALL_STATUS_ACTIVE = 0,            /*!< active */
112     ESP_HF_CURRENT_CALL_STATUS_HELD = 1,              /*!< held */
113     ESP_HF_CURRENT_CALL_STATUS_DIALING = 2,           /*!< dialing (outgoing calls only) */
114     ESP_HF_CURRENT_CALL_STATUS_ALERTING = 3,          /*!< alerting (outgoing calls only) */
115     ESP_HF_CURRENT_CALL_STATUS_INCOMING = 4,          /*!< incoming (incoming calls only) */
116     ESP_HF_CURRENT_CALL_STATUS_WAITING = 5,           /*!< waiting (incoming calls only) */
117     ESP_HF_CURRENT_CALL_STATUS_HELD_BY_RESP_HOLD = 6, /*!< call held by response and hold */
118 } esp_hf_current_call_status_t;
119 
120 /// +CLCC direction of the call
121 typedef enum {
122     ESP_HF_CURRENT_CALL_DIRECTION_OUTGOING = 0,       /*!< outgoing */
123     ESP_HF_CURRENT_CALL_DIRECTION_INCOMING = 1,       /*!< incoming */
124 } esp_hf_current_call_direction_t;
125 
126 /// +CLCC multi-party call flag
127 typedef enum {
128     ESP_HF_CURRENT_CALL_MPTY_TYPE_SINGLE = 0,         /*!< not a member of a multi-party call */
129     ESP_HF_CURRENT_CALL_MPTY_TYPE_MULTI = 1,          /*!< member of a multi-party call */
130 } esp_hf_current_call_mpty_type_t;
131 
132 /// +CLCC call mode
133 typedef enum {
134     ESP_HF_CURRENT_CALL_MODE_VOICE = 0,
135     ESP_HF_CURRENT_CALL_MODE_DATA = 1,
136     ESP_HF_CURRENT_CALL_MODE_FAX = 2,
137 } esp_hf_current_call_mode_t;
138 
139 /// +CLCC address type
140 typedef enum {
141     ESP_HF_CALL_ADDR_TYPE_UNKNOWN = 0x81,            /*!< unknown address type */
142     ESP_HF_CALL_ADDR_TYPE_INTERNATIONAL = 0x91,      /*!< international address */
143 } esp_hf_call_addr_type_t;
144 
145 /// +CNUM service type of the phone number
146 typedef enum {
147     ESP_HF_SUBSCRIBER_SERVICE_TYPE_UNKNOWN = 0,      /*!< unknown */
148     ESP_HF_SUBSCRIBER_SERVICE_TYPE_VOICE = 4,        /*!< voice service */
149     ESP_HF_SUBSCRIBER_SERVICE_TYPE_FAX,              /*!< fax service */
150 } esp_hf_subscriber_service_type_t;
151 
152 /// +BTRH response and hold result code
153 typedef enum {
154     ESP_HF_BTRH_STATUS_HELD = 0,       /*!< incoming call is put on held in AG */
155     ESP_HF_BTRH_STATUS_ACCEPTED,       /*!< held incoming call is accepted in AG */
156     ESP_HF_BTRH_STATUS_REJECTED,       /*!< held incoming call is rejected in AG */
157 } esp_hf_btrh_status_t;
158 
159 /// AT+BTRH response and hold action code
160 typedef enum {
161     ESP_HF_BTRH_CMD_HOLD = 0,          /*!< put the incoming call on hold */
162     ESP_HF_BTRH_CMD_ACCEPT = 1,        /*!< accept a held incoming call */
163     ESP_HF_BTRH_CMD_REJECT = 2,        /*!< reject a held incoming call */
164 } esp_hf_btrh_cmd_t;
165 
166 /* +NREC */
167 typedef enum
168 {
169     ESP_HF_NREC_STOP = 0,
170     ESP_HF_NREC_START
171 } esp_hf_nrec_t;
172 
173 ///+CCWA response status
174 typedef enum {
175     ESP_HF_CALL_WAITING_INACTIVE,
176     ESP_HF_CALL_WAITING_ACTIVE,
177 } esp_hf_call_waiting_status_t;
178 
179 /* WBS codec setting */
180 typedef enum
181 {
182    ESP_HF_WBS_NONE,
183    ESP_HF_WBS_NO,
184    ESP_HF_WBS_YES
185 }esp_hf_wbs_config_t;
186 
187 /// Bluetooth HFP RFCOMM connection and service level connection status
188 typedef enum {
189     ESP_HF_CONNECTION_STATE_DISCONNECTED = 0,     /*!< RFCOMM data link channel released */
190     ESP_HF_CONNECTION_STATE_CONNECTING,           /*!< connecting remote device on the RFCOMM data link*/
191     ESP_HF_CONNECTION_STATE_CONNECTED,            /*!< RFCOMM connection established */
192     ESP_HF_CONNECTION_STATE_SLC_CONNECTED,        /*!< service level connection established */
193     ESP_HF_CONNECTION_STATE_DISCONNECTING,        /*!< disconnecting with remote device on the RFCOMM data link*/
194 } esp_hf_connection_state_t;
195 
196 /// AT+CHLD command values
197 typedef enum {
198     ESP_HF_CHLD_TYPE_REL = 0,               /*!< <0>, Terminate all held or set UDUB("busy") to a waiting call */
199     ESP_HF_CHLD_TYPE_REL_ACC,               /*!< <1>, Terminate all active calls and accepts a waiting/held call */
200     ESP_HF_CHLD_TYPE_HOLD_ACC,              /*!< <2>, Hold all active calls and accepts a waiting/held call */
201     ESP_HF_CHLD_TYPE_MERGE,                 /*!< <3>, Add all held calls to a conference */
202     ESP_HF_CHLD_TYPE_MERGE_DETACH,          /*!< <4>, connect the two calls and disconnects the subscriber from both calls */
203     ESP_HF_CHLD_TYPE_REL_X,                 /*!< <1x>, releases specified calls only */
204     ESP_HF_CHLD_TYPE_PRIV_X,                /*!< <2x>, request private consultation mode with specified call */
205 } esp_hf_chld_type_t;
206 
207 /* AT response code - OK/Error */
208 typedef enum {
209     ESP_HF_AT_RESPONSE_CODE_OK = 0,         /*!< acknowledges execution of a command line */
210     ESP_HF_AT_RESPONSE_CODE_ERR,            /*!< command not accepted */
211     ESP_HF_AT_RESPONSE_CODE_NO_CARRIER,     /*!< connection terminated */
212     ESP_HF_AT_RESPONSE_CODE_BUSY,           /*!< busy signal detected */
213     ESP_HF_AT_RESPONSE_CODE_NO_ANSWER,      /*!< connection completion timeout */
214     ESP_HF_AT_RESPONSE_CODE_DELAYED,        /*!< delayed */
215     ESP_HF_AT_RESPONSE_CODE_BLACKLISTED,    /*!< blacklisted */
216     ESP_HF_AT_RESPONSE_CODE_CME,            /*!< CME error */
217 } esp_hf_at_response_code_t;
218 
219 /* AT response code - OK/Error */
220 typedef enum {
221     ESP_HF_AT_RESPONSE_ERROR = 0,
222     ESP_HF_AT_RESPONSE_OK
223 } esp_hf_at_response_t;
224 
225 /// Extended Audio Gateway Error Result Code Response
226 typedef enum {
227     ESP_HF_CME_AG_FAILURE = 0,                    /*!< ag failure */
228     ESP_HF_CME_NO_CONNECTION_TO_PHONE = 1,        /*!< no connection to phone */
229     ESP_HF_CME_OPERATION_NOT_ALLOWED = 3,         /*!< operation not allowed */
230     ESP_HF_CME_OPERATION_NOT_SUPPORTED = 4,       /*!< operation not supported */
231     ESP_HF_CME_PH_SIM_PIN_REQUIRED = 5,           /*!< PH-SIM PIN Required */
232     ESP_HF_CME_SIM_NOT_INSERTED = 10,             /*!< SIM not inserted */
233     ESP_HF_CME_SIM_PIN_REQUIRED = 11,             /*!< SIM PIN required */
234     ESP_HF_CME_SIM_PUK_REQUIRED = 12,             /*!< SIM PUK required */
235     ESP_HF_CME_SIM_FAILURE = 13,                  /*!< SIM failure */
236     ESP_HF_CME_SIM_BUSY = 14,                     /*!< SIM busy */
237     ESP_HF_CME_INCORRECT_PASSWORD = 16,           /*!< incorrect password */
238     ESP_HF_CME_SIM_PIN2_REQUIRED = 17,            /*!< SIM PIN2 required */
239     ESP_HF_CME_SIM_PUK2_REQUIRED = 18,            /*!< SIM PUK2 required */
240     ESP_HF_CME_MEMORY_FULL = 20,                  /*!< memory full */
241     ESP_HF_CME_INVALID_INDEX = 21,                /*!< invalid index */
242     ESP_HF_CME_MEMORY_FAILURE = 23,              /*!< memory failure */
243     ESP_HF_CME_TEXT_STRING_TOO_LONG = 24,         /*!< test string too long */
244     ESP_HF_CME_INVALID_CHARACTERS_IN_TEXT_STRING = 25,  /*!< invalid characters in text string */
245     ESP_HF_CME_DIAL_STRING_TOO_LONG = 26,         /*!< dial string too long*/
246     ESP_HF_CME_INVALID_CHARACTERS_IN_DIAL_STRING = 27,  /*!< invalid characters in dial string */
247     ESP_HF_CME_NO_NETWORK_SERVICE = 30,           /*!< no network service */
248     ESP_HF_CME_NETWORK_TIMEOUT = 31,              /*!< network timeout */
249     ESP_HF_CME_NETWORK_NOT_ALLOWED = 32,          /*!< network not allowed --emergency calls only */
250 } esp_hf_cme_err_t;
251 
252 #ifdef __cplusplus
253 }
254 #endif
255 
256 #endif /* __ESP_HF_DEFS_H__ */
257