diff options
author | zzy <zhenye@broadcom.com> | 2012-08-15 18:03:15 -0700 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2012-08-27 20:39:30 -0700 |
commit | 54cdfabe7c0ed98732d0641ffe8b19ff7284e7d4 (patch) | |
tree | e629044f6e72ed09807643e56b2a29a26993e1c7 /btif/include | |
parent | be7063ce21ac1e2f67d489c29a1e979dc3d8f075 (diff) | |
download | external_bluetooth_bluedroid-54cdfabe7c0ed98732d0641ffe8b19ff7284e7d4.zip external_bluetooth_bluedroid-54cdfabe7c0ed98732d0641ffe8b19ff7284e7d4.tar.gz external_bluetooth_bluedroid-54cdfabe7c0ed98732d0641ffe8b19ff7284e7d4.tar.bz2 |
Added new storage code and bluez configuration migration support
Filter out hid device from bluez migration.
Change-Id: I8b5eb29f37ca37e97b728f69063266a1b0a61eb8
Conflicts:
main/Android.mk
Diffstat (limited to 'btif/include')
-rw-r--r-- | btif/include/btif_config.h | 95 | ||||
-rw-r--r-- | btif/include/btif_config_util.h | 80 | ||||
-rw-r--r-- | btif/include/btif_sock_thread.h | 4 | ||||
-rw-r--r-- | btif/include/btif_util.h | 1 |
4 files changed, 179 insertions, 1 deletions
diff --git a/btif/include/btif_config.h b/btif/include/btif_config.h new file mode 100644 index 0000000..7188a0f --- /dev/null +++ b/btif/include/btif_config.h @@ -0,0 +1,95 @@ +/************************************************************************************ + * + * Copyright (C) 2009-2011 Broadcom Corporation + * + * This program is the proprietary software of Broadcom Corporation and/or its + * licensors, and may only be used, duplicated, modified or distributed + * pursuant to the terms and conditions of a separate, written license + * agreement executed between you and Broadcom (an "Authorized License"). + * Except as set forth in an Authorized License, Broadcom grants no license + * (express or implied), right to use, or waiver of any kind with respect to + * the Software, and Broadcom expressly reserves all rights in and to the + * Software and all intellectual property rights therein. + * IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS + * SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE + * ALL USE OF THE SOFTWARE. + * + * Except as expressly set forth in the Authorized License, + * + * 1. This program, including its structure, sequence and organization, + * constitutes the valuable trade secrets of Broadcom, and you shall + * use all reasonable efforts to protect the confidentiality thereof, + * and to use this information only in connection with your use of + * Broadcom integrated circuit products. + * + * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED + * "AS IS" AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, + * REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, + * OR OTHERWISE, WITH RESPECT TO THE SOFTWARE. BROADCOM SPECIFICALLY + * DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, + * NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, + * ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR + * CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT + * OF USE OR PERFORMANCE OF THE SOFTWARE. + * + * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR + * ITS LICENSORS BE LIABLE FOR + * (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR EXEMPLARY + * DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO + * YOUR USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM + * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES; OR + * (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT ACTUALLY PAID FOR THE + * SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE + * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF + * ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. + * + ************************************************************************************/ + + +/************************************************************************************ + * + * Filename: btif_config.h + * + * Description: Bluetooth configuration Interface + * + * + ***********************************************************************************/ + +#ifndef btif_config_h_ +#define btif_config_h_ +#ifdef __cplusplus +#include <stdint.h> +extern "C" { +#endif +#define BTIF_CFG_TYPE_INVALID 0 +#define BTIF_CFG_TYPE_STR 1 +#define BTIF_CFG_TYPE_INT (1 << 1) +#define BTIF_CFG_TYPE_BIN (1 << 2) +#define BTIF_CFG_TYPE_VOLATILE (1 << 15) +int btif_config_init(); + +int btif_config_exist(const char* section, const char* key, const char* name); +int btif_config_get_int(const char* section, const char* key, const char* name, int* value); +int btif_config_set_int(const char* section, const char* key, const char* name, int value); +int btif_config_get_str(const char* section, const char* key, const char* name, char* value, int* bytes); +int btif_config_set_str(const char* section, const char* key, const char* name, const char* value); + +int btif_config_get(const char* section, const char* key, const char* name, char* value, int* bytes, int* type); +int btif_config_set(const char* section, const char* key, const char* name, const char* value, int bytes, int type); + +int btif_config_remove(const char* section, const char* key, const char* name); + +short btif_config_next_key(short current_key_pos, const char* section, char * key_name, int* key_name_bytes); +short btif_config_next_value(short pos, const char* section, const char* key, char* value_name, int* value_name_bytes); + +typedef void (*btif_config_enum_callback)(void* user_data, const char* section, const char* key, const char* name, + const char* value, int bytes, int type); +int btif_config_enum(btif_config_enum_callback cb, void* user_data); + +int btif_config_save(); +void btif_config_flush(); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/btif/include/btif_config_util.h b/btif/include/btif_config_util.h new file mode 100644 index 0000000..0612796 --- /dev/null +++ b/btif/include/btif_config_util.h @@ -0,0 +1,80 @@ +/************************************************************************************ + * + * Copyright (C) 2009-2011 Broadcom Corporation + * + * This program is the proprietary software of Broadcom Corporation and/or its + * licensors, and may only be used, duplicated, modified or distributed + * pursuant to the terms and conditions of a separate, written license + * agreement executed between you and Broadcom (an "Authorized License"). + * Except as set forth in an Authorized License, Broadcom grants no license + * (express or implied), right to use, or waiver of any kind with respect to + * the Software, and Broadcom expressly reserves all rights in and to the + * Software and all intellectual property rights therein. + * IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS + * SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE + * ALL USE OF THE SOFTWARE. + * + * Except as expressly set forth in the Authorized License, + * + * 1. This program, including its structure, sequence and organization, + * constitutes the valuable trade secrets of Broadcom, and you shall + * use all reasonable efforts to protect the confidentiality thereof, + * and to use this information only in connection with your use of + * Broadcom integrated circuit products. + * + * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED + * "AS IS" AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, + * REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, + * OR OTHERWISE, WITH RESPECT TO THE SOFTWARE. BROADCOM SPECIFICALLY + * DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, + * NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, + * ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR + * CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT + * OF USE OR PERFORMANCE OF THE SOFTWARE. + * + * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR + * ITS LICENSORS BE LIABLE FOR + * (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR EXEMPLARY + * DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO + * YOUR USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM + * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES; OR + * (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT ACTUALLY PAID FOR THE + * SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE + * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF + * ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. + * + ************************************************************************************/ + + +/************************************************************************************ + * + * Filename: btif_config_util.h + * + * Description: Bluetooth configuration utility api + * + * + ***********************************************************************************/ + +#ifndef btif_config_util_h_ +#define btif_config_util_h_ +#ifdef __cplusplus +extern "C" { +#endif +#define BLUEZ_PATH "/data/misc/bluetoothd/" +#define BLUEZ_PATH_BAK "/data/misc/bluetoothd_bak" +#define BLUEZ_LINKKEY "linkkeys" +#define BLUEZ_NAMES "names" +#define BLUEZ_PROFILES "profiles" +#define BLUEZ_CLASSES "classes" +#define BLUEZ_TYPES "types" +#define BLUEZ_CONFIG "config" +#define BLUEZ_ALIASES "aliases" +int btif_config_save_file(const char* file_name); +int btif_config_load_file(const char* file_name); +int load_bluez_adapter_info(char* adapter_path, int size); +int load_bluez_linkkeys(const char* adapter_path); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/btif/include/btif_sock_thread.h b/btif/include/btif_sock_thread.h index 1e2fe0c..0f5212f 100644 --- a/btif/include/btif_sock_thread.h +++ b/btif/include/btif_sock_thread.h @@ -64,8 +64,10 @@ int btsock_thread_init(); int btsock_thread_add_fd(int handle, int fd, int type, int flags, uint32_t user_id); int btsock_thread_wakeup(int handle); +int btsock_thread_post_cmd(int handle, int cmd_type, const unsigned char* cmd_data, int data_size, uint32_t user_id); typedef void (*btsock_signaled_cb)(int fd, int type, int flags, uint32_t user_id); -int btsock_thread_create(btsock_signaled_cb callback); +typedef void (*btsock_cmd_cb)(int cmd_fd, int type, int size, uint32_t user_id); +int btsock_thread_create(btsock_signaled_cb callback, btsock_cmd_cb cmd_callback); int btsock_thread_exit(int handle); #endif diff --git a/btif/include/btif_util.h b/btif/include/btif_util.h index fd16a40..075194d 100644 --- a/btif/include/btif_util.h +++ b/btif/include/btif_util.h @@ -102,6 +102,7 @@ int str2bd(char *str, bt_bdaddr_t *addr); char *bd2str(bt_bdaddr_t *addr, bdstr_t *bdstr); UINT32 devclass2uint(DEV_CLASS dev_class); +void uint2devclass(UINT32 dev, DEV_CLASS dev_class); void uuid16_to_uuid128(uint16_t uuid16, bt_uuid_t* uuid128); void uuid_to_string(bt_uuid_t *p_uuid, char *str); |