From 46cdc5401647de197f6e9d68e803e754bdb5eb89 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 13 Oct 2014 15:04:15 +0300 Subject: [PATCH] unit/test-avrcp: Add TP/VLH/BV-03-C test Verify the NotifyVolumeChange command issued by the CT. --- unit/test-avrcp.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c index b26c553c5..4314defe4 100644 --- a/unit/test-avrcp.c +++ b/unit/test-avrcp.c @@ -868,7 +868,29 @@ static void get_folder_items_rsp(struct avrcp *session, int err, context_quit(context); } +static bool register_notification_rsp(struct avrcp *session, int err, + uint8_t code, uint8_t event, + uint8_t *params, void *user_data) +{ + struct context *context = user_data; + + DBG(""); + + g_assert_cmpint(err, ==, 0); + + switch (event) { + case AVRCP_EVENT_VOLUME_CHANGED: + g_assert_cmpint(params[0], ==, 0); + break; + } + + context_quit(context); + + return false; +} + static const struct avrcp_control_cfm control_cfm = { + .register_notification = register_notification_rsp, .get_folder_items = get_folder_items_rsp, }; @@ -998,6 +1020,10 @@ static void test_client(gconstpointer data) if (g_str_equal(context->data->test_name, "/TP/VLH/BV-01-C")) avrcp_set_volume(context->session, 0x00); + if (g_str_equal(context->data->test_name, "/TP/VLH/BV-03-C")) + avrcp_register_notification(context->session, + AVRCP_EVENT_VOLUME_CHANGED, 0); + execute_context(context); } @@ -1966,6 +1992,17 @@ int main(int argc, char *argv[]) 0x00, 0x19, 0x58, AVRCP_SET_ABSOLUTE_VOLUME, 0x00, 0x00, 0x01, 0x00)); + /* NotifyVolumeChange - CT */ + define_test("/TP/VLH/BV-03-C", test_client, + raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00, + 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION, + 0x00, 0x00, 0x05, 0x0d, + 0x00, 0x00, 0x00, 0x00), + raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00, + 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION, + 0x00, 0x00, 0x02, 0x0d, + 0x00)); + /* Set absolute volume – TG */ define_test("/TP/VLH/BI-01-C", test_server, raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00, -- 2.47.3