-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Android SDK parse manual code fail #25477
Comments
|
we want to provide two ways to users to connect the the matter device : scan a barcode or input the 11/21 digits manual code . As you say , we can not provide the input-method to users , right ? (Maybe the 21 digits code can parse 1018? but I don't know how to get it) |
You cannot get "1018" out of any manual code. The 21-digit version includes a VID+PID, but still has a short discriminator. Whatever code is doing discriminator matching needs to track whether it has a long or short discriminator. If it has a short one, it needs to only compare it to the top 4 bits of the device-advertised discriminator. |
We need discriminator 1018 to pair the device with bluetooth . If we use discriminator 768 , it will connect fail . So we can not parse a long discriminator which can be used on pairing with bluetooth from 11digits , right ? |
The core code certainly does not need that; both chip-tool on Linux and Mac and the Darwin framework code can pair over bluetooth using short discriminators. It sounds like the real problem here is that
and indeed the code there makes not sense for short discriminators. But that's a not a problem with parsing of the manual code. It's a bug in the BLE bits on Android.
You cannot parse a long discriminator from an 11-digit from numeric code. You can pair with a short discriminator on non-buggy platforms, but it's broken on Android, apparently. |
How about iOS platform ? My iOS colleague say that he
How about iOS platform ? My iOS colleague say that he meet the same issue . By the way , I want to try revert the commit on "Fix handling of short discriminator in Linux BLE scan. (#21187)" |
I will try it for the short discriminator. version=0, vendorId=0, productId=0, discriminator=768, setupPinCode=22884930, commissioningFlow=0, optionalQrCodeInfoMap={}, discoveryCapabilities=[], ipAddress=null the setupPinCode is wrong ,too |
@luobosu version=0, vendorId=4488, productId=257, discriminator=1018, setupPinCode=22884930, commissioningFlow=0, optionalQrCodeInfoMap={}, discoveryCapabilities=[BLE], ipAddress=null version=0, vendorId=0, productId=0, discriminator=768, setupPinCode=22884930, commissioningFlow=0, optionalQrCodeInfoMap={}, discoveryCapabilities=[], ipAddress=null |
oh ! Sorry , I was wrong , it is the same . |
It is OK now , thanks a lot ! @joonhaengHeo when I init the chipdevicecontroller , it will crash . Should I replace the vendor id from 0 to VENDOR_ID = 0xFFF4 (default value on sample) ? this is the crash information:
|
This all works fine on iOS if you use the APIs correctly. MTRSetupPayload on iOS has a |
@luobosu connectedhomeip/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/ChipClient.kt Line 50 in 3889a44
This issue occurs because the Controller Vendor ID is not set. |
ok , my colleague will follow it , thanks ~ |
yes , it is this code . But I can only get the verdorId=0 from the 11 digists manual pairing code . As you see : When I use the default vendorId = 0xFFF4 , it will work ok: My problem is that should I use 0xFFF4 to init the ChipDeviceController object when I can only get vendorId = 0 from the 11 digists? |
@luobosu I am facing the same Issue. Have you managed to resolve this for manual codes? The manual code for an Esp32 device built off the esp-matter works with the android demo. However, another device supplied by another manufacturer doesn't. I have noticed that the discriminator obtained from the QR code ( @joonhaengHeo for the device with different discriminators, the device name for the device returned by val device = bluetoothManager.getBluetoothDevice(requireContext(), deviceInfo.discriminator, deviceInfo.isShortDiscriminator) has the name MATTER-3414 (even when using the discriminator |
@edWin-m I have resolved it using this code . But I do not know about Esp32 demo , sorry about that. |
@luobosu I am sure I have the same code, but somehow this issue still persists. Besides passing the generated service mask into the scan filter as shown below is there another way to use this mask? val serviceData = getServiceData(discriminator)
val serviceDataMask = getServiceDataMask(isShortDiscriminator)
val scanFilter =
ScanFilter.Builder()
.setServiceData(ParcelUuid(UUID.fromString(CHIP_UUID)), serviceData, serviceDataMask)
.build() |
@edWin-m 3414 -> 0xD56 In the case of Manual Pairing Code, since Short Discriminator is used, only 4 bits are valid. |
@joonhaengHeo thanks for the reply. However, this leads me right back to the beginning. If the issue with the short discriminator was fixed as you hinted below, why does the device still fail to commission when using the manual code? Is it something that I need to discuss with the manufacturer?
|
Reproduction steps
1.scan a bar code and get the raw text :
MT:YZ7A0U.R02T.163EI00
2.get a setup payload by sdk method :
val payloadParser = SetupPayloadParser()
val payload = payloadParser.parseQrCode(“MT:YZ7A0U.R02T.163EI00”)
and I can see the attibutes on the payload:
version=0, vendorId=4488, productId=257, discriminator=1018, setupPinCode=22884930, commissioningFlow=0, optionalQrCodeInfoMap={}, discoveryCapabilities=[BLE], ipAddress=null
3.get a manul code of this payload:
String entryCode = payloadParser.getManualEntryCodeFromPayload(setupPayload)
4.get a setup payload by sdk method :
setupCodeParser.parseManualEntryCode(entryCode)
and I can see the attibutes on the payload:
version=0, vendorId=0, productId=0, discriminator=768, setupPinCode=22884930, commissioningFlow=0, optionalQrCodeInfoMap={}, discoveryCapabilities=[], ipAddress=null
this discriminator is not match to the discriminator on the step2 !!
Bug prevalence
always
GitHub hash of the SDK that was being used
TAG 1.0.0.2
Platform
android
Platform Version(s)
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: