From 8606dc98a8a52fd1f9352e97c135a28475fd4578 Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Thu, 14 Sep 2017 14:04:41 +0200 Subject: Reading and exporting the surfaceID from WM original author is Aurelian. Signed-off-by: Marcus Fritzsch --- AFBClient.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'AFBClient.cpp') diff --git a/AFBClient.cpp b/AFBClient.cpp index 3d5a878..09d174d 100644 --- a/AFBClient.cpp +++ b/AFBClient.cpp @@ -167,9 +167,23 @@ void AFBClient::onRequestSurfaceReply(void *closure, afb_wsj1_msg *msg) afb_wsj1_msg_is_reply_ok(msg) ? "OK" : "ERROR", json_object_to_json_string_ext(afb_wsj1_msg_object_j(msg), JSON_C_TO_STRING_PRETTY)); - printf("\n\n===>RETURN STR: %s\n\n", afb_wsj1_msg_object_s(msg)); - // putenv("QT_IVI_SURFACE_ID=16778219"); - fflush(stdout); + if(afb_wsj1_msg_is_reply_ok(msg)) + { + const char begin[] = "QT_IVI_SURFACE_ID=\""; + const char end[] = "\""; + char *parameter = (char *)malloc(strlen(begin) + + strlen(json_object_get_string(json_object_object_get(afb_wsj1_msg_object_j(msg), "response"))) + + strlen(end) + 1); + strcpy(parameter, begin); + strcat(parameter, json_object_get_string(json_object_object_get(afb_wsj1_msg_object_j(msg), "response"))); + strcat(parameter, end); + printf("\n\n===>RETURN STR: %s\n\n", parameter); + putenv(parameter); + fflush(stdout); + } + else + fprintf(stderr, "wrong request surface reply received!"); + free(closure); } -- cgit 1.2.3-korg