diff options
author | Nick Pelly <npelly@google.com> | 2009-10-30 18:28:49 -0700 |
---|---|---|
committer | Nick Pelly <npelly@google.com> | 2009-10-30 18:28:49 -0700 |
commit | a15c33f9aaf27f75a7f6fa02a539b54caace4d35 (patch) | |
tree | 45215c0865ba46ce9e35f19be2827ebfe1f111f9 | |
parent | d4397861e745c5b6ae99fe547b841df9babf3085 (diff) | |
download | bluetooth-a15c33f9aaf27f75a7f6fa02a539b54caace4d35.tar.gz |
Add support for ba2str and str2ba to bluedroid.android-sdk-2.0.1_r1android-sdk-2.0.1-docs_r1android-2.0.1_r1eclair-sholes-release
Add missing structs from hci.h.
Change-Id: I4cebb3136cd832d5b61f4cd70bcf4504238e2531
-rw-r--r-- | bluedroid/bluetooth.c | 14 | ||||
-rw-r--r-- | bluedroid/include/bluedroid/bluetooth.h | 4 | ||||
-rw-r--r-- | bluez-clean-headers/bluetooth/hci.h | 14 | ||||
-rw-r--r-- | tools/Android.mk | 4 |
4 files changed, 35 insertions, 1 deletions
diff --git a/bluedroid/bluetooth.c b/bluedroid/bluetooth.c index f36dd09..b953082 100644 --- a/bluedroid/bluetooth.c +++ b/bluedroid/bluetooth.c @@ -255,3 +255,17 @@ out: if (hci_sock >= 0) close(hci_sock); return ret; } + +int ba2str(const bdaddr_t *ba, char *str) { + return sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", + ba->b[5], ba->b[4], ba->b[3], ba->b[2], ba->b[1], ba->b[0]); +} + +int str2ba(const char *str, bdaddr_t *ba) { + int i; + for (i = 5; i >= 0; i--) { + ba->b[i] = (uint8_t) strtoul(str, &str, 16); + str++; + } + return 0; +} diff --git a/bluedroid/include/bluedroid/bluetooth.h b/bluedroid/include/bluedroid/bluetooth.h index 64603e9..70085e4 100644 --- a/bluedroid/include/bluedroid/bluetooth.h +++ b/bluedroid/include/bluedroid/bluetooth.h @@ -19,6 +19,7 @@ #ifdef __cplusplus extern "C" { #endif +#include <bluetooth/bluetooth.h> /* Enable the bluetooth interface. * @@ -41,6 +42,9 @@ int bt_disable(); /* Returns 1 if enabled, 0 if disabled, and -ve on error */ int bt_is_enabled(); +int ba2str(const bdaddr_t *ba, char *str); +int str2ba(const char *str, bdaddr_t *ba); + #ifdef __cplusplus } #endif diff --git a/bluez-clean-headers/bluetooth/hci.h b/bluez-clean-headers/bluetooth/hci.h index 5eadcf8..506d7a0 100644 --- a/bluez-clean-headers/bluetooth/hci.h +++ b/bluez-clean-headers/bluetooth/hci.h @@ -15,6 +15,7 @@ #ifdef __cplusplus #endif #include <sys/socket.h> +#include <sys/ioctl.h> #define HCI_MAX_DEV 16 #define HCI_MAX_ACL_SIZE 1024 #define HCI_MAX_SCO_SIZE 255 @@ -679,4 +680,17 @@ struct sockaddr_hci { sa_family_t hci_family; unsigned short hci_dev; }; +struct hci_conn_info { + uint16_t handle; + bdaddr_t bdaddr; + uint8_t type; + uint8_t out; + uint16_t state; + uint32_t link_mode; +}; +struct hci_conn_list_req { + uint16_t dev_id; + uint16_t conn_num; + struct hci_conn_info conn_info[0]; +}; #endif diff --git a/tools/Android.mk b/tools/Android.mk index 2ad7540..87dedad 100644 --- a/tools/Android.mk +++ b/tools/Android.mk @@ -10,7 +10,9 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := bttest.c -LOCAL_C_INCLUDES := $(LOCAL_PATH)/../bluedroid/include +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../bluedroid/include \ + system/bluetooth/bluez-clean-headers LOCAL_SHARED_LIBRARIES := libbluedroid |