added default initialisation

This commit is contained in:
lathoub 2019-08-17 17:31:21 +02:00
parent 0787571f5f
commit 8a0619c498
2 changed files with 12 additions and 20 deletions

View File

@ -6,26 +6,22 @@
#include <BLEServer.h>
#include <BLE2902.h>
BEGIN_BLEMIDI_NAMESPACE
#define SERVICE_UUID "03b80e5a-ede8-4b33-a751-6ce34ec4c700"
#define CHARACTERISTIC_UUID "7772e5db-3868-4112-a1a9-f2669d106bf3"
BEGIN_BLEMIDI_NAMESPACE
class BluetoothEsp32
{
private:
BLEServer* _server;
BLEAdvertising* _advertising;
BLECharacteristic* _characteristic;
BLEServer* _server = nullptr;
BLEAdvertising* _advertising = nullptr;
BLECharacteristic* _characteristic = nullptr;
BleMidiTransport<class BluetoothEsp32>* _bleMidiTransport;
BleMidiTransport<class BluetoothEsp32>* _bleMidiTransport = nullptr;
public:
BluetoothEsp32()
: _server(NULL),
_advertising(NULL),
_characteristic(NULL),
_bleMidiTransport(NULL)
{
}
@ -66,7 +62,7 @@ public:
}
protected:
BluetoothEsp32* _bluetoothEsp32;
BluetoothEsp32* _bluetoothEsp32 = nullptr;
void onConnect(BLEServer* server) {
_bluetoothEsp32->connected();
@ -84,7 +80,7 @@ public:
}
protected:
BluetoothEsp32* _bluetoothEsp32;
BluetoothEsp32* _bluetoothEsp32 = nullptr;
void onWrite(BLECharacteristic * characteristic) {
std::string rxValue = characteristic->getValue();

View File

@ -18,16 +18,14 @@ private:
midi::RingBuffer<byte, 44> mRxBuffer;
byte mTxBuffer[44];
unsigned mTxIndex;
unsigned mTxIndex = 0;
bool _connected;
private:
BleClass& mBleClass;
public:
inline BleMidiTransport(BleClass& inBleClass)
: mBleClass(inBleClass), mTxIndex(0)
: mBleClass(inBleClass)
{
}
@ -117,17 +115,15 @@ protected:
public:
// callbacks
void(*_connectedCallback)() = NULL;
void(*_disconnectedCallback)() = NULL;
void(*_connectedCallback)() = nullptr;
void(*_disconnectedCallback)() = nullptr;
public:
void onConnected(void(*fptr)()) {
_connected = true;
_connectedCallback = fptr;
}
void onDisconnected(void(*fptr)()) {
_connected = false;
_disconnectedCallback = fptr;
}