Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions libraries/CurieBLE/src/internal/BLEDescriptorImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ bool BLEDescriptorImp::read()
{
int retval = 0;
bt_conn_t* conn = NULL;
bool ret_bool = true;

if (true == BLEUtils::isLocalBLE(_bledev))
{
Expand Down Expand Up @@ -209,6 +210,13 @@ bool BLEDescriptorImp::read()
{
_reading = true;
}

// Block the read
while (_reading == true && ret_bool)
{
delay(5);
ret_bool = _bledev.connected();
}
return _reading;
}

Expand All @@ -219,6 +227,12 @@ bool BLEDescriptorImp::writeValue(const byte value[],
bool ret = true;
int total_length = length + offset;
int write_len = length;

if (_reading)
{
_reading = false;
}

if (total_length > BLE_MAX_ATTR_DATA_LEN)
{
return false;
Expand Down