From e8daf2fd3fa1ccb3e51ca69a4b64337b49008d7a Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 13 Oct 2014 15:18:09 +0300 Subject: [PATCH] unit/test-avrcp: Add TP/VLH/BV-04-C test Verify the NotifyVolumeChange response issued by the TG. --- unit/test-avrcp.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c index 4314defe4..a48e085cf 100644 --- a/unit/test-avrcp.c +++ b/unit/test-avrcp.c @@ -648,6 +648,26 @@ static int now_playing_content_changed(struct avrcp *session, return 0; } +static int volume_changed(struct avrcp *session, uint8_t transaction, + uint32_t interval, void *user_data) +{ + uint8_t volume = 0x00; + + DBG(""); + + avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_INTERIM, + AVRCP_EVENT_VOLUME_CHANGED, + &volume, sizeof(volume)); + + volume = 0x01; + + avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_CHANGED, + AVRCP_EVENT_VOLUME_CHANGED, + &volume, sizeof(volume)); + + return 0; +} + static int register_notification(struct avrcp *session, uint8_t transaction, uint8_t event, uint32_t interval, void *user_data) @@ -671,6 +691,9 @@ static int register_notification(struct avrcp *session, uint8_t transaction, case AVRCP_EVENT_NOW_PLAYING_CONTENT_CHANGED: return now_playing_content_changed(session, transaction, interval, user_data); + case AVRCP_EVENT_VOLUME_CHANGED: + return volume_changed(session, transaction, + interval, user_data); default: return -EINVAL; } @@ -2003,6 +2026,21 @@ int main(int argc, char *argv[]) 0x00, 0x00, 0x02, 0x0d, 0x00)); + /* NotifyVolumeChange - TG */ + define_test("/TP/VLH/BV-04-C", test_server, + raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00, + 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION, + 0x00, 0x00, 0x05, 0x0d, + 0x00, 0x00, 0x00, 0x00), + frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00, + 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION, + 0x00, 0x00, 0x02, 0x0d, + 0x00), + raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00, + 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION, + 0x00, 0x00, 0x02, 0x0d, + 0x01)); + /* Set absolute volume – TG */ define_test("/TP/VLH/BI-01-C", test_server, raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00, -- 2.47.3