CENTRAL_LINK_COUNT, ifdef NRF52

Posted on
  • First of all before returning back to business, a happy new year !!
    Hope you enjoyed vacation with your family.
    My vacation will start in less than 2 weeks, so let me write some lines before.

    Started porting of GATT Client for ESP32 and found a lot usage of CENTRAL_LINK_COUNT
    What does CENTRAL_LINK_COUNT stand for ? Is it something like "GATT_CLIENT_ENABLED" ?

    In wrapper often is an ifdef NRF52. First I expanded ifdef to support several definitions. This way I could have "ifdef" : "NRF52,ESP32"
    But then I walked into the trap of having sd_ble-functions, which are not available for ESP32. To bypass this I defined new wrapper, for example for defintion of BluetoothDevice in an ESP32 specific file, where main change is ifdef to ESP32.

    Since major part of source in this new file is copy/paste, this is not my favourite solution. Right now it helps me to go on. Any suggestion, how we should go on for the future ? Should we add some more definitions to bluetooth.h ? Other option would be some ifdefs in core functions, which I would not prefer.

    One more point, for me to understand what sd_ble.functions are doing, is different naming. Looks like for NRF connect is used and for ESP32 it is open. Not a big deal, once you know about it. I wonder if there is a general naming convention.

  • Thanks - you too!

    What does CENTRAL_LINK_COUNT stand for ?

    It's the number of available 'Central' (eg. Espruino connecting to another device) links supported at one time - currently only 1 or 0 is supported - so yes, it's basically just GATT_CLIENT_ENABLED

    "ifdef" : "NRF52,ESP32"

    This sounds like a good plan - if there's something that could be common then I'd add new functions to bluetooth.h, but I think otherwise just having the ifdef inside jswrap_bluetooth.c isn't too bad.

    different naming ... I wonder if there is a general naming convention.

    I doubt it :) I guess to avoid as much confusion as possible I'd stick with the naming that's used for the JS APIs themselves - but I know that may not be the case at the moment :)

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

CENTRAL_LINK_COUNT, ifdef NRF52

Posted by Avatar for JumJum @JumJum

Actions