From e28ae5f481c3a0d78bb7d6c21416dc38be541a4d Mon Sep 17 00:00:00 2001 From: Arthur Guyader Date: Mon, 16 Dec 2019 16:54:07 +0100 Subject: [PATCH] openxc-utils : Add json value for DynamicField Change-Id: I93d31768804d4e30994897487e9fd312a56c547b Signed-off-by: Arthur Guyader Signed-off-by: Romain Forlot --- libs/openxc-message-format/gen/cpp/openxc.pb.h | 6 +++- low-can-binding/utils/openxc-utils.cpp | 40 +++++++++++++++++++------- low-can-binding/utils/openxc-utils.hpp | 1 + 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/libs/openxc-message-format/gen/cpp/openxc.pb.h b/libs/openxc-message-format/gen/cpp/openxc.pb.h index 30b0818d..8b1cb19a 100644 --- a/libs/openxc-message-format/gen/cpp/openxc.pb.h +++ b/libs/openxc-message-format/gen/cpp/openxc.pb.h @@ -4,6 +4,7 @@ #ifndef PB_OPENXC_PB_H_INCLUDED #define PB_OPENXC_PB_H_INCLUDED #include +#include #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -76,7 +77,8 @@ typedef enum _openxc_DynamicField_Type { openxc_DynamicField_Type_STRING = 1, openxc_DynamicField_Type_NUM = 2, openxc_DynamicField_Type_BOOL = 3, - openxc_DynamicField_Type_BYTES = 4 + openxc_DynamicField_Type_BYTES = 4, + openxc_DynamicField_Type_JSON = 5 } openxc_DynamicField_Type; /* Struct definitions */ @@ -169,6 +171,8 @@ typedef struct _openxc_DynamicField { uint8_t bytes_value[MAX_ISOTP_BYTES]; uint32_t length_array; bool has_bytes_value; + json_object* json_value; + bool has_json_value; } openxc_DynamicField; typedef struct _openxc_NetworkOperatorSettings_NetworkDescriptor { diff --git a/low-can-binding/utils/openxc-utils.cpp b/low-can-binding/utils/openxc-utils.cpp index 5ca70b88..8d331003 100644 --- a/low-can-binding/utils/openxc-utils.cpp +++ b/low-can-binding/utils/openxc-utils.cpp @@ -235,7 +235,6 @@ const openxc_DynamicField build_DynamicField(std::vector &array) d.length_array = (uint32_t) size; } - for(int i=0;i &array); +const openxc_DynamicField build_DynamicField_json(json_object *value); int get_bool_from_DynamicField(const openxc_VehicleMessage& v_msg, bool& ret); double get_numerical_from_DynamicField(const openxc_VehicleMessage& v_msg); -- 2.16.6