diff --git a/android/Makefile.am b/android/Makefile.am
index 5364c2e..f3e77c3 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
src/shared/mgmt.h src/shared/mgmt.c \
src/shared/hciemu.h src/shared/hciemu.c \
src/shared/tester.h src/shared/tester.c \
- android/android-tester.c
+ android/hal-utils.h android/hal-utils.c \
+ android/client/hwmodule.c android/android-tester.c
-android_android_tester_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
+
+android_android_tester_LDADD = lib/libbluetooth-internal.la \
+ android/libhal-internal.la @GLIB_LIBS@
+
+android_android_tester_LDFLAGS = -pthread
endif
diff --git a/android/android-tester.c b/android/android-tester.c
index ad7aa39..15f8c61 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
#include "src/shared/mgmt.h"
#include "src/shared/hciemu.h"
+#include <hardware/hardware.h>
+#include <hardware/bluetooth.h>
+
struct generic_data {
};
enum hciemu_type hciemu_type;
const struct generic_data *test_data;
pid_t bluetoothd_pid;
+ const bt_interface_t *if_bluetooth;
};
static char exec_dir[PATH_MAX + 1];
close(fd);
}
+static bt_callbacks_t bt_callbacks = {
+ .size = sizeof(bt_callbacks),
+ .adapter_state_changed_cb = NULL,
+ .adapter_properties_cb = NULL,
+ .remote_device_properties_cb = NULL,
+ .device_found_cb = NULL,
+ .discovery_state_changed_cb = NULL,
+ .pin_request_cb = NULL,
+ .ssp_request_cb = NULL,
+ .bond_state_changed_cb = NULL,
+ .acl_state_changed_cb = NULL,
+ .thread_evt_cb = NULL,
+ .dut_mode_recv_cb = NULL,
+ .le_test_mode_cb = NULL
+};
+
static void setup(struct test_data *data)
{
+ const hw_module_t *module;
+ hw_device_t *device;
+ bt_status_t status;
int signal_fd[2];
char buf[1024];
pid_t pid;
int len;
+ int err;
if (pipe(signal_fd)) {
tester_setup_failed();
tester_setup_failed();
return;
}
+
+ close(signal_fd[0]);
+
+ err = hw_get_module(BT_HARDWARE_MODULE_ID, &module);
+ if (err) {
+ tester_setup_failed();
+ return;
+ }
+
+ err = module->methods->open(module, BT_HARDWARE_MODULE_ID, &device);
+ if (err) {
+ tester_setup_failed();
+ return;
+ }
+
+ data->if_bluetooth = ((bluetooth_device_t *)
+ device)->get_bluetooth_interface();
+ if (!data->if_bluetooth) {
+ tester_setup_failed();
+ return;
+ }
+
+ status = data->if_bluetooth->init(&bt_callbacks);
+ if (status != BT_STATUS_SUCCESS) {
+ data->if_bluetooth = NULL;
+ tester_setup_failed();
+ }
}
static void setup_base(const void *test_data)
{
struct test_data *data = tester_get_data();
+ if (data->if_bluetooth) {
+ data->if_bluetooth->cleanup();
+ data->if_bluetooth = NULL;
+ }
+
if (data->bluetoothd_pid)
waitpid(data->bluetoothd_pid, NULL, 0);
static void controller_setup(const void *test_data)
{
+ tester_test_passed();
}
#define test_bredrle(name, data, test_setup, test, test_teardown) \