Maximum length of BT service characteristic value

Posted on
  • I'm trying to put more than 22 characters into a bluetooth service characteristic value. I can see from targets/esp32/BLE/esp32_gatts_func.h that the maximum value is defined as 22 however this value is never referred to again in code (at least I can't see where it is). When I try to fit a string of more than 22 characters it repeats 22 characters of the longer value.

    Anyone had any luck presenting a value longer than 22 characters?

    I'm using the Device Name org.bluetooth.characteristic.gap.device_­name 0x2A00 characteristic with code something like:

    -- snip
    
    0x2A00 : {	
    	value: "123456789abcdefghijklmnopqrstuvwxyz",
    	maxLen : 127,  //this has no effect
    	readable : true, 
    	description: "123456789abcdefghijklmnopqrstuvwxyz"
    }
    
    -- snip
    

    p.s. Loving Espruino, it's fantastic. Keep up the excellent work.

  • ESP32 uses some firmware already on chip (ROM) and some precompiled libs for BT
    I'm pretty sure, 22 limit is hidden there
    In latest ESP-IDF- versions, some functions from ROM are moved to flash. This is one reason why size of binaries increased that much.
    Not helpful for you (sorry), but at least you know why we have these, and other, limits

  • Ah, that explains it. That's a pity... Thanks for the info!

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

Maximum length of BT service characteristic value

Posted by Avatar for JPep @JPep

Actions