2014-03-07 11:51:45

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 1/9] unit/avrcp: Add /TP/MDI/BV-01-C test

From: Andrei Emeltchenko <[email protected]>

Test verifies Get play status.
---
unit/test-avrcp.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index db1a67e..4f81954 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -459,6 +459,23 @@ static ssize_t avrcp_handle_set_player_value(struct avrcp *session,
return 1;
}

+static ssize_t avrcp_handle_get_play_status(struct avrcp *session,
+ uint8_t transaction,
+ uint16_t params_len,
+ uint8_t *params,
+ void *user_data)
+{
+ DBG("");
+
+ if (params_len)
+ return -EINVAL;
+
+ avrcp_get_play_status_rsp(session, transaction, 0xaaaaaaaa, 0xbbbbbbbb,
+ 0x00);
+
+ return -EAGAIN;
+}
+
static const struct avrcp_control_handler control_handlers[] = {
{ AVRCP_GET_CAPABILITIES,
AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
@@ -481,6 +498,9 @@ static const struct avrcp_control_handler control_handlers[] = {
{ AVRCP_SET_PLAYER_VALUE,
AVC_CTYPE_CONTROL, AVC_CTYPE_STABLE,
avrcp_handle_set_player_value },
+ { AVRCP_GET_PLAY_STATUS,
+ AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
+ avrcp_handle_get_play_status },
{ },
};

@@ -782,5 +802,16 @@ int main(int argc, char *argv[])
0x00, 0x19, 0x58, AVRCP_GET_PLAY_STATUS,
0x00, 0x00, 0x00));

+ /* Get play status - TG */
+ define_test("/TP/MDI/BV-02-C", test_server,
+ raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_GET_PLAY_STATUS,
+ 0x00, 0x00, 0x00),
+ raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_GET_PLAY_STATUS,
+ 0x00, 0x00, 0x09, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xbb, 0xbb, 0xbb, 0xbb, 0x00));
+
+
return g_test_run();
}
--
1.8.3.2



2014-03-10 08:32:50

by Andrei Emeltchenko

[permalink] [raw]
Subject: Re: [PATCH 1/9] unit/avrcp: Add /TP/MDI/BV-01-C test

On Fri, Mar 07, 2014 at 01:51:45PM +0200, Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <[email protected]>
>
> Test verifies Get play status.

ping

> ---
> unit/test-avrcp.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
> index db1a67e..4f81954 100644
> --- a/unit/test-avrcp.c
> +++ b/unit/test-avrcp.c
> @@ -459,6 +459,23 @@ static ssize_t avrcp_handle_set_player_value(struct avrcp *session,
> return 1;
> }
>
> +static ssize_t avrcp_handle_get_play_status(struct avrcp *session,
> + uint8_t transaction,
> + uint16_t params_len,
> + uint8_t *params,
> + void *user_data)
> +{
> + DBG("");
> +
> + if (params_len)
> + return -EINVAL;
> +
> + avrcp_get_play_status_rsp(session, transaction, 0xaaaaaaaa, 0xbbbbbbbb,
> + 0x00);
> +
> + return -EAGAIN;
> +}
> +
> static const struct avrcp_control_handler control_handlers[] = {
> { AVRCP_GET_CAPABILITIES,
> AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
> @@ -481,6 +498,9 @@ static const struct avrcp_control_handler control_handlers[] = {
> { AVRCP_SET_PLAYER_VALUE,
> AVC_CTYPE_CONTROL, AVC_CTYPE_STABLE,
> avrcp_handle_set_player_value },
> + { AVRCP_GET_PLAY_STATUS,
> + AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
> + avrcp_handle_get_play_status },
> { },
> };
>
> @@ -782,5 +802,16 @@ int main(int argc, char *argv[])
> 0x00, 0x19, 0x58, AVRCP_GET_PLAY_STATUS,
> 0x00, 0x00, 0x00));
>
> + /* Get play status - TG */
> + define_test("/TP/MDI/BV-02-C", test_server,
> + raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
> + 0x00, 0x19, 0x58, AVRCP_GET_PLAY_STATUS,
> + 0x00, 0x00, 0x00),
> + raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
> + 0x00, 0x19, 0x58, AVRCP_GET_PLAY_STATUS,
> + 0x00, 0x00, 0x09, 0xaa, 0xaa, 0xaa,
> + 0xaa, 0xbb, 0xbb, 0xbb, 0xbb, 0x00));
> +
> +
> return g_test_run();
> }
> --
> 1.8.3.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2014-03-07 13:23:11

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 8/9] unit/avrcp: Add /TP/NFY/BV-02-C test

