Skip to content

Commit b66acf8

Browse files
Restyler
1 parent c50365d commit b66acf8

File tree

4 files changed

+247
-248
lines changed

4 files changed

+247
-248
lines changed

src/app/clusters/icd-management-server/CodegenIntegration.cpp

Lines changed: 103 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -15,106 +15,106 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include <app-common/zap-generated/attributes/Accessors.h>
19-
#include <app/clusters/icd-management-server/ICDManagementCluster.h>
20-
#include <app/server/Server.h>
21-
#include <app/static-cluster-config/IcdManagement.h>
22-
#include <data-model-providers/codegen/ClusterIntegration.h>
23-
#include <zap-generated/gen_config.h>
24-
25-
namespace {
26-
using namespace chip;
27-
using namespace chip::app;
28-
using namespace chip::app::Clusters;
29-
using namespace chip::app::Clusters::IcdManagement;
30-
31-
static_assert((IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size() == 1 &&
32-
IcdManagement::StaticApplicationConfig::kFixedClusterConfig[0].endpointNumber == kRootEndpointId) ||
33-
IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size() == 0);
34-
35-
#if CHIP_CONFIG_ENABLE_ICD_CIP
36-
LazyRegisteredServerCluster<ICDManagementClusterWithCIP> gServer;
37-
#else
38-
LazyRegisteredServerCluster<ICDManagementCluster> gServer;
39-
#endif
40-
41-
constexpr chip::BitMask<OptionalCommands> kEnabledCommands()
42-
{
43-
chip::BitMask<OptionalCommands> result;
44-
#if defined(ICD_MANAGEMENT_STAY_ACTIVE_REQUEST_COMMAND) || defined(ICD_MANAGEMENT_STAY_ACTIVE_RESPONSE_COMMAND)
45-
result.Set(kStayActive);
46-
#endif
47-
return result;
48-
}
49-
50-
class IntegrationDelegate : public CodegenClusterIntegration::Delegate
51-
{
52-
public:
53-
ServerClusterRegistration & CreateRegistration(EndpointId endpointId, unsigned clusterInstanceIndex,
54-
uint32_t optionalAttributeBits, uint32_t featureMap) override
55-
{
56-
ICDManagementCluster::OptionalAttributeSet optionalAttributeSet(optionalAttributeBits);
57-
const BitMask<OptionalCommands> enabledCommands = kEnabledCommands();
58-
59-
// Get UserActiveModeTriggerHint
60-
BitMask<IcdManagement::UserActiveModeTriggerBitmap> userActiveModeTriggerHint(0);
61-
if (Clusters::IcdManagement::Attributes::UserActiveModeTriggerHint::Get(endpointId, &userActiveModeTriggerHint) !=
62-
Protocols::InteractionModel::Status::Success)
63-
{
64-
ChipLogError(Zcl, "Failed to get UserActiveModeTriggerHint, using default (0)");
65-
}
66-
67-
// Get UserActiveModeTriggerInstruction
68-
char instructionBuffer[kUserActiveModeTriggerInstructionMaxLength];
69-
MutableCharSpan instructionSpan(instructionBuffer, sizeof(instructionBuffer));
70-
CharSpan userActiveModeTriggerInstruction;
71-
72-
if (Clusters::IcdManagement::Attributes::UserActiveModeTriggerInstruction::Get(endpointId, instructionSpan) !=
73-
Protocols::InteractionModel::Status::Success)
74-
{
75-
ChipLogError(Zcl, "Failed to get UserActiveModeTriggerInstruction, using default (empty string)");
76-
userActiveModeTriggerInstruction = CharSpan();
77-
}
78-
else
79-
{
80-
userActiveModeTriggerInstruction = CharSpan(instructionSpan.data(), instructionSpan.size());
81-
}
82-
83-
gServer.Create(endpointId, Server::GetInstance().GetPersistentStorage(), *Server::GetInstance().GetSessionKeystore(),
84-
Server::GetInstance().GetFabricTable(), ICDConfigurationData::GetInstance().GetInstance(),
85-
optionalAttributeSet, enabledCommands, userActiveModeTriggerHint, userActiveModeTriggerInstruction);
86-
return gServer.Registration();
87-
}
88-
89-
ServerClusterInterface * FindRegistration(unsigned clusterInstanceIndex) override { return &gServer.Cluster(); }
90-
void ReleaseRegistration(unsigned clusterInstanceIndex) override { gServer.Destroy(); }
91-
};
92-
} // namespace
93-
94-
void MatterIcdManagementClusterInitCallback(EndpointId endpointId)
95-
{
96-
IntegrationDelegate integrationDelegate;
97-
CodegenClusterIntegration::RegisterServer(
98-
{
99-
.endpointId = endpointId,
100-
.clusterId = IcdManagement::Id,
101-
.fixedClusterInstanceCount = static_cast<uint16_t>(IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size()),
102-
.maxClusterInstanceCount = 1, // only root-node functionality supported by this implementation
103-
.fetchFeatureMap = false,
104-
.fetchOptionalAttributes = true,
105-
},
106-
integrationDelegate);
107-
}
108-
109-
void MatterIcdManagementClusterShutdownCallback(EndpointId endpointId)
110-
{
111-
IntegrationDelegate integrationDelegate;
112-
CodegenClusterIntegration::UnregisterServer(
113-
{
114-
.endpointId = endpointId,
115-
.clusterId = IcdManagement::Id,
116-
.fixedClusterInstanceCount = static_cast<uint16_t>(IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size()),
117-
.maxClusterInstanceCount = 1, // only root-node functionality supported by this implementation
118-
},
119-
integrationDelegate);
120-
}
18+
#include <app-common/zap-generated/attributes/Accessors.h>
19+
#include <app/clusters/icd-management-server/ICDManagementCluster.h>
20+
#include <app/server/Server.h>
21+
#include <app/static-cluster-config/IcdManagement.h>
22+
#include <data-model-providers/codegen/ClusterIntegration.h>
23+
#include <zap-generated/gen_config.h>
24+
25+
namespace {
26+
using namespace chip;
27+
using namespace chip::app;
28+
using namespace chip::app::Clusters;
29+
using namespace chip::app::Clusters::IcdManagement;
30+
31+
static_assert((IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size() == 1 &&
32+
IcdManagement::StaticApplicationConfig::kFixedClusterConfig[0].endpointNumber == kRootEndpointId) ||
33+
IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size() == 0);
34+
35+
#if CHIP_CONFIG_ENABLE_ICD_CIP
36+
LazyRegisteredServerCluster<ICDManagementClusterWithCIP> gServer;
37+
#else
38+
LazyRegisteredServerCluster<ICDManagementCluster> gServer;
39+
#endif
40+
41+
constexpr chip::BitMask<OptionalCommands> kEnabledCommands()
42+
{
43+
chip::BitMask<OptionalCommands> result;
44+
#if defined(ICD_MANAGEMENT_STAY_ACTIVE_REQUEST_COMMAND) || defined(ICD_MANAGEMENT_STAY_ACTIVE_RESPONSE_COMMAND)
45+
result.Set(kStayActive);
46+
#endif
47+
return result;
48+
}
49+
50+
class IntegrationDelegate : public CodegenClusterIntegration::Delegate
51+
{
52+
public:
53+
ServerClusterRegistration & CreateRegistration(EndpointId endpointId, unsigned clusterInstanceIndex,
54+
uint32_t optionalAttributeBits, uint32_t featureMap) override
55+
{
56+
ICDManagementCluster::OptionalAttributeSet optionalAttributeSet(optionalAttributeBits);
57+
const BitMask<OptionalCommands> enabledCommands = kEnabledCommands();
58+
59+
// Get UserActiveModeTriggerHint
60+
BitMask<IcdManagement::UserActiveModeTriggerBitmap> userActiveModeTriggerHint(0);
61+
if (Clusters::IcdManagement::Attributes::UserActiveModeTriggerHint::Get(endpointId, &userActiveModeTriggerHint) !=
62+
Protocols::InteractionModel::Status::Success)
63+
{
64+
ChipLogError(Zcl, "Failed to get UserActiveModeTriggerHint, using default (0)");
65+
}
66+
67+
// Get UserActiveModeTriggerInstruction
68+
char instructionBuffer[kUserActiveModeTriggerInstructionMaxLength];
69+
MutableCharSpan instructionSpan(instructionBuffer, sizeof(instructionBuffer));
70+
CharSpan userActiveModeTriggerInstruction;
71+
72+
if (Clusters::IcdManagement::Attributes::UserActiveModeTriggerInstruction::Get(endpointId, instructionSpan) !=
73+
Protocols::InteractionModel::Status::Success)
74+
{
75+
ChipLogError(Zcl, "Failed to get UserActiveModeTriggerInstruction, using default (empty string)");
76+
userActiveModeTriggerInstruction = CharSpan();
77+
}
78+
else
79+
{
80+
userActiveModeTriggerInstruction = CharSpan(instructionSpan.data(), instructionSpan.size());
81+
}
82+
83+
gServer.Create(endpointId, Server::GetInstance().GetPersistentStorage(), *Server::GetInstance().GetSessionKeystore(),
84+
Server::GetInstance().GetFabricTable(), ICDConfigurationData::GetInstance().GetInstance(),
85+
optionalAttributeSet, enabledCommands, userActiveModeTriggerHint, userActiveModeTriggerInstruction);
86+
return gServer.Registration();
87+
}
88+
89+
ServerClusterInterface * FindRegistration(unsigned clusterInstanceIndex) override { return &gServer.Cluster(); }
90+
void ReleaseRegistration(unsigned clusterInstanceIndex) override { gServer.Destroy(); }
91+
};
92+
} // namespace
93+
94+
void MatterIcdManagementClusterInitCallback(EndpointId endpointId)
95+
{
96+
IntegrationDelegate integrationDelegate;
97+
CodegenClusterIntegration::RegisterServer(
98+
{
99+
.endpointId = endpointId,
100+
.clusterId = IcdManagement::Id,
101+
.fixedClusterInstanceCount = static_cast<uint16_t>(IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size()),
102+
.maxClusterInstanceCount = 1, // only root-node functionality supported by this implementation
103+
.fetchFeatureMap = false,
104+
.fetchOptionalAttributes = true,
105+
},
106+
integrationDelegate);
107+
}
108+
109+
void MatterIcdManagementClusterShutdownCallback(EndpointId endpointId)
110+
{
111+
IntegrationDelegate integrationDelegate;
112+
CodegenClusterIntegration::UnregisterServer(
113+
{
114+
.endpointId = endpointId,
115+
.clusterId = IcdManagement::Id,
116+
.fixedClusterInstanceCount = static_cast<uint16_t>(IcdManagement::StaticApplicationConfig::kFixedClusterConfig.size()),
117+
.maxClusterInstanceCount = 1, // only root-node functionality supported by this implementation
118+
},
119+
integrationDelegate);
120+
}

src/app/clusters/icd-management-server/ICDManagementCluster.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ class ICDManagementCluster : public DefaultServerCluster
9595

9696
namespace Crypto {
9797
using SymmetricKeystore = chip::Crypto::SessionKeystore;
98-
;
9998
} // namespace Crypto
10099

101100
/**

src/app/clusters/icd-management-server/tests/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ chip_test_suite("tests") {
3333
"${chip_root}/src/lib/core:string-builder-adapters",
3434
"${chip_root}/src/lib/support:testing",
3535
]
36-
}
36+
}

0 commit comments

Comments
 (0)