1/*
2 * Copyright (C) 2017 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
17package android.bluetooth.le;
18
19import android.bluetooth.BluetoothDevice;
20
21/**
22 * Bluetooth LE advertising set callbacks, used to deliver advertising operation
23 * status.
24 */
25public abstract class AdvertisingSetCallback {
26
27    /**
28     * The requested operation was successful.
29     */
30    public static final int ADVERTISE_SUCCESS = 0;
31
32    /**
33     * Failed to start advertising as the advertise data to be broadcasted is too
34     * large.
35     */
36    public static final int ADVERTISE_FAILED_DATA_TOO_LARGE = 1;
37
38    /**
39     * Failed to start advertising because no advertising instance is available.
40     */
41    public static final int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS = 2;
42
43    /**
44     * Failed to start advertising as the advertising is already started.
45     */
46    public static final int ADVERTISE_FAILED_ALREADY_STARTED = 3;
47
48    /**
49     * Operation failed due to an internal error.
50     */
51    public static final int ADVERTISE_FAILED_INTERNAL_ERROR = 4;
52
53    /**
54     * This feature is not supported on this platform.
55     */
56    public static final int ADVERTISE_FAILED_FEATURE_UNSUPPORTED = 5;
57
58    /**
59     * Callback triggered in response to {@link BluetoothLeAdvertiser#startAdvertisingSet}
60     * indicating result of the operation. If status is ADVERTISE_SUCCESS, then advertisingSet
61     * contains the started set and it is advertising. If error occured, advertisingSet is
62     * null, and status will be set to proper error code.
63     *
64     * @param advertisingSet The advertising set that was started or null if error.
65     * @param txPower tx power that will be used for this set.
66     * @param status Status of the operation.
67     */
68    public void onAdvertisingSetStarted(AdvertisingSet advertisingSet, int txPower, int status) {}
69
70    /**
71     * Callback triggered in response to {@link BluetoothLeAdvertiser#stopAdvertisingSet}
72     * indicating advertising set is stopped.
73     *
74     * @param advertisingSet The advertising set.
75     */
76    public void onAdvertisingSetStopped(AdvertisingSet advertisingSet) {}
77
78    /**
79     * Callback triggered in response to {@link BluetoothLeAdvertiser#startAdvertisingSet} indicating
80     * result of the operation. If status is ADVERTISE_SUCCESS, then advertising set is advertising.
81     *
82     * @param advertisingSet The advertising set.
83     * @param status Status of the operation.
84     */
85    public void onAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable, int status) {}
86
87    /**
88     * Callback triggered in response to {@link AdvertisingSet#setAdvertisingData} indicating
89     * result of the operation. If status is ADVERTISE_SUCCESS, then data was changed.
90     *
91     * @param advertisingSet The advertising set.
92     * @param status Status of the operation.
93     */
94    public void onAdvertisingDataSet(AdvertisingSet advertisingSet, int status) {}
95
96    /**
97     * Callback triggered in response to {@link AdvertisingSet#setAdvertisingData} indicating
98     * result of the operation.
99     *
100     * @param advertisingSet The advertising set.
101     * @param status Status of the operation.
102     */
103    public void onScanResponseDataSet(AdvertisingSet advertisingSet, int status) {}
104
105    /**
106     * Callback triggered in response to {@link AdvertisingSet#setAdvertisingParameters}
107     * indicating result of the operation.
108     *
109     * @param advertisingSet The advertising set.
110     * @param txPower tx power that will be used for this set.
111     * @param status Status of the operation.
112     */
113    public void onAdvertisingParametersUpdated(AdvertisingSet advertisingSet,
114                                               int txPower, int status) {}
115
116    /**
117     * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingParameters}
118     * indicating result of the operation.
119     *
120     * @param advertisingSet The advertising set.
121     * @param status Status of the operation.
122     */
123    public void
124    onPeriodicAdvertisingParametersUpdated(AdvertisingSet advertisingSet,
125                                           int status) {}
126
127    /**
128     * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingData}
129     * indicating result of the operation.
130     *
131     * @param advertisingSet The advertising set.
132     * @param status Status of the operation.
133     */
134    public void onPeriodicAdvertisingDataSet(AdvertisingSet advertisingSet,
135                                             int status) {}
136
137    /**
138     * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingEnabled}
139     * indicating result of the operation.
140     *
141     * @param advertisingSet The advertising set.
142     * @param status Status of the operation.
143     */
144    public void onPeriodicAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable,
145                                            int status) {}
146
147    /**
148     * Callback triggered in response to {@link AdvertisingSet#getOwnAddress()}
149     * indicating result of the operation.
150     *
151     * @param advertisingSet The advertising set.
152     * @param addressType type of address.
153     * @param address advertising set bluetooth address.
154     * @hide
155     */
156    public void onOwnAddressRead(AdvertisingSet advertisingSet, int addressType, String address) {}
157}