aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2019-07-09 10:54:55 +0900
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>2019-07-09 10:54:55 +0900
commit9b2b0b07a95fcac2a3c9043e476b13cf9893d55a (patch)
tree5ce324c064f6e411f39177873b7a6e8ba819ead3
parent101db974a45feaf0819887121f638f7fd0eab3a9 (diff)
-rw-r--r--src/api.cpp16
1 files changed, 15 insertions, 1 deletions
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<char*>(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");