|
14 | 14 | * the name of the server or the BLE address of the server. If you want to connect |
15 | 15 | * to the first MIDI server BLE found by the device, you just have to set the name field empty (""). |
16 | 16 | * |
17 | | - * FOR ADVANCED USERS: Other advanced BLE configurations can be changed in hardware/BLEMIDI_Client_ESP32.h |
18 | | - * #defines in the head of the file (IMPORTANT: Only the first user defines must be modified). These configurations |
19 | | - * are related to security (password, pairing and securityCallback()), communication params, the device name |
20 | | - * and other stuffs. Modify defines at your own risk. |
| 17 | + * FOR ADVANCED USERS: Other advanced BLE configurations can be changed with a struct that heritate |
| 18 | + * from BLEMIDI_NAMESPACE::DefaultSettingsClient. These configurations are related to |
| 19 | + * security (password, pairing and securityCallback()), communication params, the device name |
| 20 | + * and other stuffs. Modify those settings at your own risk. |
21 | 21 | * |
22 | 22 | * |
23 | 23 | * |
|
28 | 28 | #include <Arduino.h> |
29 | 29 | #include <BLEMIDI_Transport.h> |
30 | 30 |
|
31 | | - struct CustomBufferSizeSettings : public BLEMIDI_NAMESPACE::DefaultSettings { |
32 | | - static const size_t MaxBufferSize = 16; |
33 | | -}; |
34 | | - |
35 | 31 | #include <hardware/BLEMIDI_Client_ESP32.h> |
36 | | - |
37 | 32 | //#include <hardware/BLEMIDI_ESP32_NimBLE.h> |
38 | 33 | //#include <hardware/BLEMIDI_ESP32.h> |
39 | 34 | //#include <hardware/BLEMIDI_ArduinoBLE.h> |
40 | 35 |
|
41 | | -BLEMIDI_CREATE_CUSTOM_INSTANCE("Esp32-BLE-MIDI", MIDI, CustomBufferSizeSettings); // Connect to first server found |
| 36 | +#ifndef LED_BUILTIN |
| 37 | +#define LED_BUILTIN 2 |
| 38 | +#endif |
| 39 | + |
| 40 | +//See DefaultSettingsClient in hardware/BLEMIDI_Client_ESP32.h for more configurable settings |
| 41 | +// If you do not redefine a parameter, it will use the default value for these parameter |
| 42 | +struct CustomBufferSizeSettings : public BLEMIDI_NAMESPACE::DefaultSettingsClient { |
| 43 | + static const size_t MaxBufferSize = 16; |
| 44 | +}; |
| 45 | + |
| 46 | +BLEMIDI_CREATE_CUSTOM_INSTANCE("Esp32-BLE-MIDI", MIDI, CustomBufferSizeSettings); // Connect to a server named "Esp32-BLE-MIDI" and use CustomBufferSizeSettings as settings of client |
42 | 47 |
|
43 | | -//BLEMIDI_CREATE_INSTANCE("",MIDI) //Connect to the first server found |
44 | | -//BLEMIDI_CREATE_INSTANCE("f2:c1:d9:36:e7:6b",MIDI) //Connect to a specific BLE address server |
45 | | -//BLEMIDI_CREATE_INSTANCE("MyBLEserver",MIDI) //Connect to a specific name server |
| 48 | +//BLEMIDI_CREATE_INSTANCE("",MIDI) //Connect to the first server found, using default settings |
| 49 | +//BLEMIDI_CREATE_INSTANCE("f2:c1:d9:36:e7:6b",MIDI) //Connect to a specific BLE address server, using default settings |
| 50 | +//BLEMIDI_CREATE_INSTANCE("MyBLEserver",MIDI) //Connect to a specific name server, using default settings |
46 | 51 |
|
47 | 52 | #ifndef LED_BUILTIN |
48 | 53 | #define LED_BUILTIN 2 //modify for match with yout board |
|
0 commit comments