Thanks to visit codestin.com
Credit goes to github.com

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 11 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

@jhsa
Copy link

jhsa commented May 23, 2025

Hi, I tried compiling the Sketch "MidiBle_Client.ino" for the ESP32-S3 board, but it does not compile. I am using IDE 2.3.5. Here is the error:

In file included from C:\Users\Joao\AppData\Local\Temp\.arduinoIDE-unsaved2025423-8740-17gekze.0ejj\MidiBle_Client\MidiBle_Client.ino:31:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:178:1: error: expected class-name before '{' token
  178 | {
      | ^
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h: In member function 'void bleMidi::AdvertisedDeviceCallbacks::onResult(NimBLEAdvertisedDevice*)':
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:125: error: no match for 'operator==' (operand types are 'const NimBLEAddress' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~~~~~~~
      |                                                                                                                          |     |
      |                                                                                                                          |     std::string {aka std::__cxx11::basic_string<char>}
      |                                                                                                                          const NimBLEAddress
In file included from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/xtensa-esp-elf/esp32s3/no-rtti/bits/c++allocator.h:33,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/allocator.h:46,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/alloc_traits.h:39,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/ext/alloc_traits.h:34,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/hashtable_policy.h:39,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/hashtable.h:35,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/unordered_map.h:33,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/unordered_map:41,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/functional:63,
                 from C:\Users\Joao\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\cores\esp32/HardwareSerial.h:49,
                 from C:\Users\Joao\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\cores\esp32/Arduino.h:203,
                 from C:\Users\Joao\AppData\Local\Temp\.arduinoIDE-unsaved2025423-8740-17gekze.0ejj\MidiBle_Client\MidiBle_Client.ino:28:
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/new_allocator.h:215:9: note: candidate: 'template<class _Up> constexpr bool std::operator==(const __new_allocator<char>&, const __new_allocator<_Tp>&)' (reversed)
  215 |         operator==(const __new_allocator&, const __new_allocator<_Up>&)
      |         ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/new_allocator.h:215:9: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'const NimBLEAddress' is not derived from 'const std::__new_allocator<_Tp>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
In file included from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_algobase.h:64,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/specfun.h:43,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/cmath:3898,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/math.h:36,
                 from C:\Users\Joao\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\cores\esp32/esp32-hal.h:30,
                 from C:\Users\Joao\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\cores\esp32/Arduino.h:45:
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_pair.h:1010:5: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_U1, _U2>&)' (reversed)
 1010 |     operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y)
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_pair.h:1010:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
In file included from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_algobase.h:67:
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_iterator.h:527:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorR>&) requires requires{{std::operator==::__x->base() == std::operator==::__y->base()} -> decltype(auto) [requires std::convertible_to<<placeholder>, bool>];}' (reversed)
  527 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_iterator.h:527:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_IteratorL>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&) requires requires{{std::operator==::__x->base() == std::operator==::__y->base()} -> decltype(auto) [requires std::convertible_to<<placeholder>, bool>];}' (reversed)
 1667 |     operator==(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_iterator.h:1667:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
In file included from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/functional:53:
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/tuple:2556:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' (reversed)
 2556 |     operator==(const tuple<_TElements...>& __t,
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/tuple:2556:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
In file included from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/functional:59:
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/std_function.h:743:5: note: candidate: 'template<class _Res, class ... _Args> bool std::operator==(const function<_Res(_ArgTypes ...)>&, nullptr_t)' (reversed)
  743 |     operator==(const function<_Res(_Args...)>& __f, nullptr_t) noexcept
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/std_function.h:743:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::function<_Res(_ArgTypes ...)>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const allocator<_Up>&, const allocator<_T2>&)' (reversed)
  235 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/allocator.h:235:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_Up>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
In file included from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/basic_string.h:47,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/string:54,
                 from c:\Users\Joao\Documents\Arduino\libraries\NimBLE-Arduino\src/NimBLEDevice.h:40,
                 from c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:145:
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/string_view:609:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, type_identity_t<basic_string_view<_CharT, _Traits> >)' (reversed)
  609 |     operator==(basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/string_view:609:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' (reversed)
 3772 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/basic_string.h:3772:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   mismatched types 'const _CharT*' and 'NimBLEAddress'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
In file included from c:\Users\Joao\Documents\Arduino\libraries\NimBLE-Arduino\src/NimBLEClient.h:30,
                 from c:\Users\Joao\Documents\Arduino\libraries\NimBLE-Arduino\src/NimBLEDevice.h:282:
c:\Users\Joao\Documents\Arduino\libraries\NimBLE-Arduino\src/NimBLEAddress.h:63:26: note: candidate: 'bool NimBLEAddress::operator==(const NimBLEAddress&) const'
   63 |     bool                 operator==(const NimBLEAddress& rhs) const;
      |                          ^~~~~~~~
c:\Users\Joao\Documents\Arduino\libraries\NimBLE-Arduino\src/NimBLEAddress.h:63:58: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const NimBLEAddress&'
   63 |     bool                 operator==(const NimBLEAddress& rhs) const;
      |                                     ~~~~~~~~~~~~~~~~~~~~~^~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_iterator.h:586:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorL>&) requires requires{{std::operator==::__x->base() == std::operator==::__y->base()} -> decltype(auto) [requires std::convertible_to<<placeholder>, bool>];}'
  586 |     operator==(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_iterator.h:586:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'const NimBLEAddress' is not derived from 'const std::reverse_iterator<_IteratorL>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
 1737 |     operator==(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_iterator.h:1737:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'const NimBLEAddress' is not derived from 'const std::move_iterator<_IteratorL>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/unordered_map.h:2144:5: note: candidate: 'template<class _Key1, class _Tp1, class _Hash1, class _Pred1, class _Alloc1> bool std::operator==(const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&, const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&)'
 2144 |     operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/unordered_map.h:2144:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'const NimBLEAddress' is not derived from 'const std::unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/unordered_map.h:2158:5: note: candidate: 'template<class _Key1, class _Tp1, class _Hash1, class _Pred1, class _Alloc1> bool std::operator==(const unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&, const unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&)'
 2158 |     operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/unordered_map.h:2158:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'const NimBLEAddress' is not derived from 'const std::unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
In file included from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/vector:66,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/functional:64:
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_vector.h:2050:5: note: candidate: 'template<class _Tp, class _Alloc> constexpr bool std::operator==(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
 2050 |     operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_vector.h:2050:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'const NimBLEAddress' is not derived from 'const std::vector<_Tp, _Alloc>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
In file included from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/functional:65:
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/array:303:5: note: candidate: 'template<class _Tp, unsigned int _Nm> constexpr bool std::operator==(const array<_Tp, _Nm>&, const array<_Tp, _Nm>&)'
  303 |     operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/array:303:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'const NimBLEAddress' is not derived from 'const std::array<_Tp, _Nm>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
In file included from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/char_traits.h:42,
                 from C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/string:42:
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
  192 |     operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/postypes.h:192:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'const NimBLEAddress' is not derived from 'const std::fpos<_StateT>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3755 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/basic_string.h:3755:5: note:   template argument deduction/substitution failed:
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:197:128: note:   'const NimBLEAddress' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  197 |                 if (!specificTarget || (advertisedDevice->getName() == nameTarget.c_str() || advertisedDevice->getAddress() == nameTarget))
      |                                                                                                                                ^~~~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/allocator.h:214:7: note: candidate: 'constexpr bool std::operator==(const allocator<char>&, const allocator<char>&)'
  214 |       operator==(const allocator&, const allocator&) _GLIBCXX_NOTHROW
      |       ^~~~~~~~
C:/Users/Joao/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/allocator.h:214:18: note:   no known conversion for argument 1 from 'const NimBLEAddress' to 'const std::allocator<char>&'
  214 |       operator==(const allocator&, const allocator&) _GLIBCXX_NOTHROW
      |                  ^~~~~~~~~~~~~~~~
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h: In member function 'void bleMidi::BLEMIDI_Client_ESP32::scan()':
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:499:19: error: 'class NimBLEScan' has no member named 'setAdvertisedDeviceCallbacks'
  499 |         pBLEScan->setAdvertisedDeviceCallbacks(&myAdvCB);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h: In member function 'bool bleMidi::BLEMIDI_Client_ESP32::connect()':
c:\Users\Joao\Documents\Arduino\libraries\BLE-MIDI\src/hardware/BLEMIDI_Client_ESP32.h:547:23: error: 'getClientListSize' is not a member of 'NimBLEDevice'
  547 |     if (NimBLEDevice::getClientListSize() >= NIMBLE_MAX_CONNECTIONS)
      |                       ^~~~~~~~~~~~~~~~~
exit status 1

Compilation error: exit status 1

@RobertoHE
Copy link
Contributor Author

Do you use the branch or main repo?

@jhsa
Copy link

jhsa commented May 23, 2025

Do you use the branch or main repo?

Well, I have just reinstalled the library using the IDE itself. Shall I do it differently?

@jhsa
Copy link

jhsa commented May 23, 2025

I have just installed version 2.1.0 of the library using the arduino IDE, tried to compile the sketch "MidiBle.ino" for ESP32-S3 with "#include <hardware/BLEMIDI_ESP32_NimBLE.h>" selected and it did compile. I still don't know if it actually works. But at least it did compile.

@RobertoHE
Copy link
Contributor Author

You are using the main repo without request changes. You must use pull request code.

@jhsa
Copy link

jhsa commented May 23, 2025

You are using the main repo without request changes. You must use pull request code.

So, manual installation then.
Do you mind posting the link to it again please?
Also, I am still not very familiar with all this, do I have to install the other "Dependencies/libraries" inside the library this library folder?
Thanks

@RobertoHE
Copy link
Contributor Author

If you use Platformio, you can use something like this in platformio.ini:
lib_deps = ;https://github.com/lathoub/Arduino-BLE-MIDI ; <-- Main repro. NO ;https://github.com/RobertoHE/Arduino-BLE-MIDI ; <-- My main repo. NO https://github.com/RobertoHE/Arduino-BLE-MIDI.git#CustomSettings <-- My repro with PullRequest code YES

In Arduino IDE, you must select the PR code (for example, my repo and CustomSetting Branch ), download the code ( Code -> Download as zip), and install it manually in Arduino (copy files to the Arduino path and reload the IDE).
In both cases, you will find more info and step-by-step guides on internet.

@jhsa
Copy link

jhsa commented May 23, 2025

Ok, Thanks RobertoHE, I am trying to improve an old project and it wasn't compiling anymore. I think the ESP32 core changed and as far as I understand libraries will have to adapt to it, otherwise they won't work anymore, at least some of them. Will try this asap. It might take a couple days..

@RobertoHE
Copy link
Contributor Author

@lathoub. The Auto Test script has a little problem, if you try to compile Arduino-BLE lib and ESP-BLE libs on the same computer, because they have incompatible methods. If I only include the Hardware transport layer of ESP-BLE lib (<hardware/BLEMIDI_ESP32_NimBLE.h>, <hardware/BLEMIDI_ESP32.h> or<hardware/BLEMIDI_Client_ESP32.h> but no <hardware/BLEMIDI_ArduinoBLE.h>) The test runs OK, but the test doesn't cover the ArduinoBLE lib code.

Except for this one, I compile every code with every hardware layer manually, and everything compiles fine. I can't test them in functionality because I don't have hardware now, but I can suppose that they can work fine.

Additionally, I unified all configuration methods by hierarchy ( MIDI -> BLE_MIDI -> BLE_Transport Layer). You can configure MIDI and BLE with the same structure configuration. I refactored some example code to illustrate that.
I didn't study the other transport layer lib, but if they use some configurations (transmission power, security, or whatever), I advise you, @lathoub, to update them by adding those code lines functionalities of the BLE lib following the example of the client lib.

@RobertoHE
Copy link
Contributor Author

I think that the CustomSettings branch (configuration capabilities of MIDI and BLEMIDI) can merge as the master branch. In my opinion, this method of configuration transport layer and MIDI functionality is more flexible, adaptive, and easy to use than the master branch.
Some tests must be necessary to prove that this branch and master have the same methods, and they may be used in the same way without any additional changes in end-user codes.

@lathoub
Copy link
Owner

lathoub commented May 25, 2025

Great work, i will try on my end. @ all: please check as well

@jhsa
Copy link

jhsa commented May 29, 2025

In Arduino IDE, you must select the PR code (for example, my repo and CustomSetting Branch ), download the code ( Code -> Download as zip), and install it manually in Arduino (copy files to the Arduino path and reload the IDE). In both cases, you will find more info and step-by-step guides on internet.

I am testing your library on my older project and the devices is being recognized as "Unknown Device" by my android smartphone. Am I doing something wrong?
EDIT: The same happens when I try the "MidiBle.ino" sketch It is detected by the MIDI+BTLE tool on my android smartphone, but as Unknown device. It appears on the midi monitor as a blank space (no name), and it doesn't send or receive any midi messages.

#include <BLEMIDI_Transport.h>
#include <hardware/BLEMIDI_ESP32_NimBLE.h>

// BLE MIDI object
BLEMIDI_CREATE_INSTANCE("iL9_BLE", BLE_MIDI)

void setup {

BLE_MIDI.begin(MIDI_CHANNEL_OMNI);
    BLE_MIDI.setHandleProgramChange(BLE_ProgramChange);
    BLE_MIDI.setHandleControlChange(BLE_ControlChange);

}

@jhsa
Copy link

jhsa commented May 31, 2025

Tried also with a normal "ESP32 board "DOIT ESP32 DEVKIT V1" and am having the same behavior.
Selecting the default "#include <hardware/BLEMIDI_ESP32.h>" it doesn't compile.
Selecting "#include <hardware/BLEMIDI_ESP32_NimBLE.h>" it compiles but it appears as Unknown device on my phone, and the device name appears empty on the Midi Monitor device name setting. No Midi messages are transferred either way.
Sketch is the "MidiBle.ino".
Same behavior as with the ESP32-S3 board.
Are you guys testing this?? Is it working for you? Am I doing something wrong?

@nforro
Copy link

nforro commented May 31, 2025

@jhsa For the Unknown Device, see the last hunk of the diff I posted above - device name is not being advertised by default anymore.

Sorry, I haven't been able to test the code changes yet.

@jhsa
Copy link

jhsa commented May 31, 2025

@jhsa For the Unknown Device, see the last hunk of the diff I posted above - device name is not being advertised by default anymore.

Sorry, I haven't been able to test the code changes yet.

what file is that? Can't find it..
Sorry I am a beginner..

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.

5 participants