Author Topic: GATT Server functionality related questions  (Read 20295 times)

Offline exsurgo_ankit

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
GATT Server functionality related questions
« on: May 05, 2022, 05:07:00 AM »
Hello

I am building a hardware emulator on windows. Our hardware acts as a Bluetooth LE GATT server and connects to a Windows app which acts as a GATT client and works fine.
We are using version 7.10.1.0.

Now I working on making the windows machine act as a GATT server. I am able to advertise and accept a connection, get notified on writes and subscriptions. But I can't find the following:
1. An event to notify that a GATT client has connected.
2. Ability to read and change GAP connection parameters to change min and max connection intervals. We need to set a short interval as we transmit a lot of data.

We really need to update GAP parameters to enable proper hardware emulation.

Please advice how we can achieve this.

Regards
Ankit

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: GATT Server functionality related questions
« Reply #1 on: May 05, 2022, 06:20:12 AM »
Hello,

1. Unfortunately on Windows there is no notification about connection.disconnection for GATT server. We were looking to find a workaround but it looks not possible.
2. It does not look possible to change connection parameters for GATT server but we will look onit deeper. However, if that can be possible, it will work on Windows 11 only.

Offline exsurgo_ankit

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: GATT Server functionality related questions
« Reply #2 on: May 06, 2022, 12:37:46 AM »
Hello Mike,

Thank you for a response. I tried to dig further and time the operations.

I found that the slowest bit is this call
wclGattLocalCharacteristic.Notify(subscriberAddr, dataToWrite)
It takes 45 milliseconds.

Can I assume that with Bluetooth 5.0 compliant hardware, Data Length Extensions would be enabled? I am trying to write more than 100 bytes in a single notification.

Do note that when the same PC is a GATT Client, it is able to receive the packets with more than 100 bytes just fine.

Regards

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: GATT Server functionality related questions
« Reply #3 on: May 06, 2022, 12:45:33 AM »
Windows 10 claims to support BT 5.0 Data Length Extensions.

Offline exsurgo_ankit

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: GATT Server functionality related questions
« Reply #4 on: May 06, 2022, 12:54:13 AM »
I believe so too. But why does wclGattLocalCharacteristic.Notify take 45 milliseconds then?
That is the bottle neck in our application at the moment.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: GATT Server functionality related questions
« Reply #5 on: May 06, 2022, 01:00:51 AM »
Because it has to copy data to the driver level. First, the function has to find device object  by its MAC, then it has to send data to WinRT API (which is COM and COM is not faster way) using WinRT interface (it can't pass just a pointer to the data, it must copy data to the IBuffer object). And then WinRT passes data to the driver by calling DeviceIoControl.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: GATT Server functionality related questions
« Reply #6 on: May 06, 2022, 01:05:38 AM »
By the way: is your characteristic notifiable or indicatable?

Offline exsurgo_ankit

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: GATT Server functionality related questions
« Reply #7 on: May 06, 2022, 01:39:31 AM »
Hello Mike, 

I have it to be notifiable.
Params.Props = wclGattLocalCharacteristicProperty.cpNotifiable;

Regarding your comment on copying the data to driver level. I understand all of that, however, when the similar copy happens when the driver is receiving the bytes, we don't see the delay. We use your framework to receive 200 bytes in one notification of the hardware, every 20 to 30 milliseconds and don't see this delay.

So why does a write cause this delay? To clarify my question, if the write takes 45 milli seconds, then even with Widnows 11 and the latest version of the BT Framework, a connection interval or 40 milliseconds is not possible.



Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: GATT Server functionality related questions
« Reply #8 on: May 06, 2022, 01:59:32 AM »
You forgot that Windows is not real-time OS. It will never be precise in any timing, especialy on user level.

Offline exsurgo_ankit

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: GATT Server functionality related questions
« Reply #9 on: May 06, 2022, 02:05:09 AM »
Hello Mike,

Agree with Windows not being RTOS as well. I am just trying to point out that there is a delay which can't be explained fully.

It could be either the inability to use the Data Length Extensions on the write, causing the packet tx be split into smaller chunks of 20 bytes.

Or some other issue causing this delay.

I tried writing 220 bytes and it took 53 milii seconds. This means I am able to double data without a huge impact of the write function time delay.

Please investigate at your end, why Notify takes this long and whether changing connection parameters in windows 11 reduces this delay to something negligible, which is what we observe as a GATT client.

Regards

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: GATT Server functionality related questions
« Reply #10 on: May 06, 2022, 02:14:32 AM »
Unfortunately we did not develop MS Bluetooth drivers and can't control how it works internally. All we can do is try to find a way (if possible) to change connection parameters for the GATT server. However, to be able to change connection parameter it is required to get some internal LEDevice object. That is possible only after device subscribed for changes notifications. Because there is no other way to get connected devices list for GATT server.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: GATT Server functionality related questions
« Reply #11 on: May 06, 2022, 11:25:33 AM »
Small update: It looks we found a way to be notified about connected/disconnected LE device for GATT server. I am not 100% sure we will be able to implement it but at least we see the possible way. I will keep you updated.

Offline exsurgo_ankit

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: GATT Server functionality related questions
« Reply #12 on: May 08, 2022, 10:54:33 PM »
Hello Mike,

Thank you for the update.

 

Sitemap 1 2 3 4 5 6 7