From: Andrei Emeltchenko <[email protected]>

Test verifies that Target responds to Register notification command.
---
unit/test-avrcp.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index fa4870d..0e3bb51 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -162,6 +162,8 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
ssize_t len;
int fd;

+ DBG("");
+
pdu = &context->data->pdu_list[context->pdu_offset++];

if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
@@ -495,6 +497,43 @@ static ssize_t avrcp_handle_get_element_attrs(struct avrcp *session,
return -EAGAIN;
}

+static ssize_t avrcp_handle_register_notification(struct avrcp *session,
+ uint8_t transaction,
+ uint16_t params_len,
+ uint8_t *params,
+ void *user_data)
+{
+ uint8_t event;
+ uint8_t pdu[1024];
+ size_t pdu_len;
+
+ DBG("");
+
+ if (params_len != AVRCP_REGISTER_NOTIFICATION_PARAM_LENGTH)
+ return -EINVAL;
+
+ event = params[0];
+ pdu[0] = event;
+ pdu_len = 1;
+
+ switch (event) {
+ case AVRCP_EVENT_TRACK_CHANGED:
+ memset(&pdu[1], 0xff, 8);
+ pdu_len += 8;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_INTERIM,
+ pdu, pdu_len);
+
+ avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_CHANGED,
+ pdu, pdu_len);
+
+ return -EAGAIN;
+}
+
static const struct avrcp_control_handler control_handlers[] = {
{ AVRCP_GET_CAPABILITIES,
AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
@@ -523,6 +562,9 @@ static const struct avrcp_control_handler control_handlers[] = {
{ AVRCP_GET_ELEMENT_ATTRIBUTES,
AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
avrcp_handle_get_element_attrs },
+ { AVRCP_REGISTER_NOTIFICATION,
+ AVC_CTYPE_NOTIFY, AVC_CTYPE_INTERIM,
+ avrcp_handle_register_notification },
{ },
};

@@ -879,5 +921,22 @@ int main(int argc, char *argv[])
0x00, 0x00, 0x05, AVRCP_EVENT_STATUS_CHANGED,
0x00, 0x00, 0x00, 0x00));

+ /* Register notification - TG */
+ define_test("/TP/NFY/BV-02-C", test_server,
+ raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x05, AVRCP_EVENT_TRACK_CHANGED,
+ 0x00, 0x00, 0x00, 0x00),
+ raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x09, AVRCP_EVENT_TRACK_CHANGED,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff),
+ raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x09, AVRCP_EVENT_TRACK_CHANGED,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff));
+
return g_test_run();
}
--
1.8.3.2


2014-03-07 11:51:49

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 5/9] unit/avrcp: Add /TP/MDI/BV-05-C test

From: Andrei Emeltchenko <[email protected]>

Test verifies that Target responds to Get element attributes cmd.
---
unit/test-avrcp.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 393afee..496dd1b 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -482,11 +482,14 @@ static ssize_t avrcp_handle_get_element_attrs(struct avrcp *session,
uint8_t *params,
void *user_data)
{
- DBG("");
+ DBG("params_len %d params[8] %d", params_len, params[8]);

if (params_len < 9)
return -EINVAL;

+ if (params_len != 9 + params[8] * 4)
+ return -EINVAL;
+
avrcp_get_element_attrs_rsp(session, transaction, NULL, 0);

return -EAGAIN;
@@ -850,5 +853,17 @@ int main(int argc, char *argv[])
raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
0x00, 0x00, 0x00));
+
+ /* Get element attributes - TG */
+ define_test("/TP/MDI/BV-05-C", test_server,
+ raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
+ 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x01),
+ raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
+ 0x00, 0x00, 0x00));
+
return g_test_run();
}
--
1.8.3.2


