2014-11-05 12:41:48

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 1/6] android/client: Support new API for Audio HAL

From: Andrei Emeltchenko <[email protected]>

Add support for new parameter in open_output_stream().
---
android/client/if-audio.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/android/client/if-audio.c b/android/client/if-audio.c
index f3f87fb..65e2f2f 100644
--- a/android/client/if-audio.c
+++ b/android/client/if-audio.c
@@ -60,7 +60,14 @@ SINTMAP(audio_channel_mask_t, -1, "(AUDIO_CHANNEL_INVALID)")
DELEMENT(AUDIO_CHANNEL_OUT_MONO),
DELEMENT(AUDIO_CHANNEL_OUT_STEREO),
DELEMENT(AUDIO_CHANNEL_OUT_QUAD),
+#if ANDROID_VERSION < PLATFORM_VER(5, 0, 0)
DELEMENT(AUDIO_CHANNEL_OUT_SURROUND),
+#else
+ DELEMENT(AUDIO_CHANNEL_OUT_QUAD_BACK),
+ DELEMENT(AUDIO_CHANNEL_OUT_QUAD_SIDE),
+ DELEMENT(AUDIO_CHANNEL_OUT_5POINT1_BACK),
+ DELEMENT(AUDIO_CHANNEL_OUT_5POINT1_SIDE),
+#endif
DELEMENT(AUDIO_CHANNEL_OUT_5POINT1),
DELEMENT(AUDIO_CHANNEL_OUT_7POINT1),
DELEMENT(AUDIO_CHANNEL_OUT_ALL),
@@ -305,12 +312,21 @@ static void open_output_stream_p(int argc, const char **argv)
}
pthread_mutex_unlock(&state_mutex);

+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+ err = if_audio->open_output_stream(if_audio,
+ 0,
+ AUDIO_DEVICE_OUT_ALL_A2DP,
+ AUDIO_OUTPUT_FLAG_NONE,
+ NULL,
+ &stream_out, NULL);
+#else
err = if_audio->open_output_stream(if_audio,
0,
AUDIO_DEVICE_OUT_ALL_A2DP,
AUDIO_OUTPUT_FLAG_NONE,
NULL,
&stream_out);
+#endif
if (err < 0) {
haltest_error("open output stream returned %d\n", err);
return;
--
1.9.1



2014-11-05 20:52:05

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH 1/6] android/client: Support new API for Audio HAL

Hi Andrei,

On Wednesday 05 of November 2014 14:41:48 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <[email protected]>
>
> Add support for new parameter in open_output_stream().
> ---
> android/client/if-audio.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/android/client/if-audio.c b/android/client/if-audio.c
> index f3f87fb..65e2f2f 100644
> --- a/android/client/if-audio.c
> +++ b/android/client/if-audio.c
> @@ -60,7 +60,14 @@ SINTMAP(audio_channel_mask_t, -1,
> "(AUDIO_CHANNEL_INVALID)") DELEMENT(AUDIO_CHANNEL_OUT_MONO),
> DELEMENT(AUDIO_CHANNEL_OUT_STEREO),
> DELEMENT(AUDIO_CHANNEL_OUT_QUAD),
> +#if ANDROID_VERSION < PLATFORM_VER(5, 0, 0)
> DELEMENT(AUDIO_CHANNEL_OUT_SURROUND),
> +#else
> + DELEMENT(AUDIO_CHANNEL_OUT_QUAD_BACK),
> + DELEMENT(AUDIO_CHANNEL_OUT_QUAD_SIDE),
> + DELEMENT(AUDIO_CHANNEL_OUT_5POINT1_BACK),
> + DELEMENT(AUDIO_CHANNEL_OUT_5POINT1_SIDE),
> +#endif
> DELEMENT(AUDIO_CHANNEL_OUT_5POINT1),
> DELEMENT(AUDIO_CHANNEL_OUT_7POINT1),
> DELEMENT(AUDIO_CHANNEL_OUT_ALL),
> @@ -305,12 +312,21 @@ static void open_output_stream_p(int argc, const char
> **argv) }
> pthread_mutex_unlock(&state_mutex);
>
> +#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
> + err = if_audio->open_output_stream(if_audio,
> + 0,
> + AUDIO_DEVICE_OUT_ALL_A2DP,
> + AUDIO_OUTPUT_FLAG_NONE,
> + NULL,
> + &stream_out, NULL);
> +#else
> err = if_audio->open_output_stream(if_audio,
> 0,
> AUDIO_DEVICE_OUT_ALL_A2DP,
> AUDIO_OUTPUT_FLAG_NONE,
> NULL,
> &stream_out);
> +#endif
> if (err < 0) {
> haltest_error("open output stream returned %d\n", err);
> return;

All patches in this set are now applied, thanks.

--
BR
Szymon Janc

2014-11-05 12:41:52

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 5/6] android/client: Add support for new API for gatt connect()

