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 advertising operation 23 * 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 /** Sync failed to be established because remote device did not respond. */ 38 public static final int SYNC_NO_RESPONSE = 1; 39 40 /** Sync failed to be established because controller can't support more syncs. */ 41 public static final int SYNC_NO_RESOURCES = 2; 42 43 /** 44 * Callback when synchronization was established. 45 * 46 * @param syncHandle handle used to identify this synchronization. 47 * @param device remote device. 48 * @param advertisingSid synchronized advertising set id. 49 * @param skip The number of periodic advertising packets that can be skipped after a successful 50 * receive in force. @see PeriodicAdvertisingManager#createSync 51 * @param timeout Synchronization timeout for the periodic advertising in force. One unit is 52 * 10ms. @see PeriodicAdvertisingManager#createSync 53 * @param status operation status. 54 */ onSyncEstablished( int syncHandle, BluetoothDevice device, int advertisingSid, int skip, int timeout, int status)55 public void onSyncEstablished( 56 int syncHandle, 57 BluetoothDevice device, 58 int advertisingSid, 59 int skip, 60 int timeout, 61 int status) {} 62 63 /** 64 * Callback when periodic advertising report is received. 65 * 66 * @param report periodic advertising report. 67 */ onPeriodicAdvertisingReport(PeriodicAdvertisingReport report)68 public void onPeriodicAdvertisingReport(PeriodicAdvertisingReport report) {} 69 70 /** 71 * Callback when periodic advertising synchronization was lost. 72 * 73 * @param syncHandle handle used to identify this synchronization. 74 */ onSyncLost(int syncHandle)75 public void onSyncLost(int syncHandle) {} 76 77 /** Callback when periodic sync transferred. */ onSyncTransferred(BluetoothDevice device, int status)78 public void onSyncTransferred(BluetoothDevice device, int status) {} 79 80 /** 81 * Callback when BIGInfo advertising report is received. 82 * 83 * @param syncHandle handle used to identify this synchronization. 84 * @param encrypted BIG carries encrypted data or not 85 */ onBigInfoAdvertisingReport(int syncHandle, boolean encrypted)86 public void onBigInfoAdvertisingReport(int syncHandle, boolean encrypted) {} 87 } 88