X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=low-can-binding%2Futils%2Fopenxc-utils.cpp;h=b88c45d9173e40f4cadf873955864743e5c536c6;hb=f2ba29a69543a88199b7a664459980ada9345c03;hp=c06beabb6ef39f2a9f5190a8bddc969038189394;hpb=97a08a7e37835f0e8619d22c83243bee26a2bff2;p=apps%2Fagl-service-can-low-level.git diff --git a/low-can-binding/utils/openxc-utils.cpp b/low-can-binding/utils/openxc-utils.cpp index c06beabb..b88c45d9 100644 --- a/low-can-binding/utils/openxc-utils.cpp +++ b/low-can-binding/utils/openxc-utils.cpp @@ -17,9 +17,10 @@ */ #include "openxc-utils.hpp" - +#include "converter.hpp" #include "../binding/application.hpp" + /// /// @brief Build a specific VehicleMessage containing a DiagnosticResponse. /// @@ -210,6 +211,38 @@ const openxc_DynamicField build_DynamicField(json_object* value) } } +const openxc_DynamicField build_DynamicField(std::vector &array) +{ + openxc_DynamicField d; + d.has_type = true; + d.type = openxc_DynamicField_Type_BYTES; + + d.has_string_value = false; + d.has_numeric_value = false; + d.has_boolean_value = false; + d.has_bytes_value = true; + + + size_t size = array.size(); + + if(size > 2040) + { + AFB_ERROR("Error to generate array dynamic field, too large data"); + return d; + } + else + { + d.length_array = (uint32_t) size; + } + + + for(int i=0;i