Skip to content

Commit 26eeb92

Browse files
authored
Update BLEMIDI_Client_ESP32.h
Some bug fixed related with AdvertisedDeviceCallbacks and templates. #define BLEMIDI_CREATE_INTANCE fixed
1 parent 8536bc4 commit 26eeb92

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/hardware/BLEMIDI_Client_ESP32.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ BEGIN_BLEMIDI_NAMESPACE
174174
#define BLEMIDI_CLIENT_SECURITY_AUTH (BLEMIDI_CLIENT_BOND_DUMMY | BLEMIDI_CLIENT_MITM_DUMMY | BLEMIDI_CLIENT_PAIR_DUMMY)
175175

176176
/** Define a class to handle the callbacks when advertisments are received */
177-
template <class _Settings>
178177
class AdvertisedDeviceCallbacks : public NimBLEAdvertisedDeviceCallbacks
179178
{
180179
public:
@@ -235,10 +234,7 @@ class BLEMIDI_Client_ESP32
235234

236235
bool specificTarget = false;
237236

238-
// TODO: somehow the forward declaration of the template class is not accepted by the compiler
239-
// template <class> friend MyClientCallbacks;
240-
241-
AdvertisedDeviceCallbacks<_Settings> myAdvCB;
237+
AdvertisedDeviceCallbacks myAdvCB;
242238

243239
protected:
244240
QueueHandle_t mRxQueue;
@@ -300,7 +296,7 @@ class BLEMIDI_Client_ESP32
300296
void scan();
301297
bool connect();
302298

303-
public: // TODO: somehow the forward declaration of the template class is not accepted by the compiler
299+
public:
304300
void connected()
305301
{
306302
if (_bleMidiTransport->_connectedCallback)
@@ -432,7 +428,7 @@ bool BLEMIDI_Client_ESP32<_Settings>::begin(const char *deviceName, BLEMIDI_Tran
432428

433429
// To communicate between the 2 cores.
434430
// Core_0 runs here, core_1 runs the BLE stack
435-
mRxQueue = xQueueCreate(256, sizeof(uint8_t)); // TODO Settings::MaxBufferSize
431+
mRxQueue = xQueueCreate(_Settings::MaxBufferSize, sizeof(uint8_t));
436432

437433
NimBLEDevice::setSecurityIOCap(BLEMIDI_CLIENT_SECURITY_CAP); // Attention, it may need a passkey
438434
NimBLEDevice::setSecurityAuth(BLEMIDI_CLIENT_SECURITY_AUTH);
@@ -633,8 +629,8 @@ END_BLEMIDI_NAMESPACE
633629
It will try to connect to a specific server with equal name or addr than <DeviceName>. If <DeviceName> is "", it will connect to first midi server
634630
*/
635631
#define BLEMIDI_CREATE_INSTANCE(DeviceName, Name) \
636-
BLEMIDI_NAMESPACE::BLEMIDI_Transport<BLEMIDI_NAMESPACE::BLEMIDI_Client_ESP32> BLE##Name(DeviceName); \
637-
MIDI_NAMESPACE::MidiInterface<BLEMIDI_NAMESPACE::BLEMIDI_Transport<BLEMIDI_NAMESPACE::BLEMIDI_Client_ESP32>, BLEMIDI_NAMESPACE::MySettings> Name((BLEMIDI_NAMESPACE::BLEMIDI_Transport<BLEMIDI_NAMESPACE::BLEMIDI_Client_ESP32> &)BLE##Name);
632+
BLEMIDI_NAMESPACE::BLEMIDI_Transport<BLEMIDI_NAMESPACE::BLEMIDI_Client_ESP32<BLEMIDI_NAMESPACE::DefaultSettings>, BLEMIDI_NAMESPACE::DefaultSettings> BLE##Name(DeviceName); \
633+
MIDI_NAMESPACE::MidiInterface<BLEMIDI_NAMESPACE::BLEMIDI_Transport<BLEMIDI_NAMESPACE::BLEMIDI_Client_ESP32<BLEMIDI_NAMESPACE::DefaultSettings>, BLEMIDI_NAMESPACE::DefaultSettings>, BLEMIDI_NAMESPACE::MySettings> Name((BLEMIDI_NAMESPACE::BLEMIDI_Transport<BLEMIDI_NAMESPACE::BLEMIDI_Client_ESP32<BLEMIDI_NAMESPACE::DefaultSettings>, BLEMIDI_NAMESPACE::DefaultSettings> &)BLE##Name);
638634

639635
/*! \brief Create a default instance for ESP32 named BLEMIDI-CLIENT.
640636
It will try to connect to first midi ble server found.

0 commit comments

Comments
 (0)