From 349ca0614834fa1c146b1048f9c7eae65de83c21 Mon Sep 17 00:00:00 2001 From: Dereje Wassie Date: Fri, 7 Oct 2022 13:27:14 +0000 Subject: [PATCH] Pull request #154: UIC-2508 added data type fix Merge in WMN_TOOLS/matter from bugfix/uic-2508_fix_attribute_read_data_type_error to silabs Squashed commit of the following: commit 8bddd9c5ebc3a679e42488660b3eb6f727524030 Author: Dereje Wassie Date: Fri Oct 7 14:53:23 2022 +0200 UIC-2508 added data type fix --- .../chip_types_from_json.hpp.zapt | 84 ++++++++++++++++++- .../zap-handlers/gen/chip_types_from_json.hpp | 82 +++++++++++++++++- 2 files changed, 162 insertions(+), 4 deletions(-) diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/chip_types_from_json.hpp.zapt b/silabs_examples/unify-matter-bridge/linux/zap-handlers/chip_types_from_json.hpp.zapt index 15ad304d7351cc..65be526eb2939e 100644 --- a/silabs_examples/unify-matter-bridge/linux/zap-handlers/chip_types_from_json.hpp.zapt +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/chip_types_from_json.hpp.zapt @@ -11,7 +11,7 @@ * sections of the MSLA applicable to Source Code. * ******************************************************************************/ - +#include "app/data-model/NullObject.h" // Default translation template @@ -19,7 +19,6 @@ std::optional from_json(const nlohmann::json & value) { return std::nullopt; } - /***************************** Simple types Convertes **************/ template<> inline @@ -40,7 +39,86 @@ std::optional from_json(const nlohmann::json & value) return value; } - +template <> +inline std::optional from_json(const nlohmann::json & value) +{ + return value; +} +template <> +inline std::optional from_json(const nlohmann::json & value) +{ + return value; +} +template <> +inline std::optional from_json(const nlohmann::json & value) +{ + return value; +} +template <> +inline std::optional from_json(const nlohmann::json & value) +{ + return value; +} +template <> +inline std::optional> from_json(const nlohmann::json & value) +{ + if (value.is_null()) + { + return std::nullopt; + } + else + { + return chip::app::DataModel::Nullable(value); + } +} +template <> +inline std::optional> from_json(const nlohmann::json & value) +{ + if (value.is_null()) + { + return std::nullopt; + } + else + { + return chip::app::DataModel::Nullable(value); + } +} +template <> +inline std::optional> from_json(const nlohmann::json & value) +{ + if (value.is_null()) + { + return std::nullopt; + } + else + { + return chip::app::DataModel::Nullable(value); + } +} +template <> +inline std::optional> from_json(const nlohmann::json & value) +{ + if (value.is_null()) + { + return std::nullopt; + } + else + { + return chip::app::DataModel::Nullable(value); + } +} +template <> +inline std::optional> from_json(const nlohmann::json & value) +{ + if (value.is_null()) + { + return std::nullopt; + } + else + { + return chip::app::DataModel::Nullable(value); + } +} /***************************** Bitmap Convertes **************/ //{{#zcl_clusters}} //{{#zcl_bitmaps}} diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/chip_types_from_json.hpp b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/chip_types_from_json.hpp index 02d7b181953bf6..1e2984565403a1 100644 --- a/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/chip_types_from_json.hpp +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/chip_types_from_json.hpp @@ -11,6 +11,7 @@ * sections of the MSLA applicable to Source Code. * ******************************************************************************/ +#include "app/data-model/NullObject.h" // Default translation template @@ -18,7 +19,6 @@ std::optional from_json(const nlohmann::json & value) { return std::nullopt; } - /***************************** Simple types Convertes **************/ template <> @@ -39,6 +39,86 @@ inline std::optional from_json(const nlohmann::json & value) return value; } +template <> +inline std::optional from_json(const nlohmann::json & value) +{ + return value; +} +template <> +inline std::optional from_json(const nlohmann::json & value) +{ + return value; +} +template <> +inline std::optional from_json(const nlohmann::json & value) +{ + return value; +} +template <> +inline std::optional from_json(const nlohmann::json & value) +{ + return value; +} +template <> +inline std::optional> from_json(const nlohmann::json & value) +{ + if (value.is_null()) + { + return std::nullopt; + } + else + { + return chip::app::DataModel::Nullable(value); + } +} +template <> +inline std::optional> from_json(const nlohmann::json & value) +{ + if (value.is_null()) + { + return std::nullopt; + } + else + { + return chip::app::DataModel::Nullable(value); + } +} +template <> +inline std::optional> from_json(const nlohmann::json & value) +{ + if (value.is_null()) + { + return std::nullopt; + } + else + { + return chip::app::DataModel::Nullable(value); + } +} +template <> +inline std::optional> from_json(const nlohmann::json & value) +{ + if (value.is_null()) + { + return std::nullopt; + } + else + { + return chip::app::DataModel::Nullable(value); + } +} +template <> +inline std::optional> from_json(const nlohmann::json & value) +{ + if (value.is_null()) + { + return std::nullopt; + } + else + { + return chip::app::DataModel::Nullable(value); + } +} /***************************** Bitmap Convertes **************/ // //