X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fjson_helper.cpp;h=4b35952aa565a76c90ff228b8b0553e6f4eb1fb9;hb=160b8947d684ce037120cf5237bd221bd9ea9785;hp=f9b916e1e094c2e13248d2f8fc27764f4559b1d5;hpb=2ea71aa957634ce69681ae34abace0566d52b744;p=apps%2Fagl-service-windowmanager.git diff --git a/src/json_helper.cpp b/src/json_helper.cpp index f9b916e..4b35952 100644 --- a/src/json_helper.cpp +++ b/src/json_helper.cpp @@ -15,8 +15,6 @@ */ -#include -#include #include "json_helper.hpp" #include "hmi-debug.h" @@ -136,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!!!");