Skip to content

Commit

Permalink
[Tizen] Do not fail if BLE is already connected (#25725)
Browse files Browse the repository at this point in the history
* [Tizen] Do not fail if BLE is already connected

* Show error message in case of BLE connection failure
  • Loading branch information
arkq authored and pull[bot] committed Sep 1, 2023
1 parent 539cfcf commit 2556441
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/platform/Tizen/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,19 @@ static void __AdapterStateChangedCb(int result, bt_adapter_state_e adapterState,

void BLEManagerImpl::GattConnectionStateChangedCb(int result, bool connected, const char * remoteAddress, void * userData)
{
ChipLogProgress(DeviceLayer, "Gatt Connection State Changed: %s result [%d]", connected ? "Connected" : "Disconnected", result);

if (result != BT_ERROR_NONE)
ChipLogProgress(DeviceLayer, "Gatt Connection State Changed [%u]: %s", result, connected ? "Connected" : "Disconnected");
switch (result)
{
ChipLogError(DeviceLayer, "%s", connected ? "Connection req failed" : "Disconnection req failed");
case BT_ERROR_NONE:
case BT_ERROR_ALREADY_DONE:
sInstance.HandleConnectionEvent(connected, remoteAddress);
break;
default:
ChipLogError(DeviceLayer, "%s: %s", connected ? "Connection req failed" : "Disconnection req failed",
get_error_message(result));
if (connected)
sInstance.NotifyHandleConnectFailed(CHIP_ERROR_INTERNAL);
}
else
{
sInstance.HandleConnectionEvent(connected, remoteAddress);
}
}

gboolean BLEManagerImpl::_BleInitialize(void * userData)
Expand Down

0 comments on commit 2556441

Please sign in to comment.