2014-03-07 11:51:48

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 4/9] unit/avrcp: Add /TP/MDI/BV-04-C test

From: Andrei Emeltchenko <[email protected]>

Test verifies Get element attributes responded by Target.
---
unit/test-avrcp.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 9b334e6..393afee 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -476,6 +476,22 @@ static ssize_t avrcp_handle_get_play_status(struct avrcp *session,
return -EAGAIN;
}

+static ssize_t avrcp_handle_get_element_attrs(struct avrcp *session,
+ uint8_t transaction,
+ uint16_t params_len,
+ uint8_t *params,
+ void *user_data)
+{
+ DBG("");
+
+ if (params_len < 9)
+ return -EINVAL;
+
+ avrcp_get_element_attrs_rsp(session, transaction, NULL, 0);
+
+ return -EAGAIN;
+}
+
static const struct avrcp_control_handler control_handlers[] = {
{ AVRCP_GET_CAPABILITIES,
AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
@@ -501,6 +517,9 @@ static const struct avrcp_control_handler control_handlers[] = {
{ AVRCP_GET_PLAY_STATUS,
AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
avrcp_handle_get_play_status },
+ { AVRCP_GET_ELEMENT_ATTRIBUTES,
+ AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
+ avrcp_handle_get_element_attrs },
{ },
};

@@ -822,5 +841,14 @@ int main(int argc, char *argv[])
0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00));

+ /* Get element attributes - TG */
+ define_test("/TP/MDI/BV-04-C", test_server,
+ raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
+ 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00),
+ raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
+ 0x00, 0x00, 0x00));
return g_test_run();
}
--
1.8.3.2


2014-03-07 11:51:53

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 9/9] doc: Update test coverage document

From: Andrei Emeltchenko <[email protected]>

---
doc/test-coverage.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/test-coverage.txt b/doc/test-coverage.txt
index 244e0c6..1bac0f8 100644
--- a/doc/test-coverage.txt
+++ b/doc/test-coverage.txt
@@ -19,7 +19,7 @@ test-queue 1 Queue handling functionality
test-hfp 9 HFP Audio Gateway functionality
test-avdtp 60 AVDTP qualification test cases
test-avctp 9 AVCTP qualification test cases
-test-avrcp 24 AVRCP qualification test cases
+test-avrcp 32 AVRCP qualification test cases
test-gobex 31 Generic OBEX functionality
test-gobex-packet 9 OBEX packet handling
test-gobex-header 28 OBEX header handling
--
1.8.3.2


2014-03-07 11:51:52

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 8/9] unit/avrcp: Add /TP/NFY/BV-02-C test

From: Andrei Emeltchenko <[email protected]>

Test verifies that Target responds to Register notification command.
---
unit/test-avrcp.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 65 insertions(+), 1 deletion(-)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index fa4870d..20445ff 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -162,7 +162,7 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
ssize_t len;
int fd;

- pdu = &context->data->pdu_list[context->pdu_offset++];
+ DBG("");

if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
context->source = 0;
@@ -172,6 +172,9 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,

fd = g_io_channel_unix_get_fd(channel);

+again:
+ pdu = &context->data->pdu_list[context->pdu_offset++];
+
len = read(fd, buf, sizeof(buf));

g_assert(len > 0);
@@ -183,6 +186,10 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,

g_assert(memcmp(buf, pdu->data, pdu->size) == 0);

+ if (g_str_equal(context->data->test_name, "/TP/NFY/BV-02-C") &&
+ context->pdu_offset == 2)
+ goto again;
+
if (!pdu->fragmented)
context_process(context);

@@ -495,6 +502,43 @@ static ssize_t avrcp_handle_get_element_attrs(struct avrcp *session,
return -EAGAIN;
}

