Skip to content

Commit 303e5b4

Browse files
committed
Fix arduino#444 BLEPeripheral::connected() always returns false
1. Root casue: the stack need use connected device to get the state. The current code used local address to get the link and get an error. 2. Solution: Use central's address to get connection state.
1 parent 3563ce4 commit 303e5b4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libraries/CurieBLE/src/BLEPeripheral.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ BLECentral BLEPeripheral::central(void)
146146

147147
bool BLEPeripheral::connected(void)
148148
{
149-
return BLE.connected();
149+
BLEDevice centralBle = BLE.central();
150+
return centralBle.connected();
150151
}
151152

152153
void BLEPeripheral::init()

0 commit comments

Comments
 (0)