diff --git a/android/Android.mk b/android/Android.mk
index 5a55a76..ae52ab4 100644
--- a/android/Android.mk
+++ b/android/Android.mk
# Specify common compiler flags
BLUEZ_COMMON_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\" \
- -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
-DANDROID_STORAGEDIR=\"/data/misc/bluetooth\" \
# Disable warnings enabled by Android but not enabled in autotools build
client/if-hh.c \
client/if-pan.c \
client/if-sock.c \
+ client/if-gatt.c \
hal-utils.c \
-ANDROID_4_3_OR_ABOVE := $(shell echo 0 | awk -v v=$(PLATFORM_SDK_VERSION) 'END {print (v > 17) ? 1 : 0}')
-
-ifeq ($(ANDROID_4_3_OR_ABOVE), 1)
-LOCAL_SRC_FILES += \
- client/if-gatt.c
-endif
-
LOCAL_C_INCLUDES += \
$(call include-path-for, system-core) \
$(call include-path-for, libhardware) \
diff --git a/android/Makefile.am b/android/Makefile.am
index 356f932..7806f79 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
android/hal-ipc.h android/hal-ipc.c \
android/hal-utils.h android/hal-utils.c
-android_bluetooth_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
- -DPLATFORM_SDK_VERSION=19
+android_bluetooth_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
android_bluetooth_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-no-undefined
android/hal-utils.h android/hal-utils.c
android_haltest_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
- -DPLATFORM_SDK_VERSION=19 \
-DPLUGINDIR=\""$(android_plugindir)"\"
android_haltest_LDFLAGS = -pthread -ldl
diff --git a/android/README b/android/README
index 39ca9d2..717ffa2 100644
--- a/android/README
+++ b/android/README
More details about BlueZ for Android architecture and components can be found
in android/hal-apc-api.txt file.
+Supported Android version: 4.4
+
===============================
Building and running on Android
===============================
diff --git a/android/client/haltest.c b/android/client/haltest.c
index 7c314c0..f4d1ade 100644
--- a/android/client/haltest.c
+++ b/android/client/haltest.c
&audio_if,
&bluetooth_if,
&av_if,
-#if PLATFORM_SDK_VERSION > 17
&gatt_if,
&gatt_client_if,
&gatt_server_if,
-#endif
&hf_if,
&hh_if,
&pan_if,
BT_PROFILE_HEALTH_ID,
BT_PROFILE_HIDHOST_ID,
BT_PROFILE_PAN_ID,
-#if PLATFORM_SDK_VERSION > 17
BT_PROFILE_GATT_ID,
-#endif
BT_PROFILE_SOCKETS_ID
};
const struct method *m;
diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index 6771df4..6bfb439 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
haltest_info("%s\n", __func__);
}
-#if PLATFORM_SDK_VERSION > 17
static void le_test_mode_cb(bt_status_t status, uint16_t num_packets)
{
haltest_info("%s %s %d\n", __func__, bt_status_t2str(status),
num_packets);
}
-#endif
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.acl_state_changed_cb = acl_state_changed_cb,
.thread_evt_cb = thread_evt_cb,
.dut_mode_recv_cb = dut_mode_recv_cb,
-#if PLATFORM_SDK_VERSION > 17
.le_test_mode_cb = le_test_mode_cb
-#endif
};
static void init_p(int argc, const char **argv)
BT_PROFILE_SOCKETS_ID,
BT_PROFILE_HIDHOST_ID,
BT_PROFILE_PAN_ID,
-#if PLATFORM_SDK_VERSION > 17
BT_PROFILE_GATT_ID,
BT_PROFILE_AV_RC_ID,
-#endif
NULL
};
pif = (const void **) &if_hh;
else if (strcmp(BT_PROFILE_PAN_ID, id) == 0)
pif = (const void **) &if_pan;
-#if PLATFORM_SDK_VERSION > 17
else if (strcmp(BT_PROFILE_AV_RC_ID, id) == 0)
pif = &dummy; /* TODO: change when if_rc is there */
else if (strcmp(BT_PROFILE_GATT_ID, id) == 0)
pif = (const void **) &if_gatt;
-#endif
else
haltest_error("%s is not correct for get_profile_interface\n",
id);
haltest_error("not implemented\n");
}
-#if PLATFORM_SDK_VERSION > 17
static void le_test_mode_p(int argc, const char **argv)
{
haltest_error("not implemented\n");
}
-#endif
-#if PLATFORM_SDK_VERSION > 18
static void config_hci_snoop_log_p(int argc, const char **argv)
{
uint8_t mode;
EXEC(if_bluetooth->config_hci_snoop_log, mode);
}
-#endif
static struct method methods[] = {
STD_METHOD(init),
STD_METHODCH(get_profile_interface, "<profile id>"),
STD_METHODH(dut_mode_configure, "<dut mode>"),
STD_METHOD(dut_mode_send),
-#if PLATFORM_SDK_VERSION > 17
STD_METHOD(le_test_mode),
-#endif
-#if PLATFORM_SDK_VERSION > 18
STD_METHODH(config_hci_snoop_log, "<mode>"),
-#endif
END_METHOD
};
diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index bb53952..e8837ff 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
* btgatt_char_id_t -> btgatt_gatt_id_t
* bt_uuid_t -> btgatt_gatt_id_t
*/
-#if PLATFORM_SDK_VERSION > 18
#define str2btgatt_descr_id_t str2btgatt_gatt_id_t
#define btgatt_descr_id_t2str btgatt_gatt_id_t2str
#define btgatt_descr_id_t btgatt_gatt_id_t
-#else
-#define btgatt_descr_id_t2str gatt_uuid_t2str
-#define str2btgatt_descr_id_t(a, b) gatt_str2bt_uuid_t(a, -1, b)
-#define btgatt_gatt_id_t btgatt_char_id_t
-#define btgatt_descr_id_t bt_uuid_t
-#endif
#define MAX_CHAR_ID_STR_LEN (MAX_UUID_STR_LEN + 3 + 11)
#define MAX_SRVC_ID_STR_LEN (MAX_UUID_STR_LEN + 3 + 11 + 1 + 11)
diff --git a/android/client/if-main.h b/android/client/if-main.h
index 0371c3e..2b22fc4 100644
--- a/android/client/if-main.h
+++ b/android/client/if-main.h
#include <hardware/bt_hf.h>
#include <hardware/bt_hl.h>
-#if PLATFORM_SDK_VERSION > 17
#include <hardware/bt_rc.h>
#include <hardware/bt_gatt.h>
#include <hardware/bt_gatt_types.h>
#include <hardware/bt_gatt_client.h>
#include <hardware/bt_gatt_server.h>
-#endif
extern audio_hw_device_t *if_audio;
extern const bthh_interface_t *if_hh;
extern const btpan_interface_t *if_pan;
extern const btsock_interface_t *if_sock;
-#if PLATFORM_SDK_VERSION > 17
extern const btgatt_interface_t *if_gatt;
extern const btgatt_server_interface_t *if_gatt_server;
extern const btgatt_client_interface_t *if_gatt_client;
-#endif
/*
* Structure defines top level interfaces that can be used in test tool
extern const struct interface audio_if;
extern const struct interface bluetooth_if;
extern const struct interface av_if;
-#if PLATFORM_SDK_VERSION > 17
extern const struct interface gatt_if;
extern const struct interface gatt_client_if;
extern const struct interface gatt_server_if;
-#endif
extern const struct interface pan_if;
extern const struct interface sock_if;
extern const struct interface hf_if;
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 7accdcc..be45836 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
enum_prop_to_hal(send_props[i], prop,
bt_device_type_t);
break;
-#if PLATFORM_SDK_VERSION > 17
case HAL_PROP_DEVICE_VERSION_INFO:
{
static bt_remote_version_t e;
e.version = p->version;
}
break;
-#endif
case HAL_PROP_DEVICE_SERVICE_REC:
{
static bt_service_record_t e;
bt_hal_cbacks->dut_mode_recv_cb(ev->opcode, ev->data, ev->len);
}
-#if PLATFORM_SDK_VERSION > 17
static void handle_le_test_mode(void *buf, uint16_t len)
{
struct hal_ev_le_test_mode *ev = buf;
if (bt_hal_cbacks->le_test_mode_cb)
bt_hal_cbacks->le_test_mode_cb(ev->status, ev->num_packets);
}
-#endif
/* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT' */
.var_len = true,
.data_len = sizeof(struct hal_ev_dut_mode_receive),
},
-#if PLATFORM_SDK_VERSION > 17
{ /* HAL_EV_LE_TEST_MODE */
.handler = handle_le_test_mode,
.var_len = false,
.data_len = sizeof(struct hal_ev_le_test_mode),
}
-#endif
};
static int init(bt_callbacks_t *callbacks)
sizeof(cmd_buf), cmd, 0, NULL, NULL);
}
-#if PLATFORM_SDK_VERSION > 17
static int le_test_mode(uint16_t opcode, uint8_t *buf, uint8_t len)
{
uint8_t cmd_buf[sizeof(struct hal_cmd_le_test_mode) + len];
return hal_ipc_cmd(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_LE_TEST_MODE,
sizeof(cmd_buf), cmd, 0, NULL, NULL);
}
-#endif
-#if PLATFORM_SDK_VERSION > 18
static int config_hci_snoop_log(uint8_t enable)
{
DBG("enable %u", enable);
return BT_STATUS_SUCCESS;
}
-#endif
static const bt_interface_t bluetooth_if = {
.size = sizeof(bt_interface_t),
.get_profile_interface = get_profile_interface,
.dut_mode_configure = dut_mode_configure,
.dut_mode_send = dut_mode_send,
-#if PLATFORM_SDK_VERSION > 17
.le_test_mode = le_test_mode,
-#endif
-#if PLATFORM_SDK_VERSION > 18
.config_hci_snoop_log = config_hci_snoop_log,
-#endif
};
static const bt_interface_t *get_bluetooth_interface(void)
diff --git a/android/hal-utils.c b/android/hal-utils.c
index e3c0c60..ceefefc 100644
--- a/android/hal-utils.c
+++ b/android/hal-utils.c
DELEMENT(BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT),
DELEMENT(BT_PROPERTY_REMOTE_FRIENDLY_NAME),
DELEMENT(BT_PROPERTY_REMOTE_RSSI),
-#if PLATFORM_SDK_VERSION > 17
DELEMENT(BT_PROPERTY_REMOTE_VERSION_INFO),
-#endif
DELEMENT(BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP),
ENDMAP
diff --git a/android/main.c b/android/main.c
index 5210b4b..bd1bed7 100644
--- a/android/main.c
+++ b/android/main.c
#include <unistd.h>
#include <sys/signalfd.h>
+#include <sys/capability.h>
#include <glib.h>
#include "a2dp.h"
#include "pan.h"
-/* TODO: Consider to remove PLATFORM_SDKVERSION check if requirement
-* for minimal Android platform version increases. */
-#if defined(ANDROID) && PLATFORM_SDK_VERSION >= 18
-#include <sys/capability.h>
-#endif
-
#define STARTUP_GRACE_SECONDS 5
#define SHUTDOWN_GRACE_SECONDS 10