Skip to content

Commit 7539eec

Browse files
committed
[TLSCert and TLSClient Management] Add attribute change reporting when
commands update the corresponding list attributes.
1 parent 9eaaaf2 commit 7539eec

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/app/clusters/tls-certificate-management-server/tls-certificate-management-server.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,11 @@ void TlsCertificateManagementServer::HandleProvisionRootCertificate(HandlerConte
257257
}
258258

259259
VerifyOrDieWithMsg(response.caid <= kMaxRootCertId, NotSpecified, "Spec requires CAID to be < kMaxRootCertId");
260+
260261
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
262+
263+
MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, TlsCertificateManagement::Id,
264+
TlsCertificateManagement::Attributes::ProvisionedRootCertificates::Id);
261265
}
262266

263267
void TlsCertificateManagementServer::HandleFindRootCertificate(HandlerContext & ctx, const FindRootCertificate::DecodableType & req)
@@ -338,6 +342,13 @@ void TlsCertificateManagementServer::HandleRemoveRootCertificate(HandlerContext
338342
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidInState));
339343

340344
auto result = mDelegate.RemoveRootCert(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(), req.caid);
345+
346+
if (result == Status::Success)
347+
{
348+
MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, TlsCertificateManagement::Id,
349+
TlsCertificateManagement::Attributes::ProvisionedRootCertificates::Id);
350+
}
351+
341352
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, result);
342353
}
343354

@@ -412,6 +423,13 @@ void TlsCertificateManagementServer::HandleProvisionClientCertificate(HandlerCon
412423
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::NotFound));
413424

414425
auto status = mDelegate.ProvisionClientCert(ctx.mRequestPath.mEndpointId, fabric, req);
426+
427+
if (status == Status::Success)
428+
{
429+
MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, TlsCertificateManagement::Id,
430+
TlsCertificateManagement::Attributes::ProvisionedClientCertificates::Id);
431+
}
432+
415433
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
416434
}
417435

@@ -498,6 +516,13 @@ void TlsCertificateManagementServer::HandleRemoveClientCertificate(HandlerContex
498516

499517
auto result =
500518
mDelegate.RemoveClientCert(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(), req.ccdid);
519+
520+
if (result == Status::Success)
521+
{
522+
MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, TlsCertificateManagement::Id,
523+
TlsCertificateManagement::Attributes::ProvisionedClientCertificates::Id);
524+
}
525+
501526
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, result);
502527
}
503528

src/app/clusters/tls-client-management-server/tls-client-management-server.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ void TlsClientManagementServer::HandleProvisionEndpoint(HandlerContext & ctx,
169169
if (status.IsSuccess())
170170
{
171171
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
172+
173+
MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, TlsClientManagement::Id,
174+
TlsClientManagement::Attributes::ProvisionedEndpoints::Id);
172175
}
173176
else
174177
{
@@ -209,6 +212,13 @@ void TlsClientManagementServer::HandleRemoveEndpoint(HandlerContext & ctx, const
209212

210213
auto status = mDelegate.RemoveProvisionedEndpointByID(ctx.mRequestPath.mEndpointId,
211214
ctx.mCommandHandler.GetAccessingFabricIndex(), req.endpointID);
215+
216+
if (status == Status::Success)
217+
{
218+
MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, TlsClientManagement::Id,
219+
TlsClientManagement::Attributes::ProvisionedEndpoints::Id);
220+
}
221+
212222
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
213223
}
214224

0 commit comments

Comments
 (0)