From: Andrei Emeltchenko <[email protected]>

Fixes number of parameters in gatt connect() for different Android API.
---
android/client/if-gatt.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index 64429e4..6b4ff28 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
@@ -969,6 +969,9 @@ static void connect_p(int argc, const char **argv)
int client_if;
bt_bdaddr_t bd_addr;
int is_direct = 1;
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+ int transport = 1;
+#endif

RETURN_IF_NULL(if_gatt);
VERIFY_CLIENT_IF(2, client_if);
@@ -978,7 +981,16 @@ static void connect_p(int argc, const char **argv)
if (argc > 4)
is_direct = atoi(argv[4]);

+#if ANDROID_VERSION < PLATFORM_VER(5, 0, 0)
EXEC(if_gatt->client->connect, client_if, &bd_addr, is_direct);
+#else
+ /* transport */
+ if (argc > 5)
+ transport = atoi(argv[5]);
+
+ EXEC(if_gatt->client->connect, client_if, &bd_addr, is_direct,
+ transport);
+#endif
}

/* disconnect */
--
1.9.1


2014-11-05 12:41:53

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 6/6] android/client: Add support for new API for gatt server connect()

From: Andrei Emeltchenko <[email protected]>

Fixes number of parameters in gatt server connect() for different Android
API.
---
android/client/if-gatt.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index 6b4ff28..6a09012 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
@@ -1594,6 +1594,9 @@ static void gatts_connect_p(int argc, const char *argv[])
int server_if;
bt_bdaddr_t bd_addr;
int is_direct = 1;
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+ int transport = 1;
+#endif

RETURN_IF_NULL(if_gatt);
VERIFY_SERVER_IF(2, server_if);
@@ -1603,7 +1606,16 @@ static void gatts_connect_p(int argc, const char *argv[])
if (argc > 4)
is_direct = atoi(argv[4]);

+#if ANDROID_VERSION < PLATFORM_VER(5, 0, 0)
EXEC(if_gatt->server->connect, server_if, &bd_addr, is_direct);
+#else
+ /* transport */
+ if (argc > 5)
+ transport = atoi(argv[5]);
+
+ EXEC(if_gatt->server->connect, server_if, &bd_addr, is_direct,
+ transport);
+#endif
}

/* disconnect */
--
1.9.1


2014-11-05 12:41:51

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 4/6] android/client: Add support for new API for gatt scan()

From: Andrei Emeltchenko <[email protected]>

Fixes number of parameters in gatt scan()
---
android/client/if-gatt.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index d593022..64429e4 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
@@ -933,6 +933,7 @@ static void scan_p(int argc, const char **argv)

RETURN_IF_NULL(if_gatt);

+#if ANDROID_VERSION < PLATFORM_VER(5, 0, 0)
VERIFY_CLIENT_IF(2, client_if);

/* start */
@@ -940,6 +941,13 @@ static void scan_p(int argc, const char **argv)
start = atoi(argv[3]);

EXEC(if_gatt->client->scan, client_if, start);
+#else
+ /* start */
+ if (argc >= 3)
+ start = atoi(argv[2]);
+
+ EXEC(if_gatt->client->scan, start);
+#endif
}

