diff options
author | 2018-05-11 13:23:53 +0900 | |
---|---|---|
committer | 2018-05-11 13:23:53 +0900 | |
commit | 160b8947d684ce037120cf5237bd221bd9ea9785 (patch) | |
tree | 7b523f91da6516502528ad737e13d9eda847fd12 /src/json_helper.cpp | |
parent | f73c5f5ff5cd4b424eed1a757c7bc8d3e34ec0e9 (diff) |
LowCanClient can receive accelerator.pedal.position signal
Change-Id: Ia6d4ad7888ec764fcd8dec696f6eda9d826cb62d
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/json_helper.cpp')
-rw-r--r-- | src/json_helper.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/json_helper.cpp b/src/json_helper.cpp index cbbf564..4b35952 100644 --- a/src/json_helper.cpp +++ b/src/json_helper.cpp @@ -134,6 +134,21 @@ int getIntFromJson(json_object* obj, const char* key) { return json_object_get_int(tmp); } +double getDoubleFromJson(json_object* obj, const char* key) { + if ((nullptr == obj) || (nullptr == key)) { + HMI_ERROR("wm:jh", "Argument is nullptr!!!"); + return 0; + } + + json_object* tmp; + if (!json_object_object_get_ex(obj, key, &tmp)) { + HMI_DEBUG("wm:jh", "Not found key \"%s\"", key); + return 0; + } + + return json_object_get_double(tmp); +} + json_bool getBoolFromJson(json_object* obj, const char* key) { if ((nullptr == obj) || (nullptr == key)) { HMI_ERROR("wm:jh", "Argument is nullptr!!!"); |