1 /*
2  * Copyright 2021 HIMSA II K/S - www.himsa.com.
3  * Represented by EHIMA - www.ehima.com
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 package android.bluetooth;
19 
20 import android.bluetooth.BluetoothDevice;
21 import android.bluetooth.BluetoothHapPresetInfo;
22 import android.bluetooth.IBluetoothHapClientCallback;
23 import android.content.AttributionSource;
24 
25 /**
26  * APIs for Bluetooth Hearing Access Profile client
27  *
28  * @hide
29  */
30 interface IBluetoothHapClient {
31     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getConnectedDevices(in AttributionSource attributionSource)32     List<BluetoothDevice> getConnectedDevices(in AttributionSource attributionSource);
33     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getDevicesMatchingConnectionStates(in int[] states, in AttributionSource attributionSource)34     List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states, in AttributionSource attributionSource);
35     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getConnectionState(in BluetoothDevice device, in AttributionSource attributionSource)36     int getConnectionState(in BluetoothDevice device, in AttributionSource attributionSource);
37     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource)38     boolean setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource);
39     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource)40     int getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource);
41     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getHapGroup(in BluetoothDevice device, in AttributionSource attributionSource)42     int getHapGroup(in BluetoothDevice device, in AttributionSource attributionSource);
43     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getActivePresetIndex(in BluetoothDevice device, in AttributionSource attributionSource)44     int getActivePresetIndex(in BluetoothDevice device, in AttributionSource attributionSource);
45     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getActivePresetInfo(in BluetoothDevice device, in AttributionSource attributionSource)46     BluetoothHapPresetInfo getActivePresetInfo(in BluetoothDevice device, in AttributionSource attributionSource);
47     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
selectPreset(in BluetoothDevice device, int presetIndex, in AttributionSource attributionSource)48     oneway void selectPreset(in BluetoothDevice device, int presetIndex, in AttributionSource attributionSource);
49     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
selectPresetForGroup(int groupId, int presetIndex, in AttributionSource attributionSource)50     oneway void selectPresetForGroup(int groupId, int presetIndex, in AttributionSource attributionSource);
51     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
switchToNextPreset(in BluetoothDevice device, in AttributionSource attributionSource)52     oneway void switchToNextPreset(in BluetoothDevice device, in AttributionSource attributionSource);
53     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
switchToNextPresetForGroup(int groupId, in AttributionSource attributionSource)54     oneway void switchToNextPresetForGroup(int groupId, in AttributionSource attributionSource);
55     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
switchToPreviousPreset(in BluetoothDevice device, in AttributionSource attributionSource)56     oneway void switchToPreviousPreset(in BluetoothDevice device, in AttributionSource attributionSource);
57     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
switchToPreviousPresetForGroup(int groupId, in AttributionSource attributionSource)58     oneway void switchToPreviousPresetForGroup(int groupId, in AttributionSource attributionSource);
59     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getPresetInfo(in BluetoothDevice device, int presetIndex, in AttributionSource attributionSource)60     BluetoothHapPresetInfo getPresetInfo(in BluetoothDevice device, int presetIndex, in AttributionSource attributionSource);
61     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getAllPresetInfo(in BluetoothDevice device, in AttributionSource attributionSource)62     List<BluetoothHapPresetInfo> getAllPresetInfo(in BluetoothDevice device, in AttributionSource attributionSource);
63     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getFeatures(in BluetoothDevice device, in AttributionSource attributionSource)64     int getFeatures(in BluetoothDevice device, in AttributionSource attributionSource);
65     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
setPresetName(in BluetoothDevice device, int presetIndex, in String name, in AttributionSource attributionSource)66     oneway void setPresetName(in BluetoothDevice device, int presetIndex, in String name, in AttributionSource attributionSource);
67     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
setPresetNameForGroup(int groupId, int presetIndex, in String name, in AttributionSource attributionSource)68     oneway void setPresetNameForGroup(int groupId, int presetIndex, in String name, in AttributionSource attributionSource);
69     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
registerCallback(in IBluetoothHapClientCallback callback, in AttributionSource attributionSource)70     void registerCallback(in IBluetoothHapClientCallback callback, in AttributionSource attributionSource);
71     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
unregisterCallback(in IBluetoothHapClientCallback callback, in AttributionSource attributionSource)72     void unregisterCallback(in IBluetoothHapClientCallback callback, in AttributionSource attributionSource);
73 
74     const int PRESET_INDEX_UNAVAILABLE = 0;
75     const int GROUP_ID_UNAVAILABLE = -1;
76 
77     const int FEATURE_BIT_NUM_TYPE_MONAURAL = 0;
78     const int FEATURE_BIT_NUM_TYPE_BANDED = 1;
79     const int FEATURE_BIT_NUM_SYNCHRONIZATED_PRESETS = 2;
80     const int FEATURE_BIT_NUM_INDEPENDENT_PRESETS = 3;
81     const int FEATURE_BIT_NUM_DYNAMIC_PRESETS = 4;
82     const int FEATURE_BIT_NUM_WRITABLE_PRESETS = 5;
83 }
84