File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,7 @@ class BLEMIDI_Transport
185
185
public:
186
186
// callbacks
187
187
void (*_connectedCallback)() = nullptr ;
188
+ void (*_connectedCallbackDeviceName)(char *) = nullptr ;
188
189
void (*_disconnectedCallback)() = nullptr ;
189
190
190
191
BLEMIDI_Transport &setName (const char *deviceName)
@@ -199,6 +200,12 @@ class BLEMIDI_Transport
199
200
_connectedCallback = fptr;
200
201
return *this ;
201
202
}
203
+
204
+ BLEMIDI_Transport &setHandleConnected (void (*fptr)(char *))
205
+ {
206
+ _connectedCallbackDeviceName= fptr;
207
+ return *this ;
208
+ }
202
209
203
210
BLEMIDI_Transport &setHandleDisconnected (void (*fptr)())
204
211
{
Original file line number Diff line number Diff line change @@ -228,7 +228,8 @@ class BLEMIDI_Client_ESP32
228
228
BLERemoteCharacteristic *_characteristic = nullptr ;
229
229
BLERemoteService *pSvc = nullptr ;
230
230
bool firstTimeSend = true ; // First writeValue get sends like Write with reponse for clean security flags. After first time, all messages are send like WriteNoResponse for increase transmision speed.
231
-
231
+ char connectedDeviceName[24 ];
232
+
232
233
BLEMIDI_Transport<class BLEMIDI_Client_ESP32 > *_bleMidiTransport = nullptr ;
233
234
234
235
bool specificTarget = false ;
@@ -303,6 +304,12 @@ class BLEMIDI_Client_ESP32
303
304
_bleMidiTransport->_connectedCallback ();
304
305
}
305
306
firstTimeSend = true ;
307
+
308
+ if (_bleMidiTransport->_connectedCallbackDeviceName )
309
+ {
310
+ sprintf (connectedDeviceName, " %s" , myAdvCB.advDevice .getName ().c_str ());
311
+ _bleMidiTransport->_connectedCallbackDeviceName (connectedDeviceName);
312
+ }
306
313
}
307
314
308
315
void disconnected ()
You can’t perform that action at this time.
0 commit comments