summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-04-06 18:40:41 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-05-14 13:26:56 +0000
commit65d717b400a17e3a380126657ebaa080f1877e47 (patch)
treef2d04df68cda7ec2708def6f6facb0faee948988
parentfba3216156bccf7ca1424e4e4e389369c4eccefe (diff)
binding: mediaplayer: give initial playlist to new subscribers
On initial subscription to playlist event request the playlist via event Bug-AGL: SPEC-1375 Change-Id: Id2d7565b384ce117873827392c1e5f2a3e123098 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> (cherry picked from commit 310ef55d02662230939dcbe0901e3056f6197980)
-rw-r--r--binding/afm-mediaplayer-binding.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c
index 1c2ce6a..b8e2f47 100644
--- a/binding/afm-mediaplayer-binding.c
+++ b/binding/afm-mediaplayer-binding.c
@@ -552,8 +552,17 @@ static void subscribe(struct afb_req request)
afb_req_success(request, NULL, NULL);
return;
} else if (!strcasecmp(value, "playlist")) {
+ json_object *jresp = json_object_new_object();
+
afb_req_subscribe(request, playlist_event);
afb_req_success(request, NULL, NULL);
+
+ pthread_mutex_lock(&mutex);
+ jresp = populate_json_playlist(jresp);
+ pthread_mutex_unlock(&mutex);
+
+ afb_event_push(playlist_event, jresp);
+
return;
}