From 560433708e4cbb466e170bc1370983f8eaaf23ca Mon Sep 17 00:00:00 2001 From: wang_zhiqiang Date: Tue, 14 May 2019 14:47:13 +0800 Subject: [PATCH] recover handshake Change-Id: Ic763640bdf86df98d804bf64bff368d22e66fbf7 --- src/homescreen.cpp | 15 +++++++++------ src/hs-proxy.h | 13 +++++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/homescreen.cpp b/src/homescreen.cpp index 1caa23d..7457f88 100644 --- a/src/homescreen.cpp +++ b/src/homescreen.cpp @@ -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."); diff --git a/src/hs-proxy.h b/src/hs-proxy.h index a0acf10..45bf9f4 100644 --- a/src/hs-proxy.h +++ b/src/hs-proxy.h @@ -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, -- 2.16.6