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 package com.android.bluetooth.hfp;
18 
19 public final class HeadsetHalConstants {
20     // Do not modify without updating the HAL bt_hf.h files.
21 
22     // match up with bthf_connection_state_t enum of bt_hf.h
23     static final int CONNECTION_STATE_DISCONNECTED = 0;
24     static final int CONNECTION_STATE_CONNECTING = 1;
25     static final int CONNECTION_STATE_CONNECTED = 2;
26     static final int CONNECTION_STATE_SLC_CONNECTED = 3;
27     static final int CONNECTION_STATE_DISCONNECTING = 4;
28 
29     // match up with bthf_audio_state_t enum of bt_hf.h
30     static final int AUDIO_STATE_DISCONNECTED = 0;
31     static final int AUDIO_STATE_CONNECTING = 1;
32     static final int AUDIO_STATE_CONNECTED = 2;
33     static final int AUDIO_STATE_DISCONNECTING = 3;
34 
35     // match up with bthf_vr_state_t enum of bt_hf.h
36     static final int VR_STATE_STOPPED = 0;
37     static final int VR_STATE_STARTED = 1;
38 
39     // match up with bthf_volume_type_t enum of bt_hf.h
40     static final int VOLUME_TYPE_SPK = 0;
41     static final int VOLUME_TYPE_MIC = 1;
42 
43     // match up with bthf_network_state_t enum of bt_hf.h
44     static final int NETWORK_STATE_NOT_AVAILABLE = 0;
45     static final int NETWORK_STATE_AVAILABLE = 1;
46 
47     // match up with bthf_service_type_t enum of bt_hf.h
48     static final int SERVICE_TYPE_HOME = 0;
49     static final int SERVICE_TYPE_ROAMING = 1;
50 
51     // match up with bthf_at_response_t of bt_hf.h
52     static final int AT_RESPONSE_ERROR = 0;
53     static final int AT_RESPONSE_OK = 1;
54 
55     // match up with bthf_call_state_t of bt_hf.h
56     static final int CALL_STATE_ACTIVE = 0;
57     static final int CALL_STATE_HELD = 1;
58     static final int CALL_STATE_DIALING = 2;
59     static final int CALL_STATE_ALERTING = 3;
60     static final int CALL_STATE_INCOMING = 4;
61     static final int CALL_STATE_WAITING = 5;
62     static final int CALL_STATE_IDLE = 6;
63     static final int CALL_STATE_DISCONNECTED = 7;
64 
65     // match up with bthf_hf_ind_type_t of bt_hf.h
66     static final int HF_INDICATOR_ENHANCED_DRIVER_SAFETY = 1;
67     public static final int HF_INDICATOR_BATTERY_LEVEL_STATUS = 2;
68 
69     // match up with bthf_wbs_config_t of bt_hf.h
70     static final int BTHF_WBS_NONE = 0;
71     static final int BTHF_WBS_NO = 1;
72     static final int BTHF_WBS_YES = 2;
73 
74     // match up with bthf_swb_codec_t of bt_hf.h
75     static final int BTHF_SWB_CODEC_LC3 = 0;
76     static final int BTHF_SWB_CODEC_VENDOR_APTX = 1;
77 
78     // match up with bthf_swb_config_t of bt_hf.h
79     static final int BTHF_SWB_NONE = 0;
80     static final int BTHF_SWB_NO = 1;
81     static final int BTHF_SWB_YES = 2;
82 
getConnectionStateName(int state)83     static String getConnectionStateName(int state) {
84         switch (state) {
85             case CONNECTION_STATE_DISCONNECTED:
86                 return "CONNECTION_STATE_DISCONNECTED";
87             case CONNECTION_STATE_CONNECTING:
88                 return "CONNECTION_STATE_CONNECTING";
89             case CONNECTION_STATE_CONNECTED:
90                 return "CONNECTION_STATE_CONNECTED";
91             case CONNECTION_STATE_SLC_CONNECTED:
92                 return "CONNECTION_STATE_SLC_CONNECTED";
93             case CONNECTION_STATE_DISCONNECTING:
94                 return "CONNECTION_STATE_DISCONNECTING";
95             default:
96                 return "UNKNOWN STATE!!!";
97         }
98     }
99 }
100