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