Bluetooth, define descriptors for characteristics ?

Posted on
  • Bluetooth supports descriptors for characteristics.
    In bluetooth.c for nrf is this:

        char_md.p_char_pf                = NULL;
        char_md.p_user_desc_md           = NULL;
        char_md.p_cccd_md                = NULL;
        char_md.p_sccd_md                = NULL; 
    

    I can't find a way where they are used.
    Can descriptors be defined in javascript ?
    If yes,is this the right place to search for descriptors ?

  • As I understand it (I could be wrong!):

    A characteristic on a device has a handle - it's basically a number (a byte value?) which is the index of the characteristic in that device.

    Then there's the cccd - it's another handle that is used for setting flags to do with that characteristic. Specifically Espruino uses that handle to write to a device and ask for notifications - it's done here: jswrap_nrf_BluetoothRemoteGATTCharacteri­stic_startNotifications

    So Espruino stores those two as handle_cccd and handle_value (the actual characteristic) on BluetoothRemoteGATTCharacteristic. I think that should work for ESP32 as well.

    I'm not sure about the others if I'm honest, but I think you could probably ignore them safely for now.

  • Well, the only thing I know is, in a sample there is this:

    • - Descriptor: Characteristic User Description
    • - Descriptor: Client Characteristic Configuration
    • - Descriptor: Characteristic Presentation Format
      Found some more information in O'REILLY Getting started with Bluetooth Low Energy.
      To be honest, no. of questionmarks in my face is more than before.
      I'll try to ignore them for now :-)
  • Client Characteristic Configuration would be the cccd I was talking about. I'm not 100% sure about the others - as you say, I'd ignore them until you think you need them :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Bluetooth, define descriptors for characteristics ?

Posted by Avatar for JumJum @JumJum

Actions