-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[java-matter-controller] Convert from java to kotlin phase II
- Loading branch information
1 parent
105b98b
commit d7ae990
Showing
42 changed files
with
1,032 additions
and
824 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 0 additions & 45 deletions
45
...atter-controller/java/src/com/matter/controller/commands/pairing/CloseSessionCommand.java
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
...-matter-controller/java/src/com/matter/controller/commands/pairing/CloseSessionCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
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 | ||
import java.util.concurrent.atomic.AtomicLong | ||
|
||
class CloseSessionCommand(controller: ChipDeviceController, credsIssuer: CredentialsIssuer?) : | ||
MatterCommand(controller, "close-session", credsIssuer) { | ||
private val destinationId: AtomicLong = AtomicLong() | ||
private val timeoutSecs: AtomicInteger = AtomicInteger() | ||
|
||
init { | ||
addArgument("destination-id", 0, Long.MAX_VALUE, destinationId, null, false) | ||
addArgument( | ||
"timeout", 0.toShort(), Short.MAX_VALUE, | ||
timeoutSecs, | ||
"Time, in seconds, before this command is considered to have timed out.", | ||
false | ||
) | ||
} | ||
|
||
override fun runCommand() {} | ||
} |
53 changes: 22 additions & 31 deletions
53
...commands/pairing/DiscoveryFilterType.java → ...r/commands/pairing/DiscoveryFilterType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,22 @@ | ||
/* | ||
* Copyright (c) 2022 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.matter.controller.commands.pairing; | ||
|
||
public enum DiscoveryFilterType { | ||
NONE, | ||
SHORT_DISCRIMINATOR, | ||
LONG_DISCRIMINATOR, | ||
VENDOR_ID, | ||
DEVICE_TYPE, | ||
COMMISSIONING_MODE, | ||
INSTANCE_NAME, | ||
COMMISSIONER, | ||
COMPRESSED_FABRIC_ID, | ||
} | ||
/* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.matter.controller.commands.pairing | ||
|
||
enum class DiscoveryFilterType { | ||
NONE, SHORT_DISCRIMINATOR, LONG_DISCRIMINATOR, VENDOR_ID, DEVICE_TYPE, COMMISSIONING_MODE, INSTANCE_NAME, COMMISSIONER, COMPRESSED_FABRIC_ID | ||
} |
39 changes: 0 additions & 39 deletions
39
...er-controller/java/src/com/matter/controller/commands/pairing/PairAddressPaseCommand.java
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
...tter-controller/java/src/com/matter/controller/commands/pairing/PairAddressPaseCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.matter.controller.commands.pairing | ||
|
||
import chip.devicecontroller.ChipDeviceController | ||
import com.matter.controller.commands.common.CredentialsIssuer | ||
import java.util.logging.Level | ||
import java.util.logging.Logger | ||
|
||
class PairAddressPaseCommand(controller: ChipDeviceController, credsIssue: CredentialsIssuer?) : PairingCommand( | ||
controller, | ||
"address-paseonly", | ||
PairingModeType.ADDRESS_PASE_ONLY, | ||
PairingNetworkType.NONE, | ||
credsIssue | ||
) { | ||
private val logger = Logger.getLogger(PairAddressPaseCommand::class.java.name) | ||
|
||
override fun onPairingComplete(errorCode: Int) { | ||
logger.log(Level.INFO, "onPairingComplete with error code: $errorCode") | ||
if (errorCode == 0) { | ||
setSuccess() | ||
} else { | ||
setFailure("onPairingComplete failure") | ||
} | ||
} | ||
|
||
override fun runCommand() { | ||
currentCommissioner() | ||
.establishPaseConnection( | ||
getNodeId(), | ||
getRemoteAddr().getHostAddress(), | ||
getRemotePort(), | ||
getSetupPINCode() | ||
) | ||
currentCommissioner().setCompletionListener(this) | ||
waitCompleteMs(getTimeoutMillis()) | ||
} | ||
} |
30 changes: 0 additions & 30 deletions
30
...troller/java/src/com/matter/controller/commands/pairing/PairAlreadyDiscoveredCommand.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
...ontroller/java/src/com/matter/controller/commands/pairing/PairAlreadyDiscoveredCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.matter.controller.commands.pairing | ||
|
||
import chip.devicecontroller.ChipDeviceController | ||
import com.matter.controller.commands.common.CredentialsIssuer | ||
|
||
class PairAlreadyDiscoveredCommand( | ||
controller: ChipDeviceController, credsIssue: CredentialsIssuer? | ||
) : PairingCommand( | ||
controller, | ||
"already-discovered", | ||
PairingModeType.ALREADY_DISCOVERED, | ||
PairingNetworkType.NONE, | ||
credsIssue | ||
) { | ||
override fun runCommand() { | ||
currentCommissioner() | ||
.pairDeviceWithAddress( | ||
getNodeId(), | ||
getRemoteAddr().getHostAddress(), | ||
getRemotePort(), | ||
getDiscriminator(), | ||
getSetupPINCode(), | ||
null | ||
) | ||
currentCommissioner().setCompletionListener(this) | ||
waitCompleteMs(getTimeoutMillis()) | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
...va-matter-controller/java/src/com/matter/controller/commands/pairing/PairCodeCommand.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.