Skip to content

Commit

Permalink
restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
panliming-tuya committed Jan 4, 2023
1 parent c027231 commit 2b094c8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 83 deletions.
15 changes: 3 additions & 12 deletions src/controller/java/AndroidDeviceControllerWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,9 @@ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDel
CHIP_ERROR SyncGetKeyValue(const char * key, void * buffer, uint16_t & size) override;
CHIP_ERROR SyncDeleteKeyValue(const char * key) override;

chip::Controller::AutoCommissioner * GetAutoCommissioner()
{
return &mAutoCommissioner;
}
chip::Controller::AutoCommissioner * GetAutoCommissioner() { return &mAutoCommissioner; }

chip::Credentials::PartialDACVerifier * GetPartialDACVerifier()
{
return &mPartialDACVerifier;
}
chip::Credentials::PartialDACVerifier * GetPartialDACVerifier() { return &mPartialDACVerifier; }

const chip::Controller::CommissioningParameters & GetCommissioningParameters() const
{
Expand Down Expand Up @@ -191,10 +185,7 @@ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDel
mDeviceAttestationDelegateBridge = deviceAttestationDelegateBridge;
}

DeviceAttestationDelegateBridge * GetDeviceAttestationDelegateBridge()
{
return mDeviceAttestationDelegateBridge;
}
DeviceAttestationDelegateBridge * GetDeviceAttestationDelegateBridge() { return mDeviceAttestationDelegateBridge; }

void ClearDeviceAttestationDelegateBridge()
{
Expand Down
2 changes: 1 addition & 1 deletion src/controller/java/CHIPDeviceController-JNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ JNI_METHOD(void, continueCommissioning)
: chip::Credentials::AttestationVerificationResult::kSuccess;
chip::DeviceProxy * deviceProxy = reinterpret_cast<chip::DeviceProxy *>(devicePtr);
err = wrapper->Controller()->ContinueCommissioningAfterDeviceAttestation(
deviceProxy, ignoreAttestationFailure ? chip::Credentials::AttestationVerificationResult::kSuccess : lastAttestationResult);
deviceProxy, ignoreAttestationFailure ? chip::Credentials::AttestationVerificationResult::kSuccess : lastAttestationResult);

