AdvertisingSetCallback.java revision a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9
1a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski/*
2a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski * Copyright (C) 2017 The Android Open Source Project
3a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski *
4a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski * Licensed under the Apache License, Version 2.0 (the "License");
5a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski * you may not use this file except in compliance with the License.
6a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski * You may obtain a copy of the License at
7a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski *
8a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski *      http://www.apache.org/licenses/LICENSE-2.0
9a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski *
10a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski * Unless required by applicable law or agreed to in writing, software
11a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski * distributed under the License is distributed on an "AS IS" BASIS,
12a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski * See the License for the specific language governing permissions and
14a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski * limitations under the License.
15a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski */
16a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
17a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowskipackage android.bluetooth.le;
18a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
19a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowskiimport android.bluetooth.BluetoothDevice;
20a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
21a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski/**
22a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski * Bluetooth LE advertising set callbacks, used to deliver advertising operation
23a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski * status.
24a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski */
25a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowskipublic abstract class AdvertisingSetCallback {
26a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
27a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
28a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * The requested operation was successful.
29a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
30a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public static final int ADVERTISE_SUCCESS = 0;
31a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
32a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
33a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Failed to start advertising as the advertise data to be broadcasted is too
34a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * large.
35a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
36a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public static final int ADVERTISE_FAILED_DATA_TOO_LARGE = 1;
37a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
38a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
39a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Failed to start advertising because no advertising instance is available.
40a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
41a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public static final int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS = 2;
42a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
43a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
44a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Failed to start advertising as the advertising is already started.
45a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
46a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public static final int ADVERTISE_FAILED_ALREADY_STARTED = 3;
47a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
48a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
49a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Operation failed due to an internal error.
50a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
51a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public static final int ADVERTISE_FAILED_INTERNAL_ERROR = 4;
52a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
53a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
54a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * This feature is not supported on this platform.
55a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
56a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public static final int ADVERTISE_FAILED_FEATURE_UNSUPPORTED = 5;
57a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
58a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
59a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link BluetoothLeAdvertiser#startAdvertisingSet}
60a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * indicating result of the operation. If status is ADVERTISE_SUCCESS, then advertisingSet
61a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * contains the started set and it is advertising. If error occured, advertisingSet is
62a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * null, and status will be set to proper error code.
63a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
64a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set that was started or null if error.
65a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
66a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
67a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onAdvertisingSetStarted(AdvertisingSet advertisingSet, int status) {}
68a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
69a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
70a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link BluetoothLeAdvertiser#stopAdvertisingSet}
71a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * indicating advertising set is stopped.
72a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
73a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
74a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
75a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onAdvertisingSetStopped(AdvertisingSet advertisingSet) {}
76a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
77a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
78a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link BluetoothLeAdvertiser#startAdvertisingSet} indicating
79a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * result of the operation. If status is ADVERTISE_SUCCESS, then advertising set is advertising.
80a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
81a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
82a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
83a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
84a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable, int status) {}
85a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
86a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
87a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#setAdvertisingData} indicating
88a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * result of the operation. If status is ADVERTISE_SUCCESS, then data was changed.
89a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
90a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
91a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
92a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
93a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onAdvertisingDataSet(AdvertisingSet advertisingSet, int status) {}
94a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
95a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
96a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#setAdvertisingData} indicating
97a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * result of the operation.
98a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
99a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
100a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
101a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
102a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onScanResponseDataSet(AdvertisingSet advertisingSet, int status) {}
103a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
104a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
105a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#setAdvertisingParameters}
106a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * indicating result of the operation.
107a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
108a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
109a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
110a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
111a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onAdvertisingParametersUpdated(AdvertisingSet advertisingSet,
112a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski                                               int status) {}
113a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
114a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
115a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingParameters}
116a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * indicating result of the operation.
117a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
118a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
119a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
120a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
121a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void
122a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    onPeriodicAdvertisingParametersUpdated(AdvertisingSet advertisingSet,
123a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski                                           int status) {}
124a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
125a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
126a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingData}
127a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * indicating result of the operation.
128a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
129a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
130a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
131a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
132a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onPeriodicAdvertisingDataSet(AdvertisingSet advertisingSet,
133a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski                                             int status) {}
134a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
135a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
136a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#periodicAdvertisingEnable}
137a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * indicating result of the operation.
138a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
139a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
140a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
141a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
142a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onPeriodicAdvertisingEnable(AdvertisingSet advertisingSet, boolean enable,
143a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski                                            int status) {}
144a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski}