recover handshake
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Tue, 14 May 2019 06:47:13 +0000 (14:47 +0800)
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Tue, 14 May 2019 06:47:13 +0000 (14:47 +0800)
Change-Id: Ic763640bdf86df98d804bf64bff368d22e66fbf7

src/homescreen.cpp
src/hs-proxy.h

index 1caa23d..7457f88 100644 (file)
@@ -72,6 +72,7 @@ int hs_handshake::hs_sts = hs_handshake::Handshake_Idle;
  */
 void handshake_subscribe_callback(struct json_object *obj, const char *error, const char *info)
 {
+    AFB_NOTICE("subscribe handshake reply: obj=%s, error=%s, info=%s", json_object_to_json_string(obj), error, info);
     if(error == nullptr) {
         hs_handshake::hs_sts =  hs_handshake::Handshake_WaitEvent;
     }
@@ -94,6 +95,7 @@ void handshake_subscribe_callback(struct json_object *obj, const char *error, co
  */
 int on_handshake_event(afb_api_t api, const char *event, struct json_object *object)
 {
+    AFB_NOTICE("received handshake event from windowmanager.");
     hs_handshake::hs_sts =  hs_handshake::Handshake_Over;
     return 1;
 }
@@ -112,6 +114,7 @@ int on_handshake_event(afb_api_t api, const char *event, struct json_object *obj
  */
 int hs_handshake::start(afb_api_t api) const
 {
+    AFB_NOTICE("start handshake with windowmanager.");
     int ret = -1;
     setEventHook(sub_event.c_str(), on_handshake_event);
     int count = 0;
@@ -183,12 +186,12 @@ int hs_instance::init(afb_api_t api)
         return -1;
     }
 
-    // const struct handshake_info *h = hs_config.getHandshakeInfo();
-    // struct hs_handshake handshake(h->times, h->sleep);
-    // if(handshake.start(api) < 0) {
-    //     AFB_ERROR("handshake with windowmanager failed.");
-    //     return -1;
-    // }
+    const struct handshake_info *h = hs_config.getHandshakeInfo();
+    struct hs_handshake handshake(h->times, h->sleep);
+    if(handshake.start(api) < 0) {
+        AFB_ERROR("handshake with windowmanager failed.");
+        return -1;
+    }
 
     if(app_recover == nullptr) {
         AFB_ERROR("app_recover is nullptr.");
index a0acf10..45bf9f4 100644 (file)
@@ -51,8 +51,21 @@ public:
         Event_FlushDraw,
 
         Event_ScreenUpdated,
+
         Event_Handshake,
 
+        Event_HeadlampOff,
+        Event_HeadlampOn,
+
+        Event_ParkingBrakeOff,
+        Event_ParkingBrakeOn,
+
+        Event_LightstatusBrakeOff,
+        Event_LightstatusBrakeOn,
+
+        Event_CarStop,
+        Event_CarRun,
+
         Event_Error,
 
         Event_Val_Max = Event_Error,