summaryrefslogtreecommitdiffstats
path: root/binding
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-04-06 21:40:20 -0700
commit310ef55d02662230939dcbe0901e3056f6197980 (patch)
treeaed275acd2ec59f1176dbaf583b1a2aec3fd48ab /binding
parenta324c040e4145f0f353b69852cf81a450db5c385 (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>
Diffstat (limited to 'binding')
-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;
}