Use afb_service_call instead of afb_service_call_sync
authorYuta Doi <yuta-d@witz-inc.co.jp>
Fri, 25 May 2018 05:27:58 +0000 (14:27 +0900)
committerYuta Doi <yuta-d@witz-inc.co.jp>
Fri, 25 May 2018 08:13:24 +0000 (17:13 +0900)
because initializing of WindowManager is dispatched
when starting low-can service is late.

Change-Id: I081aeda5dcd2a815467e6d19c51deec63d6303f4
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
src/low_can_client.cpp

index c02a71c..e0568e5 100644 (file)
@@ -72,12 +72,11 @@ void LowCanClient::initialize() {
         HMI_DEBUG("wm:lcc", "subscribe message:%s", json_object_get_string(json_obj));
 
         // Subscribe
-        json_object *json_result = json_object_new_object();
-        ret = afb_service_call_sync("low-can", "subscribe", json_obj, &json_result);
-        if (0 > ret) {
-            HMI_INFO("wm:lcc", "Could not subscribe to \"low-can\" :%d", ret);
-        }
-        HMI_DEBUG("wm:lcc", "subscribe result:%s", json_object_get_string(json_result));
+        afb_service_call("low-can", "subscribe", json_obj,
+                               [](void* closure, int status, json_object *result){
+                HMI_DEBUG("wm:lcc", "subscribe result:%s", json_object_get_string(result));
+            },
+            nullptr);
     }
 
     return;