This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Connection handle 16 and 19

Hi,

I get BLE_GATTS_EVT_WRITE with connection handles 16 and 19 which seems to be some defaults of the softdevice.

Can you explain the source and usage of these connection handles?

Thanks,

Daniel

Parents Reply
  • Hung hi,

    I'm using the softdevice directly and using Web Bluetooth on the phone. When calling sd_ble_evt_get I always get a BLE_GATTS_EVT_WRITE as gatts_evt right after connections and disconnection. This is ok but it is a phenomena that is under the hood for me and I would like to understand it rather than just observing it. I noticed that I must wait for it to happen before further communicating (e.g. indicating or notifying anything). 

    Best, Daniel

Children
  • Hi Daniel, 

    Please give more information. What's the application is about, how they are supposed to work  ?

    It's normal that you get a BLE_GATTS_EVT_WRITE  before you can send notification or indication. It's because the client need to enable notification/indication by a write request or write command. 

    What strange here is what you described as you received connection handle 16 or 19. 

    Please try capturing a sniffer trace. 

  • Hung hi,

    I'm using Web Bluetooth (https://webbluetoothcg.github.io/web-bluetooth/). I also use Softdevice directly without additional libraries since I couldn't get consistent behaviour across devices that I could understand using the libraries that are in the examples. This has been a frustrating experience since examples are a poor substitute to a good documentation. My program works fine and consistently now but I obviously haven't tested it on all the phones out there. Since I don't have access to the source code of the Softdevice, there are still some things I don't understand and I cannot resolve myself by reading your code. I would like to understand which services that I haven't explicitly defined are being communicated by the Softdevice.

    Thanks,

    Daniel

  • I would strongly suggest to capture a sniffer trace to fully understand what happened over the air. 

    We don't provide source code of the softdevice but what you can do is to look at the message sequence charts here or here . They would explain most of the behaviors of the softdevice and how you should react to the event from the softdevice. 

    Connection handle is the handle that identify the connection. Usually when you have only one connection with a single peer the connection handle should be 0. 

Related