From 8177fff39802f56fde6ef2605bf1ef2986fdf6b4 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Tue, 24 Apr 2018 14:39:58 +0200 Subject: [PATCH] a2dp sink demo: add register track changed event --- example/a2dp_sink_demo.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/example/a2dp_sink_demo.c b/example/a2dp_sink_demo.c index 91896bb9e..ebb38b152 100644 --- a/example/a2dp_sink_demo.c +++ b/example/a2dp_sink_demo.c @@ -765,7 +765,10 @@ static void avrcp_controller_packet_handler(uint8_t packet_type, uint16_t channe if (!avrcp_cid) return; // ignore INTERIM status - if (status == AVRCP_CTYPE_RESPONSE_INTERIM) return; + if (status == AVRCP_CTYPE_RESPONSE_INTERIM){ + printf(" INTERIM response \n"); + return; + } printf("AVRCP demo: command status: %s, ", avrcp_ctype2str(status)); switch (packet[2]){ @@ -982,6 +985,9 @@ static void show_usage(void){ printf("X - disable repeat mode\n"); printf("z - shuffle all tracks\n"); printf("Z - disable shuffle mode\n"); + + printf("a/A - register/deregister TRACK_CHANGED\n"); + printf("---\n"); } #endif @@ -1112,6 +1118,15 @@ static void stdin_process(char cmd){ printf(" - disable shuffle mode\n"); status = avrcp_controller_set_shuffle_mode(avrcp_cid, AVRCP_SHUFFLE_MODE_OFF); break; + case 'a': + printf("AVRCP: enable notification TRACK_CHANGED\n"); + avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_CHANGED); + break; + case 'A': + printf("AVRCP: disable notification TRACK_CHANGED\n"); + avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_CHANGED); + break; + default: show_usage(); return;