Skip to content

Commit

Permalink
Add taglist to Endpoints to fix conformance issue
Browse files Browse the repository at this point in the history
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
  • Loading branch information
erwinpan1 committed Oct 2, 2024
1 parent 37273c9 commit 4c37639
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions examples/chef/common/stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
#include <app-common/zap-generated/callback.h>
#include <app/data-model/Nullable.h>
#include <app/util/config.h>
#include <app/util/attribute-storage.h>
#include <lib/core/DataModelTypes.h>

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
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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<const Clusters::Descriptor::Structs::SemanticTagStruct::Type>(refrigeratorTagList));
SetTagList(kFreezeCabinetEndpointId, Span<const Clusters::Descriptor::Structs::SemanticTagStruct::Type>(freezerTagList));
#endif // MATTER_DM_PLUGIN_REFRIGERATOR_AND_TEMPERATURE_CONTROLLED_CABINET_MODE_SERVER
}

void ApplicationShutdown()
Expand Down

0 comments on commit 4c37639

Please sign in to comment.