Author Topic: Connecting GATT Client After Pairing  (Read 14132 times)

Offline briandunham

  • Newbie
  • *
  • Posts: 29
  • Karma: 0
Connecting GATT Client After Pairing
« on: February 09, 2022, 11:33:42 PM »
Hi,

I've been referencing the GattClient Demo project. I first pair the device successfully then I try connecting the GATT client, but I get error code 0x005105C (WCL_E_BLUETOOTH_LE_DEVICE_NOT_FOUND). However, if I skip the pairing step and just directly connect the GATT client, that it works fine. Is there something about pairing before connecting the GATT client that breaks it? Is pairing first necessary?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Connecting GATT Client After Pairing
« Reply #1 on: February 10, 2022, 12:28:11 AM »
Hi,

It is known issue(s). Theer are 2 reasons:

1. If your device is mixed (supports both Classic and LE) pairing may be executed with it as with Classic instead of LE.
2. Device changes MAC after pairing.

Any ways. The solution is to pair after connecting: https://github.com/btframework/GattAuth

And of course if yuor device does not require pairing it is better to do not pair with it.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Connecting GATT Client After Pairing
« Reply #2 on: February 10, 2022, 12:36:14 AM »
Sorry, I forgot to ask, if possible, send more details about your device and how you pair/connect with it to support@btframework.com so we can check it on our side and provide more detailed answer (or fix the problem if it is a bug).

Thank you.

Offline briandunham

  • Newbie
  • *
  • Posts: 29
  • Karma: 0
Re: Connecting GATT Client After Pairing
« Reply #3 on: February 10, 2022, 09:50:47 PM »
Thank you, pairing after connecting is the solution. But that was hidden by an additional problem of the device changing it's MAC I believe.

So for this current stage of development, I'm using a smartphone app to test with while the development on our hardware device catches up. I'm using a Galaxy S9 smartphone with the nRF Connect app. The app allows for building advertisements and has a configurable GATT server. However, the app uses random addresses and it likes to change it's MAC after certain events. I think this is causing issues in addition to your solution of pairing after connecting.

But I'm now aware of the problem and I can figure out a workaround. Thanks!

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Connecting GATT Client After Pairing
« Reply #4 on: February 10, 2022, 09:55:58 PM »
You are very welcome. Great that you got it working.

 

Sitemap 1 2 3 4 5 6 7