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.content.AttributionSource;
22 import android.os.ParcelUuid;
23 import android.bluetooth.IBluetoothCsipSetCoordinatorLockCallback;
24 import java.util.List;
25 import java.util.Map;
26 
27 /**
28  * APIs for Bluetooth CSIP Set Coordinator
29  *
30  * @hide
31  */
32 interface IBluetoothCsipSetCoordinator {
33   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)")
connect(in BluetoothDevice device, in AttributionSource attributionSource)34   boolean connect(in BluetoothDevice device, in AttributionSource attributionSource);
35   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)")
disconnect(in BluetoothDevice device, in AttributionSource attributionSource)36   boolean disconnect(in BluetoothDevice device, in AttributionSource attributionSource);
37   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getConnectedDevices(in AttributionSource attributionSource)38   List<BluetoothDevice> getConnectedDevices(in AttributionSource attributionSource);
39   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getDevicesMatchingConnectionStates(in int[] states, in AttributionSource attributionSource)40   List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states, in AttributionSource attributionSource);
41   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getConnectionState(in BluetoothDevice device, in AttributionSource attributionSource)42   int getConnectionState(in BluetoothDevice device, in AttributionSource attributionSource);
43   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)")
setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource)44   boolean setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource);
45   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)")
getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource)46   int getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource);
47 
48   /**
49     * Get the list of group identifiers for the given context {@var uuid}.
50     * @return group identifiers as <code>List<Integer></code>
51     */
52   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getAllGroupIds(in ParcelUuid uuid, in AttributionSource attributionSource)53   List getAllGroupIds(in ParcelUuid uuid, in AttributionSource attributionSource);
54 
55   /**
56     * Get all groups that {@var device} belongs to.
57     * @return group identifiers and their context uuids as <code>Map<Integer, ParcelUuid></code>
58     */
59   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getGroupUuidMapByDevice(in BluetoothDevice device, in AttributionSource attributionSource)60   Map getGroupUuidMapByDevice(in BluetoothDevice device, in AttributionSource attributionSource);
61 
62   /**
63    * Get the number of known group members or
64    * {@link android.bluetooth.IBluetoothCsipSetCoordinator.CSIS_GROUP_SIZE_UNKNOWN} if unknown.
65    * @return group size
66    */
67   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
getDesiredGroupSize(in int group_id, in AttributionSource attributionSource)68   int getDesiredGroupSize(in int group_id, in AttributionSource attributionSource);
69 
70   /**
71    * Lock group identified with {@var groupId}.
72    * @return unique lock identifier required for unlocking
73    */
74   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
lockGroup(int groupId, in IBluetoothCsipSetCoordinatorLockCallback callback, in AttributionSource attributionSource)75   ParcelUuid lockGroup(int groupId, in IBluetoothCsipSetCoordinatorLockCallback callback, in AttributionSource attributionSource);
76 
77   /**
78    * Unlock group using {@var lockUuid} acquired through
79    * {@link android.bluetooth.IBluetoothCsipSetCoordinator.lockGroup}.
80    */
81   @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
unlockGroup(in ParcelUuid lockUuid, in AttributionSource attributionSource)82   void unlockGroup(in ParcelUuid lockUuid, in AttributionSource attributionSource);
83 
84   const int CSIS_GROUP_ID_INVALID = -1;
85   const int CSIS_GROUP_SIZE_UNKNOWN = 1;
86 
87   const int CSIS_GROUP_LOCK_SUCCESS = 0;
88   const int CSIS_GROUP_LOCK_FAILED_INVALID_GROUP = 1;
89   const int CSIS_GROUP_LOCK_FAILED_GROUP_EMPTY = 2;
90   const int CSIS_GROUP_LOCK_FAILED_GROUP_NOT_CONNECTED = 3;
91   const int CSIS_GROUP_LOCK_FAILED_LOCKED_BY_OTHER = 4;
92   const int CSIS_GROUP_LOCK_FAILED_OTHER_REASON = 5;
93   const int CSIS_LOCKED_GROUP_MEMBER_LOST = 6;
94 }
95