1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <bluetooth/log.h>
20 
21 namespace bluetooth {
22 namespace headset {
23 
24 /* AT response code - OK/Error */
25 typedef enum {
26   BTHF_AT_RESPONSE_ERROR = 0,
27   BTHF_AT_RESPONSE_OK
28 } bthf_at_response_t;
29 
30 typedef enum {
31   BTHF_CONNECTION_STATE_DISCONNECTED = 0,
32   BTHF_CONNECTION_STATE_CONNECTING,
33   BTHF_CONNECTION_STATE_CONNECTED,
34   BTHF_CONNECTION_STATE_SLC_CONNECTED,
35   BTHF_CONNECTION_STATE_DISCONNECTING
36 } bthf_connection_state_t;
37 
38 typedef enum {
39   BTHF_AUDIO_STATE_DISCONNECTED = 0,
40   BTHF_AUDIO_STATE_CONNECTING,
41   BTHF_AUDIO_STATE_CONNECTED,
42   BTHF_AUDIO_STATE_DISCONNECTING
43 } bthf_audio_state_t;
44 
45 typedef enum {
46   BTHF_VR_STATE_STOPPED = 0,
47   BTHF_VR_STATE_STARTED
48 } bthf_vr_state_t;
49 
50 typedef enum {
51   BTHF_VOLUME_TYPE_SPK = 0,
52   BTHF_VOLUME_TYPE_MIC
53 } bthf_volume_type_t;
54 
55 /* Noise Reduction and Echo Cancellation */
56 typedef enum { BTHF_NREC_STOP, BTHF_NREC_START } bthf_nrec_t;
57 
58 /* WBS codec setting */
59 typedef enum { BTHF_WBS_NONE, BTHF_WBS_NO, BTHF_WBS_YES } bthf_wbs_config_t;
60 
61 /* SWB codec */
62 typedef enum {
63   BTHF_SWB_CODEC_LC3 = 0,
64   BTHF_SWB_CODEC_VENDOR_APTX
65 } bthf_swb_codec_t;
66 
67 /* SWB codec setting */
68 typedef enum {
69   BTHF_SWB_NONE,
70   BTHF_SWB_NO,
71   BTHF_SWB_YES,
72 } bthf_swb_config_t;
73 
74 /* CHLD - Call held handling */
75 typedef enum {
76   BTHF_CHLD_TYPE_RELEASEHELD,  // Terminate all held or set UDUB("busy") to a
77                                // waiting call
78   BTHF_CHLD_TYPE_RELEASEACTIVE_ACCEPTHELD,  // Terminate all active calls and
79                                             // accepts a waiting/held call
80   BTHF_CHLD_TYPE_HOLDACTIVE_ACCEPTHELD,  // Hold all active calls and accepts a
81                                          // waiting/held call
82   BTHF_CHLD_TYPE_ADDHELDTOCONF,          // Add all held calls to a conference
83 } bthf_chld_type_t;
84 
85 /* HF Indicators HFP 1.7 */
86 typedef enum {
87   BTHF_HF_IND_ENHANCED_DRIVER_SAFETY = 1,
88   BTHF_HF_IND_BATTERY_LEVEL_STATUS = 2,
89 } bthf_hf_ind_type_t;
90 
91 typedef enum {
92   BTHF_HF_IND_DISABLED = 0,
93   BTHF_HF_IND_ENABLED,
94 } bthf_hf_ind_status_t;
95 
96 /** Network Status */
97 typedef enum {
98   BTHF_NETWORK_STATE_NOT_AVAILABLE = 0,
99   BTHF_NETWORK_STATE_AVAILABLE
100 } bthf_network_state_t;
101 
102 /** Service type */
103 typedef enum {
104   BTHF_SERVICE_TYPE_HOME = 0,
105   BTHF_SERVICE_TYPE_ROAMING
106 } bthf_service_type_t;
107 
108 typedef enum {
109   BTHF_CALL_STATE_ACTIVE = 0,
110   BTHF_CALL_STATE_HELD,
111   BTHF_CALL_STATE_DIALING,
112   BTHF_CALL_STATE_ALERTING,
113   BTHF_CALL_STATE_INCOMING,
114   BTHF_CALL_STATE_WAITING,
115   BTHF_CALL_STATE_IDLE,
116   BTHF_CALL_STATE_DISCONNECTED
117 } bthf_call_state_t;
118 
119 typedef enum {
120   BTHF_CALL_DIRECTION_OUTGOING = 0,
121   BTHF_CALL_DIRECTION_INCOMING
122 } bthf_call_direction_t;
123 
124 typedef enum {
125   BTHF_CALL_TYPE_VOICE = 0,
126   BTHF_CALL_TYPE_DATA,
127   BTHF_CALL_TYPE_FAX
128 } bthf_call_mode_t;
129 
130 typedef enum {
131   BTHF_CALL_MPTY_TYPE_SINGLE = 0,
132   BTHF_CALL_MPTY_TYPE_MULTI
133 } bthf_call_mpty_type_t;
134 
135 typedef enum {
136   BTHF_CALL_ADDRTYPE_UNKNOWN = 0x81,
137   BTHF_CALL_ADDRTYPE_INTERNATIONAL = 0x91
138 } bthf_call_addrtype_t;
139 
140 }  // namespace headset
141 }  // namespace bluetooth
142 
143 namespace fmt {
144 template <>
145 struct formatter<bluetooth::headset::bthf_connection_state_t>
146     : enum_formatter<bluetooth::headset::bthf_connection_state_t> {};
147 template <>
148 struct formatter<bluetooth::headset::bthf_audio_state_t>
149     : enum_formatter<bluetooth::headset::bthf_audio_state_t> {};
150 template <>
151 struct formatter<bluetooth::headset::bthf_call_addrtype_t>
152     : enum_formatter<bluetooth::headset::bthf_call_addrtype_t> {};
153 template <>
154 struct formatter<bluetooth::headset::bthf_call_mode_t>
155     : enum_formatter<bluetooth::headset::bthf_call_mode_t> {};
156 template <>
157 struct formatter<bluetooth::headset::bthf_call_state_t>
158     : enum_formatter<bluetooth::headset::bthf_call_state_t> {};
159 template <>
160 struct formatter<bluetooth::headset::bthf_call_direction_t>
161     : enum_formatter<bluetooth::headset::bthf_call_direction_t> {};
162 template <>
163 struct formatter<bluetooth::headset::bthf_hf_ind_type_t>
164     : enum_formatter<bluetooth::headset::bthf_hf_ind_type_t> {};
165 template <>
166 struct formatter<bluetooth::headset::bthf_wbs_config_t>
167     : enum_formatter<bluetooth::headset::bthf_wbs_config_t> {};
168 template <>
169 struct formatter<bluetooth::headset::bthf_swb_codec_t>
170     : enum_formatter<bluetooth::headset::bthf_swb_codec_t> {};
171 template <>
172 struct formatter<bluetooth::headset::bthf_swb_config_t>
173     : enum_formatter<bluetooth::headset::bthf_swb_config_t> {};
174 }  // namespace fmt
175