/* connect */
--
1.9.1


2014-11-05 12:41:49

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 2/6] android/client: Support new API for SCO HAL

From: Andrei Emeltchenko <[email protected]>

Add support for new parameters in open_output_stream() and
open_inut_stream().
---
android/client/if-sco.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

diff --git a/android/client/if-sco.c b/android/client/if-sco.c
index e7197b2..5a68ed5 100644
--- a/android/client/if-sco.c
+++ b/android/client/if-sco.c
@@ -62,7 +62,14 @@ SINTMAP(audio_channel_mask_t, -1, "(AUDIO_CHANNEL_INVALID)")
DELEMENT(AUDIO_CHANNEL_OUT_MONO),
DELEMENT(AUDIO_CHANNEL_OUT_STEREO),
DELEMENT(AUDIO_CHANNEL_OUT_QUAD),
+#if ANDROID_VERSION < PLATFORM_VER(5, 0, 0)
DELEMENT(AUDIO_CHANNEL_OUT_SURROUND),
+#else
+ DELEMENT(AUDIO_CHANNEL_OUT_QUAD_BACK),
+ DELEMENT(AUDIO_CHANNEL_OUT_QUAD_SIDE),
+ DELEMENT(AUDIO_CHANNEL_OUT_5POINT1_BACK),
+ DELEMENT(AUDIO_CHANNEL_OUT_5POINT1_SIDE),
+#endif
DELEMENT(AUDIO_CHANNEL_OUT_5POINT1),
DELEMENT(AUDIO_CHANNEL_OUT_7POINT1),
DELEMENT(AUDIO_CHANNEL_OUT_ALL),
@@ -509,12 +516,21 @@ static void open_output_stream_p(int argc, const char **argv)
config->format = AUDIO_FORMAT_PCM_16_BIT;
}

+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+ err = if_audio_sco->open_output_stream(if_audio_sco,
+ 0,
+ AUDIO_DEVICE_OUT_ALL_SCO,
+ AUDIO_OUTPUT_FLAG_NONE,
+ config,
+ &stream_out, NULL);
+#else
err = if_audio_sco->open_output_stream(if_audio_sco,
0,
AUDIO_DEVICE_OUT_ALL_SCO,
AUDIO_OUTPUT_FLAG_NONE,
config,
&stream_out);
+#endif
if (err < 0) {
haltest_error("open output stream returned %d\n", err);
goto failed;
@@ -572,11 +588,19 @@ static void open_input_stream_p(int argc, const char **argv)
config->format = AUDIO_FORMAT_PCM_16_BIT;
}

+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+ err = if_audio_sco->open_input_stream(if_audio_sco,
+ 0,
+ AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET,
+ config,
+ &stream_in, 0, NULL, 0);
+#else
err = if_audio_sco->open_input_stream(if_audio_sco,
0,
AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET,
config,
&stream_in);
+#endif
if (err < 0) {
haltest_error("open output stream returned %d\n", err);
goto failed;
--
1.9.1


2014-11-05 12:41:50

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 3/6] android/client: Add support for new Android API for PAN HAL

From: Andrei Emeltchenko <[email protected]>

Fixes parameters order for new API.
---
android/client/if-pan.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/android/client/if-pan.c b/android/client/if-pan.c
index 6207f6e..b0c4b84 100644
--- a/android/client/if-pan.c
+++ b/android/client/if-pan.c
@@ -40,8 +40,13 @@ SINTMAP(btpan_control_state_t, -1, "(unknown)")
DELEMENT(BTPAN_STATE_DISABLED),
ENDMAP

+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+static void control_state_cb(btpan_control_state_t state, int local_role,
+ bt_status_t error, const char *ifname)
+#else
static void control_state_cb(btpan_control_state_t state, bt_status_t error,
int local_role, const char *ifname)
+#endif
{
haltest_info("%s: state=%s error=%s local_role=%s ifname=%s\n",
__func__, btpan_control_state_t2str(state),
--
1.9.1