aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2019-05-14 14:47:13 +0800
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2019-05-14 14:47:13 +0800
commit560433708e4cbb466e170bc1370983f8eaaf23ca (patch)
treedd887674ee72eeace236b4ed5fd2b7fbe9223719
parentfa01549aba442decaf7c6d5b655da2d15d1a32ed (diff)
recover handshake
Change-Id: Ic763640bdf86df98d804bf64bff368d22e66fbf7
-rw-r--r--src/homescreen.cpp15
-rw-r--r--src/hs-proxy.h13
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,