Add support for ba2str and str2ba to bluedroid.

Add missing structs from hci.h.

Change-Id: I4cebb3136cd832d5b61f4cd70bcf4504238e2531
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 @@
     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 @@
 /* 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 @@
 	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 @@
 
 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