Skip to content

Commit

Permalink
Expose the implemented ClusterRevision of Descriptor in a header. (#3…
Browse files Browse the repository at this point in the history
…1671)

This way SDK consumers can tell what version of that they have.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Feb 12, 2024
1 parent 1824ebd commit 1153428
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/app/clusters/descriptor/descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <lib/support/CodeUtils.h>
#include <lib/support/logging/CHIPLogging.h>

#include "descriptor.h"

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;
Expand All @@ -45,8 +47,6 @@ class DescriptorAttrAccess : public AttributeAccessInterface
CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override;

private:
static constexpr uint16_t ClusterRevision = 2;

CHIP_ERROR ReadTagListAttribute(EndpointId endpoint, AttributeValueEncoder & aEncoder);
CHIP_ERROR ReadPartsAttribute(EndpointId endpoint, AttributeValueEncoder & aEncoder);
CHIP_ERROR ReadDeviceAttribute(EndpointId endpoint, AttributeValueEncoder & aEncoder);
Expand All @@ -55,8 +55,6 @@ class DescriptorAttrAccess : public AttributeAccessInterface
CHIP_ERROR ReadFeatureMap(EndpointId endpoint, AttributeValueEncoder & aEncoder);
};

constexpr uint16_t DescriptorAttrAccess::ClusterRevision;

CHIP_ERROR DescriptorAttrAccess::ReadFeatureMap(EndpointId endpoint, AttributeValueEncoder & aEncoder)
{
Clusters::Descriptor::Structs::SemanticTagStruct::Type tag;
Expand Down Expand Up @@ -202,7 +200,7 @@ CHIP_ERROR DescriptorAttrAccess::ReadClientServerAttribute(EndpointId endpoint,

CHIP_ERROR DescriptorAttrAccess::ReadClusterRevision(EndpointId endpoint, AttributeValueEncoder & aEncoder)
{
return aEncoder.Encode(ClusterRevision);
return aEncoder.Encode(kClusterRevision);
}

DescriptorAttrAccess gAttrAccess;
Expand Down
27 changes: 27 additions & 0 deletions src/app/clusters/descriptor/descriptor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (c) 2024 Project CHIP Authors
*
* 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.
*/

namespace chip {
namespace app {
namespace Clusters {
namespace Descriptor {

inline constexpr uint16_t kClusterRevision = 2;

} // namespace Descriptor
} // namespace Clusters
} // namespace app
} // namespace chip

0 comments on commit 1153428

Please sign in to comment.