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);
}
+ /// copied from 6.0
common::PlatformResult BluetoothGATTService::GetServiceAllUuids(const std::string& address,
picojson::array* array) {
ScopeLogger();
return CheckFileStatus(path);
}
+void PrintDeprecationWarningFor(const char* className, const char* replacement) {
+ if (nullptr == replacement) {
+ LoggerW("DEPRECATION WARNING: %s is deprecated and using it is not recommended.", className);
+ } else {
+ LoggerW(
+ "DEPRECATION WARNING: %s is deprecated and using it is not recommended. Try using %s "
+ "instead",
+ className, replacement);
+ }
+}
+
+ std::string ConvertToLowerCase(const std::string& input_string) {
+ std::string output_string = input_string;
+ std::transform(output_string.begin(), output_string.end(), output_string.begin(), ::tolower);
+ return output_string;
+ }
+
} // namespace tools
} // namespace common