Skip to content

Commit

Permalink
Allow device does not support any method for rendezvous (#27557)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed Feb 23, 2024
1 parent bc2d222 commit 04006f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 04006f2

Please sign in to comment.