aboutsummaryrefslogtreecommitdiffstats
path: root/src/low_can_client.cpp
diff options
context:
space:
mode:
authorYuta Doi <yuta-d@witz-inc.co.jp>2018-05-11 15:42:29 +0900
committerYuta Doi <yuta-d@witz-inc.co.jp>2018-05-11 15:42:29 +0900
commitf317b379ffd8a7c0f20cd2dd9f81be2d112e73fb (patch)
tree5396b33544696bb64f9cf3fe64ea7ea63881ed70 /src/low_can_client.cpp
parent160b8947d684ce037120cf5237bd221bd9ea9785 (diff)
LowCanClient can set filter
Change-Id: I9464b631a5b36cdfeba28ebd146fce3f5ca7f879 Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/low_can_client.cpp')
-rw-r--r--src/low_can_client.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/low_can_client.cpp b/src/low_can_client.cpp
index 01a7340..a42e641 100644
--- a/src/low_can_client.cpp
+++ b/src/low_can_client.cpp
@@ -66,12 +66,20 @@ void LowCanClient::initialize() {
// low-can subscribe { "event": "headlamp_status" }
// low-can subscribe { "event": "parking_brake_status" }
// low-can subscribe { "event": "accelerator.pedal.position" }
- int num_event = this->kEventName_.size();
- for (int i=0; i<num_event; i++) {
+ for (int i=SignalNoMin; i<=SignalNoMax; i++) {
+ // Set Event
json_object *json_obj = json_object_new_object();
- json_object_object_add(json_obj, "event", json_object_new_string(this->kEventName_[i]));
+ json_object_object_add(json_obj, "event",
+ json_object_new_string(this->kEventName_[i]));
+
+ // Set filter
+ if (0 != strcmp("", this->kFilterValue_[i])) {
+ json_object_object_add(json_obj, "filter",
+ json_tokener_parse(this->kFilterValue_[i]));
+ }
HMI_DEBUG("wm:lcc", "subscribe message:%s", json_object_get_string(json_obj));
+ // Subscribe
json_object *json_result = json_object_new_object();
ret = afb_service_call_sync("low-can", "subscribe", json_obj, &json_result);
if (0 > ret) {