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 { BTHF_AT_RESPONSE_ERROR = 0, BTHF_AT_RESPONSE_OK } bthf_at_response_t;
26 
27 typedef enum {
28   BTHF_CONNECTION_STATE_DISCONNECTED = 0,
29   BTHF_CONNECTION_STATE_CONNECTING,
30   BTHF_CONNECTION_STATE_CONNECTED,
31   BTHF_CONNECTION_STATE_SLC_CONNECTED,
32   BTHF_CONNECTION_STATE_DISCONNECTING
33 } bthf_connection_state_t;
34 
35 typedef enum {
36   BTHF_AUDIO_STATE_DISCONNECTED = 0,
37   BTHF_AUDIO_STATE_CONNECTING,
38   BTHF_AUDIO_STATE_CONNECTED,
39   BTHF_AUDIO_STATE_DISCONNECTING
40 } bthf_audio_state_t;
41 
42 typedef enum { BTHF_VR_STATE_STOPPED = 0, BTHF_VR_STATE_STARTED } bthf_vr_state_t;
43 
44 typedef enum { BTHF_VOLUME_TYPE_SPK = 0, BTHF_VOLUME_TYPE_MIC } bthf_volume_type_t;
45 
46 /* Noise Reduction and Echo Cancellation */
47 typedef enum { BTHF_NREC_STOP, BTHF_NREC_START } bthf_nrec_t;
48 
49 /* WBS codec setting */
50 typedef enum { BTHF_WBS_NONE, BTHF_WBS_NO, BTHF_WBS_YES } bthf_wbs_config_t;
51 
52 /* SWB codec */
53 typedef enum { BTHF_SWB_CODEC_LC3 = 0, BTHF_SWB_CODEC_VENDOR_APTX } bthf_swb_codec_t;
54 
55 /* SWB codec setting */
56 typedef enum {
57   BTHF_SWB_NONE,
58   BTHF_SWB_NO,
59   BTHF_SWB_YES,
60 } bthf_swb_config_t;
61 
62 /* CHLD - Call held handling */
63 typedef enum {
64   BTHF_CHLD_TYPE_RELEASEHELD,               // Terminate all held or set UDUB("busy") to a
65                                             // waiting call
66   BTHF_CHLD_TYPE_RELEASEACTIVE_ACCEPTHELD,  // Terminate all active calls and
67                                             // accepts a waiting/held call
68   BTHF_CHLD_TYPE_HOLDACTIVE_ACCEPTHELD,     // Hold all active calls and accepts a
69                                             // waiting/held call
70   BTHF_CHLD_TYPE_ADDHELDTOCONF,             // Add all held calls to a conference
71 } bthf_chld_type_t;
72 
73 /* HF Indicators HFP 1.7 */
74 typedef enum {
75   BTHF_HF_IND_ENHANCED_DRIVER_SAFETY = 1,
76   BTHF_HF_IND_BATTERY_LEVEL_STATUS = 2,
77 } bthf_hf_ind_type_t;
78 
79 typedef enum {
80   BTHF_HF_IND_DISABLED = 0,
81   BTHF_HF_IND_ENABLED,
82 } bthf_hf_ind_status_t;
83 
84 /** Network Status */
85 typedef enum {
86   BTHF_NETWORK_STATE_NOT_AVAILABLE = 0,
87   BTHF_NETWORK_STATE_AVAILABLE
88 } bthf_network_state_t;
89 
90 /** Service type */
91 typedef enum { BTHF_SERVICE_TYPE_HOME = 0, BTHF_SERVICE_TYPE_ROAMING } bthf_service_type_t;
92 
93 typedef enum {
94   BTHF_CALL_STATE_ACTIVE = 0,
95   BTHF_CALL_STATE_HELD,
96   BTHF_CALL_STATE_DIALING,
97   BTHF_CALL_STATE_ALERTING,
98   BTHF_CALL_STATE_INCOMING,
99   BTHF_CALL_STATE_WAITING,
100   BTHF_CALL_STATE_IDLE,
101   BTHF_CALL_STATE_DISCONNECTED
102 } bthf_call_state_t;
103 
104 typedef enum {
105   BTHF_CALL_DIRECTION_OUTGOING = 0,
106   BTHF_CALL_DIRECTION_INCOMING
107 } bthf_call_direction_t;
108 
109 typedef enum { BTHF_CALL_TYPE_VOICE = 0, BTHF_CALL_TYPE_DATA, BTHF_CALL_TYPE_FAX } bthf_call_mode_t;
110 
111 typedef enum { BTHF_CALL_MPTY_TYPE_SINGLE = 0, BTHF_CALL_MPTY_TYPE_MULTI } bthf_call_mpty_type_t;
112 
113 typedef enum {
114   BTHF_CALL_ADDRTYPE_UNKNOWN = 0x81,
115   BTHF_CALL_ADDRTYPE_INTERNATIONAL = 0x91
116 } bthf_call_addrtype_t;
117 
118 }  // namespace headset
119 }  // namespace bluetooth
120 
121 namespace std {
122 template <>
123 struct formatter<bluetooth::headset::bthf_connection_state_t>
124     : enum_formatter<bluetooth::headset::bthf_connection_state_t> {};
125 template <>
126 struct formatter<bluetooth::headset::bthf_audio_state_t>
127     : enum_formatter<bluetooth::headset::bthf_audio_state_t> {};
128 template <>
129 struct formatter<bluetooth::headset::bthf_call_addrtype_t>
130     : enum_formatter<bluetooth::headset::bthf_call_addrtype_t> {};
131 template <>
132 struct formatter<bluetooth::headset::bthf_call_mode_t>
133     : enum_formatter<bluetooth::headset::bthf_call_mode_t> {};
134 template <>
135 struct formatter<bluetooth::headset::bthf_call_state_t>
136     : enum_formatter<bluetooth::headset::bthf_call_state_t> {};
137 template <>
138 struct formatter<bluetooth::headset::bthf_call_direction_t>
139     : enum_formatter<bluetooth::headset::bthf_call_direction_t> {};
140 template <>
141 struct formatter<bluetooth::headset::bthf_hf_ind_type_t>
142     : enum_formatter<bluetooth::headset::bthf_hf_ind_type_t> {};
143 template <>
144 struct formatter<bluetooth::headset::bthf_wbs_config_t>
145     : enum_formatter<bluetooth::headset::bthf_wbs_config_t> {};
146 template <>
147 struct formatter<bluetooth::headset::bthf_swb_codec_t>
148     : enum_formatter<bluetooth::headset::bthf_swb_codec_t> {};
149 template <>
150 struct formatter<bluetooth::headset::bthf_swb_config_t>
151     : enum_formatter<bluetooth::headset::bthf_swb_config_t> {};
152 }  // namespace std
153