32feet icon indicating copy to clipboard operation
32feet copied to clipboard

BluetoothSecurity.PairRequest issue in InTheHand.Net.Bluetooth V4

Open juliokele opened this issue 4 years ago • 6 comments

After BluetoothSecurity.PairRequest with result=true, paired device in Windows10 Bluetoothmanager not shown. Aftert that: BluetoothSecurity.RemoveDevice result = false. Pairing with BluetoothAuthenticationMethod.NumericComparison, NumericComparison on target device not shown.

juliokele avatar Oct 05 '20 09:10 juliokele

any news on this?

juliokele avatar Oct 15 '20 08:10 juliokele

For NumericComparison the handler should be echoing back whatever code was received and so automatically approving it. I'll need to run some more tests. What type of device are you pairing with?

peterfoot avatar Oct 15 '20 08:10 peterfoot

in V3 mostly works, but not always, process hangs infinitely at this point: https://github.com/inthehand/32feet/blob/a3d464e7825f7ed9b458bdcc5755c2fe6bf2ea00/Legacy/InTheHand.Net.Personal/Net.Bluetooth.Msft/WindowsBluetoothSecurity.cs#L282

Thats why i switched to V4...

Device is a custom device with ESP32 Chip on + SPP_INITIATOR_DEMO firmware. Pairing with Windows 10 (Version: 2004, Build: 19041.572) built in Bluetooth Manager works without any problems

juliokele avatar Oct 15 '20 09:10 juliokele

Hi,

Interested to know if this issue is fixed in 4.20. I am trying to do Pairing in an ASP.Net Core application and Pairing Pin dialog does not appear. It is working fine in InTheHand.Net.Personal 3.5. Using two laptops for pairing.

isPaired = BluetoothSecurity.PairRequest(deviceInfo.DeviceAddress, "123456"); <= Pin dialog works fine in old library but not in latest one.

BluetoothClient client = new BluetoothClient If I try to set client.Authenticate = true it throws null exception.

Not sure if I am missing any steps here or the issue listed here is same as what I am getting.

Any help is much appreciated.

subodhpathak avatar Aug 26 '21 20:08 subodhpathak

I am seeing the same on Android (12) and MAUI.

IReadOnlyCollection<BluetoothDeviceInfo> bluetoothDeviceInfos = bluetoothClient.DiscoverDevices(); BluetoothDeviceInfo frameworkDevice = bluetoothDeviceInfos.FirstOrDefault(x => x.DeviceAddress.ToString("C") == MACAddress); if (frameworkDevice == null) { await Shell.Current.DisplayAlert("Pair", "Device is not available", AppResources.Close); return; } bool paired = true; if (!frameworkDevice.Authenticated) { paired = BluetoothSecurity.PairRequest(frameworkDevice.DeviceAddress, Pin); }

PairRequest return true, but the device is not paired. Same call with Pin=null does not trigger the Pairing Pin dialog. I have the following Bluetooth permission set for the app:

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

JkPersson avatar Aug 22 '22 07:08 JkPersson

Same issue here !

With MAUI .Net 6.0 and Android 12 SKQ1.210908.001 on MUI 13.0.11 Trying to pair a HC-06 device.

It's working to pairing the device manually.

Pyroa avatar Jan 01 '23 18:01 Pyroa