From 4c37639febf08a04759436b2f11e41141f5ad5af Mon Sep 17 00:00:00 2001 From: erwinpan1 Date: Thu, 3 Oct 2024 00:05:29 +0800 Subject: [PATCH] Add taglist to Endpoints to fix conformance issue Caused by test_TC_DESC_2_2: For device types with more than one endpoint listed, ensure each of the listed endpoints has a tag attribute and the tag attributes are not the same --- examples/chef/common/stubs.cpp | 41 +++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/examples/chef/common/stubs.cpp b/examples/chef/common/stubs.cpp index 8386f2e65998f3..9831c8d95034f1 100644 --- a/examples/chef/common/stubs.cpp +++ b/examples/chef/common/stubs.cpp @@ -2,7 +2,15 @@ #include #include #include +#include #include + +using chip::app::DataModel::Nullable; + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; + #ifdef MATTER_DM_PLUGIN_AIR_QUALITY_SERVER #include "chef-air-quality.h" #endif // MATTER_DM_PLUGIN_AIR_QUALITY_SERVER @@ -28,6 +36,20 @@ #ifdef MATTER_DM_PLUGIN_REFRIGERATOR_AND_TEMPERATURE_CONTROLLED_CABINET_MODE_SERVER #include "refrigerator-and-temperature-controlled-cabinet-mode/tcc-mode.h" + +namespace { + +// Please refer to https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/namespaces +constexpr const uint8_t kNamespaceRefrigerator = 0x41; +// Refrigerator Namespace: 0x41, tag 0x00 (Refrigerator) +constexpr const uint8_t kTagRefrigerator = 0x00; +// Refrigerator Namespace: 0x41, tag 0x01 (Freezer) +constexpr const uint8_t kTagFreezer = 0x01; +const Clusters::Descriptor::Structs::SemanticTagStruct::Type refrigeratorTagList[] = { { .namespaceID = kNamespaceRefrigerator, + .tag = kTagRefrigerator } }; +const Clusters::Descriptor::Structs::SemanticTagStruct::Type freezerTagList[] = { { .namespaceID = kNamespaceRefrigerator, + .tag = kTagFreezer } }; +} // namespace #endif #ifdef MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER @@ -42,12 +64,6 @@ #include "chef-operational-state-delegate-impl.h" #endif // MATTER_DM_PLUGIN_OPERATIONAL_STATE_SERVER -using chip::app::DataModel::Nullable; - -using namespace chip; -using namespace chip::app; -using namespace chip::app::Clusters; - Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, uint16_t maxReadLength) @@ -301,6 +317,19 @@ void emberAfWakeOnLanClusterInitCallback(EndpointId endpoint) void ApplicationInit() { ChipLogProgress(NotSpecified, "Chef Application Init !!!") + +#ifdef MATTER_DM_PLUGIN_REFRIGERATOR_AND_TEMPERATURE_CONTROLLED_CABINET_MODE_SERVER + // set Parent Endpoint and Composition Type for an Endpoint + EndpointId kRefEndpointId = 1; + EndpointId kColdCabinetEndpointId = 2; + EndpointId kFreezeCabinetEndpointId = 3; + SetTreeCompositionForEndpoint(kRefEndpointId); + SetParentEndpointForEndpoint(kColdCabinetEndpointId, kRefEndpointId); + SetParentEndpointForEndpoint(kFreezeCabinetEndpointId, kRefEndpointId); + // set TagList + SetTagList(kColdCabinetEndpointId, Span(refrigeratorTagList)); + SetTagList(kFreezeCabinetEndpointId, Span(freezerTagList)); +#endif // MATTER_DM_PLUGIN_REFRIGERATOR_AND_TEMPERATURE_CONTROLLED_CABINET_MODE_SERVER } void ApplicationShutdown()