OSDN Git Service

c05620e41ee6f75b474aae52aa92b6eb202ad88c
[android-x86/system-bt.git] / service / doc / IBluetoothLowEnergy.txt
1 /*
2  * Copyright (C) 2015, 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 /**
18  * Binder IPC API for interacting with Bluetooth Low-Energy features.
19  */
20 interface IBluetoothLowEnergy {
21   /**
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.
26    */
27   boolean registerClient(in IBluetoothLowEnergyCallback callback);
28
29   /**
30    * Unregisters a previously registered client with "client interface ID"
31    * |client_if|.
32    */
33   void unregisterClient(in int client_if);
34
35   /**
36    * Unregisters all previously registered clients.
37    */
38   void unregisterAll();
39
40   /* Initiates a BLE connection do device with address |address|. If
41    * |is_direct| is set, use direct connect procedure. Return true on success,
42    * false otherwise.
43    */
44   boolean Connect(in int client_id, in const char* address,
45                   in boolean is_direct);
46
47   /* Disconnect from previously connected BLE device with address |address|.
48    * Return true on success, false otherwise.
49    */
50   boolean Disconnect(in int client_id, in const char* address);
51
52   /**
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.
58    */
59   boolean startScan(in int client_id, in ScanSettings settings,
60                     in ScanFilter[] filters);
61
62   /**
63    * Stops a previously initiated scan session for the client with ID
64    * |client_id|. Return true on success, false otherwise.
65    */
66   boolean stopScan(in int client_id);
67
68   /**
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.
78    */
79   boolean startMultiAdvertising(in int client_if,
80                                 in AdvertiseData advertise_data,
81                                 in AdvertiseData scan_response_data,
82                                 in AdvertiseSettings settings);
83
84   /**
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
87    * an instance.
88    */
89   boolean stopMultiAdvertising(in int client_if);
90 }