Skip to content

Commit 3f83f31

Browse files
Update comissioning registration procedure for client type
1 parent 2e98bba commit 3f83f31

File tree

6 files changed

+31
-2
lines changed

6 files changed

+31
-2
lines changed

examples/chip-tool/commands/pairing/PairingCommand.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ CommissioningParameters PairingCommand::GetCommissioningParameters()
153153
{
154154
mICDMonitoredSubject.SetValue(mICDCheckInNodeId.Value());
155155
}
156+
if (!mICDClientType.HasValue())
157+
{
158+
mICDClientType.SetValue(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent);
159+
}
156160
// These Optionals must have values now.
157161
// The commissioner will verify these values.
158162
params.SetICDSymmetricKey(mICDSymmetricKey.Value());
@@ -162,6 +166,7 @@ CommissioningParameters PairingCommand::GetCommissioningParameters()
162166
}
163167
params.SetICDCheckInNodeId(mICDCheckInNodeId.Value());
164168
params.SetICDMonitoredSubject(mICDMonitoredSubject.Value());
169+
params.SetICDClientType(mICDClientType.Value());
165170
}
166171

167172
return params;

examples/chip-tool/commands/pairing/PairingCommand.h

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class PairingCommand : public CHIPCommand,
7171
"The check-in node id for the ICD, default: node id of the commissioner.");
7272
AddArgument("icd-monitored-subject", 0, UINT64_MAX, &mICDMonitoredSubject,
7373
"The monitored subject of the ICD, default: The node id used for icd-check-in-nodeid.");
74+
AddArgument("icd-client-type", 0, 1, &mICDClientType,
75+
"The ClientType of the client regsitering, default: Permanent client - 0");
7476
AddArgument("icd-symmetric-key", &mICDSymmetricKey, "The 16 bytes ICD symmetric key, default: randomly generated.");
7577
AddArgument("icd-stay-active-duration", 0, UINT32_MAX, &mICDStayActiveDurationMsec,
7678
"If set, a LIT ICD that is commissioned will be requested to stay active for this many milliseconds");
@@ -237,6 +239,7 @@ class PairingCommand : public CHIPCommand,
237239
chip::Optional<NodeId> mICDCheckInNodeId;
238240
chip::Optional<chip::ByteSpan> mICDSymmetricKey;
239241
chip::Optional<uint64_t> mICDMonitoredSubject;
242+
chip::Optional<chip::app::Clusters::IcdManagement::ClientTypeEnum> mICDClientType;
240243
chip::Optional<uint32_t> mICDStayActiveDurationMsec;
241244
chip::app::DataModel::List<chip::app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::Type> mTimeZoneList;
242245
TypedComplexArgument<chip::app::DataModel::List<chip::app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::Type>>

examples/fabric-admin/commands/pairing/PairingCommand.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ CommissioningParameters PairingCommand::GetCommissioningParameters()
153153
{
154154
mICDMonitoredSubject.SetValue(mICDCheckInNodeId.Value());
155155
}
156+
if (!mICDClientType.HasValue())
157+
{
158+
mICDClientType.SetValue(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent);
159+
}
156160
// These Optionals must have values now.
157161
// The commissioner will verify these values.
158162
params.SetICDSymmetricKey(mICDSymmetricKey.Value());
@@ -162,6 +166,7 @@ CommissioningParameters PairingCommand::GetCommissioningParameters()
162166
}
163167
params.SetICDCheckInNodeId(mICDCheckInNodeId.Value());
164168
params.SetICDMonitoredSubject(mICDMonitoredSubject.Value());
169+
params.SetICDClientType(mICDClientType.Value());
165170
}
166171

167172
return params;