+static ssize_t avrcp_handle_register_notification(struct avrcp *session,
+ uint8_t transaction,
+ uint16_t params_len,
+ uint8_t *params,
+ void *user_data)
+{
+ uint8_t event;
+ uint8_t pdu[1024];
+ size_t pdu_len;
+
+ DBG("");
+
+ if (params_len != AVRCP_REGISTER_NOTIFICATION_PARAM_LENGTH)
+ return -EINVAL;
+
+ event = params[0];
+ pdu[0] = event;
+ pdu_len = 1;
+
+ switch (event) {
+ case AVRCP_EVENT_TRACK_CHANGED:
+ memset(&pdu[1], 0xff, 8);
+ pdu_len += 8;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_INTERIM,
+ pdu, pdu_len);
+
+ avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_CHANGED,
+ pdu, pdu_len);
+
+ return -EAGAIN;
+}
+
static const struct avrcp_control_handler control_handlers[] = {
{ AVRCP_GET_CAPABILITIES,
AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
@@ -523,6 +567,9 @@ static const struct avrcp_control_handler control_handlers[] = {
{ AVRCP_GET_ELEMENT_ATTRIBUTES,
AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
avrcp_handle_get_element_attrs },
+ { AVRCP_REGISTER_NOTIFICATION,
+ AVC_CTYPE_NOTIFY, AVC_CTYPE_INTERIM,
+ avrcp_handle_register_notification },
{ },
};

@@ -879,5 +926,22 @@ int main(int argc, char *argv[])
0x00, 0x00, 0x05, AVRCP_EVENT_STATUS_CHANGED,
0x00, 0x00, 0x00, 0x00));

+ /* Register notification - TG */
+ define_test("/TP/NFY/BV-02-C", test_server,
+ raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x05, AVRCP_EVENT_TRACK_CHANGED,
+ 0x00, 0x00, 0x00, 0x00),
+ raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x09, AVRCP_EVENT_TRACK_CHANGED,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff),
+ raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x09, AVRCP_EVENT_TRACK_CHANGED,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff));
+
return g_test_run();
}
--
1.8.3.2


2014-03-07 11:51:50

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 6/9] android/avrcp: Add avrcp_register_notification() function

From: Andrei Emeltchenko <[email protected]>

---
android/avrcp-lib.c | 14 ++++++++++++++
android/avrcp-lib.h | 6 ++++++
2 files changed, 20 insertions(+)

diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index fbaa48d..1663218 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -416,6 +416,20 @@ int avrcp_get_element_attributes(struct avrcp *session, avctp_rsp_cb func,
func, user_data);
}

+int avrcp_register_notification(struct avrcp *session, uint8_t event,
+ uint32_t interval, avctp_rsp_cb func,
+ void *user_data)
+{
+ uint8_t pdu[AVRCP_REGISTER_NOTIFICATION_PARAM_LENGTH];
+
+ pdu[0] = event;
+ bt_put_be32(interval, &pdu[1]);
+
+ return avrcp_send_req(session, AVC_CTYPE_NOTIFY, AVC_SUBUNIT_PANEL,
+ AVRCP_REGISTER_NOTIFICATION, pdu, sizeof(pdu),
+ func, user_data);
+}
+
int avrcp_get_play_status_rsp(struct avrcp *session, uint8_t transaction,
uint32_t position, uint32_t duration,
uint8_t status)
diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
index 5e90ea1..b0a1025 100644
--- a/android/avrcp-lib.h
+++ b/android/avrcp-lib.h
@@ -86,6 +86,9 @@
/* Company IDs for vendor dependent commands */
#define IEEEID_BTSIG 0x001958

+/* Parameters legths */
+#define AVRCP_REGISTER_NOTIFICATION_PARAM_LENGTH 5
+
struct avrcp;

