diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-09-14 14:04:41 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-09-14 14:04:41 +0200 |
commit | 8606dc98a8a52fd1f9352e97c135a28475fd4578 (patch) | |
tree | b0132406f97137cc8e4d077b0c76fe38e40beac5 | |
parent | 4206071440384c5336d720475800bc4dbf9414cc (diff) |
Reading and exporting the surfaceID from WM
original author is Aurelian.
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
-rw-r--r-- | AFBClient.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
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); } |