blob: 51324fdb01ffeed6c306ae37fa1634c8dc50f55a [file] [log] [blame]
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -08001/*
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
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080019/**
20 * Bluetooth LE advertising set callbacks, used to deliver advertising operation
21 * status.
22 */
23public abstract class AdvertisingSetCallback {
24
25 /**
26 * The requested operation was successful.
27 */
28 public static final int ADVERTISE_SUCCESS = 0;
29
30 /**
31 * Failed to start advertising as the advertise data to be broadcasted is too
32 * large.
33 */
34 public static final int ADVERTISE_FAILED_DATA_TOO_LARGE = 1;
35
36 /**
37 * Failed to start advertising because no advertising instance is available.
38 */
39 public static final int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS = 2;
40
41 /**
42 * Failed to start advertising as the advertising is already started.
43 */
44 public static final int ADVERTISE_FAILED_ALREADY_STARTED = 3;
45
46 /**
47 * Operation failed due to an internal error.
48 */
49 public static final int ADVERTISE_FAILED_INTERNAL_ERROR = 4;
50
51 /**
52 * This feature is not supported on this platform.
53 */
54 public static final int ADVERTISE_FAILED_FEATURE_UNSUPPORTED = 5;
55
56 /**
57 * Callback triggered in response to {@link BluetoothLeAdvertiser#startAdvertisingSet}
58 * indicating result of the operation. If status is ADVERTISE_SUCCESS, then advertisingSet
kopriva219f7dc2018-10-09 13:42:28 -070059 * contains the started set and it is advertising. If error occurred, advertisingSet is
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080060 * null, and status will be set to proper error code.
61 *
62 * @param advertisingSet The advertising set that was started or null if error.
Jakub Pawlowski6a55da92017-03-17 15:33:27 -070063 * @param txPower tx power that will be used for this set.
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080064 * @param status Status of the operation.
65 */
Jack Hea355e5e2017-08-22 16:06:54 -070066 public void onAdvertisingSetStarted(AdvertisingSet advertisingSet, int txPower, int status) {
67 }
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080068
69 /**
70 * Callback triggered in response to {@link BluetoothLeAdvertiser#stopAdvertisingSet}
71 * indicating advertising set is stopped.
72 *
73 * @param advertisingSet The advertising set.
74 */
Jack Hea355e5e2017-08-22 16:06:54 -070075 public void onAdvertisingSetStopped(AdvertisingSet advertisingSet) {
76 }
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080077
78 /**
Jack Hea355e5e2017-08-22 16:06:54 -070079 * Callback triggered in response to {@link BluetoothLeAdvertiser#startAdvertisingSet}
80 * indicating result of the operation. If status is ADVERTISE_SUCCESS, then advertising set is
81 * advertising.
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080082 *
83 * @param advertisingSet The advertising set.
84 * @param status Status of the operation.
85 */
Jack Hea355e5e2017-08-22 16:06:54 -070086 public void onAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable, int status) {
87 }
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080088
89 /**
90 * Callback triggered in response to {@link AdvertisingSet#setAdvertisingData} indicating
91 * result of the operation. If status is ADVERTISE_SUCCESS, then data was changed.
92 *
93 * @param advertisingSet The advertising set.
94 * @param status Status of the operation.
95 */
Jack Hea355e5e2017-08-22 16:06:54 -070096 public void onAdvertisingDataSet(AdvertisingSet advertisingSet, int status) {
97 }
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080098
99 /**
100 * Callback triggered in response to {@link AdvertisingSet#setAdvertisingData} indicating
101 * result of the operation.
102 *
103 * @param advertisingSet The advertising set.
104 * @param status Status of the operation.
105 */
Jack Hea355e5e2017-08-22 16:06:54 -0700106 public void onScanResponseDataSet(AdvertisingSet advertisingSet, int status) {
107 }
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -0800108
109 /**
110 * Callback triggered in response to {@link AdvertisingSet#setAdvertisingParameters}
111 * indicating result of the operation.
112 *
113 * @param advertisingSet The advertising set.
Jakub Pawlowski6a55da92017-03-17 15:33:27 -0700114 * @param txPower tx power that will be used for this set.
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -0800115 * @param status Status of the operation.
116 */
117 public void onAdvertisingParametersUpdated(AdvertisingSet advertisingSet,
Jack Hea355e5e2017-08-22 16:06:54 -0700118 int txPower, int status) {
119 }
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -0800120
121 /**
122 * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingParameters}
123 * indicating result of the operation.
124 *
125 * @param advertisingSet The advertising set.
126 * @param status Status of the operation.
127 */
Jack He2992cd02017-08-22 21:21:23 -0700128 public void onPeriodicAdvertisingParametersUpdated(AdvertisingSet advertisingSet, int status) {
Jack Hea355e5e2017-08-22 16:06:54 -0700129 }
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -0800130
131 /**
132 * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingData}
133 * indicating result of the operation.
134 *
135 * @param advertisingSet The advertising set.
136 * @param status Status of the operation.
137 */
138 public void onPeriodicAdvertisingDataSet(AdvertisingSet advertisingSet,
Jack Hea355e5e2017-08-22 16:06:54 -0700139 int status) {
140 }
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -0800141
142 /**
Jakub Pawlowski9d4abb52017-04-28 04:11:26 -0700143 * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingEnabled}
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -0800144 * indicating result of the operation.
145 *
146 * @param advertisingSet The advertising set.
147 * @param status Status of the operation.
148 */
Jakub Pawlowski7998be92017-03-22 15:40:21 -0700149 public void onPeriodicAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable,
Jack Hea355e5e2017-08-22 16:06:54 -0700150 int status) {
151 }
Jakub Pawlowski4bc4a442017-04-19 06:52:08 -0700152
153 /**
154 * Callback triggered in response to {@link AdvertisingSet#getOwnAddress()}
155 * indicating result of the operation.
156 *
157 * @param advertisingSet The advertising set.
158 * @param addressType type of address.
159 * @param address advertising set bluetooth address.
160 * @hide
161 */
Jack Hea355e5e2017-08-22 16:06:54 -0700162 public void onOwnAddressRead(AdvertisingSet advertisingSet, int addressType, String address) {
163 }
Jack He2992cd02017-08-22 21:21:23 -0700164}