1/* 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 19import android.bluetooth.BluetoothDevice; 20 21/** 22 * Bluetooth LE periodic advertising callbacks, used to deliver periodic 23 * advertising operation status. 24 * 25 * @see PeriodicAdvertisingManager#createSync 26 * @hide 27 */ 28public abstract class PeriodicAdvertisingCallback { 29 30 /** 31 * The requested operation was successful. 32 * 33 * @hide 34 */ 35 public static final int SYNC_SUCCESS = 0; 36 37 /** 38 * Sync failed to be established because remote device did not respond. 39 */ 40 public static final int SYNC_NO_RESPONSE = 1; 41 42 /** 43 * Sync failed to be established because controller can't support more syncs. 44 */ 45 public static final int SYNC_NO_RESOURCES = 2; 46 47 48 /** 49 * Callback when synchronization was established. 50 * 51 * @param syncHandle handle used to identify this synchronization. 52 * @param device remote device. 53 * @param advertisingSid synchronized advertising set id. 54 * @param skip The number of periodic advertising packets that can be skipped 55 * after a successful receive in force. @see PeriodicAdvertisingManager#createSync 56 * @param timeout Synchronization timeout for the periodic advertising in force. One 57 * unit is 10ms. @see PeriodicAdvertisingManager#createSync 58 * @param timeout 59 * @param status operation status. 60 */ 61 public void onSyncEstablished(int syncHandle, BluetoothDevice device, 62 int advertisingSid, int skip, int timeout, 63 int status) {} 64 65 /** 66 * Callback when periodic advertising report is received. 67 * 68 * @param report periodic advertising report. 69 */ 70 public void onPeriodicAdvertisingReport(PeriodicAdvertisingReport report) {} 71 72 /** 73 * Callback when periodic advertising synchronization was lost. 74 * 75 * @param syncHandle handle used to identify this synchronization. 76 */ 77 public void onSyncLost(int syncHandle) {} 78} 79