ESP32 and Arduino

Hi there,

I was using an ESP32 with Arduino framework and the BLE libraries:

#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>

The problem is that I want to advertise more than 8 services, and as I’m using Arduino framework I don’t have access to this macro in sdkconfig.h:

#define CONFIG_BT_GATT_MAX_SR_PROFILES 8

My first question is how can I change this?

I have never used ESP-IDF framework, I tried combining both frameworks in Platformio like this:

framework = arduino, espidf

The first error is with all the BLE configuration, as an example:

#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
#include <ble_uuids.h>

class MyBLEProfile
{
public:
MyBLEProfile() {}

BLEService *deviceService;

… code continues

Here I have the first error:

src/BLE_profile.h:20:5: error: ‘BLEService’ does not name a type
BLEService *deviceService;

Any suggestion? Mainly I just want to use more than 8 services, but it would be also interesting to be able to use ESP-IDF framework.

Thank you.

Yes exactly like this.

Can you clone platform-espressif32/examples/espidf-arduino-blink at develop · platformio/platform-espressif32 · GitHub as a base project and try to make the changes from there?

Note that you can get the base config from esp32-arduino-lib-builder/configs/defconfig.esp32 at master · espressif/esp32-arduino-lib-builder · GitHub.

So the first thing I notice when cloning the project is that the sdkconfig on my project has way more configurations. I found out that BLEDevice.h needs CONFIG_BLUEDROID_ENABLED to be enabled, this option is actually deprecated, maybe that’s why I can’t use it in the cloned project “espidf-arduino-blink”, I checked the sdkconfig.h of this project and I don’t find it. I also don’t find CONFIG_BT_GATT_MAX_SR_PROFILES.

Yeah… I think you wanna copy https://raw.githubusercontent.com/espressif/arduino-esp32/72c41d09538663ebef80d29eb986cd5bc3395c2d/tools/sdk/esp32/sdkconfig as your starting sdkconfig after all and modify it. Delete all previous sdkconfig files in the project before that.