ScopeLogger();
const auto& address = args.get("address").get<std::string>();
if (!IsStillConnected(address)) {
- LogAndReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR, "Device is not connected"), &out,
- ("Device with address %s is no longer connected", address.c_str()));
- return;
- }
-
- bt_gatt_h handle = (bt_gatt_h) static_cast<long>(args.get(kHandle).get<double>());
+ LoggerW("Device with address %s is no longer connected", address.c_str());
+ } else {
+ bt_gatt_h handle = (bt_gatt_h) static_cast<long>(args.get(kHandle).get<double>());
- int ret = bt_gatt_client_unset_characteristic_value_changed_cb(handle);
+ int ret = bt_gatt_client_unset_characteristic_value_changed_cb(handle);
- if (BT_ERROR_NONE != ret) {
- LogAndReportError(
- util::GetBluetoothError(ret, "Failed to unregister listener"), &out,
- ("bt_gatt_client_unset_characteristic_value_changed_cb() failed with: %d (%s)", ret,
- get_error_message(ret)));
- } else {
- gatt_characteristic_.erase(
- std::remove(gatt_characteristic_.begin(), gatt_characteristic_.end(), handle),
- gatt_characteristic_.end());
- ReportSuccess(out);
+ if (BT_ERROR_NONE != ret) {
+ LoggerW("bt_gatt_client_unset_characteristic_value_changed_cb() failed with: %d (%s)", ret,
+ get_error_message(ret));
+ } else {
+ gatt_characteristic_.erase(
+ std::remove(gatt_characteristic_.begin(), gatt_characteristic_.end(), handle),
+ gatt_characteristic_.end());
+ }
}
+ ReportSuccess(out);
}
common::PlatformResult BluetoothGATTService::GetServiceAllUuids(const std::string& address,