2014-02-27 09:11:26

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 1/5] android/avrcp: Refactor get_caps() to allow parameter

From: Andrei Emeltchenko <[email protected]>

Allow passing parameter specifying capability ID.
---
android/avrcp-lib.c | 6 ++----
android/avrcp-lib.h | 4 ++--
unit/test-avrcp.c | 3 ++-
3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index 1b5a294..6ae8df8 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -297,11 +297,9 @@ static int avrcp_send_req(struct avrcp *session, uint8_t code, uint8_t subunit,
session->tx_buf, len, func, user_data);
}

-int avrcp_get_capabilities(struct avrcp *session, avctp_rsp_cb func,
- void *user_data)
+int avrcp_get_capabilities(struct avrcp *session, uint8_t param,
+ avctp_rsp_cb func, void *user_data)
{
- uint8_t param = CAP_EVENTS_SUPPORTED;
-
return avrcp_send_req(session, AVC_CTYPE_STATUS, AVC_SUBUNIT_PANEL,
AVRCP_GET_CAPABILITIES, &param, sizeof(param),
func, user_data);
diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
index 75802b9..e6e12c1 100644
--- a/android/avrcp-lib.h
+++ b/android/avrcp-lib.h
@@ -106,5 +106,5 @@ void avrcp_set_passthrough_handlers(struct avrcp *session,
int avrcp_init_uinput(struct avrcp *session, const char *name,
const char *address);

-int avrcp_get_capabilities(struct avrcp *session, avctp_rsp_cb func,
- void *user_data);
+int avrcp_get_capabilities(struct avrcp *session, uint8_t param,
+ avctp_rsp_cb func, void *user_data);
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index bcd8f88..f222df8 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -353,7 +353,8 @@ static void test_client(gconstpointer data)
struct context *context = create_context(0x0100, data);

if (g_str_equal(context->data->test_name, "/TP/CFG/BV-01-C"))
- avrcp_get_capabilities(context->session, NULL, NULL);
+ avrcp_get_capabilities(context->session, CAP_EVENTS_SUPPORTED,
+ NULL, NULL);

execute_context(context);
}
--
1.8.3.2



2014-02-27 09:11:31

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 5/5] unit/avrcp: Add /TP/PAS/BV-01-C test

From: Andrei Emeltchenko <[email protected]>

Test verifies that the List Player Application Setting Attributes command
issued from the Controller.
---
unit/test-avrcp.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 0924a7e..c65f743 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -358,6 +358,9 @@ static void test_client(gconstpointer data)
avrcp_get_capabilities(context->session, CAP_EVENTS_SUPPORTED,
NULL, NULL);

+ if (g_str_equal(context->data->test_name, "/TP/PAS/BV-01-C"))
+ avrcp_list_player_attributes(context->session, NULL, NULL);
+
execute_context(context);
}

@@ -452,5 +455,12 @@ int main(int argc, char *argv[])
0x00, 0x00, 0x01,
AVRCP_STATUS_INVALID_PARAM));

+ /* Player Application Settings tests */
+
+ define_test("/TP/PAS/BV-01-C", test_client,
+ raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
+ 0x00, 0x19, 0x58, 0x11, 0x00, 0x00,
+ 0x00));
+
return g_test_run();
}
--
1.8.3.2


2014-02-27 09:11:30

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 4/5] android/avrcp: Add list player attributes command

From: Andrei Emeltchenko <[email protected]>

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

diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index 6ae8df8..3db5bda 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -304,3 +304,11 @@ int avrcp_get_capabilities(struct avrcp *session, uint8_t param,
AVRCP_GET_CAPABILITIES, &param, sizeof(param),
func, user_data);
}
+
+int avrcp_list_player_attributes(struct avrcp *session, avctp_rsp_cb func,
+ void *user_data)
+{
+ return avrcp_send_req(session, AVC_CTYPE_STATUS, AVC_SUBUNIT_PANEL,
+ AVRCP_LIST_PLAYER_ATTRIBUTES, NULL, 0,
+ func, user_data);
+}
diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
index e6e12c1..7283203 100644
--- a/android/avrcp-lib.h
+++ b/android/avrcp-lib.h
@@ -108,3 +108,5 @@ int avrcp_init_uinput(struct avrcp *session, const char *name,

int avrcp_get_capabilities(struct avrcp *session, uint8_t param,
avctp_rsp_cb func, void *user_data);
+int avrcp_list_player_attributes(struct avrcp *session, avctp_rsp_cb func,
+ void *user_data);
--
1.8.3.2


2014-02-27 09:11:27

by Andrei Emeltchenko

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

From: Andrei Emeltchenko <[email protected]>

Update AVRCP test numbers.
---
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 d37bcb8..79cace9 100644
--- a/doc/test-coverage.txt
+++ b/doc/test-coverage.txt
@@ -18,7 +18,7 @@ test-ringbuf 3 Ring buffer functionality
test-queue 1 Queue handling functionality
test-avdtp 60 AVDTP qualification test cases
test-avctp 9 AVCTP qualification test cases
-test-avrcp 7 AVRCP qualification test cases
+test-avrcp 13 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-02-27 09:11:28

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 2/5] unit/avrcp: Fix lengths byte order

From: Andrei Emeltchenko <[email protected]>

params_len is passed as function argument and needs to be in host byte
order.
---
unit/test-avrcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index f222df8..a43985a 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -323,7 +323,7 @@ static uint8_t avrcp_handle_get_capabilities(struct avrcp *session,
}

fail:
- *params_len = htons(1);
+ *params_len = 1;
params[0] = AVRCP_STATUS_INVALID_PARAM;

return AVC_CTYPE_REJECTED;
--
1.8.3.2


2014-02-27 09:11:29

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 3/5] unit/avrcp: Add /TP/CFG/BI-01-C test

From: Andrei Emeltchenko <[email protected]>

Test verifies the get capabilities response issued from the Target when
an invalid capability is requested (0x7f).
---
unit/test-avrcp.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index a43985a..0924a7e 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -311,6 +311,8 @@ static uint8_t avrcp_handle_get_capabilities(struct avrcp *session,
{
uint32_t id = 0x001958;

+ DBG("params[0] %d params_len %d", params[0], *params_len);
+
if (*params_len != 1)
goto fail;

@@ -441,5 +443,14 @@ int main(int argc, char *argv[])
0x00, 0x19, 0x58, 0x10, 0x00, 0x00,
0x05, 0x02, 0x01, 0x00, 0x19, 0x58));

+ define_test("/TP/CFG/BI-01-C", test_server,
+ raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
+ 0x00, 0x19, 0x58, 0x10, 0x00, 0x00,
+ 0x01, 0x7f),
+ raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_REJECTED,
+ 0x48, 0x00, 0x00, 0x19, 0x58, 0x10,
+ 0x00, 0x00, 0x01,
+ AVRCP_STATUS_INVALID_PARAM));
+
return g_test_run();
}
--
1.8.3.2