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 17 package android.bluetooth.le; 18 19 import android.bluetooth.BluetoothDevice; 20 21 /** 22 * Bluetooth LE periodic advertising callbacks, used to deliver periodic 23 * advertising operation status. 24 * 25 * @hide 26 * @see PeriodicAdvertisingManager#createSync 27 */ 28 public 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 after a successful 55 * receive in force. @see PeriodicAdvertisingManager#createSync 56 * @param timeout Synchronization timeout for the periodic advertising in force. One unit is 57 * 10ms. @see PeriodicAdvertisingManager#createSync 58 * @param timeout 59 * @param status operation status. 60 */ onSyncEstablished(int syncHandle, BluetoothDevice device, int advertisingSid, int skip, int timeout, int status)61 public void onSyncEstablished(int syncHandle, BluetoothDevice device, 62 int advertisingSid, int skip, int timeout, 63 int status) { 64 } 65 66 /** 67 * Callback when periodic advertising report is received. 68 * 69 * @param report periodic advertising report. 70 */ onPeriodicAdvertisingReport(PeriodicAdvertisingReport report)71 public void onPeriodicAdvertisingReport(PeriodicAdvertisingReport report) { 72 } 73 74 /** 75 * Callback when periodic advertising synchronization was lost. 76 * 77 * @param syncHandle handle used to identify this synchronization. 78 */ onSyncLost(int syncHandle)79 public void onSyncLost(int syncHandle) { 80 } 81 82 /** 83 * Callback when periodic sync transferred. 84 * 85 * @param device 86 * @param status 87 */ onSyncTransferred(BluetoothDevice device, int status)88 public void onSyncTransferred(BluetoothDevice device, int status) { 89 } 90 } 91