hal-pan.c \
hal-a2dp.c \
client/textconv.c \
+ hal-utils.c \
LOCAL_C_INCLUDES += \
$(call include-path-for, system-core) \
client/if-hh.c \
client/if-pan.c \
client/if-sock.c \
+ hal-utils.c \
ANDROID_4_3_OR_ABOVE := $(shell echo 0 | awk -v v=$(PLATFORM_SDK_VERSION) 'END {print (v > 17) ? 1 : 0}')
android/client/if-hh.c \
android/client/if-pan.c \
android/client/if-sock.c \
- android/client/hwmodule.c
+ android/client/hwmodule.c \
+ android/hal-utils.h android/hal-utils.c
android_haltest_LDADD = android/libhal-internal.la
#include <hardware/bluetooth.h>
+#include "../hal-utils.h"
#include "if-main.h"
const btgatt_interface_t *if_gatt = NULL;
#include <stdio.h>
#include <hardware/bluetooth.h>
+#include "../hal-utils.h"
+
#include "textconv.h"
/*
&p[0], &p[1], &p[2], &p[3], &p[4], &p[5]);
}
-static const char BT_BASE_UUID[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
- 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb
-};
-
-/*
- * converts uuid to string
- * buf should be at least 39 bytes
- *
- * returns string representation of uuid
- */
-char *bt_uuid_t2str(const bt_uuid_t *uuid, char *buf)
-{
- int shift = 0;
- int i;
- int is_bt;
-
- is_bt = !memcmp(&uuid->uu[4], &BT_BASE_UUID[4], sizeof(bt_uuid_t) - 4);
-
- for (i = 0; i < (int) sizeof(bt_uuid_t); i++) {
- if (i == 4 && is_bt)
- break;
-
- if (i == 4 || i == 6 || i == 8 || i == 10) {
- buf[i * 2 + shift] = '-';
- shift++;
- }
- sprintf(buf + i * 2 + shift, "%02x", uuid->uu[i]);
- }
-
- return buf;
-}
-
/* converts string to uuid */
void str2bt_uuid_t(const char *str, bt_uuid_t *uuid)
{
return bt_bdaddr_t2str(bd_addr, buf);
}
-static char *btuuid2str(const bt_uuid_t *uuid)
-{
- static char buf[MAX_UUID_STR_LEN];
-
- return bt_uuid_t2str(uuid, buf);
-}
-
char *btproperty2str(const bt_property_t *property)
{
static char buf[4096];
char *bt_bdaddr_t2str(const bt_bdaddr_t *bd_addr, char *buf);
void str2bt_bdaddr_t(const char *str, bt_bdaddr_t *bd_addr);
-#define MAX_UUID_STR_LEN 37
-char *bt_uuid_t2str(const bt_uuid_t *uuid, char *buf);
void str2bt_uuid_t(const char *str, bt_uuid_t *uuid);
char *btproperty2str(const bt_property_t *property);
--- /dev/null
+/*
+ * Copyright (C) 2013 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <hardware/bluetooth.h>
+
+#include "hal-utils.h"
+
+/*
+ * converts uuid to string
+ * buf should be at least 39 bytes
+ *
+ * returns string representation of uuid
+ */
+char *bt_uuid_t2str(const bt_uuid_t *uuid, char *buf)
+{
+ int shift = 0;
+ int i;
+ int is_bt;
+
+ is_bt = !memcmp(&uuid->uu[4], &BT_BASE_UUID[4], sizeof(bt_uuid_t) - 4);
+
+ for (i = 0; i < (int) sizeof(bt_uuid_t); i++) {
+ if (i == 4 && is_bt)
+ break;
+
+ if (i == 4 || i == 6 || i == 8 || i == 10) {
+ buf[i * 2 + shift] = '-';
+ shift++;
+ }
+ sprintf(buf + i * 2 + shift, "%02x", uuid->uu[i]);
+ }
+
+ return buf;
+}
+
+char *btuuid2str(const bt_uuid_t *uuid)
+{
+ static char buf[MAX_UUID_STR_LEN];
+
+ return bt_uuid_t2str(uuid, buf);
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#define MAX_UUID_STR_LEN 37
+
+static const char BT_BASE_UUID[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
+ 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb
+};
+
+char *btuuid2str(const bt_uuid_t *uuid);
+char *bt_uuid_t2str(const bt_uuid_t *uuid, char *buf);