|
22 | 22 |
|
23 | 23 | #include "DataModelLogger.h"
|
24 | 24 | #include "ModelCommand.h"
|
| 25 | +#include <app-common/zap-generated/cluster-objects.h> |
| 26 | +#include <app-common/zap-generated/ids/Attributes.h> |
| 27 | +#include <app-common/zap-generated/ids/Clusters.h> |
25 | 28 |
|
26 | 29 | class ClusterCommand : public InteractionModelCommands, public ModelCommand, public chip::app::CommandSender::Callback
|
27 | 30 | {
|
@@ -59,6 +62,8 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
|
59 | 62 | chip::CommandId commandId,
|
60 | 63 | const chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type & value)
|
61 | 64 | {
|
| 65 | + mPeerNodeId = device->GetDeviceId(); |
| 66 | + mFabricIndex = device->GetSecureSession().Value()->GetFabricIndex(); |
62 | 67 | ReturnErrorOnFailure(InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value));
|
63 | 68 |
|
64 | 69 | if (value.transferFileDesignator.HasValue() &&
|
@@ -109,6 +114,15 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
|
109 | 114 | return;
|
110 | 115 | }
|
111 | 116 | }
|
| 117 | + if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) && (path.mCommandId == chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Id)) |
| 118 | + { |
| 119 | + CHIP_ERROR deleteEntryError = |
| 120 | + CHIPCommand::sICDClientStorage.DeleteEntry(chip::ScopedNodeId(mPeerNodeId, mFabricIndex)); |
| 121 | + if (deleteEntryError != CHIP_NO_ERROR) |
| 122 | + { |
| 123 | + ChipLogError(chipTool, "Failed to delete ICD entry: %s", chip::ErrorStr(deleteEntryError)); |
| 124 | + } |
| 125 | + } |
112 | 126 | }
|
113 | 127 |
|
114 | 128 | virtual void OnError(const chip::app::CommandSender * client, CHIP_ERROR error) override
|
@@ -208,7 +222,8 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
|
208 | 222 | private:
|
209 | 223 | chip::ClusterId mClusterId;
|
210 | 224 | chip::CommandId mCommandId;
|
211 |
| - |
| 225 | + chip::FabricIndex mFabricIndex = 0; |
| 226 | + chip::NodeId mPeerNodeId = 0; |
212 | 227 | CHIP_ERROR mError = CHIP_NO_ERROR;
|
213 | 228 | CustomArgument mPayload;
|
214 | 229 | };
|
0 commit comments