1 /* 2 * Copyright (C) 2014 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 17 package android.bluetooth.le; 18 19 /** Bluetooth LE advertising callbacks, used to deliver advertising operation status. */ 20 public abstract class AdvertiseCallback { 21 22 /** 23 * The requested operation was successful. 24 * 25 * @hide 26 */ 27 public static final int ADVERTISE_SUCCESS = 0; 28 29 /** 30 * Failed to start advertising as the advertise data to be broadcasted is larger than 31 bytes. 31 */ 32 public static final int ADVERTISE_FAILED_DATA_TOO_LARGE = 1; 33 34 /** Failed to start advertising because no advertising instance is available. */ 35 public static final int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS = 2; 36 37 /** Failed to start advertising as the advertising is already started. */ 38 public static final int ADVERTISE_FAILED_ALREADY_STARTED = 3; 39 40 /** Operation failed due to an internal error. */ 41 public static final int ADVERTISE_FAILED_INTERNAL_ERROR = 4; 42 43 /** This feature is not supported on this platform. */ 44 public static final int ADVERTISE_FAILED_FEATURE_UNSUPPORTED = 5; 45 46 /** 47 * Callback triggered in response to {@link BluetoothLeAdvertiser#startAdvertising} indicating 48 * that the advertising has been started successfully. 49 * 50 * @param settingsInEffect The actual settings used for advertising, which may be different from 51 * what has been requested. 52 */ onStartSuccess(AdvertiseSettings settingsInEffect)53 public void onStartSuccess(AdvertiseSettings settingsInEffect) {} 54 55 /** 56 * Callback when advertising could not be started. 57 * 58 * @param errorCode Error code (see ADVERTISE_FAILED_* constants) for advertising start 59 * failures. 60 */ onStartFailure(int errorCode)61 public void onStartFailure(int errorCode) {} 62 } 63