AdvertisingSetCallback.java revision 4bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18
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.
656a55da90184fcc6e8f4bb9ebb01662b4925f6094Jakub Pawlowski     * @param txPower tx power that will be used for this set.
66a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
67a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
686a55da90184fcc6e8f4bb9ebb01662b4925f6094Jakub Pawlowski    public void onAdvertisingSetStarted(AdvertisingSet advertisingSet, int txPower, int status) {}
69a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
70a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
71a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link BluetoothLeAdvertiser#stopAdvertisingSet}
72a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * indicating advertising set is stopped.
73a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
74a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
75a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
76a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onAdvertisingSetStopped(AdvertisingSet advertisingSet) {}
77a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
78a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
79a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link BluetoothLeAdvertiser#startAdvertisingSet} indicating
80a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * result of the operation. If status is ADVERTISE_SUCCESS, then advertising set is advertising.
81a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
82a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
83a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
84a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
85a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable, int status) {}
86a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
87a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
88a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#setAdvertisingData} indicating
89a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * result of the operation. If status is ADVERTISE_SUCCESS, then data was changed.
90a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
91a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
92a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
93a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
94a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onAdvertisingDataSet(AdvertisingSet advertisingSet, int status) {}
95a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
96a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
97a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#setAdvertisingData} indicating
98a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * result of the operation.
99a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
100a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
101a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
102a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
103a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onScanResponseDataSet(AdvertisingSet advertisingSet, int status) {}
104a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
105a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
106a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#setAdvertisingParameters}
107a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * indicating result of the operation.
108a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
109a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
1106a55da90184fcc6e8f4bb9ebb01662b4925f6094Jakub Pawlowski     * @param txPower tx power that will be used for this set.
111a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
112a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
113a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onAdvertisingParametersUpdated(AdvertisingSet advertisingSet,
1146a55da90184fcc6e8f4bb9ebb01662b4925f6094Jakub Pawlowski                                               int txPower, int status) {}
115a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
116a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
117a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingParameters}
118a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * indicating result of the operation.
119a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
120a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
121a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
122a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
123a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void
124a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    onPeriodicAdvertisingParametersUpdated(AdvertisingSet advertisingSet,
125a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski                                           int status) {}
126a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
127a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
128a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingData}
129a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * indicating result of the operation.
130a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
131a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
132a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
133a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
134a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    public void onPeriodicAdvertisingDataSet(AdvertisingSet advertisingSet,
135a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski                                             int status) {}
136a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski
137a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski    /**
1386a55da90184fcc6e8f4bb9ebb01662b4925f6094Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingEnable}
139a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * indicating result of the operation.
140a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     *
141a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param advertisingSet The advertising set.
142a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     * @param status Status of the operation.
143a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski     */
1447998be9e44f7797a96fb0a2568b95581ebccc1d0Jakub Pawlowski    public void onPeriodicAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable,
145a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski                                            int status) {}
1464bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18Jakub Pawlowski
1474bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18Jakub Pawlowski    /**
1484bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18Jakub Pawlowski     * Callback triggered in response to {@link AdvertisingSet#getOwnAddress()}
1494bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18Jakub Pawlowski     * indicating result of the operation.
1504bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18Jakub Pawlowski     *
1514bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18Jakub Pawlowski     * @param advertisingSet The advertising set.
1524bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18Jakub Pawlowski     * @param addressType type of address.
1534bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18Jakub Pawlowski     * @param address advertising set bluetooth address.
1544bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18Jakub Pawlowski     * @hide
1554bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18Jakub Pawlowski     */
1564bc4a441007e0a9ef6ccd1816c831ffd2dfa4c18Jakub Pawlowski    public void onOwnAddressRead(AdvertisingSet advertisingSet, int addressType, String address) {}
157a9d1a32e5e51ebc3c141370c9d5045c6c938aaf9Jakub Pawlowski}