h2zero / NimBLE-Arduino

A fork of the NimBLE library structured for compilation with Arduino, for use with ESP32, nRF5x.
https://h2zero.github.io/NimBLE-Arduino/
Apache License 2.0
672 stars 138 forks source link

example BT5.0 nimble extended server not working on ESP32-C3 #534

Closed ZZZOEFFF closed 1 month ago

ZZZOEFFF commented 1 year ago

Hi, had issues moving my nimble project from 'standard' BLE to the more advanced bluetooth 5.0. The standard NimBLE version compiles fine so my Arduino setup is correct, also rund fine on HW. So I just opened the "nimBLE extended server" example and tried to compile it but it fails (I have added nimconfig.h and NimBLEDevice.h)

Here is the output log: \Arduino\NimBLE_extended_server\NimBLE_extended_server.ino:59:66: error: expected class-name before '{' token class advertisingCallbacks: public NimBLEExtAdvertisingCallbacks { ^ \Arduino\NimBLE_extended_server\NimBLE_extended_server.ino:60:20: error: 'NimBLEExtAdvertising' has not been declared void onStopped(NimBLEExtAdvertising pAdv, int reason, uint8_t inst_id) { ^~~~~~~~ \Arduino\NimBLE_extended_server\NimBLE_extended_server.ino: In function 'void setup()': \Arduino\NimBLE_extended_server\NimBLE_extended_server.ino:102:5: error: 'NimBLEExtAdvertisement' was not declared in this scope NimBLEExtAdvertisement extAdv(primaryPhy, secondaryPhy); ^~~~~~ \Arduino\NimBLE_extended_server\NimBLE_extended_server.ino:102:5: note: suggested alternative: 'NimBLEAdvertising' NimBLEExtAdvertisement extAdv(primaryPhy, secondaryPhy); ^~~~~~ NimBLEAdvertising \Arduino\NimBLE_extended_server\NimBLE_extended_server.ino:105:5: error: 'extAdv' was not declared in this scope extAdv.setConnectable(true); ^~ \Arduino\NimBLE_extended_server\NimBLE_extended_server.ino:105:5: note: suggested alternative: 'execv' extAdv.setConnectable(true); ^~ execv \Arduino\NimBLE_extended_server\NimBLE_extended_server.ino:121:5: error: 'NimBLEExtAdvertising' was not declared in this scope NimBLEExtAdvertising pAdvertising = NimBLEDevice::getAdvertising(); ^~~~~~~~ \Arduino\NimBLE_extended_server\NimBLE_extended_server.ino:121:5: note: suggested alternative: 'NimBLEAdvertising' NimBLEExtAdvertising pAdvertising = NimBLEDevice::getAdvertising(); ^~~~~~~~ NimBLEAdvertising \Arduino\NimBLE_extended_server\NimBLE_extended_server.ino:121:27: error: 'pAdvertising' was not declared in this scope NimBLEExtAdvertising pAdvertising = NimBLEDevice::getAdvertising(); ^~~~ \Arduino\NimBLE_extended_server\NimBLE_extended_server.ino:121:27: note: suggested alternative: 'BLEAdvertising' NimBLEExtAdvertising* pAdvertising = NimBLEDevice::getAdvertising(); ^~~~ BLEAdvertising

exit status 1

Compilation error: expected class-name before '{' token

h2zero commented 1 year ago

You need to enable BT5 as explained here https://github.com/h2zero/NimBLE-Arduino/blob/release/1.4/docs/Bluetooth%205%20features.md