diff --git a/libraries/CurieBLE/src/BLEPeripheral.cpp b/libraries/CurieBLE/src/BLEPeripheral.cpp index 760d374f..ec817f9d 100644 --- a/libraries/CurieBLE/src/BLEPeripheral.cpp +++ b/libraries/CurieBLE/src/BLEPeripheral.cpp @@ -21,7 +21,7 @@ #include "BLEPeripheral.h" -static BLEPeripheralEventHandler m_eventHandlers[BLEDeviceLastEvent]; +static BLEPeripheralEventHandler m_eventHandlers[BLEDeviceLastEvent] = {NULL, NULL, NULL, NULL}; void bleBackCompatiblePeripheralConnectHandler(BLEDevice central) { @@ -146,7 +146,8 @@ BLECentral BLEPeripheral::central(void) bool BLEPeripheral::connected(void) { - return BLE.connected(); + BLEDevice centralBle = BLE.central(); + return centralBle.connected(); } void BLEPeripheral::init() @@ -154,7 +155,6 @@ void BLEPeripheral::init() if (!_initCalled) { BLE.begin(); - memset(m_eventHandlers, 0, sizeof(m_eventHandlers)); _initCalled = true; } }