2 * Copyright (C) 2015, The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * Binder IPC API for interacting with Bluetooth Low-Energy features.
20 interface IBluetoothLowEnergy {
22 * Registers a client application that can manage its own Low Energy
23 * instance. A special client interface ID will be returned in a callback to
24 * the application that can be used to perform Low Energy operations. Returns
25 * false in case of an error.
27 boolean registerClient(in IBluetoothLowEnergyCallback callback);
30 * Unregisters a previously registered client with "client interface ID"
33 void unregisterClient(in int client_if);
36 * Unregisters all previously registered clients.
40 /* Initiates a BLE connection do device with address |address|. If
41 * |is_direct| is set, use direct connect procedure. Return true on success,
44 boolean Connect(in int client_id, in const char* address,
45 in boolean is_direct);
47 /* Disconnect from previously connected BLE device with address |address|.
48 * Return true on success, false otherwise.
50 boolean Disconnect(in int client_id, in const char* address);
53 * Initiates a BLE device scan for the scan client with ID |client_id|, using
54 * the parameters defined in |settings|. Scan results that are reported to the
55 * application with the associated IBluetoothLowEnergyCallback event will be
56 * filtered using a combination of hardware and software filtering based on
57 * |filters|. Return true on success, false otherwise.
59 boolean startScan(in int client_id, in ScanSettings settings,
60 in ScanFilter[] filters);
63 * Stops a previously initiated scan session for the client with ID
64 * |client_id|. Return true on success, false otherwise.
66 boolean stopScan(in int client_id);
69 * Starts a multi-advertising instance using |advertising_data| and
70 * |scan_response_data|, both of which can be empty. Each of these parameters
71 * must contain the raw advertising packet. Returns false if there were any
72 * synchronous failures, e.g. if the advertising or scan response data are
73 * incorrectly formatted. Otherwise, the result of the operation will be
74 * asynchronously reported in
75 * IBluetoothLowEnergyCallback.onMultiAdvertiseCallback. See the headers in
76 * common/bluetooth/binder for documentation on the AdvertiseData and
77 * AdvertiseSettings data types.
79 boolean startMultiAdvertising(in int client_if,
80 in AdvertiseData advertise_data,
81 in AdvertiseData scan_response_data,
82 in AdvertiseSettings settings);
85 * Stops the previously started multi-advertising instance for the given
86 * client. Returns false in case of an error, e.g. this client has not started
89 boolean stopMultiAdvertising(in int client_if);