Skip to content

Commit

Permalink
Fix Jira 923 BLE 4.2 BLECharacteristic::setValue() hangs
Browse files Browse the repository at this point in the history
Root cause
  1. The central powered off peripherial device and make it not give response.

Solution
  1. Exit the wait loop when connection lost.

Changed file
  BLECharacteristicImp.cpp - Change the wait logic
  • Loading branch information
sgbihu committed May 23, 2017
1 parent 2a760b7 commit ddc6771
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraries/CurieBLE/src/internal/BLECharacteristicImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,12 @@ bool BLECharacteristicImp::write(const unsigned char value[],
retval = bt_gatt_write(conn, &params);
if (0 == retval)
{
bool connected = true;
// Wait for write response
while (_gattc_writing)
while (_gattc_writing && connected)
{
delay(2);
connected = _ble_device.connected();
}
write_process_result = _gattc_write_result;
}
Expand Down

1 comment on commit ddc6771

@russmcinnis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was testing using the central and peripheral that are on Jira 923 and there is a hang at
FAIL : Attribute discovery failed! 55 errors
peripheral.disconnect();
I was seeing the issues (discoverAttributes()) that were fixed by the other commit in the jira

Please sign in to comment.