Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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 | package android.bluetooth; |
| 17 | |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 18 | import android.os.Parcel; |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 19 | import android.os.ParcelUuid; |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 20 | import android.os.Parcelable; |
| 21 | |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 22 | import java.util.ArrayList; |
| 23 | import java.util.List; |
| 24 | import java.util.UUID; |
| 25 | |
| 26 | /** |
Matthew Xie | ddf7e47 | 2013-03-01 18:41:02 -0800 | [diff] [blame] | 27 | * Represents a Bluetooth GATT Service |
Matthew Xie | 33ec984 | 2013-04-03 00:29:27 -0700 | [diff] [blame] | 28 | * |
| 29 | * <p> Gatt Service contains a collection of {@link BluetoothGattCharacteristic}, |
| 30 | * as well as referenced services. |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 31 | */ |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 32 | public class BluetoothGattService implements Parcelable { |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 33 | |
| 34 | /** |
| 35 | * Primary service |
| 36 | */ |
| 37 | public static final int SERVICE_TYPE_PRIMARY = 0; |
| 38 | |
| 39 | /** |
| 40 | * Secondary service (included by primary services) |
| 41 | */ |
| 42 | public static final int SERVICE_TYPE_SECONDARY = 1; |
| 43 | |
| 44 | |
| 45 | /** |
| 46 | * The remote device his service is associated with. |
| 47 | * This applies to client applications only. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 48 | * |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 49 | * @hide |
| 50 | */ |
| 51 | protected BluetoothDevice mDevice; |
| 52 | |
| 53 | /** |
| 54 | * The UUID of this service. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 55 | * |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 56 | * @hide |
| 57 | */ |
| 58 | protected UUID mUuid; |
| 59 | |
| 60 | /** |
| 61 | * Instance ID for this service. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 62 | * |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 63 | * @hide |
| 64 | */ |
| 65 | protected int mInstanceId; |
| 66 | |
| 67 | /** |
| 68 | * Handle counter override (for conformance testing). |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 69 | * |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 70 | * @hide |
| 71 | */ |
| 72 | protected int mHandles = 0; |
| 73 | |
| 74 | /** |
| 75 | * Service type (Primary/Secondary). |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 76 | * |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 77 | * @hide |
| 78 | */ |
| 79 | protected int mServiceType; |
| 80 | |
| 81 | /** |
| 82 | * List of characteristics included in this service. |
| 83 | */ |
| 84 | protected List<BluetoothGattCharacteristic> mCharacteristics; |
| 85 | |
| 86 | /** |
| 87 | * List of included services for this service. |
| 88 | */ |
| 89 | protected List<BluetoothGattService> mIncludedServices; |
| 90 | |
| 91 | /** |
Wei Wang | 18c7693 | 2013-10-29 21:05:37 -0700 | [diff] [blame] | 92 | * Whether the service uuid should be advertised. |
| 93 | */ |
| 94 | private boolean mAdvertisePreferred; |
| 95 | |
| 96 | /** |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 97 | * Create a new BluetoothGattService. |
Matthew Xie | ddf7e47 | 2013-03-01 18:41:02 -0800 | [diff] [blame] | 98 | * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. |
| 99 | * |
| 100 | * @param uuid The UUID for this service |
| 101 | * @param serviceType The type of this service, |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 102 | * {@link BluetoothGattService#SERVICE_TYPE_PRIMARY} |
| 103 | * or {@link BluetoothGattService#SERVICE_TYPE_SECONDARY} |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 104 | */ |
Matthew Xie | ddf7e47 | 2013-03-01 18:41:02 -0800 | [diff] [blame] | 105 | public BluetoothGattService(UUID uuid, int serviceType) { |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 106 | mDevice = null; |
| 107 | mUuid = uuid; |
| 108 | mInstanceId = 0; |
| 109 | mServiceType = serviceType; |
| 110 | mCharacteristics = new ArrayList<BluetoothGattCharacteristic>(); |
| 111 | mIncludedServices = new ArrayList<BluetoothGattService>(); |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Create a new BluetoothGattService |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 116 | * |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 117 | * @hide |
| 118 | */ |
| 119 | /*package*/ BluetoothGattService(BluetoothDevice device, UUID uuid, |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 120 | int instanceId, int serviceType) { |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 121 | mDevice = device; |
| 122 | mUuid = uuid; |
| 123 | mInstanceId = instanceId; |
| 124 | mServiceType = serviceType; |
| 125 | mCharacteristics = new ArrayList<BluetoothGattCharacteristic>(); |
| 126 | mIncludedServices = new ArrayList<BluetoothGattService>(); |
| 127 | } |
| 128 | |
| 129 | /** |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 130 | * Create a new BluetoothGattService |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 131 | * |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 132 | * @hide |
| 133 | */ |
| 134 | public BluetoothGattService(UUID uuid, int instanceId, int serviceType) { |
| 135 | mDevice = null; |
| 136 | mUuid = uuid; |
| 137 | mInstanceId = instanceId; |
| 138 | mServiceType = serviceType; |
| 139 | mCharacteristics = new ArrayList<BluetoothGattCharacteristic>(); |
| 140 | mIncludedServices = new ArrayList<BluetoothGattService>(); |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * @hide |
| 145 | */ |
| 146 | public int describeContents() { |
| 147 | return 0; |
| 148 | } |
| 149 | |
| 150 | @Override |
| 151 | public void writeToParcel(Parcel out, int flags) { |
| 152 | out.writeParcelable(new ParcelUuid(mUuid), 0); |
| 153 | out.writeInt(mInstanceId); |
| 154 | out.writeInt(mServiceType); |
| 155 | out.writeTypedList(mCharacteristics); |
| 156 | |
| 157 | ArrayList<BluetoothGattIncludedService> includedServices = |
| 158 | new ArrayList<BluetoothGattIncludedService>(mIncludedServices.size()); |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 159 | for (BluetoothGattService s : mIncludedServices) { |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 160 | includedServices.add(new BluetoothGattIncludedService(s.getUuid(), |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 161 | s.getInstanceId(), s.getType())); |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 162 | } |
| 163 | out.writeTypedList(includedServices); |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 164 | } |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 165 | |
Jack He | 2992cd0 | 2017-08-22 21:21:23 -0700 | [diff] [blame] | 166 | public static final Parcelable.Creator<BluetoothGattService> CREATOR = |
| 167 | new Parcelable.Creator<BluetoothGattService>() { |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 168 | public BluetoothGattService createFromParcel(Parcel in) { |
| 169 | return new BluetoothGattService(in); |
| 170 | } |
| 171 | |
| 172 | public BluetoothGattService[] newArray(int size) { |
| 173 | return new BluetoothGattService[size]; |
| 174 | } |
| 175 | }; |
| 176 | |
| 177 | private BluetoothGattService(Parcel in) { |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 178 | mUuid = ((ParcelUuid) in.readParcelable(null)).getUuid(); |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 179 | mInstanceId = in.readInt(); |
| 180 | mServiceType = in.readInt(); |
| 181 | |
| 182 | mCharacteristics = new ArrayList<BluetoothGattCharacteristic>(); |
| 183 | |
| 184 | ArrayList<BluetoothGattCharacteristic> chrcs = |
| 185 | in.createTypedArrayList(BluetoothGattCharacteristic.CREATOR); |
| 186 | if (chrcs != null) { |
| 187 | for (BluetoothGattCharacteristic chrc : chrcs) { |
| 188 | chrc.setService(this); |
| 189 | mCharacteristics.add(chrc); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | mIncludedServices = new ArrayList<BluetoothGattService>(); |
| 194 | |
| 195 | ArrayList<BluetoothGattIncludedService> inclSvcs = |
| 196 | in.createTypedArrayList(BluetoothGattIncludedService.CREATOR); |
| 197 | if (chrcs != null) { |
| 198 | for (BluetoothGattIncludedService isvc : inclSvcs) { |
| 199 | mIncludedServices.add(new BluetoothGattService(null, isvc.getUuid(), |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 200 | isvc.getInstanceId(), isvc.getType())); |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 201 | } |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | /** |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 206 | * Returns the device associated with this service. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 207 | * |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 208 | * @hide |
| 209 | */ |
| 210 | /*package*/ BluetoothDevice getDevice() { |
| 211 | return mDevice; |
| 212 | } |
| 213 | |
| 214 | /** |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 215 | * Returns the device associated with this service. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 216 | * |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 217 | * @hide |
| 218 | */ |
| 219 | /*package*/ void setDevice(BluetoothDevice device) { |
Jack He | 2992cd0 | 2017-08-22 21:21:23 -0700 | [diff] [blame] | 220 | mDevice = device; |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | /** |
Matthew Xie | ddf7e47 | 2013-03-01 18:41:02 -0800 | [diff] [blame] | 224 | * Add an included service to this service. |
| 225 | * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. |
| 226 | * |
| 227 | * @param service The service to be added |
| 228 | * @return true, if the included service was added to the service |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 229 | */ |
Matthew Xie | ddf7e47 | 2013-03-01 18:41:02 -0800 | [diff] [blame] | 230 | public boolean addService(BluetoothGattService service) { |
| 231 | mIncludedServices.add(service); |
| 232 | return true; |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * Add a characteristic to this service. |
| 237 | * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. |
| 238 | * |
| 239 | * @param characteristic The characteristics to be added |
| 240 | * @return true, if the characteristic was added to the service |
| 241 | */ |
| 242 | public boolean addCharacteristic(BluetoothGattCharacteristic characteristic) { |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 243 | mCharacteristics.add(characteristic); |
Matthew Xie | ddf7e47 | 2013-03-01 18:41:02 -0800 | [diff] [blame] | 244 | characteristic.setService(this); |
| 245 | return true; |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | /** |
| 249 | * Get characteristic by UUID and instanceId. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 250 | * |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 251 | * @hide |
| 252 | */ |
| 253 | /*package*/ BluetoothGattCharacteristic getCharacteristic(UUID uuid, int instanceId) { |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 254 | for (BluetoothGattCharacteristic characteristic : mCharacteristics) { |
Andre Eisenbach | 25b9cf9 | 2013-07-08 23:58:16 -0700 | [diff] [blame] | 255 | if (uuid.equals(characteristic.getUuid()) |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 256 | && characteristic.getInstanceId() == instanceId) { |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 257 | return characteristic; |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 258 | } |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 259 | } |
| 260 | return null; |
| 261 | } |
| 262 | |
| 263 | /** |
Matthew Xie | ddf7e47 | 2013-03-01 18:41:02 -0800 | [diff] [blame] | 264 | * Force the instance ID. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 265 | * |
Matthew Xie | ddf7e47 | 2013-03-01 18:41:02 -0800 | [diff] [blame] | 266 | * @hide |
| 267 | */ |
| 268 | public void setInstanceId(int instanceId) { |
| 269 | mInstanceId = instanceId; |
| 270 | } |
| 271 | |
| 272 | /** |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 273 | * Get the handle count override (conformance testing. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 274 | * |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 275 | * @hide |
| 276 | */ |
| 277 | /*package*/ int getHandles() { |
| 278 | return mHandles; |
| 279 | } |
| 280 | |
| 281 | /** |
Matthew Xie | ddf7e47 | 2013-03-01 18:41:02 -0800 | [diff] [blame] | 282 | * Force the number of handles to reserve for this service. |
| 283 | * This is needed for conformance testing only. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 284 | * |
Matthew Xie | ddf7e47 | 2013-03-01 18:41:02 -0800 | [diff] [blame] | 285 | * @hide |
| 286 | */ |
| 287 | public void setHandles(int handles) { |
| 288 | mHandles = handles; |
| 289 | } |
| 290 | |
| 291 | /** |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 292 | * Add an included service to the internal map. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 293 | * |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 294 | * @hide |
| 295 | */ |
Jakub Pawlowski | 8d312a8 | 2016-03-01 18:50:27 -0800 | [diff] [blame] | 296 | public void addIncludedService(BluetoothGattService includedService) { |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 297 | mIncludedServices.add(includedService); |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * Returns the UUID of this service |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 302 | * |
| 303 | * @return UUID of this service |
| 304 | */ |
| 305 | public UUID getUuid() { |
| 306 | return mUuid; |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | * Returns the instance ID for this service |
| 311 | * |
| 312 | * <p>If a remote device offers multiple services with the same UUID |
| 313 | * (ex. multiple battery services for different batteries), the instance |
| 314 | * ID is used to distuinguish services. |
| 315 | * |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 316 | * @return Instance ID of this service |
| 317 | */ |
| 318 | public int getInstanceId() { |
| 319 | return mInstanceId; |
| 320 | } |
| 321 | |
| 322 | /** |
| 323 | * Get the type of this service (primary/secondary) |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 324 | */ |
| 325 | public int getType() { |
| 326 | return mServiceType; |
| 327 | } |
| 328 | |
| 329 | /** |
Matthew Xie | ddf7e47 | 2013-03-01 18:41:02 -0800 | [diff] [blame] | 330 | * Get the list of included GATT services for this service. |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 331 | * |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 332 | * @return List of included services or empty list if no included services were discovered. |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 333 | */ |
| 334 | public List<BluetoothGattService> getIncludedServices() { |
| 335 | return mIncludedServices; |
| 336 | } |
| 337 | |
| 338 | /** |
| 339 | * Returns a list of characteristics included in this service. |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 340 | * |
| 341 | * @return Characteristics included in this service |
| 342 | */ |
| 343 | public List<BluetoothGattCharacteristic> getCharacteristics() { |
| 344 | return mCharacteristics; |
| 345 | } |
| 346 | |
| 347 | /** |
| 348 | * Returns a characteristic with a given UUID out of the list of |
| 349 | * characteristics offered by this service. |
| 350 | * |
| 351 | * <p>This is a convenience function to allow access to a given characteristic |
| 352 | * without enumerating over the list returned by {@link #getCharacteristics} |
| 353 | * manually. |
| 354 | * |
| 355 | * <p>If a remote service offers multiple characteristics with the same |
| 356 | * UUID, the first instance of a characteristic with the given UUID |
| 357 | * is returned. |
| 358 | * |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 359 | * @return GATT characteristic object or null if no characteristic with the given UUID was |
| 360 | * found. |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 361 | */ |
| 362 | public BluetoothGattCharacteristic getCharacteristic(UUID uuid) { |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 363 | for (BluetoothGattCharacteristic characteristic : mCharacteristics) { |
| 364 | if (uuid.equals(characteristic.getUuid())) { |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 365 | return characteristic; |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 366 | } |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 367 | } |
| 368 | return null; |
| 369 | } |
Wei Wang | 18c7693 | 2013-10-29 21:05:37 -0700 | [diff] [blame] | 370 | |
| 371 | /** |
| 372 | * Returns whether the uuid of the service should be advertised. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 373 | * |
Wei Wang | 18c7693 | 2013-10-29 21:05:37 -0700 | [diff] [blame] | 374 | * @hide |
| 375 | */ |
| 376 | public boolean isAdvertisePreferred() { |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 377 | return mAdvertisePreferred; |
Wei Wang | 18c7693 | 2013-10-29 21:05:37 -0700 | [diff] [blame] | 378 | } |
| 379 | |
| 380 | /** |
| 381 | * Set whether the service uuid should be advertised. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 382 | * |
Wei Wang | 18c7693 | 2013-10-29 21:05:37 -0700 | [diff] [blame] | 383 | * @hide |
| 384 | */ |
| 385 | public void setAdvertisePreferred(boolean advertisePreferred) { |
Jack He | 2992cd0 | 2017-08-22 21:21:23 -0700 | [diff] [blame] | 386 | mAdvertisePreferred = advertisePreferred; |
Wei Wang | 18c7693 | 2013-10-29 21:05:37 -0700 | [diff] [blame] | 387 | } |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 388 | } |