Author Topic: Necessity to Pair LE Devices in current Win10  (Read 20747 times)

Offline sommerat

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Necessity to Pair LE Devices in current Win10
« on: January 27, 2020, 03:40:11 PM »
As read in your description to BLE with Microsoft Bluetooth Drivers (https://www.btframework.com/ble.htm)
On Windows 10 1703 and above you do not need to pair with your device manually. You can discover nearby Bluetooth LE device using in-app discovering.

I am on Windows 10 Version 1903 and I cannot find my BLE device without pairing in Windows nor read/write to an already known address after GattClient Connect.
After pairing/bonding in Windows, both actions perform as expected.

I tried to pair an unpaired BLE with wcl Functions but I get different error messages in OnAuthenticationCompleted Event:
...but I forgot to write them all down. I think it was amongst others
WCL_E_BLUETOOTH_DRIVER_NOT_AVAILABLE
WCL_E_BLUETOOTH_CANCELLED_BY_USER if I Connect before Completed Event fires

« Last Edit: January 27, 2020, 03:47:55 PM by sommerat »

Offline sommerat

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Necessity to Pair LE Devices in current Win10
« Reply #1 on: January 27, 2020, 03:51:00 PM »
forgot to mention:
we tried with 7.7.11.0 but not with a version prior to that.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Necessity to Pair LE Devices in current Win10
« Reply #2 on: January 27, 2020, 08:50:29 PM »
Hello,

1. Try to run Beacons demo to see if your device is discoverable.
2. Make sure that there is no any thrid party Bluetooth drivers installed (this is usually the problem).

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Necessity to Pair LE Devices in current Win10
« Reply #3 on: January 27, 2020, 10:13:00 PM »
By the way how do you test pairing?

Offline sommerat

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Necessity to Pair LE Devices in current Win10
« Reply #4 on: January 29, 2020, 09:56:29 AM »
Hi again,

With unpaired/unbonded BLE device:
Beacons Demo shows some frames from our BLE device in Monitoring; the Name, the Service UUID, a short uuid, ....
Re-Testing Discovery today it found the BLE device too - must have been bad karma the other day.
Still unpaired/unbonded:
Connect works, gettings services and getting characteristics from the specific service works.
Subscribe to an IsIndicatable characteristic returns no error.
But the WriteClientConfiguration returns a WCL_E_BLUETOOTH_LE_INSUFFICIENT_AUTHENTICATION
Writing to a IsWritable characteristic also returns 0x00051004

Code: [Select]
if (m_creditTx.IsIndicatable)
{
    success = m_client.Subscribe(m_creditTx);
    success = m_client.WriteClientConfiguration(m_creditTx, true, wclGattOperationFlag.goNone, wclGattProtectionLevel.plNone);
    if (success != wclErrors.WCL_E_SUCCESS)
    {
         throw new Exception();
    }
}

When the device is paired in Windows - there is no PIN no Passphrase no nothing - the above code works like a charm.


For your other question regarding pairing:
I am using the same procedure as for classic devices except for one difference.
Registering all Events in the Manager and call RemotePair. Connect the wclRfCommClient and wait for the Events to authenticate the device and check the Error in OnAuthenticationCompleted.
For BLE I need to wait prior to Connect the wclGattClient because the Connect aborts the process; but the Error in OnAuthenticationCompleted is mostly WCL_E_BLUETOOTH_LE_AUTH_REJECTED_BY_HANDLER

« Last Edit: January 29, 2020, 10:00:59 AM by sommerat »

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Necessity to Pair LE Devices in current Win10
« Reply #5 on: January 29, 2020, 12:39:00 PM »
Try BluetoothManager demo application. Unpair your device first. In the demo app in discovering type select BLE. Then discover your device, select it and click Pair. What is the result?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Necessity to Pair LE Devices in current Win10
« Reply #6 on: January 29, 2020, 01:09:24 PM »
Also please check how your device detected during discovering in BluetoothManager: is it BLE, Mixed or Classic?

Offline sommerat

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Necessity to Pair LE Devices in current Win10
« Reply #7 on: January 29, 2020, 01:51:01 PM »
it is BLE

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Necessity to Pair LE Devices in current Win10
« Reply #8 on: January 29, 2020, 02:26:20 PM »
Ok, that is good.

Now please, try BluetoothManager demo application. Unpair your device first. In the demo app in discovering type select BLE. Then discover your device, select it and click Pair. What is the result?

Offline sommerat

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Necessity to Pair LE Devices in current Win10
« Reply #9 on: January 29, 2020, 06:13:42 PM »
It seems to be working with the BluetoothManager demo.
I will compare the pairing process in the demo to the one in our application to find the differences.

Thanks for the help so far. I will post the solution.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Necessity to Pair LE Devices in current Win10
« Reply #10 on: January 29, 2020, 08:48:51 PM »
I think it is because you forget to handle wclBluetoothManagerConfirm event of wclBluetoothRadio object. It is used for "Just works" pairing.

Offline sommerat

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Necessity to Pair LE Devices in current Win10
« Reply #11 on: January 30, 2020, 12:54:56 PM »
Hi Mike,

You were right, there were several Events missing that are necessary for this type of BLE communication (Terminal IO protocol):
Code: [Select]
OnProtectionLevelRequest
Code: [Select]
OnIoCapabilityRequest
with out values set to
Code: [Select]
            Mitm = wclBluetoothMitmProtection.mitmProtectionRequiredBonding;
            IoCapability = wclBluetoothIoCapability.iocapDisplayYesNo;
and finally the
Code: [Select]
OnConfirm

Thanks for the direction where to search for the solution!

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Necessity to Pair LE Devices in current Win10
« Reply #12 on: January 30, 2020, 01:13:34 PM »
You are welcome!

 

Sitemap 1 2 3 4 5 6 7