Skip to content

Commit d965904

Browse files
Modify icdm cluster to make ClientType mandatory
1 parent 521832f commit d965904

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ CHIP_ERROR IcdManagementAttributeAccess::ReadRegisteredClients(EndpointId endpoi
202202

203203
Structs::MonitoringRegistrationStruct::Type s{ .checkInNodeID = e.checkInNodeID,
204204
.monitoredSubject = e.monitoredSubject,
205-
.clientType = ClientTypeEnum(e.clientType),
205+
.clientType = e.clientType,
206206
.fabricIndex = e.fabricIndex };
207207
ReturnErrorOnFailure(subEncoder.Encode(s));
208208
}
@@ -250,13 +250,13 @@ CHIP_ERROR CheckAdmin(CommandHandler * commandObj, const ConcreteCommandPath & c
250250
Status ICDManagementServer::RegisterClient(CommandHandler * commandObj, const ConcreteCommandPath & commandPath,
251251
const Commands::RegisterClient::DecodableType & commandData, uint32_t & icdCounter)
252252
{
253-
FabricIndex fabricIndex = commandObj->GetAccessingFabricIndex();
254-
NodeId nodeId = commandData.checkInNodeID;
255-
uint64_t monitoredSubject = commandData.monitoredSubject;
256-
Optional<ClientTypeEnum> clientType = commandData.clientType;
257-
ByteSpan key = commandData.key;
258-
Optional<ByteSpan> verificationKey = commandData.verificationKey;
259-
bool isClientAdmin = false;
253+
FabricIndex fabricIndex = commandObj->GetAccessingFabricIndex();
254+
NodeId nodeId = commandData.checkInNodeID;
255+
uint64_t monitoredSubject = commandData.monitoredSubject;
256+
ClientTypeEnum clientType = commandData.clientType;
257+
ByteSpan key = commandData.key;
258+
Optional<ByteSpan> verificationKey = commandData.verificationKey;
259+
bool isClientAdmin = false;
260260

261261
// Check if client is admin
262262
VerifyOrReturnError(CHIP_NO_ERROR == CheckAdmin(commandObj, commandPath, isClientAdmin), InteractionModel::Status::Failure);
@@ -293,7 +293,7 @@ Status ICDManagementServer::RegisterClient(CommandHandler * commandObj, const Co
293293
// Save
294294
entry.checkInNodeID = nodeId;
295295
entry.monitoredSubject = monitoredSubject;
296-
entry.clientType = clientType.ValueOr(ClientTypeEnum::kPermanent);
296+
entry.clientType = clientType;
297297

298298
if (entry.keyHandleValid)
299299
{

src/app/tests/suites/TestIcdManagementCluster.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ tests:
195195
value: 1001
196196
- name: "Key"
197197
value: "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e"
198+
- name: "ClientType"
199+
value: 0
198200
response:
199201
error: CONSTRAINT_ERROR
200202

@@ -208,6 +210,8 @@ tests:
208210
value: 1001
209211
- name: "Key"
210212
value: "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\xff"
213+
- name: "ClientType"
214+
value: 0
211215
response:
212216
error: CONSTRAINT_ERROR
213217

@@ -221,6 +225,8 @@ tests:
221225
value: 1001
222226
- name: "Key"
223227
value: "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
228+
- name: "ClientType"
229+
value: 0
224230
response:
225231
values:
226232
- name: "ICDCounter"
@@ -260,6 +266,8 @@ tests:
260266
value: 3001
261267
- name: "Key"
262268
value: "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
269+
- name: "ClientType"
270+
value: 0
263271
response:
264272
error: RESOURCE_EXHAUSTED
265273

0 commit comments

Comments
 (0)