diff --git a/android/Android.mk b/android/Android.mk
index 99882bb..5a55a76 100644
--- a/android/Android.mk
+++ b/android/Android.mk
client/terminal.c \
client/history.c \
client/tabcompletion.c \
+ client/if-audio.c \
client/if-av.c \
client/if-bt.c \
client/if-hf.c \
diff --git a/android/Makefile.am b/android/Makefile.am
index f5e8c99..87676cd 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
android/client/if-hh.c \
android/client/if-pan.c \
android/client/if-sock.c \
+ android/client/if-audio.c \
android/hardware/hardware.c \
android/hal-utils.h android/hal-utils.c
diff --git a/android/client/haltest.c b/android/client/haltest.c
index 7154d27..7c314c0 100644
--- a/android/client/haltest.c
+++ b/android/client/haltest.c
#include "history.h"
const struct interface *interfaces[] = {
+ &audio_if,
&bluetooth_if,
&av_if,
#if PLATFORM_SDK_VERSION > 17
};
const struct method *m;
const char *argv[4];
- char init_line[] = "bluetooth init";
+ char init_audio[] = "audio init";
+ char init_bt[] = "bluetooth init";
uint32_t i;
- process_line(init_line);
+ process_line(init_audio);
+ process_line(init_bt);
+
m = get_interface_method("bluetooth", "get_profile_interface");
for (i = 0; i < NELEM(inames); ++i) {
}
/* Init what is available to init */
- for (i = 1; i < NELEM(interfaces) - 1; ++i) {
+ for (i = 2; i < NELEM(interfaces) - 1; ++i) {
m = get_interface_method(interfaces[i]->name, "init");
if (m != NULL)
m->func(2, argv);
diff --git a/android/client/if-audio.c b/android/client/if-audio.c
new file mode 100644
index 0000000..203e088
--- /dev/null
+++ b/android/client/if-audio.c
+/*
+ * Copyright (C) 2014 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 "if-main.h"
+#include "../hal-utils.h"
+
+audio_hw_device_t *if_audio = NULL;
+
+static void init_p(int argc, const char **argv)
+{
+ int err;
+ const hw_module_t *module;
+ audio_hw_device_t *device;
+
+ err = hw_get_module_by_class(AUDIO_HARDWARE_MODULE_ID,
+ AUDIO_HARDWARE_MODULE_ID_A2DP, &module);
+ if (err) {
+ haltest_error("hw_get_module_by_class returned %d\n", err);
+ return;
+ }
+
+ err = audio_hw_device_open(module, &device);
+ if (err)
+ haltest_error("audio_hw_device_open returned %d\n", err);
+
+ if_audio = device;
+}
+
+static void cleanup_p(int argc, const char **argv)
+{
+ int err;
+
+ RETURN_IF_NULL(if_audio);
+
+ err = audio_hw_device_close(if_audio);
+ if (err < 0) {
+ haltest_error("audio_hw_device_close returned %d\n", err);
+ return;
+ }
+
+ if_audio = NULL;
+}
+
+static struct method methods[] = {
+ STD_METHOD(init),
+ STD_METHOD(cleanup),
+ END_METHOD
+};
+
+const struct interface audio_if = {
+ .name = "audio",
+ .methods = methods
+};
diff --git a/android/client/if-main.h b/android/client/if-main.h
index 4a5d4cc..0371c3e 100644
--- a/android/client/if-main.h
+++ b/android/client/if-main.h
#include <sys/un.h>
#include <poll.h>
+#include <hardware/audio.h>
#include <hardware/bluetooth.h>
#include <hardware/bt_av.h>
#include <hardware/bt_hh.h>
#include <hardware/bt_gatt_server.h>
#endif
+extern audio_hw_device_t *if_audio;
+
/* Interfaces from hal that can be populated during application lifetime */
extern const bt_interface_t *if_bluetooth;
extern const btav_interface_t *if_av;
struct method *methods; /* methods available for this interface */
};
+extern const struct interface audio_if;
extern const struct interface bluetooth_if;
extern const struct interface av_if;
#if PLATFORM_SDK_VERSION > 17