• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 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 #ifndef __BLUEDROID_BLUETOOTH_H__
18 #define __BLUEDROID_BLUETOOTH_H__
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 #include <bluetooth/bluetooth.h>
23 
24 /* Enable the bluetooth interface.
25  *
26  * Responsible for power on, bringing up HCI interface, and starting daemons.
27  * Will block until the HCI interface and bluetooth daemons are ready to
28  * use.
29  *
30  * Returns 0 on success, -ve on error */
31 int bt_enable();
32 
33 /* Disable the bluetooth interface.
34  *
35  * Responsbile for stopping daemons, pulling down the HCI interface, and
36  * powering down the chip. Will block until power down is complete, and it
37  * is safe to immediately call enable().
38  *
39  * Returns 0 on success, -ve on error */
40 int bt_disable();
41 
42 /* Returns 1 if enabled, 0 if disabled, and -ve on error */
43 int bt_is_enabled();
44 
45 int ba2str(const bdaddr_t *ba, char *str);
46 int str2ba(const char *str, bdaddr_t *ba);
47 
48 #ifdef __cplusplus
49 }
50 #endif
51 #endif //__BLUEDROID_BLUETOOTH_H__
52