Skip to content

Adaptation to new NimBLE lib methods. #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: CustomSettings
Choose a base branch
from

Conversation

RobertoHE
Copy link
Contributor

I have updated the method names following the migration guide. You can find it here: https://github.com/h2zero/NimBLE-Arduino/blob/62180ab2bc9c9a8b41f9fb800ea7256e89628a3a/docs/1.x_to2.x_migration_guide.md?plain=1#L132

Please note that these changes have only been compiled without errors and have not been tested with hardware (I haven't any ESP32 now).

This pull request is intended as a hotfix. I will need additional time to update the other transport layers.

@lathoub , could you please review this pull request before it is merged?

Please, add other users to this theat that may be involved with the lib and what they may test with real hardware.

@samspencer5991
Copy link

Will check later this week and report back after hardware testing.

@samspencer5991
Copy link

@RobertoHE
I am getting compilation errors when trying to build. I am using the latest source from here (pulled from GH via PIO and also manually downloading the source and replacing it in the libdeps. This is building with the latest (v2.2.3) NimBLE version. Any thoughts:
image

@samspencer5991
Copy link

@RobertoHE just wondering if you can steer me in the right direction here please

@nforro
Copy link

nforro commented May 15, 2025

Apart from the changes here I also did these:

diff --git a/src/hardware/BLEMIDI_Client_ESP32.h b/src/hardware/BLEMIDI_Client_ESP32.h
index b16dd48..8f2c5dc 100644
--- a/src/hardware/BLEMIDI_Client_ESP32.h
+++ b/src/hardware/BLEMIDI_Client_ESP32.h
@@ -149,7 +149,7 @@ public:
     std::string nameTarget;
 
 protected:
-    void onResult(NimBLEAdvertisedDevice *advertisedDevice)
+    void onResult(const NimBLEAdvertisedDevice *advertisedDevice)
     {
         if (!enableConnection) // not begin() or end()
         {
diff --git a/src/hardware/BLEMIDI_ESP32_NimBLE.h b/src/hardware/BLEMIDI_ESP32_NimBLE.h
index 6914a00..9a4c3d1 100644
--- a/src/hardware/BLEMIDI_ESP32_NimBLE.h
+++ b/src/hardware/BLEMIDI_ESP32_NimBLE.h
@@ -82,13 +82,13 @@ public:
 protected:
     BLEMIDI_ESP32_NimBLE<_Settings> *_bluetoothEsp32 = nullptr;
 
-    void onConnect(BLEServer *)
+    void onConnect(BLEServer *, NimBLEConnInfo &)
     {
         if (_bluetoothEsp32)
             _bluetoothEsp32->connected();
     };
 
-    void onDisconnect(BLEServer *)
+    void onDisconnect(BLEServer *, NimBLEConnInfo &, int)
     {
         if (_bluetoothEsp32)
             _bluetoothEsp32->disconnected();
@@ -107,7 +107,7 @@ public:
 protected:
     BLEMIDI_ESP32_NimBLE<_Settings> *_bluetoothEsp32 = nullptr;
 
-    void onWrite(BLECharacteristic *characteristic)
+    void onWrite(BLECharacteristic *characteristic, NimBLEConnInfo &)
     {
         std::string rxValue = characteristic->getValue();
         if (rxValue.length() > 0)
@@ -173,6 +173,7 @@ bool BLEMIDI_ESP32_NimBLE<_Settings>::begin(const char *deviceName, BLEMIDI_Tran
     _advertising = _server->getAdvertising();
     _advertising->addServiceUUID(service->getUUID());
     _advertising->setAppearance(0x00);
+    _advertising->setName(deviceName);
     _advertising->start();
 
     return true;

Everything seems to be working fine (at least for my use case) on ESP32-C6.

@samspencer5991 I don't think those errors are related to these changes.

@RobertoHE
Copy link
Contributor Author

@samspencer5991 @nforro @lathoub @MicroMidi @jhsa. Please, check it.

@lathoub
Copy link
Owner

lathoub commented May 22, 2025

Thx @RobertoHE have other been able to test? @nforro @MicroMidi @samspencer5991

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants