From 675be4005a7fd0e7bb1234225f64b140c9c235de Mon Sep 17 00:00:00 2001 From: James Swan <122404367+swan-amazon@users.noreply.github.com> Date: Sat, 20 Jul 2024 00:02:50 +0000 Subject: [PATCH] wip: weekend progress --- .../java/com/google/chip/chiptool/CHIPToolActivity.kt | 1 + .../com/google/chip/chiptool/GenericChipDeviceListener.kt | 8 ++++++++ .../chiptool/provisioning/DeviceProvisioningFragment.kt | 8 ++++++++ .../src/chip/devicecontroller/ChipDeviceController.java | 3 +++ .../java/src/matter/controller/MatterController.kt | 4 ++++ 5 files changed, 24 insertions(+) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt index e6b53110f508d4..75353ffa5ea355 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt @@ -124,6 +124,7 @@ class CHIPToolActivity : override fun handleEnhancedSetupFlowClicked() { Toast.makeText(this, "Enhanced Setup Flow", Toast.LENGTH_SHORT).show() + showFragment(DeviceProvisioningFragment.newInstance(deviceInfo!!, null)) } override fun setNetworkType(type: ProvisionNetworkType?) { diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/GenericChipDeviceListener.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/GenericChipDeviceListener.kt index 2eb2a1c77fa042..bc333f3153ee0b 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/GenericChipDeviceListener.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/GenericChipDeviceListener.kt @@ -60,4 +60,12 @@ open class GenericChipDeviceListener : ChipDeviceController.CompletionListener { override fun onICDRegistrationComplete(errorCode: Long, icdDeviceInfo: ICDDeviceInfo) { // No op } + + override fun onTermsAndConditionsRequired() { + // No op + } + + override fun onTermsAndConditionsRequiredComplete(termsAndConditionsAcknowledgements: Int, termsAndConditionsVersion: Int) { + // No op + } } diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt index 97b2576827079a..3466fe4e746c13 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt @@ -314,6 +314,14 @@ class DeviceProvisioningFragment : Fragment() { .show() } } + + override fun onTermsAndConditionsRequired() { + } + + override fun onTermsAndConditionsRequiredComplete(termsAndConditionsAcknowledgements: Int, termsAndConditionsVersion: Int) { + Log.d(TAG, "onTermsAndConditionsRequiredComplete: $termsAndConditionsAcknowledgements, $termsAndConditionsVersion") + deviceController.updateTermsAndConditionsAcknowledgements(termsAndConditionsAcknowledgements, termsAndConditionsVersion) + } } private fun ByteArray.toHex(): String = diff --git a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java index 635e1e4e9bd539..6c235c2a6f8ad2 100644 --- a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java +++ b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java @@ -1847,5 +1847,8 @@ void onReadCommissioningInfo( /** Notifies when the registration flow for the ICD completes. */ void onICDRegistrationComplete(long errorCode, ICDDeviceInfo icdDeviceInfo); + + void onTermsAndConditionsRequired(); + void onTermsAndConditionsRequiredComplete(int termsAndConditionsAcknowledgements, int termsAndConditionsVersion); } } diff --git a/src/controller/java/src/matter/controller/MatterController.kt b/src/controller/java/src/matter/controller/MatterController.kt index 2e4ecb54da1fb9..d474b52fbdd494 100644 --- a/src/controller/java/src/matter/controller/MatterController.kt +++ b/src/controller/java/src/matter/controller/MatterController.kt @@ -59,6 +59,10 @@ interface MatterController : Closeable, InteractionClient { /** Notifies the Commissioner when the OpCSR for the Comissionee is generated. */ fun onOpCSRGenerationComplete(csr: ByteArray) + fun onTermsAndConditionsRequired() + + fun onTermsAndConditionsComplete() + /** * Notifies when the ICD registration information (ICD symmetric key, check-in node ID and * monitored subject) is required.