diff --git a/android/client/haltest.c b/android/client/haltest.c
index f9b0674..7fa15b5 100644
--- a/android/client/haltest.c
+++ b/android/client/haltest.c
#include "pollhandler.h"
#include "history.h"
+static void process_line(char *line_buffer);
+
const struct interface *interfaces[] = {
&audio_if,
&sco_if,
/* quit/exit execution */
static void quit_p(int argc, const char **argv)
{
+ char cleanup_audio[] = "audio cleanup";
+
+ close_hw_bt_dev();
+ process_line(cleanup_audio);
+
exit(0);
}
diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index 4f1a9d9..ce75834 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
#include "../hal-msg.h"
#include "../hal-utils.h"
+static hw_device_t *bt_device;
const bt_interface_t *if_bluetooth;
#define VERIFY_PROP_TYPE_ARG(n, typ) \
}
}
+bool close_hw_bt_dev(void)
+{
+ if (!bt_device)
+ return false;
+
+ bt_device->close(bt_device);
+ return true;
+}
+
static void adapter_state_changed_cb(bt_state_t state)
{
haltest_info("%s: state=%s\n", __func__, bt_state_t2str(state));
{
int err;
const hw_module_t *module;
- hw_device_t *device;
err = hw_get_module(BT_HARDWARE_MODULE_ID, &module);
if (err) {
return;
}
- err = module->methods->open(module, BT_HARDWARE_MODULE_ID, &device);
+ err = module->methods->open(module, BT_HARDWARE_MODULE_ID, &bt_device);
if (err) {
haltest_error("module->methods->open returned %d\n", err);
return;
}
if_bluetooth =
- ((bluetooth_device_t *) device)->get_bluetooth_interface();
+ ((bluetooth_device_t *) bt_device)->get_bluetooth_interface();
if (!if_bluetooth) {
haltest_error("get_bluetooth_interface returned NULL\n");
return;
diff --git a/android/client/if-main.h b/android/client/if-main.h
index 7fc8dad..d239bb2 100644
--- a/android/client/if-main.h
+++ b/android/client/if-main.h
const char *interface_name(void *v, int i);
const char *command_name(void *v, int i);
void add_remote_device(const bt_bdaddr_t *addr);
+bool close_hw_bt_dev(void);
const struct interface *get_interface(const char *name);
struct method *get_method(struct method *methods, const char *name);