1 /**
2  * Copyright (C) 2019 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.car.companiondevicesupport.api.internal.association;
18 
19 import com.android.car.companiondevicesupport.api.external.AssociatedDevice;
20 import com.android.car.companiondevicesupport.api.external.CompanionDevice;
21 import com.android.car.companiondevicesupport.api.external.IConnectionCallback;
22 import com.android.car.companiondevicesupport.api.external.IDeviceAssociationCallback;
23 import com.android.car.companiondevicesupport.api.internal.association.IAssociationCallback;
24 
25 /** Manager of devices associated with the car. */
26 interface IAssociatedDeviceManager {
27 
28     /**
29      * Set a callback for association.
30      * @param callback {@link IAssociationCallback} to set.
31      */
setAssociationCallback(in IAssociationCallback callback)32     void setAssociationCallback(in IAssociationCallback callback);
33 
34     /** Clear the association callback from manager. */
clearAssociationCallback()35     void clearAssociationCallback();
36 
37     /** Starts the association with a new device. */
startAssociation()38     void startAssociation();
39 
40     /** Stops the association with current device. */
stopAssociation()41     void stopAssociation();
42 
43     /** Returns {@link List<AssociatedDevice>} of devices associated with the given user. */
getActiveUserAssociatedDevices()44     List<AssociatedDevice> getActiveUserAssociatedDevices();
45 
46     /** Confirms the paring code. */
acceptVerification()47     void acceptVerification();
48 
49     /** Remove the associated device of the given identifier for the active user. */
removeAssociatedDevice(in String deviceId)50     void removeAssociatedDevice(in String deviceId);
51 
52     /**
53      * Set a callback for associated device related events.
54      *
55      * @param callback {@link IDeviceAssociationCallback} to set.
56      */
setDeviceAssociationCallback(in IDeviceAssociationCallback callback)57     void setDeviceAssociationCallback(in IDeviceAssociationCallback callback);
58 
59     /** Clear the device association callback from manager. */
clearDeviceAssociationCallback()60     void clearDeviceAssociationCallback();
61 
62     /** Returns {@link List<CompanionDevice>} of devices currently connected. */
getActiveUserConnectedDevices()63     List<CompanionDevice> getActiveUserConnectedDevices();
64 
65     /**
66      * Set a callback for connection events for only the currently active user's devices.
67      *
68      * @param callback {@link IConnectionCallback} to set.
69      */
setConnectionCallback(in IConnectionCallback callback)70     void setConnectionCallback(in IConnectionCallback callback);
71 
72     /** Clear the connection callback from manager. */
clearConnectionCallback()73     void clearConnectionCallback();
74 
75     /** Enable connection on the associated device with the given identifier. */
enableAssociatedDeviceConnection(in String deviceId)76     void enableAssociatedDeviceConnection(in String deviceId);
77 
78     /** Disable connection on the associated device with the given identifier. */
disableAssociatedDeviceConnection(in String deviceId)79     void disableAssociatedDeviceConnection(in String deviceId);
80 }
81