Closed pablosun closed 6 years ago
The symptom here is that LBLEClient::writeCharacteristic
may send the BLE write request with incorrect handle when the services have both 16-bit UUID and 128-bit UUID services.
This issue does not happen when there are only 16-bit UUIDs, e.g. the Example sketch.
The root cause here is that LBLEClient
stores all the scanned UUID and corresponding value handle in a std::map
table, which relies on less
(operator <
) comparison to properly order the elements.
However, the implementation of LBLEUuid
does not return proper ordering when comparing 16-bit UUID with 128-bit UUID, and vice versa. Therefore writeCharacteristic
may retrieve wrong value handle when read/write the attribute.
In the following code snippet, the read operation succeeds, while the write operation fails - even the UUID attribute is indeed having a WRITABLE permission.