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 /** 20 * Bluetooth LE advertising callbacks, used to deliver advertising operation status. 21 */ 22 public abstract class AdvertiseCallback { 23 24 /** 25 * The requested operation was successful. 26 * 27 * @hide 28 */ 29 public static final int ADVERTISE_SUCCESS = 0; 30 31 /** 32 * Failed to start advertising as the advertise data to be broadcasted is larger than 31 bytes. 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#startAdvertising} indicating 58 * that the advertising has been started successfully. 59 * 60 * @param settingsInEffect The actual settings used for advertising, which may be different from 61 * what has been requested. 62 */ 63 public void onStartSuccess(AdvertiseSettings settingsInEffect) { 64 } 65 66 /** 67 * Callback when advertising could not be started. 68 * 69 * @param errorCode Error code (see ADVERTISE_FAILED_* constants) for advertising start 70 * failures. 71 */ 72 public void onStartFailure(int errorCode) { 73 } 74 } 75