if (err != CHIP_NO_ERROR)
{
Expand Down
99 changes: 29 additions & 70 deletions src/controller/java/src/chip/devicecontroller/ControllerParams.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package chip.devicecontroller;

import java.util.ArrayList;
import javax.annotation.Nullable;

/**
* Parameters representing initialization arguments for
* {@link ChipDeviceController}.
*/
/** Parameters representing initialization arguments for {@link ChipDeviceController}. */
public final class ControllerParams {

private final long fabricId;
Expand All @@ -17,23 +13,16 @@ public final class ControllerParams {
private final boolean attemptNetworkScanWiFi;
private final boolean attemptNetworkScanThread;
private final boolean skipCommissioningComplete;
@Nullable
private final KeypairDelegate keypairDelegate;
@Nullable
private final byte[] rootCertificate;
@Nullable
private final byte[] intermediateCertificate;
@Nullable
private final byte[] operationalCertificate;
@Nullable
private final byte[] ipk;
@Nullable private final KeypairDelegate keypairDelegate;
@Nullable private final byte[] rootCertificate;
@Nullable private final byte[] intermediateCertificate;
@Nullable private final byte[] operationalCertificate;
@Nullable private final byte[] ipk;
private final long adminSubject;

private static final int LEGACY_GLOBAL_CHIP_PORT = 5540;

/**
* @param udpListenPort the UDP listening port, or 0 to pick any available port.
*/
/** @param udpListenPort the UDP listening port, or 0 to pick any available port. */
private ControllerParams(Builder builder) {
this.fabricId = builder.fabricId;
this.udpListenPort = builder.udpListenPort;
Expand Down Expand Up @@ -114,8 +103,7 @@ public static Builder newBuilder() {
}

/**
* Returns parameters which uses the provided {@code operationalKeyConfig} as
* its operating
* Returns parameters which uses the provided {@code operationalKeyConfig} as its operating
* credentials. You must set a vendor ID, 0xFFF4 is a test vendor ID
* ControllerParams.newBuilder().setControllerVendorId(0xFFF4).build()
*/
Expand All @@ -138,20 +126,14 @@ public static class Builder {
private boolean attemptNetworkScanWiFi = false;
private boolean attemptNetworkScanThread = false;
private boolean skipCommissioningComplete = false;
@Nullable
private KeypairDelegate keypairDelegate = null;
@Nullable
private byte[] rootCertificate = null;
@Nullable
private byte[] intermediateCertificate = null;
@Nullable
private byte[] operationalCertificate = null;
@Nullable
private byte[] ipk = null;
@Nullable private KeypairDelegate keypairDelegate = null;
@Nullable private byte[] rootCertificate = null;
@Nullable private byte[] intermediateCertificate = null;
@Nullable private byte[] operationalCertificate = null;
@Nullable private byte[] ipk = null;
private long adminSubject = 0;

private Builder() {
}
private Builder() {}

public Builder setFabricId(long fabricId) {
if (fabricId < 1) {
Expand All @@ -175,15 +157,11 @@ public Builder setControllerVendorId(int controllerVendorId) {
}

/**
* Sets the FailsafeTimer duration passed to ChipDeviceCommissioner's
* CommissioningParameters.
* Increasing this value from its default will allow more time for network
* scans, cloud op cert
* Sets the FailsafeTimer duration passed to ChipDeviceCommissioner's CommissioningParameters.
* Increasing this value from its default will allow more time for network scans, cloud op cert
* signing calls, and user interaction.
*
* <p>
* Note: It is also possible for internal logic (within Autocommissioner, etc)
* to re-call
* <p>Note: It is also possible for internal logic (within Autocommissioner, etc) to re-call
* ArmFailSafe to account for network config delays.
*
* @param failsafeTimerSeconds
Expand All @@ -198,15 +176,11 @@ public Builder setFailsafeTimerSeconds(int failsafeTimerSeconds) {
}

/**
* Sets the CASEFailsafeExpirySeconds duration passed to
* ChipDeviceCommissioner's
* CommissioningParameters. After PASE session has finished, the failsafe is
* rearmed with the
* Sets the CASEFailsafeExpirySeconds duration passed to ChipDeviceCommissioner's
* CommissioningParameters. After PASE session has finished, the failsafe is rearmed with the
* specified expiry before continuing commissioning.
*
* <p>
* Note: If CASEFailsafeExpirySeconds is not set (or is 0), the failsafe will
* not be rearmed.
* <p>Note: If CASEFailsafeExpirySeconds is not set (or is 0), the failsafe will not be rearmed.
*
* @param caseFailsafeExpirySeconds
* @return
Expand All @@ -223,14 +197,10 @@ public Builder setCASEFailsafeTimerSeconds(int failsafeTimerSeconds) {
* Enable/disable wifi network scan during commissioning in the the default
* CommissioningDelegate used by the ChipDeviceCommissioner.
*
* <p>
* Specifically, this sets AttemptWiFiNetworkScan in the CommissioningParameters
* passed to
* <p>Specifically, this sets AttemptWiFiNetworkScan in the CommissioningParameters passed to
* the CommissioningDelegate.
*
* <p>
* When a WiFi scan is attempted, the result will be propagated to the
* ScanNetworksListener
* <p>When a WiFi scan is attempted, the result will be propagated to the ScanNetworksListener
* assigned to the ChipDeviceController.
*
* @param attemptNetworkScanWiFi
Expand All @@ -245,14 +215,10 @@ public Builder setAttemptNetworkScanWiFi(boolean attemptNetworkScanWiFi) {
* Enable/disable Thread network scan during commissioning in the the default
* CommissioningDelegate used by the ChipDeviceCommissioner.
*
* <p>
* Specifically, this sets AttemptThreadNetworkScan in the
* CommissioningParameters passed to
* <p>Specifically, this sets AttemptThreadNetworkScan in the CommissioningParameters passed to
* the CommissioningDelegate.
*
* <p>
* When a Thread scan is attempted, the result will be propagated to the
* ScanNetworksListener
* <p>When a Thread scan is attempted, the result will be propagated to the ScanNetworksListener
* assigned to the ChipDeviceController.
*
* @param attemptNetworkScanWiFi
Expand All @@ -264,18 +230,13 @@ public Builder setAttemptNetworkScanThread(boolean attemptNetworkScanThread) {
}

/**
* Disable the CASE phase of commissioning when the CommissioningComplete
* command is sent by
* Disable the CASE phase of commissioning when the CommissioningComplete command is sent by
* this ChipDeviceCommissioner.
*
* <p>
* Specifically, this sets SkipCommissioningComplete in the
* CommissioningParameters passed to
* <p>Specifically, this sets SkipCommissioningComplete in the CommissioningParameters passed to
* the CommissioningDelegate.
*
* <p>
* A controller will set this to true when the CASE phase of commissioning is
* done by a
* <p>A controller will set this to true when the CASE phase of commissioning is done by a
* separate process, for example, by a Hub on the network.
*
* @param skipCommissioningComplete
Expand Down Expand Up @@ -312,10 +273,8 @@ public Builder setIpk(byte[] ipk) {
}

/**
* Sets the AdminSubject value passed to ChipDeviceCommissioner's
* CommissioningParameters. This
* value is passed in the AddNoc command sent to the commissionee and represents
* the subject of
* Sets the AdminSubject value passed to ChipDeviceCommissioner's CommissioningParameters. This
* value is passed in the AddNoc command sent to the commissionee and represents the subject of
* the default ACL created by that call.
*
* @param adminSubject
Expand Down

0 comments on commit 2b094c8

Please sign in to comment.