Skip to content

Autodetection if NimBLE-Arduino v1 or v2 is used #1047

@vovagorodok

Description

@vovagorodok

I'm working on automatic BLE library detection in ArduinoBleOTA library https://github.com/vovagorodok/ArduinoBleOTA/blob/main/src/BleOtaDefines.h

#if __has_include("ArduinoBLE.h")
    #include <ArduinoBLE.h>
    #define BLE_OTA_BLE_LIB_ARDUINO_BLE
    #define BLE_OTA_LIB_ARDUINO_BLE
#elif __has_include("NimBLEDevice.h")
    #include <NimBLEDevice.h>
    #define BLE_OTA_BLE_LIB_NIM_BLE_ARDUINO
    #define BLE_OTA_LIB_NIM_BLE_ARDUINO
#elif defined(ARDUINO_ARCH_ESP32)
    #include <BLEDevice.h>
    #define BLE_OTA_BLE_LIB_ESP32
    #define BLE_OTA_LIB_ESP32
#else
    #error "Unsupported BLE library. Consider ArduinoBLE or NimBLE-Arduino."
#endif

What is the best way to detect if NimBLE-Arduino v1 or v2 is used? Here is some macro that define library version? Or some files that are not in v1 and are in v2 (and will be available all the time)?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions