1a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski/* 2a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * Copyright (C) 2017 The Android Open Source Project 3a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * 4a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * Licensed under the Apache License, Version 2.0 (the "License"); 5a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * you may not use this file except in compliance with the License. 6a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * You may obtain a copy of the License at 7a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * 8a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * http://www.apache.org/licenses/LICENSE-2.0 9a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * 10a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * Unless required by applicable law or agreed to in writing, software 11a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * distributed under the License is distributed on an "AS IS" BASIS, 12a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * See the License for the specific language governing permissions and 14a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * limitations under the License. 15a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski */ 16a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski 17a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowskipackage android.bluetooth.le; 18a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski 19a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowskiimport android.bluetooth.BluetoothDevice; 20a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski 21a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski/** 22a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * Bluetooth LE periodic advertising callbacks, used to deliver periodic 23a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * advertising operation status. 24a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * 25a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * @see PeriodicAdvertisingManager#createSync 26a537b3f1f84a44dd0cd97e9d1c324dfbd3fc3e6fJakub Pawlowski * @hide 27a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski */ 28a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowskipublic abstract class PeriodicAdvertisingCallback { 29a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski 30a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski /** 31a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * The requested operation was successful. 32a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * 33a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * @hide 34a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski */ 35a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski public static final int SYNC_SUCCESS = 0; 36a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski 37a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski /** 38a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * Sync failed to be established because remote device did not respond. 39a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski */ 40a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski public static final int SYNC_NO_RESPONSE = 1; 41a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski 42a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski /** 43a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * Sync failed to be established because controller can't support more syncs. 44a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski */ 45a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski public static final int SYNC_NO_RESOURCES = 2; 46a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski 47a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski 48a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski /** 49a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * Callback when synchronization was established. 50a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * 51a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * @param syncHandle handle used to identify this synchronization. 52a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * @param device remote device. 53a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * @param advertisingSid synchronized advertising set id. 54a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * @param skip The number of periodic advertising packets that can be skipped 55a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * after a successful receive in force. @see PeriodicAdvertisingManager#createSync 56a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * @param timeout Synchronization timeout for the periodic advertising in force. One 57a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * unit is 10ms. @see PeriodicAdvertisingManager#createSync 58a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * @param timeout 59a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * @param status operation status. 60a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski */ 61a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski public void onSyncEstablished(int syncHandle, BluetoothDevice device, 62a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski int advertisingSid, int skip, int timeout, 63a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski int status) {} 64a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski 65a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski /** 66a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * Callback when periodic advertising report is received. 67a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * 68a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * @param report periodic advertising report. 69a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski */ 70a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski public void onPeriodicAdvertisingReport(PeriodicAdvertisingReport report) {} 71a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski 72a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski /** 73a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * Callback when periodic advertising synchronization was lost. 74a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * 75a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski * @param syncHandle handle used to identify this synchronization. 76a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski */ 77a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski public void onSyncLost(int syncHandle) {} 78a48e03745becc96181c676dc3d194d0572f11c10Jakub Pawlowski} 79