Skip to content

Commit 3c0a630

Browse files
Preliminary support for the Android controller
1 parent ed59d46 commit 3c0a630

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/controller/java/AndroidDeviceControllerWrapper.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,12 @@ CHIP_ERROR AndroidDeviceControllerWrapper::ApplyICDRegistrationInfo(chip::Contro
526526
VerifyOrReturnError(err == CHIP_NO_ERROR, err);
527527
jbyteArray jSymmetricKey = static_cast<jbyteArray>(env->CallObjectMethod(icdRegistrationInfo, getSymmetricKeyMethod));
528528

529+
jmethodID getClientTypeMethod;
530+
err = chip::JniReferences::GetInstance().FindMethod(env, icdRegistrationInfo, "getClientType", "()Ljava/lang/Short",
531+
&getClientTypeMethod);
532+
VerifyOrReturnError(err == CHIP_NO_ERROR, err);
533+
jobject jClientType = env->CallObjectMethod(icdRegistrationInfo, getClientTypeMethod);
534+
529535
chip::NodeId checkInNodeId = chip::kUndefinedNodeId;
530536
if (jCheckInNodeId != nullptr)
531537
{
@@ -556,6 +562,12 @@ CHIP_ERROR AndroidDeviceControllerWrapper::ApplyICDRegistrationInfo(chip::Contro
556562
}
557563
params.SetICDSymmetricKey(chip::ByteSpan(mICDSymmetricKey));
558564

565+
chip::app::Clusters::IcdManagement::ClientTypeEnum clientType = chip::app::Clusters::IcdManagement::ClientTypeEnum::kPermanent;
566+
if (jClientType != nullptr)
567+
{
568+
clientType = static_cast<chip::app::Clusters::IcdManagement::ClientTypeEnum>(jClientType)
569+
}
570+
559571
return err;
560572
}
561573

src/controller/java/src/chip/devicecontroller/ICDRegistrationInfo.java

+12
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ public class ICDRegistrationInfo {
2424
@Nullable private final Long checkInNodeId;
2525
@Nullable private final Long monitoredSubject;
2626
@Nullable private final byte[] symmetricKey;
27+
@Nullable private final Short clientType;
2728

2829
private ICDRegistrationInfo(Builder builder) {
2930
this.checkInNodeId = builder.checkInNodeId;
3031
this.monitoredSubject = builder.monitoredSubject;
3132
this.symmetricKey = builder.symmetricKey;
33+
this.clientType = builder.clientType;
3234
}
3335

3436
/** Returns the check in node ID. */
@@ -46,6 +48,10 @@ public byte[] getSymmetricKey() {
4648
return symmetricKey;
4749
}
4850

51+
public Short getClientType() {
52+
reutnr clientType;
53+
}
54+
4955
public static Builder newBuilder() {
5056
return new Builder();
5157
}
@@ -55,6 +61,7 @@ public static class Builder {
5561
@Nullable private Long checkInNodeId = null;
5662
@Nullable private Long monitoredSubject = null;
5763
@Nullable private byte[] symmetricKey = null;
64+
@Nullable private Short clientType = null;
5865

5966
private Builder() {}
6067

@@ -81,6 +88,11 @@ public Builder setSymmetricKey(byte[] symmetricKey) {
8188
return this;
8289
}
8390

91+
public Builder setClientType(Short clientType) {
92+
this.clientType = clientType;
93+
return this;
94+
}
95+
8496
public ICDRegistrationInfo build() {
8597
return new ICDRegistrationInfo(this);
8698
}

src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ void ScriptDevicePairingDelegate::OnICDRegistrationComplete(ScopedNodeId nodeId,
191191
clientInfo.peer_node = nodeId;
192192
clientInfo.monitored_subject = sCommissioningParameters.GetICDMonitoredSubject().Value();
193193
clientInfo.start_icd_counter = icdCounter;
194+
clientInfo.client_type = sCommissioningParameters.GetICDClientType().Value();
194195

195196
CHIP_ERROR err = sICDClientStorage.SetKey(clientInfo, ByteSpan(sICDSymmetricKey));
196197
if (err == CHIP_NO_ERROR)

0 commit comments

Comments
 (0)