examples/fabric-admin/commands/pairing/PairingCommand.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ class PairingCommand : public CHIPCommand,
5454
PairingCommand(const char * commandName, PairingMode mode, PairingNetworkType networkType,
5555
CredentialIssuerCommands * credIssuerCmds,
5656
chip::Dnssd::DiscoveryFilterType filterType = chip::Dnssd::DiscoveryFilterType::kNone) :
57-
CHIPCommand(commandName, credIssuerCmds),
58-
mPairingMode(mode), mNetworkType(networkType), mFilterType(filterType),
57+
CHIPCommand(commandName, credIssuerCmds), mPairingMode(mode), mNetworkType(networkType), mFilterType(filterType),
5958
mRemoteAddr{ IPAddress::Any, chip::Inet::InterfaceId::Null() }, mComplex_TimeZones(&mTimeZoneList),
6059
mComplex_DSTOffsets(&mDSTOffsetList), mCurrentFabricRemoveCallback(OnCurrentFabricRemove, this)
6160
{
@@ -70,6 +69,8 @@ class PairingCommand : public CHIPCommand,
7069
"The check-in node id for the ICD, default: node id of the commissioner.");
7170
AddArgument("icd-monitored-subject", 0, UINT64_MAX, &mICDMonitoredSubject,
7271
"The monitored subject of the ICD, default: The node id used for icd-check-in-nodeid.");
72+
AddArgument("icd-client-type", 0, 1, &mICDClientType,
73+
"The ClientType of the client regsitering, default: Permanent client - 0");
7374
AddArgument("icd-symmetric-key", &mICDSymmetricKey, "The 16 bytes ICD symmetric key, default: randomly generated.");
7475
AddArgument("icd-stay-active-duration", 0, UINT32_MAX, &mICDStayActiveDurationMsec,
7576
"If set, a LIT ICD that is commissioned will be requested to stay active for this many milliseconds");
@@ -234,6 +235,7 @@ class PairingCommand : public CHIPCommand,
234235
chip::Optional<char *> mCountryCode;
235236
chip::Optional<bool> mICDRegistration;
236237
chip::Optional<NodeId> mICDCheckInNodeId;
238+
chip::Optional<chip::app::Clusters::IcdManagement::ClientTypeEnum> mICDClientType;
237239
chip::Optional<chip::ByteSpan> mICDSymmetricKey;
238240
chip::Optional<uint64_t> mICDMonitoredSubject;
239241
chip::Optional<uint32_t> mICDStayActiveDurationMsec;

src/controller/AutoCommissioner.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ CHIP_ERROR AutoCommissioner::VerifyICDRegistrationInfo(const CommissioningParame
9191
ChipLogError(Controller, "Missing ICD monitored subject!");
9292
return CHIP_ERROR_INVALID_ARGUMENT;
9393
}
94+
if (!params.GetICDClientType().HasValue())
95+
{
96+
ChipLogError(Controller, "Missing ICD Client Type!");
97+
return CHIP_ERROR_INVALID_ARGUMENT;
98+
}
9499
return CHIP_NO_ERROR;
95100
}
96101

@@ -270,6 +275,7 @@ CHIP_ERROR AutoCommissioner::SetCommissioningParameters(const CommissioningParam
270275
mParams.SetICDSymmetricKey(ByteSpan(mICDSymmetricKey));
271276
mParams.SetICDCheckInNodeId(params.GetICDCheckInNodeId().Value());
272277
mParams.SetICDMonitoredSubject(params.GetICDMonitoredSubject().Value());
278+
mParams.SetICDClientType(params.GetICDClientType().Value());
273279
}
274280

275281
return CHIP_NO_ERROR;

src/controller/CommissioningDelegate.h

+8
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,13 @@ class CommissioningParameters
555555
return *this;
556556
}
557557

558+
Optional<app::Clusters::IcdManagement::ClientTypeEnum> GetICDClientType() const { return mICDClientType; }
559+
CommissioningParameters & SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum icdClientType)
560+
{
561+
mICDClientType = MakeOptional(icdClientType);
562+
return *this;
563+
}
564+
558565
Optional<uint32_t> GetICDStayActiveDurationMsec() const { return mICDStayActiveDurationMsec; }
559566
CommissioningParameters & SetICDStayActiveDurationMsec(uint32_t stayActiveDurationMsec)
560567
{
@@ -629,6 +636,7 @@ class CommissioningParameters
629636
Optional<NodeId> mICDCheckInNodeId;
630637
Optional<uint64_t> mICDMonitoredSubject;
631638
Optional<ByteSpan> mICDSymmetricKey;
639+
Optional<app::Clusters::IcdManagement::ClientTypeEnum> mICDClientType;
632640
Optional<uint32_t> mICDStayActiveDurationMsec;
633641
ICDRegistrationStrategy mICDRegistrationStrategy = ICDRegistrationStrategy::kIgnore;
634642
bool mCheckForMatchingFabric = false;

0 commit comments

Comments
 (0)