diff --git a/components/esp_matter/CMakeLists.txt b/components/esp_matter/CMakeLists.txt index 199303492..26be45c86 100644 --- a/components/esp_matter/CMakeLists.txt +++ b/components/esp_matter/CMakeLists.txt @@ -1,10 +1,12 @@ set(SRC_DIRS_LIST "." "utils" + "utils/jsontlv" "${MATTER_SDK_PATH}/zzz_generated/app-common/app-common/zap-generated/attributes" ) set(INCLUDE_DIRS_LIST "." "utils" + "utils/jsontlv" "data_model_provider" "${MATTER_SDK_PATH}/zzz_generated/app-common" "${MATTER_SDK_PATH}/third_party/nlfaultinjection/include" diff --git a/components/esp_matter/utils/jsontlv/element_types.h b/components/esp_matter/utils/jsontlv/element_types.h new file mode 100644 index 000000000..fdbcb32ba --- /dev/null +++ b/components/esp_matter/utils/jsontlv/element_types.h @@ -0,0 +1,43 @@ +// Copyright 2026 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +namespace esp_matter { + +namespace element_type { +// Supported Data Type +const char k_int8[] = "I8"; +const char k_int16[] = "I16"; +const char k_int32[] = "I32"; +const char k_int64[] = "I64"; +const char k_uint8[] = "U8"; +const char k_uint16[] = "U16"; +const char k_uint32[] = "U32"; +const char k_uint64[] = "U64"; +const char k_bool[] = "BOOL"; +const char k_float[] = "FP"; +const char k_double[] = "DFP"; +const char k_bytes[] = "BYT"; +const char k_string[] = "STR"; +const char k_null[] = "NULL"; +const char k_object[] = "OBJ"; +const char k_array[] = "ARR"; +const char k_empty[] = "?"; + +const char k_floating_point_positive_infinity[] = "INF"; +const char k_floating_point_negative_infinity[] = "-INF"; +} // namespace element_type + +} // namespace esp_matter diff --git a/components/esp_matter/utils/json_to_tlv.cpp b/components/esp_matter/utils/jsontlv/json_to_tlv.cpp similarity index 99% rename from components/esp_matter/utils/json_to_tlv.cpp rename to components/esp_matter/utils/jsontlv/json_to_tlv.cpp index d40619636..da43d7613 100644 --- a/components/esp_matter/utils/json_to_tlv.cpp +++ b/components/esp_matter/utils/jsontlv/json_to_tlv.cpp @@ -1,4 +1,4 @@ -// Copyright 2023 Espressif Systems (Shanghai) PTE LTD +// Copyright 2023-2026 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ #include #include +#include #include #include #include diff --git a/components/esp_matter/utils/json_to_tlv.h b/components/esp_matter/utils/jsontlv/json_to_tlv.h similarity index 66% rename from components/esp_matter/utils/json_to_tlv.h rename to components/esp_matter/utils/jsontlv/json_to_tlv.h index bd897d77d..7ea08f3e5 100644 --- a/components/esp_matter/utils/json_to_tlv.h +++ b/components/esp_matter/utils/jsontlv/json_to_tlv.h @@ -1,4 +1,4 @@ -// Copyright 2023 Espressif Systems (Shanghai) PTE LTD +// Copyright 2023-2026 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -21,30 +21,6 @@ namespace esp_matter { -namespace element_type { -// Supported Data Type -const char k_int8[] = "I8"; -const char k_int16[] = "I16"; -const char k_int32[] = "I32"; -const char k_int64[] = "I64"; -const char k_uint8[] = "U8"; -const char k_uint16[] = "U16"; -const char k_uint32[] = "U32"; -const char k_uint64[] = "U64"; -const char k_bool[] = "BOOL"; -const char k_float[] = "FP"; -const char k_double[] = "DFP"; -const char k_bytes[] = "BYT"; -const char k_string[] = "STR"; -const char k_null[] = "NULL"; -const char k_object[] = "OBJ"; -const char k_array[] = "ARR"; -const char k_empty[] = "?"; - -const char k_floating_point_positive_infinity[] = "INF"; -const char k_floating_point_negative_infinity[] = "-INF"; -} // namespace element_type - /** Convert a JSON object to the given TLVWriter * * @param[in] json_str The JSON string that represents a TLV structure