From 59447891dbee90044d61efede48cf3298f093f42 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Fri, 30 Jun 2023 08:44:41 -0700 Subject: [PATCH] Allow device does not support any method for rendezvous (#27557) --- .../java/src/chip/onboardingpayload/OnboardingPayload.kt | 4 ++-- .../QRCodeBasicOnboardingPayloadGenerator.kt | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt b/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt index 9005e5b85f9b22..a82ee3f8c8d443 100644 --- a/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt +++ b/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt @@ -182,8 +182,8 @@ class OnboardingPayload( DiscoveryCapability.SOFT_AP ) - // If discoveryCapabilities is empty or discoveryCapabilities contains values outside of allValid - if (discoveryCapabilities.isEmpty() || discoveryCapabilities.any { it !in allValid }) { + // If discoveryCapabilities is not empty and discoveryCapabilities contains values outside of allValid + if (!discoveryCapabilities.isEmpty() && discoveryCapabilities.any { it !in allValid }) { return false } diff --git a/src/controller/java/src/chip/onboardingpayload/QRCodeBasicOnboardingPayloadGenerator.kt b/src/controller/java/src/chip/onboardingpayload/QRCodeBasicOnboardingPayloadGenerator.kt index 8429e4b0388689..7772bc57a0234a 100644 --- a/src/controller/java/src/chip/onboardingpayload/QRCodeBasicOnboardingPayloadGenerator.kt +++ b/src/controller/java/src/chip/onboardingpayload/QRCodeBasicOnboardingPayloadGenerator.kt @@ -90,10 +90,6 @@ private fun generateBitSet( populateBits(bits, offset, payload.vendorId.toLong(), kVendorIDFieldLengthInBits, kTotalPayloadDataSizeInBits) populateBits(bits, offset, payload.productId.toLong(), kProductIDFieldLengthInBits, kTotalPayloadDataSizeInBits) populateBits(bits, offset, payload.commissioningFlow.toLong(), kCommissioningFlowFieldLengthInBits, kTotalPayloadDataSizeInBits) - - if (payload.discoveryCapabilities.isEmpty()) - throw OnboardingPayloadException("Invalid argument") - populateBits(bits, offset, payload.getRendezvousInformation(), kRendezvousInfoFieldLengthInBits, kTotalPayloadDataSizeInBits) populateBits(bits, offset, payload.discriminator.toLong(), kPayloadDiscriminatorFieldLengthInBits, kTotalPayloadDataSizeInBits) populateBits(bits, offset, payload.setupPinCode, kSetupPINCodeFieldLengthInBits, kTotalPayloadDataSizeInBits)