From 9b2b0b07a95fcac2a3c9043e476b13cf9893d55a Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Tue, 9 Jul 2019 10:54:55 +0900 Subject: add start gudience --- src/api.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/api.cpp b/src/api.cpp index 3258d6b..72c4b62 100644 --- a/src/api.cpp +++ b/src/api.cpp @@ -40,6 +40,7 @@ static afb_event_t gps_event; static afb_event_t getdestdir_event; static afb_event_t heading_event; static afb_event_t cancelguidance_event; +static afb_event_t startguidance_event; static afb_event_t guidancestartpos_event; static afb_event_t getdistance_event; @@ -749,9 +750,11 @@ void OnRequestNavicoreStartGuidance(afb_req_t req) AFB_REQ_NOTICE(req, "OnRequestNavicoreStartGuidance"); StartDemoCarlaclient(req->api); - const char* state = "ture"; + const char* state = "true"; navigationInfo->setNaviInfoCurrentGuidanceState(const_cast(state)); + afb_event_push(startguidance_event, NULL); + afb_req_success(req, NULL, NULL); } @@ -920,6 +923,11 @@ void subscribe(afb_req_t req) afb_req_success(req, NULL, NULL); return; } + else if(value && !strcasecmp(value, "startguidance")){ + afb_req_subscribe(req, startguidance_event); + afb_req_success(req, NULL, NULL); + return; + } else if(value && !strcasecmp(value, "setguidancestartpos")){ afb_req_subscribe(req, guidancestartpos_event); afb_req_success(req, NULL, NULL); @@ -992,6 +1000,11 @@ void unsubscribe(afb_req_t req) afb_req_success(req, NULL, NULL); return; } + else if(value && !strcasecmp(value, "startguidance")){ + afb_req_unsubscribe(req, startguidance_event); + afb_req_success(req, NULL, NULL); + return; + } else if(value && !strcasecmp(value, "setguidancestartpos")){ afb_req_unsubscribe(req, guidancestartpos_event); afb_req_success(req, NULL, NULL); @@ -1201,6 +1214,7 @@ int init(afb_api_t api) heading_event = afb_api_make_event(afbBindingV3root,"navicore_heading"); getdestdir_event = afb_api_make_event(afbBindingV3root,"navicore_getdestdir"); cancelguidance_event = afb_api_make_event(afbBindingV3root,"navicore_cancelguidance"); + startguidance_event = afb_api_make_event(afbBindingV3root,"navicore_startguidance"); guidancestartpos_event = afb_api_make_event(afbBindingV3root, "navicore_setguidancestartpos"); getdistance_event = afb_api_make_event(afbBindingV3root,"navicore_getdistance"); -- cgit 1.2.3-korg