struct avrcp_control_handler {
@@ -147,6 +150,9 @@ int avrcp_get_play_status(struct avrcp *session, avctp_rsp_cb func,
void *user_data);
int avrcp_get_element_attributes(struct avrcp *session, avctp_rsp_cb func,
void *user_data);
+int avrcp_register_notification(struct avrcp *session, uint8_t event,
+ uint32_t interval, avctp_rsp_cb func,
+ void *user_data);

int avrcp_get_play_status_rsp(struct avrcp *session, uint8_t transaction,
uint32_t position, uint32_t duration,
--
1.8.3.2


2014-03-07 11:51:51

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 7/9] unit/avrcp: Add /TP/NFY/BV-01-C test

From: Andrei Emeltchenko <[email protected]>

Test verifies that Register notification command is issued by
Controller.
---
unit/test-avrcp.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 496dd1b..fa4870d 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -578,6 +578,11 @@ static void test_client(gconstpointer data)
if (g_str_equal(context->data->test_name, "/TP/MDI/BV-03-C"))
avrcp_get_element_attributes(context->session, NULL, NULL);

+ if (g_str_equal(context->data->test_name, "/TP/NFY/BV-01-C"))
+ avrcp_register_notification(context->session,
+ AVRCP_EVENT_STATUS_CHANGED, 0,
+ NULL, NULL);
+
execute_context(context);
}

@@ -865,5 +870,14 @@ int main(int argc, char *argv[])
0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
0x00, 0x00, 0x00));

+ /* Notification Commands */
+
+ /* Register notification - CT */
+ define_test("/TP/NFY/BV-01-C", test_client,
+ raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x05, AVRCP_EVENT_STATUS_CHANGED,
+ 0x00, 0x00, 0x00, 0x00));
+
return g_test_run();
}
--
1.8.3.2


2014-03-07 11:51:47

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 3/9] unit/avrcp: Add /TP/MDI/BV-03-C test

From: Andrei Emeltchenko <[email protected]>

Test verifies that Get element attributes issued correctly.
---
unit/test-avrcp.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 4f81954..9b334e6 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -553,6 +553,9 @@ static void test_client(gconstpointer data)
if (g_str_equal(context->data->test_name, "/TP/MDI/BV-01-C"))
avrcp_get_play_status(context->session, NULL, NULL);

+ if (g_str_equal(context->data->test_name, "/TP/MDI/BV-03-C"))
+ avrcp_get_element_attributes(context->session, NULL, NULL);
+
execute_context(context);
}

@@ -812,6 +815,12 @@ int main(int argc, char *argv[])
0x00, 0x00, 0x09, 0xaa, 0xaa, 0xaa,
0xaa, 0xbb, 0xbb, 0xbb, 0xbb, 0x00));

+ /* Get element attributes - CT */
+ define_test("/TP/MDI/BV-03-C", test_client,
+ raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
+ 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));

return g_test_run();
}
--
1.8.3.2


2014-03-07 11:51:46

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 2/9] android/avrcp: Add avrcp_get_element_attributes() function

From: Andrei Emeltchenko <[email protected]>

---
android/avrcp-lib.c | 13 +++++++++++++
android/avrcp-lib.h | 2 ++
2 files changed, 15 insertions(+)

diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index cd39071..fbaa48d 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -403,6 +403,19 @@ int avrcp_get_play_status(struct avrcp *session, avctp_rsp_cb func,
user_data);
}

+int avrcp_get_element_attributes(struct avrcp *session, avctp_rsp_cb func,
+ void *user_data)
+{
+ uint8_t buf[9];
+
+ /* This returns all attributes */
+ memset(buf, 0, sizeof(buf));
+
+ return avrcp_send_req(session, AVC_CTYPE_STATUS, AVC_SUBUNIT_PANEL,
+ AVRCP_GET_ELEMENT_ATTRIBUTES, buf, sizeof(buf),
+ func, user_data);
+}
+
int avrcp_get_play_status_rsp(struct avrcp *session, uint8_t transaction,
uint32_t position, uint32_t duration,
uint8_t status)
diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
index ba1d84a..5e90ea1 100644
--- a/android/avrcp-lib.h
+++ b/android/avrcp-lib.h
@@ -145,6 +145,8 @@ int avrcp_get_current_player_value(struct avrcp *session, uint8_t *attrs,
void *user_data);
int avrcp_get_play_status(struct avrcp *session, avctp_rsp_cb func,
void *user_data);
+int avrcp_get_element_attributes(struct avrcp *session, avctp_rsp_cb func,
+ void *user_data);

int avrcp_get_play_status_rsp(struct avrcp *session, uint8_t transaction,
uint32_t position, uint32_t duration,
--
1.8.3.2