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