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.connecteddevice;
18 
19 import android.annotation.NonNull;
20 
21 /** Callbacks that will be invoked during associating a new client. */
22 public interface AssociationCallback {
23 
24     /**
25      * Invoked when IHU starts advertising with its device name for association successfully.
26      *
27      * @param deviceName The device name to identify the car.
28      */
onAssociationStartSuccess(@onNull String deviceName)29     void onAssociationStartSuccess(@NonNull String deviceName);
30 
31     /** Invoked when IHU failed to start advertising for association. */
onAssociationStartFailure()32     void onAssociationStartFailure();
33 
34     /**
35      * Invoked when a {@link ConnectedDeviceManager.DeviceError} has been encountered in attempting
36      * to associate a new device.
37      *
38      * @param error The failure indication.
39      */
onAssociationError(@onnectedDeviceManager.DeviceError int error)40     void onAssociationError(@ConnectedDeviceManager.DeviceError int error);
41 
42     /**
43      * Invoked when a verification code needs to be displayed. The user needs to confirm, and
44      * then call {@link ConnectedDeviceManager#notifyOutOfBandAccepted()}.
45      *
46      * @param code The verification code.
47      */
onVerificationCodeAvailable(@onNull String code)48     void onVerificationCodeAvailable(@NonNull String code);
49 
50     /**
51      * Invoked when the association has completed.
52      *
53      * @param deviceId The id of the newly associated device.
54      */
onAssociationCompleted(@onNull String deviceId)55     void onAssociationCompleted(@NonNull String deviceId);
56 }
57