From 13816043a57a2c6825f86a88f6fa6d8d507ec75f Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 22 Nov 2022 08:47:32 -0800 Subject: [PATCH] Setup ChipDeviceController for all Matter commands (#23712) --- .../java/src/com/matter/controller/Main.java | 51 +++++++++++-------- .../commands/common/MatterCommand.java | 19 +++++-- .../commands/discover/DiscoverCommand.java | 5 +- .../DiscoverCommissionablesCommand.java | 6 ++- .../DiscoverCommissionersCommand.java | 6 ++- .../commands/pairing/CloseSessionCommand.java | 5 +- .../commands/pairing/PairCodeCommand.java | 5 +- .../commands/pairing/PairCodePaseCommand.java | 10 +++- .../pairing/PairCodeThreadCommand.java | 5 +- .../commands/pairing/PairCodeWifiCommand.java | 5 +- .../commands/pairing/PairEthernetCommand.java | 6 ++- .../pairing/PairOnNetworkCommand.java | 5 +- .../PairOnNetworkCommissionerCommand.java | 5 +- ...PairOnNetworkCommissioningModeCommand.java | 5 +- .../PairOnNetworkDeviceTypeCommand.java | 5 +- .../pairing/PairOnNetworkFabricCommand.java | 5 +- .../PairOnNetworkInstanceNameCommand.java | 5 +- .../pairing/PairOnNetworkLongCommand.java | 4 +- .../pairing/PairOnNetworkShortCommand.java | 4 +- .../pairing/PairOnNetworkVendorCommand.java | 4 +- .../commands/pairing/PairingCommand.java | 7 ++- .../commands/pairing/UnpairCommand.java | 5 +- 22 files changed, 121 insertions(+), 56 deletions(-) diff --git a/examples/java-matter-controller/java/src/com/matter/controller/Main.java b/examples/java-matter-controller/java/src/com/matter/controller/Main.java index 11b067a6f782bd..52c84f5141dea2 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/Main.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/Main.java @@ -27,13 +27,15 @@ public class Main { private static void registerCommandsDiscover( - CommandManager commandManager, CredentialsIssuer credentialsIssuer) { + ChipDeviceController controller, + CommandManager commandManager, + CredentialsIssuer credentialsIssuer) { ArrayList clusterCommands = new ArrayList(); - DiscoverCommand discoverCommand = new DiscoverCommand(credentialsIssuer); + DiscoverCommand discoverCommand = new DiscoverCommand(controller, credentialsIssuer); DiscoverCommissionablesCommand discoverCommissionablesCommand = - new DiscoverCommissionablesCommand(credentialsIssuer); + new DiscoverCommissionablesCommand(controller, credentialsIssuer); DiscoverCommissionersCommand discoverCommissionersCommand = - new DiscoverCommissionersCommand(credentialsIssuer); + new DiscoverCommissionersCommand(controller, credentialsIssuer); clusterCommands.add(discoverCommand); clusterCommands.add(discoverCommissionablesCommand); clusterCommands.add(discoverCommissionersCommand); @@ -42,29 +44,36 @@ private static void registerCommandsDiscover( } private static void registerCommandsPairing( - CommandManager commandManager, CredentialsIssuer credentialsIssuer) { + ChipDeviceController controller, + CommandManager commandManager, + CredentialsIssuer credentialsIssuer) { ArrayList clusterCommands = new ArrayList(); - UnpairCommand unpairCommand = new UnpairCommand(credentialsIssuer); - PairCodeCommand pairCodeCommand = new PairCodeCommand(credentialsIssuer); - PairCodePaseCommand pairCodePaseCommand = new PairCodePaseCommand(credentialsIssuer); - PairCodeWifiCommand pairCodeWifiCommand = new PairCodeWifiCommand(credentialsIssuer); - PairCodeThreadCommand pairCodeThreadCommand = new PairCodeThreadCommand(credentialsIssuer); - PairEthernetCommand pairEthernetCommand = new PairEthernetCommand(credentialsIssuer); - PairOnNetworkCommand pairOnNetworkCommand = new PairOnNetworkCommand(credentialsIssuer); + UnpairCommand unpairCommand = new UnpairCommand(controller, credentialsIssuer); + PairCodeCommand pairCodeCommand = new PairCodeCommand(controller, credentialsIssuer); + PairCodePaseCommand pairCodePaseCommand = + new PairCodePaseCommand(controller, credentialsIssuer); + PairCodeWifiCommand pairCodeWifiCommand = + new PairCodeWifiCommand(controller, credentialsIssuer); + PairCodeThreadCommand pairCodeThreadCommand = + new PairCodeThreadCommand(controller, credentialsIssuer); + PairEthernetCommand pairEthernetCommand = + new PairEthernetCommand(controller, credentialsIssuer); + PairOnNetworkCommand pairOnNetworkCommand = + new PairOnNetworkCommand(controller, credentialsIssuer); PairOnNetworkShortCommand pairOnNetworkShortCommand = - new PairOnNetworkShortCommand(credentialsIssuer); + new PairOnNetworkShortCommand(controller, credentialsIssuer); PairOnNetworkLongCommand pairOnNetworkLongCommand = - new PairOnNetworkLongCommand(credentialsIssuer); + new PairOnNetworkLongCommand(controller, credentialsIssuer); PairOnNetworkVendorCommand pairOnNetworkVendorCommand = - new PairOnNetworkVendorCommand(credentialsIssuer); + new PairOnNetworkVendorCommand(controller, credentialsIssuer); PairOnNetworkCommissioningModeCommand pairOnNetworkCommissioningModeCommand = - new PairOnNetworkCommissioningModeCommand(credentialsIssuer); + new PairOnNetworkCommissioningModeCommand(controller, credentialsIssuer); PairOnNetworkCommissionerCommand pairOnNetworkCommissionerCommand = - new PairOnNetworkCommissionerCommand(credentialsIssuer); + new PairOnNetworkCommissionerCommand(controller, credentialsIssuer); PairOnNetworkDeviceTypeCommand pairOnNetworkDeviceTypeCommand = - new PairOnNetworkDeviceTypeCommand(credentialsIssuer); + new PairOnNetworkDeviceTypeCommand(controller, credentialsIssuer); PairOnNetworkInstanceNameCommand pairOnNetworkInstanceNameCommand = - new PairOnNetworkInstanceNameCommand(credentialsIssuer); + new PairOnNetworkInstanceNameCommand(controller, credentialsIssuer); clusterCommands.add(unpairCommand); clusterCommands.add(pairCodeCommand); clusterCommands.add(pairCodePaseCommand); @@ -94,8 +103,8 @@ public static void main(String[] args) { CredentialsIssuer credentialsIssuer = new CredentialsIssuer(); CommandManager commandManager = new CommandManager(); - registerCommandsDiscover(commandManager, credentialsIssuer); - registerCommandsPairing(commandManager, credentialsIssuer); + registerCommandsDiscover(controller, commandManager, credentialsIssuer); + registerCommandsPairing(controller, commandManager, credentialsIssuer); try { commandManager.run(args); diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.java index 8b0b068ba5c2a9..18f9cec59f1e86 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.java @@ -18,6 +18,7 @@ package com.matter.controller.commands.common; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.config.PersistentStorage; import com.matter.controller.config.PersistentStorageOpCertStore; import com.matter.controller.config.PersistentStorageOperationalKeystore; @@ -26,6 +27,7 @@ import java.util.concurrent.atomic.AtomicLong; public abstract class MatterCommand extends Command { + private final ChipDeviceController mChipDeviceController; private final PersistentStorage mDefaultStorage = new PersistentStorage(); private final PersistentStorage mCommissionerStorage = new PersistentStorage(); private final PersistentStorageOperationalKeystore mOperationalKeystore = @@ -40,13 +42,19 @@ public abstract class MatterCommand extends Command { private final AtomicBoolean mUseMaxSizedCerts = new AtomicBoolean();; private final AtomicBoolean mOnlyAllowTrustedCdKeys = new AtomicBoolean();; - public MatterCommand(String commandName, CredentialsIssuer credIssuerCmds) { - this(commandName, credIssuerCmds, null); + public MatterCommand( + ChipDeviceController controller, String commandName, CredentialsIssuer credIssuerCmds) { + this(controller, commandName, credIssuerCmds, null); } - public MatterCommand(String commandName, CredentialsIssuer credIssuerCmds, String helpText) { + public MatterCommand( + ChipDeviceController controller, + String commandName, + CredentialsIssuer credIssuerCmds, + String helpText) { super(commandName, helpText); this.mCredIssuerCmds = Optional.ofNullable(credIssuerCmds); + this.mChipDeviceController = controller; addArgument( "paa-trust-store-path", @@ -81,6 +89,11 @@ public MatterCommand(String commandName, CredentialsIssuer credIssuerCmds, Strin + "verifying keys are allowed. If 1 (\"true\"), test keys are disallowed."); } + // This method returns the commissioner instance to be used for running the command. + public ChipDeviceController currentCommissioner() { + return mChipDeviceController; + } + /////////// Command Interface ///////// @Override public void run() throws Exception { diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommand.java index 00c81d10d866a5..3d0bf2518e9098 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommand.java @@ -18,6 +18,7 @@ package com.matter.controller.commands.discover; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; import com.matter.controller.commands.common.MatterCommand; import java.util.concurrent.atomic.AtomicLong; @@ -26,8 +27,8 @@ public final class DiscoverCommand extends MatterCommand { private final AtomicLong mNodeId = new AtomicLong(); private final AtomicLong mFabricId = new AtomicLong(); - public DiscoverCommand(CredentialsIssuer credsIssuer) { - super("resolve", credsIssuer); + public DiscoverCommand(ChipDeviceController controller, CredentialsIssuer credsIssuer) { + super(controller, "resolve", credsIssuer); addArgument("nodeid", 0, Long.MAX_VALUE, mNodeId, null); addArgument("fabricid", 0, Long.MAX_VALUE, mFabricId, null); } diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.java index cb128c41b005d4..dd6de256c32f13 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.java @@ -18,12 +18,14 @@ package com.matter.controller.commands.discover; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; import com.matter.controller.commands.common.MatterCommand; public final class DiscoverCommissionablesCommand extends MatterCommand { - public DiscoverCommissionablesCommand(CredentialsIssuer credsIssuer) { - super("commissionables", credsIssuer); + public DiscoverCommissionablesCommand( + ChipDeviceController controller, CredentialsIssuer credsIssuer) { + super(controller, "commissionables", credsIssuer); } @Override diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionersCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionersCommand.java index a7a373683ae16c..ed5eca264a6106 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionersCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionersCommand.java @@ -18,12 +18,14 @@ package com.matter.controller.commands.discover; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; import com.matter.controller.commands.common.MatterCommand; public final class DiscoverCommissionersCommand extends MatterCommand { - public DiscoverCommissionersCommand(CredentialsIssuer credsIssuer) { - super("commissioners", credsIssuer); + public DiscoverCommissionersCommand( + ChipDeviceController controller, CredentialsIssuer credsIssuer) { + super(controller, "commissioners", credsIssuer); } @Override diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/CloseSessionCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/CloseSessionCommand.java index f756f531746873..ce3e263665866a 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/CloseSessionCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/CloseSessionCommand.java @@ -18,6 +18,7 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; import com.matter.controller.commands.common.MatterCommand; import java.util.concurrent.atomic.AtomicInteger; @@ -27,8 +28,8 @@ public final class CloseSessionCommand extends MatterCommand { private final AtomicLong mDestinationId = new AtomicLong(); private final AtomicInteger mTimeoutSecs = new AtomicInteger(); - public CloseSessionCommand(CredentialsIssuer credsIssuer) { - super("close-session", credsIssuer); + public CloseSessionCommand(ChipDeviceController controller, CredentialsIssuer credsIssuer) { + super(controller, "close-session", credsIssuer); addArgument("destination-id", 0, Long.MAX_VALUE, mDestinationId, null); addArgument( "timeout", diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeCommand.java index ceadf2ffed00c6..a95237b1c89a1f 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeCommand.java @@ -1,10 +1,11 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairCodeCommand extends PairingCommand { - public PairCodeCommand(CredentialsIssuer credsIssue) { - super("code", PairingModeType.CODE, PairingNetworkType.NONE, credsIssue); + public PairCodeCommand(ChipDeviceController controller, CredentialsIssuer credsIssue) { + super(controller, "code", PairingModeType.CODE, PairingNetworkType.NONE, credsIssue); } @Override diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodePaseCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodePaseCommand.java index 32a3bad4c14f93..b56ce3a96b4b5a 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodePaseCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodePaseCommand.java @@ -1,10 +1,16 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairCodePaseCommand extends PairingCommand { - public PairCodePaseCommand(CredentialsIssuer credsIssue) { - super("code-paseonly", PairingModeType.CODE_PASE_ONLY, PairingNetworkType.NONE, credsIssue); + public PairCodePaseCommand(ChipDeviceController controller, CredentialsIssuer credsIssue) { + super( + controller, + "code-paseonly", + PairingModeType.CODE_PASE_ONLY, + PairingNetworkType.NONE, + credsIssue); } @Override diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeThreadCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeThreadCommand.java index 8d036d2944beec..150ca17e8a42a9 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeThreadCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeThreadCommand.java @@ -1,10 +1,11 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairCodeThreadCommand extends PairingCommand { - public PairCodeThreadCommand(CredentialsIssuer credsIssue) { - super("code-thread", PairingModeType.CODE, PairingNetworkType.THREAD, credsIssue); + public PairCodeThreadCommand(ChipDeviceController controller, CredentialsIssuer credsIssue) { + super(controller, "code-thread", PairingModeType.CODE, PairingNetworkType.THREAD, credsIssue); } @Override diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeWifiCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeWifiCommand.java index 80c8098405d667..2aa764026a3303 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeWifiCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeWifiCommand.java @@ -1,10 +1,11 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairCodeWifiCommand extends PairingCommand { - public PairCodeWifiCommand(CredentialsIssuer credsIssue) { - super("code-wifi", PairingModeType.CODE, PairingNetworkType.WIFI, credsIssue); + public PairCodeWifiCommand(ChipDeviceController controller, CredentialsIssuer credsIssue) { + super(controller, "code-wifi", PairingModeType.CODE, PairingNetworkType.WIFI, credsIssue); } @Override diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairEthernetCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairEthernetCommand.java index 4296df73b9cef5..b2897760240d2d 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairEthernetCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairEthernetCommand.java @@ -1,10 +1,12 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairEthernetCommand extends PairingCommand { - public PairEthernetCommand(CredentialsIssuer credsIssue) { - super("ethernet", PairingModeType.ETHERNET, PairingNetworkType.ETHERNET, credsIssue); + public PairEthernetCommand(ChipDeviceController controller, CredentialsIssuer credsIssue) { + super( + controller, "ethernet", PairingModeType.ETHERNET, PairingNetworkType.ETHERNET, credsIssue); } @Override diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommand.java index 073e13fee7d2b8..de03adcd7e6850 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommand.java @@ -1,10 +1,11 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairOnNetworkCommand extends PairingCommand { - public PairOnNetworkCommand(CredentialsIssuer credsIssue) { - super("onnetwork", PairingModeType.ON_NETWORK, PairingNetworkType.NONE, credsIssue); + public PairOnNetworkCommand(ChipDeviceController controller, CredentialsIssuer credsIssue) { + super(controller, "onnetwork", PairingModeType.ON_NETWORK, PairingNetworkType.NONE, credsIssue); } @Override diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommissionerCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommissionerCommand.java index 6feb9d94670a81..2a737503d8e345 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommissionerCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommissionerCommand.java @@ -1,10 +1,13 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairOnNetworkCommissionerCommand extends PairingCommand { - public PairOnNetworkCommissionerCommand(CredentialsIssuer credsIssue) { + public PairOnNetworkCommissionerCommand( + ChipDeviceController controller, CredentialsIssuer credsIssue) { super( + controller, "onnetwork-commissioner", PairingModeType.ON_NETWORK, PairingNetworkType.NONE, diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommissioningModeCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommissioningModeCommand.java index 4b44e5cd7896a2..62a3c14213bc86 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommissioningModeCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkCommissioningModeCommand.java @@ -1,10 +1,13 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairOnNetworkCommissioningModeCommand extends PairingCommand { - public PairOnNetworkCommissioningModeCommand(CredentialsIssuer credsIssue) { + public PairOnNetworkCommissioningModeCommand( + ChipDeviceController controller, CredentialsIssuer credsIssue) { super( + controller, "onnetwork-commissioning-mode", PairingModeType.ON_NETWORK, PairingNetworkType.NONE, diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkDeviceTypeCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkDeviceTypeCommand.java index ad6e98fe57d45f..5a16ae3daf908e 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkDeviceTypeCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkDeviceTypeCommand.java @@ -1,10 +1,13 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairOnNetworkDeviceTypeCommand extends PairingCommand { - public PairOnNetworkDeviceTypeCommand(CredentialsIssuer credsIssue) { + public PairOnNetworkDeviceTypeCommand( + ChipDeviceController controller, CredentialsIssuer credsIssue) { super( + controller, "onnetwork-device-type", PairingModeType.ON_NETWORK, PairingNetworkType.NONE, diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkFabricCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkFabricCommand.java index c430cd7da0cda5..c0db4cdc008f77 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkFabricCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkFabricCommand.java @@ -1,11 +1,14 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; import java.net.UnknownHostException; public final class PairOnNetworkFabricCommand extends PairingCommand { - public PairOnNetworkFabricCommand(CredentialsIssuer credsIssue) throws UnknownHostException { + public PairOnNetworkFabricCommand(ChipDeviceController controller, CredentialsIssuer credsIssue) + throws UnknownHostException { super( + controller, "onnetwork-fabric", PairingModeType.ON_NETWORK, PairingNetworkType.NONE, diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkInstanceNameCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkInstanceNameCommand.java index c3dd7f7731047a..45d91665dd3671 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkInstanceNameCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkInstanceNameCommand.java @@ -1,10 +1,13 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairOnNetworkInstanceNameCommand extends PairingCommand { - public PairOnNetworkInstanceNameCommand(CredentialsIssuer credsIssue) { + public PairOnNetworkInstanceNameCommand( + ChipDeviceController controller, CredentialsIssuer credsIssue) { super( + controller, "onnetwork-instance-name", PairingModeType.ON_NETWORK, PairingNetworkType.NONE, diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongCommand.java index 62ee8c03ccf8c9..23c4cb5d2880ff 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongCommand.java @@ -1,10 +1,12 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairOnNetworkLongCommand extends PairingCommand { - public PairOnNetworkLongCommand(CredentialsIssuer credsIssue) { + public PairOnNetworkLongCommand(ChipDeviceController controller, CredentialsIssuer credsIssue) { super( + controller, "onnetwork-long", PairingModeType.ON_NETWORK, PairingNetworkType.NONE, diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkShortCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkShortCommand.java index e6af8dc6bd7f5a..135694632863d1 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkShortCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkShortCommand.java @@ -1,10 +1,12 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairOnNetworkShortCommand extends PairingCommand { - public PairOnNetworkShortCommand(CredentialsIssuer credsIssue) { + public PairOnNetworkShortCommand(ChipDeviceController controller, CredentialsIssuer credsIssue) { super( + controller, "onnetwork-short", PairingModeType.ON_NETWORK, PairingNetworkType.NONE, diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkVendorCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkVendorCommand.java index 398203d916d48a..65bdfc57c3cd94 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkVendorCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkVendorCommand.java @@ -1,10 +1,12 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class PairOnNetworkVendorCommand extends PairingCommand { - public PairOnNetworkVendorCommand(CredentialsIssuer credsIssue) { + public PairOnNetworkVendorCommand(ChipDeviceController controller, CredentialsIssuer credsIssue) { super( + controller, "onnetwork-vendor", PairingModeType.ON_NETWORK, PairingNetworkType.NONE, diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairingCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairingCommand.java index 151c88bf8bd2ca..ead0912653c90a 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairingCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairingCommand.java @@ -18,6 +18,7 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; import com.matter.controller.commands.common.IPAddress; import com.matter.controller.commands.common.MatterCommand; @@ -47,20 +48,22 @@ public abstract class PairingCommand extends MatterCommand { private final StringBuffer mDiscoveryFilterInstanceName = new StringBuffer(); public PairingCommand( + ChipDeviceController controller, String commandName, PairingModeType mode, PairingNetworkType networkType, CredentialsIssuer credsIssuer) { - this(commandName, mode, networkType, credsIssuer, DiscoveryFilterType.NONE); + this(controller, commandName, mode, networkType, credsIssuer, DiscoveryFilterType.NONE); } public PairingCommand( + ChipDeviceController controller, String commandName, PairingModeType mode, PairingNetworkType networkType, CredentialsIssuer credsIssuer, DiscoveryFilterType filterType) { - super(commandName, credsIssuer); + super(controller, commandName, credsIssuer); this.mPairingMode = mode; this.mNetworkType = networkType; this.mFilterType = filterType; diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/UnpairCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/UnpairCommand.java index 8cf1f844e1511d..2c33c8dc551a1b 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/UnpairCommand.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/UnpairCommand.java @@ -1,10 +1,11 @@ package com.matter.controller.commands.pairing; +import chip.devicecontroller.ChipDeviceController; import com.matter.controller.commands.common.CredentialsIssuer; public final class UnpairCommand extends PairingCommand { - public UnpairCommand(CredentialsIssuer credsIssue) { - super("unpair", PairingModeType.NONE, PairingNetworkType.NONE, credsIssue); + public UnpairCommand(ChipDeviceController controller, CredentialsIssuer credsIssue) { + super(controller, "unpair", PairingModeType.NONE, PairingNetworkType.NONE, credsIssue); } @Override