Rename GattErrorCode enum values.
- Change GattErrorCode enum values from FOO_BAR to modern kFooBar style.
- Use the enum values consistently as though GattErrorCode is an enum
class. This makes it easier to switch to an enum class in the future.
Change-Id: I2c2c1ca880b388e3d92c939a865767933267fec6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3905045
Reviewed-by: Jon Mann <jonmann@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1049166}
diff --git a/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.cc b/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.cc
index 212e9a3f..7236d9c 100644
--- a/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.cc
+++ b/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.cc
@@ -43,21 +43,21 @@
constexpr const char* ToString(
device::BluetoothGattService::GattErrorCode error_code) {
switch (error_code) {
- case device::BluetoothGattService::GATT_ERROR_UNKNOWN:
+ case device::BluetoothGattService::GattErrorCode::kUnknown:
return "GATT_ERROR_UNKNOWN";
- case device::BluetoothGattService::GATT_ERROR_FAILED:
+ case device::BluetoothGattService::GattErrorCode::kFailed:
return "GATT_ERROR_FAILED";
- case device::BluetoothGattService::GATT_ERROR_IN_PROGRESS:
+ case device::BluetoothGattService::GattErrorCode::kInProgress:
return "GATT_ERROR_IN_PROGRESS";
- case device::BluetoothGattService::GATT_ERROR_INVALID_LENGTH:
+ case device::BluetoothGattService::GattErrorCode::kInvalidLength:
return "GATT_ERROR_INVALID_LENGTH";
- case device::BluetoothGattService::GATT_ERROR_NOT_PERMITTED:
+ case device::BluetoothGattService::GattErrorCode::kNotPermitted:
return "GATT_ERROR_NOT_PERMITTED";
- case device::BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED:
+ case device::BluetoothGattService::GattErrorCode::kNotAuthorized:
return "GATT_ERROR_NOT_AUTHORIZED";
- case device::BluetoothGattService::GATT_ERROR_NOT_PAIRED:
+ case device::BluetoothGattService::GattErrorCode::kNotPaired:
return "GATT_ERROR_NOT_PAIRED";
- case device::BluetoothGattService::GATT_ERROR_NOT_SUPPORTED:
+ case device::BluetoothGattService::GattErrorCode::kNotSupported:
return "GATT_ERROR_NOT_SUPPORTED";
default:
NOTREACHED();
diff --git a/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_unittest.cc b/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_unittest.cc
index 7720de8..1987c3a1 100644
--- a/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_unittest.cc
+++ b/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_unittest.cc
@@ -208,7 +208,7 @@
ErrorCallback error_callback) override {
if (notify_session_error_) {
std::move(error_callback)
- .Run(device::BluetoothGattService::GATT_ERROR_NOT_PERMITTED);
+ .Run(device::BluetoothGattService::GattErrorCode::kNotPermitted);
return;
}
@@ -228,7 +228,7 @@
ErrorCallback error_callback) override {
if (write_remote_error_) {
std::move(error_callback)
- .Run(device::BluetoothGattService::GATT_ERROR_NOT_PERMITTED);
+ .Run(device::BluetoothGattService::GattErrorCode::kNotPermitted);
return;
}
diff --git a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc
index e54de75..b913b0f 100644
--- a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc
+++ b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc
@@ -50,21 +50,21 @@
std::string GattErrorToString(
device::BluetoothGattService::GattErrorCode error_code) {
switch (error_code) {
- case device::BluetoothGattService::GATT_ERROR_UNKNOWN:
+ case device::BluetoothGattService::GattErrorCode::kUnknown:
return "[GATT_ERROR_UNKNOWN]";
- case device::BluetoothGattService::GATT_ERROR_FAILED:
+ case device::BluetoothGattService::GattErrorCode::kFailed:
return "[GATT_ERROR_FAILED]";
- case device::BluetoothGattService::GATT_ERROR_IN_PROGRESS:
+ case device::BluetoothGattService::GattErrorCode::kInProgress:
return "[GATT_ERROR_IN_PROGRESS]";
- case device::BluetoothGattService::GATT_ERROR_INVALID_LENGTH:
+ case device::BluetoothGattService::GattErrorCode::kInvalidLength:
return "[GATT_ERROR_INVALID_LENGTH]";
- case device::BluetoothGattService::GATT_ERROR_NOT_PERMITTED:
+ case device::BluetoothGattService::GattErrorCode::kNotPermitted:
return "[GATT_ERROR_NOT_PERMITTED]";
- case device::BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED:
+ case device::BluetoothGattService::GattErrorCode::kNotAuthorized:
return "[GATT_ERROR_NOT_AUTHORIZED]";
- case device::BluetoothGattService::GATT_ERROR_NOT_PAIRED:
+ case device::BluetoothGattService::GattErrorCode::kNotPaired:
return "[GATT_ERROR_NOT_PAIRED]";
- case device::BluetoothGattService::GATT_ERROR_NOT_SUPPORTED:
+ case device::BluetoothGattService::GattErrorCode::kNotSupported:
return "[GATT_ERROR_NOT_SUPPORTED]";
default:
NOTREACHED();
diff --git a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc
index 80fe9f5..548de15 100644
--- a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc
+++ b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc
@@ -1521,7 +1521,7 @@
EXPECT_EQ(GetPairFailure(), absl::nullopt);
EXPECT_CALL(account_key_failure_callback_, Run);
RunWriteAccountKeyCallback(
- device::BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED);
+ device::BluetoothGattService::GattErrorCode::kFailed);
EXPECT_FALSE(IsAccountKeySavedToFootprints());
histogram_tester().ExpectTotalCount(
kWriteAccountKeyCharacteristicResultMetric, 1);
@@ -1559,7 +1559,7 @@
EXPECT_EQ(GetPairFailure(), absl::nullopt);
EXPECT_CALL(account_key_failure_callback_, Run);
RunWriteAccountKeyCallback(
- device::BluetoothGattService::GattErrorCode::GATT_ERROR_UNKNOWN);
+ device::BluetoothGattService::GattErrorCode::kUnknown);
EXPECT_FALSE(IsAccountKeySavedToFootprints());
histogram_tester().ExpectTotalCount(
kWriteAccountKeyCharacteristicResultMetric, 1);
@@ -1597,7 +1597,7 @@
EXPECT_EQ(GetPairFailure(), absl::nullopt);
EXPECT_CALL(account_key_failure_callback_, Run);
RunWriteAccountKeyCallback(
- device::BluetoothGattService::GattErrorCode::GATT_ERROR_IN_PROGRESS);
+ device::BluetoothGattService::GattErrorCode::kInProgress);
EXPECT_FALSE(IsAccountKeySavedToFootprints());
histogram_tester().ExpectTotalCount(
kWriteAccountKeyCharacteristicResultMetric, 1);
@@ -1635,7 +1635,7 @@
EXPECT_EQ(GetPairFailure(), absl::nullopt);
EXPECT_CALL(account_key_failure_callback_, Run);
RunWriteAccountKeyCallback(
- device::BluetoothGattService::GattErrorCode::GATT_ERROR_INVALID_LENGTH);
+ device::BluetoothGattService::GattErrorCode::kInvalidLength);
EXPECT_FALSE(IsAccountKeySavedToFootprints());
histogram_tester().ExpectTotalCount(
kWriteAccountKeyCharacteristicResultMetric, 1);
@@ -1673,7 +1673,7 @@
EXPECT_EQ(GetPairFailure(), absl::nullopt);
EXPECT_CALL(account_key_failure_callback_, Run);
RunWriteAccountKeyCallback(
- device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PERMITTED);
+ device::BluetoothGattService::GattErrorCode::kNotPermitted);
EXPECT_FALSE(IsAccountKeySavedToFootprints());
histogram_tester().ExpectTotalCount(
kWriteAccountKeyCharacteristicResultMetric, 1);
@@ -1711,7 +1711,7 @@
EXPECT_EQ(GetPairFailure(), absl::nullopt);
EXPECT_CALL(account_key_failure_callback_, Run);
RunWriteAccountKeyCallback(
- device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_AUTHORIZED);
+ device::BluetoothGattService::GattErrorCode::kNotAuthorized);
EXPECT_FALSE(IsAccountKeySavedToFootprints());
histogram_tester().ExpectTotalCount(
kWriteAccountKeyCharacteristicResultMetric, 1);
@@ -1749,7 +1749,7 @@
EXPECT_EQ(GetPairFailure(), absl::nullopt);
EXPECT_CALL(account_key_failure_callback_, Run);
RunWriteAccountKeyCallback(
- device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PAIRED);
+ device::BluetoothGattService::GattErrorCode::kNotPaired);
EXPECT_FALSE(IsAccountKeySavedToFootprints());
histogram_tester().ExpectTotalCount(
kWriteAccountKeyCharacteristicResultMetric, 1);
@@ -1787,7 +1787,7 @@
EXPECT_EQ(GetPairFailure(), absl::nullopt);
EXPECT_CALL(account_key_failure_callback_, Run);
RunWriteAccountKeyCallback(
- device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_SUPPORTED);
+ device::BluetoothGattService::GattErrorCode::kNotSupported);
EXPECT_FALSE(IsAccountKeySavedToFootprints());
histogram_tester().ExpectTotalCount(
kWriteAccountKeyCharacteristicResultMetric, 1);
diff --git a/ash/services/secure_channel/ble_characteristics_finder_unittest.cc b/ash/services/secure_channel/ble_characteristics_finder_unittest.cc
index 0619cca..3d01f45 100644
--- a/ash/services/secure_channel/ble_characteristics_finder_unittest.cc
+++ b/ash/services/secure_channel/ble_characteristics_finder_unittest.cc
@@ -181,7 +181,8 @@
value =
correct_eid ? GetCorrectEidValue() : GetIncorrectEidValue();
} else {
- error_code = device::BluetoothGattService::GATT_ERROR_FAILED;
+ error_code =
+ device::BluetoothGattService::GattErrorCode::kFailed;
}
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
diff --git a/ash/services/secure_channel/ble_weave_client_connection.cc b/ash/services/secure_channel/ble_weave_client_connection.cc
index aa49dee9..1175ec7 100644
--- a/ash/services/secure_channel/ble_weave_client_connection.cc
+++ b/ash/services/secure_channel/ble_weave_client_connection.cc
@@ -1014,28 +1014,28 @@
BluetoothRemoteDeviceGattServiceGattErrorCodeToGattServiceOperationResult(
device::BluetoothGattService::GattErrorCode error_code) {
switch (error_code) {
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_UNKNOWN:
+ case device::BluetoothGattService::GattErrorCode::kUnknown:
return GattServiceOperationResult::
GATT_SERVICE_OPERATION_RESULT_GATT_ERROR_UNKNOWN;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED:
+ case device::BluetoothGattService::GattErrorCode::kFailed:
return GattServiceOperationResult::
GATT_SERVICE_OPERATION_RESULT_GATT_ERROR_FAILED;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_IN_PROGRESS:
+ case device::BluetoothGattService::GattErrorCode::kInProgress:
return GattServiceOperationResult::
GATT_SERVICE_OPERATION_RESULT_GATT_ERROR_IN_PROGRESS;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_INVALID_LENGTH:
+ case device::BluetoothGattService::GattErrorCode::kInvalidLength:
return GattServiceOperationResult::
GATT_SERVICE_OPERATION_RESULT_GATT_ERROR_INVALID_LENGTH;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PERMITTED:
+ case device::BluetoothGattService::GattErrorCode::kNotPermitted:
return GattServiceOperationResult::
GATT_SERVICE_OPERATION_RESULT_GATT_ERROR_NOT_PERMITTED;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_AUTHORIZED:
+ case device::BluetoothGattService::GattErrorCode::kNotAuthorized:
return GattServiceOperationResult::
GATT_SERVICE_OPERATION_RESULT_GATT_ERROR_NOT_AUTHORIZED;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PAIRED:
+ case device::BluetoothGattService::GattErrorCode::kNotPaired:
return GattServiceOperationResult::
GATT_SERVICE_OPERATION_RESULT_GATT_ERROR_NOT_PAIRED;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_SUPPORTED:
+ case device::BluetoothGattService::GattErrorCode::kNotSupported:
return GattServiceOperationResult::
GATT_SERVICE_OPERATION_RESULT_GATT_ERROR_NOT_SUPPORTED;
default:
diff --git a/ash/services/secure_channel/ble_weave_client_connection_unittest.cc b/ash/services/secure_channel/ble_weave_client_connection_unittest.cc
index 64f1836f..6b0e6ef 100644
--- a/ash/services/secure_channel/ble_weave_client_connection_unittest.cc
+++ b/ash/services/secure_channel/ble_weave_client_connection_unittest.cc
@@ -927,7 +927,7 @@
ASSERT_FALSE(notify_session_error_callback_.is_null());
std::move(notify_session_error_callback_)
- .Run(device::BluetoothGattService::GATT_ERROR_UNKNOWN);
+ .Run(device::BluetoothGattService::GattErrorCode::kUnknown);
VerifyGattNotifySessionResult(false);
@@ -964,7 +964,7 @@
ASSERT_FALSE(write_remote_characteristic_error_callback_.is_null());
EXPECT_FALSE(write_remote_characteristic_success_callback_.is_null());
std::move(write_remote_characteristic_error_callback_)
- .Run(device::BluetoothGattService::GATT_ERROR_UNKNOWN);
+ .Run(device::BluetoothGattService::GattErrorCode::kUnknown);
task_runner_->RunUntilIdle();
VerifyGattWriteCharacteristicResult(false /* success */,
i + 1 /* num_writes */);
@@ -1130,7 +1130,7 @@
ASSERT_FALSE(write_remote_characteristic_error_callback_.is_null());
EXPECT_FALSE(write_remote_characteristic_success_callback_.is_null());
std::move(write_remote_characteristic_error_callback_)
- .Run(device::BluetoothGattService::GATT_ERROR_UNKNOWN);
+ .Run(device::BluetoothGattService::GattErrorCode::kUnknown);
task_runner_->RunUntilIdle();
VerifyGattWriteCharacteristicResult(false /* success */,
i + 1 /* num_writes */);
@@ -1346,7 +1346,7 @@
}
std::move(write_remote_characteristic_error_callback_)
- .Run(device::BluetoothGattService::GATT_ERROR_UNKNOWN);
+ .Run(device::BluetoothGattService::GattErrorCode::kUnknown);
task_runner_->RunUntilIdle();
VerifyGattWriteCharacteristicResult(false /* success */,
i + 1 /* num_writes */);
diff --git a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc
index be5dfbee..4bd868c5 100644
--- a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc
+++ b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc
@@ -224,20 +224,20 @@
const device::BluetoothGattService::GattErrorCode& error_code,
bool is_read_operation) {
switch (error_code) {
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_INVALID_LENGTH:
+ case device::BluetoothGattService::GattErrorCode::kInvalidLength:
return arc::mojom::BluetoothGattStatus::GATT_INVALID_ATTRIBUTE_LENGTH;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PERMITTED:
+ case device::BluetoothGattService::GattErrorCode::kNotPermitted:
return is_read_operation
? arc::mojom::BluetoothGattStatus::GATT_READ_NOT_PERMITTED
: arc::mojom::BluetoothGattStatus::GATT_WRITE_NOT_PERMITTED;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_AUTHORIZED:
+ case device::BluetoothGattService::GattErrorCode::kNotAuthorized:
return arc::mojom::BluetoothGattStatus::GATT_INSUFFICIENT_AUTHENTICATION;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_SUPPORTED:
+ case device::BluetoothGattService::GattErrorCode::kNotSupported:
return arc::mojom::BluetoothGattStatus::GATT_REQUEST_NOT_SUPPORTED;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_UNKNOWN:
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED:
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_IN_PROGRESS:
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PAIRED:
+ case device::BluetoothGattService::GattErrorCode::kUnknown:
+ case device::BluetoothGattService::GattErrorCode::kFailed:
+ case device::BluetoothGattService::GattErrorCode::kInProgress:
+ case device::BluetoothGattService::GattErrorCode::kNotPaired:
default:
return arc::mojom::BluetoothGattStatus::GATT_FAILURE;
}
@@ -327,7 +327,7 @@
if (status == arc::mojom::BluetoothGattStatus::GATT_SUCCESS) {
std::move(callback).Run(/*error_code=*/absl::nullopt, value);
} else {
- std::move(callback).Run(BluetoothGattService::GATT_ERROR_FAILED,
+ std::move(callback).Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
}
}
@@ -885,7 +885,7 @@
auto* bluetooth_instance = ARC_GET_INSTANCE_FOR_METHOD(
arc_bridge_service_->bluetooth(), RequestGattRead);
if (!bluetooth_instance || !IsGattOffsetValid(offset)) {
- std::move(callback).Run(BluetoothGattService::GATT_ERROR_FAILED,
+ std::move(callback).Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -1728,7 +1728,8 @@
// TODO(b/201737474): Investigate in what case this could happen.
LOG(ERROR) << "Requested GATT characteristic does not exist";
OnGattRead(std::move(callback),
- device::BluetoothGattService::GATT_ERROR_FAILED, /*result=*/{});
+ device::BluetoothGattService::GattErrorCode::kFailed,
+ /*result=*/{});
return;
}
diff --git a/chrome/browser/bluetooth/web_bluetooth_browsertest.cc b/chrome/browser/bluetooth/web_bluetooth_browsertest.cc
index 005c946..6100f37c 100644
--- a/chrome/browser/bluetooth/web_bluetooth_browsertest.cc
+++ b/chrome/browser/bluetooth/web_bluetooth_browsertest.cc
@@ -174,8 +174,9 @@
void ReadRemoteCharacteristic(ValueCallback callback) override {
if (!(GetProperties() & BluetoothGattCharacteristic::PROPERTY_READ)) {
- std::move(callback).Run(BluetoothGattService::GATT_ERROR_NOT_PERMITTED,
- std::vector<uint8_t>());
+ std::move(callback).Run(
+ BluetoothGattService::GattErrorCode::kNotPermitted,
+ std::vector<uint8_t>());
return;
}
if (defer_read_until_notification_start_) {
@@ -190,7 +191,7 @@
ErrorCallback error_callback) override {
if (!(GetProperties() & BluetoothGattCharacteristic::PROPERTY_NOTIFY)) {
std::move(error_callback)
- .Run(BluetoothGattService::GATT_ERROR_NOT_PERMITTED);
+ .Run(BluetoothGattService::GattErrorCode::kNotPermitted);
return;
}
auto fake_notify_session =
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
index 589dc1f..e5f9deba7 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
@@ -720,9 +720,9 @@
std::vector<uint8_t> value;
EXPECT_CALL(*chrc0_, ReadRemoteCharacteristic_(_))
.Times(2)
- .WillOnce(
- InvokeCallbackArgument<0>(BluetoothGattService::GATT_ERROR_FAILED,
- /*value=*/std::vector<uint8_t>()))
+ .WillOnce(InvokeCallbackArgument<0>(
+ BluetoothGattService::GattErrorCode::kFailed,
+ /*value=*/std::vector<uint8_t>()))
.WillOnce(InvokeCallbackArgument<0>(absl::nullopt, value));
ExtensionTestMessageListener listener("ready", ReplyBehavior::kWillReply);
@@ -763,8 +763,8 @@
std::vector<uint8_t> write_value;
EXPECT_CALL(*chrc0_, DeprecatedWriteRemoteCharacteristic_(_, _, _))
.Times(2)
- .WillOnce(
- InvokeCallbackArgument<2>(BluetoothGattService::GATT_ERROR_FAILED))
+ .WillOnce(InvokeCallbackArgument<2>(
+ BluetoothGattService::GattErrorCode::kFailed))
.WillOnce(DoAll(SaveArg<0>(&write_value), InvokeCallbackArgument<1>()));
EXPECT_CALL(*chrc0_, GetValue()).Times(1).WillOnce(ReturnRef(write_value));
@@ -988,26 +988,26 @@
std::vector<uint8_t> value;
EXPECT_CALL(*desc0_, ReadRemoteDescriptor_(_))
.Times(8)
- .WillOnce(
- InvokeCallbackArgument<0>(BluetoothGattService::GATT_ERROR_FAILED,
- /*value=*/std::vector<uint8_t>()))
.WillOnce(InvokeCallbackArgument<0>(
- BluetoothGattService::GATT_ERROR_INVALID_LENGTH,
+ BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>()))
.WillOnce(InvokeCallbackArgument<0>(
- BluetoothGattService::GATT_ERROR_NOT_PERMITTED,
+ BluetoothGattService::GattErrorCode::kInvalidLength,
/*value=*/std::vector<uint8_t>()))
.WillOnce(InvokeCallbackArgument<0>(
- BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED,
- /*value=*/std::vector<uint8_t>()))
- .WillOnce(
- InvokeCallbackArgument<0>(BluetoothGattService::GATT_ERROR_NOT_PAIRED,
- /*value=*/std::vector<uint8_t>()))
- .WillOnce(InvokeCallbackArgument<0>(
- BluetoothGattService::GATT_ERROR_NOT_SUPPORTED,
+ BluetoothGattService::GattErrorCode::kNotPermitted,
/*value=*/std::vector<uint8_t>()))
.WillOnce(InvokeCallbackArgument<0>(
- BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ BluetoothGattService::GattErrorCode::kNotAuthorized,
+ /*value=*/std::vector<uint8_t>()))
+ .WillOnce(InvokeCallbackArgument<0>(
+ BluetoothGattService::GattErrorCode::kNotPaired,
+ /*value=*/std::vector<uint8_t>()))
+ .WillOnce(InvokeCallbackArgument<0>(
+ BluetoothGattService::GattErrorCode::kNotSupported,
+ /*value=*/std::vector<uint8_t>()))
+ .WillOnce(InvokeCallbackArgument<0>(
+ BluetoothGattService::GattErrorCode::kInProgress,
/*value=*/std::vector<uint8_t>()))
.WillOnce(InvokeCallbackArgument<0>(/*error_code=*/absl::nullopt, value));
@@ -1055,8 +1055,8 @@
std::vector<uint8_t> write_value;
EXPECT_CALL(*desc0_, WriteRemoteDescriptor_(_, _, _))
.Times(2)
- .WillOnce(
- InvokeCallbackArgument<2>(BluetoothGattService::GATT_ERROR_FAILED))
+ .WillOnce(InvokeCallbackArgument<2>(
+ BluetoothGattService::GattErrorCode::kFailed))
.WillOnce(DoAll(SaveArg<0>(&write_value), InvokeCallbackArgument<1>()));
EXPECT_CALL(*desc0_, GetValue()).Times(1).WillOnce(ReturnRef(write_value));
@@ -1307,8 +1307,8 @@
EXPECT_CALL(*chrc0_, StartNotifySession_(_, _))
.Times(2)
- .WillOnce(
- InvokeCallbackArgument<1>(BluetoothGattService::GATT_ERROR_FAILED))
+ .WillOnce(InvokeCallbackArgument<1>(
+ BluetoothGattService::GattErrorCode::kFailed))
.WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattNotifySession>(
session0));
EXPECT_CALL(*chrc1_, StartNotifySession_(_, _))
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl.cc b/content/browser/bluetooth/web_bluetooth_service_impl.cc
index 4b470df..129aa3c 100644
--- a/content/browser/bluetooth/web_bluetooth_service_impl.cc
+++ b/content/browser/bluetooth/web_bluetooth_service_impl.cc
@@ -90,33 +90,33 @@
GattErrorCode error_code,
UMAGATTOperation operation) {
switch (error_code) {
- case device::BluetoothRemoteGattService::GATT_ERROR_UNKNOWN:
+ case device::BluetoothRemoteGattService::GattErrorCode::kUnknown:
RecordGATTOperationOutcome(operation, UMAGATTOperationOutcome::kUnknown);
return blink::mojom::WebBluetoothResult::GATT_UNKNOWN_ERROR;
- case device::BluetoothRemoteGattService::GATT_ERROR_FAILED:
+ case device::BluetoothRemoteGattService::GattErrorCode::kFailed:
RecordGATTOperationOutcome(operation, UMAGATTOperationOutcome::kFailed);
return blink::mojom::WebBluetoothResult::GATT_UNKNOWN_FAILURE;
- case device::BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS:
+ case device::BluetoothRemoteGattService::GattErrorCode::kInProgress:
RecordGATTOperationOutcome(operation,
UMAGATTOperationOutcome::kInProgress);
return blink::mojom::WebBluetoothResult::GATT_OPERATION_IN_PROGRESS;
- case device::BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH:
+ case device::BluetoothRemoteGattService::GattErrorCode::kInvalidLength:
RecordGATTOperationOutcome(operation,
UMAGATTOperationOutcome::kInvalidLength);
return blink::mojom::WebBluetoothResult::GATT_INVALID_ATTRIBUTE_LENGTH;
- case device::BluetoothRemoteGattService::GATT_ERROR_NOT_PERMITTED:
+ case device::BluetoothRemoteGattService::GattErrorCode::kNotPermitted:
RecordGATTOperationOutcome(operation,
UMAGATTOperationOutcome::kNotPermitted);
return blink::mojom::WebBluetoothResult::GATT_NOT_PERMITTED;
- case device::BluetoothRemoteGattService::GATT_ERROR_NOT_AUTHORIZED:
+ case device::BluetoothRemoteGattService::GattErrorCode::kNotAuthorized:
RecordGATTOperationOutcome(operation,
UMAGATTOperationOutcome::kNotAuthorized);
return blink::mojom::WebBluetoothResult::GATT_NOT_AUTHORIZED;
- case device::BluetoothRemoteGattService::GATT_ERROR_NOT_PAIRED:
+ case device::BluetoothRemoteGattService::GattErrorCode::kNotPaired:
RecordGATTOperationOutcome(operation,
UMAGATTOperationOutcome::kNotPaired);
return blink::mojom::WebBluetoothResult::GATT_NOT_PAIRED;
- case device::BluetoothRemoteGattService::GATT_ERROR_NOT_SUPPORTED:
+ case device::BluetoothRemoteGattService::GattErrorCode::kNotSupported:
RecordGATTOperationOutcome(operation,
UMAGATTOperationOutcome::kNotSupported);
return blink::mojom::WebBluetoothResult::GATT_NOT_SUPPORTED;
@@ -2054,8 +2054,8 @@
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (error_code.has_value()) {
#if PAIR_BLUETOOTH_ON_DEMAND()
- if (error_code.value() == GattErrorCode::GATT_ERROR_NOT_AUTHORIZED ||
- error_code.value() == GattErrorCode::GATT_ERROR_NOT_PAIRED) {
+ if (error_code.value() == GattErrorCode::kNotAuthorized ||
+ error_code.value() == GattErrorCode::kNotPaired) {
BluetoothDevice* device = GetCachedDevice(
GetCharacteristicDeviceID(characteristic_instance_id));
if (device && !device->IsPaired()) {
@@ -2093,7 +2093,7 @@
DCHECK_CURRENTLY_ON(BrowserThread::UI);
#if PAIR_BLUETOOTH_ON_DEMAND()
- if (error_code == GattErrorCode::GATT_ERROR_NOT_AUTHORIZED) {
+ if (error_code == GattErrorCode::kNotAuthorized) {
BluetoothDevice* device =
GetCachedDevice(GetCharacteristicDeviceID(characteristic_instance_id));
if (device && !device->IsPaired()) {
@@ -2153,7 +2153,7 @@
}
#if PAIR_BLUETOOTH_ON_DEMAND()
- if (error_code == GattErrorCode::GATT_ERROR_NOT_AUTHORIZED && client) {
+ if (error_code == GattErrorCode::kNotAuthorized && client) {
BluetoothDevice* device =
GetCachedDevice(GetCharacteristicDeviceID(characteristic_instance_id));
if (device && !device->IsPaired()) {
@@ -2202,7 +2202,7 @@
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (error_code.has_value()) {
#if PAIR_BLUETOOTH_ON_DEMAND()
- if (error_code.value() == GattErrorCode::GATT_ERROR_NOT_AUTHORIZED) {
+ if (error_code.value() == GattErrorCode::kNotAuthorized) {
BluetoothDevice* device =
GetCachedDevice(GetDescriptorDeviceId(descriptor_instance_id));
if (device && !device->IsPaired()) {
@@ -2237,7 +2237,7 @@
DCHECK_CURRENTLY_ON(BrowserThread::UI);
#if PAIR_BLUETOOTH_ON_DEMAND()
- if (error_code == GattErrorCode::GATT_ERROR_NOT_AUTHORIZED) {
+ if (error_code == GattErrorCode::kNotAuthorized) {
BluetoothDevice* device =
GetCachedDevice(GetDescriptorDeviceId(descriptor_instance_id));
if (device && !device->IsPaired()) {
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl_unittest.cc b/content/browser/bluetooth/web_bluetooth_service_impl_unittest.cc
index b18b89b..948e877 100644
--- a/content/browser/bluetooth/web_bluetooth_service_impl_unittest.cc
+++ b/content/browser/bluetooth/web_bluetooth_service_impl_unittest.cc
@@ -857,7 +857,8 @@
result);
EXPECT_FALSE(value.has_value());
}),
- device::BluetoothGattService::GATT_ERROR_IN_PROGRESS, read_error_value);
+ device::BluetoothGattService::GattErrorCode::kInProgress,
+ read_error_value);
EXPECT_TRUE(callback_called);
// This test doesn't invoke any methods of the mock adapter. Allow it to be
@@ -892,7 +893,7 @@
result);
EXPECT_FALSE(value.has_value());
}),
- device::BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED,
+ device::BluetoothGattService::GattErrorCode::kNotAuthorized,
read_error_value);
EXPECT_FALSE(read_value_callback_called);
}
@@ -902,7 +903,7 @@
EXPECT_CALL(test_bundle().characteristic(), ReadRemoteCharacteristic_(_))
.WillOnce(base::test::RunOnceCallback<0>(
- device::BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED,
+ device::BluetoothGattService::GattErrorCode::kNotAuthorized,
std::vector<uint8_t>()));
base::MockCallback<
@@ -933,7 +934,7 @@
int outstanding_callbacks = 2;
test_characteristic.DeferNextStartNotification(
- BluetoothGattService::GATT_ERROR_FAILED);
+ BluetoothGattService::GattErrorCode::kFailed);
auto callback = base::BindLambdaForTesting(
[&run_loop, &outstanding_callbacks](WebBluetoothResult result) {
diff --git a/content/web_test/browser/web_test_bluetooth_adapter_provider.cc b/content/web_test/browser/web_test_bluetooth_adapter_provider.cc
index f4b3cf7e..eedf581 100644
--- a/content/web_test/browser/web_test_bluetooth_adapter_provider.cc
+++ b/content/web_test/browser/web_test_bluetooth_adapter_provider.cc
@@ -1036,9 +1036,10 @@
/*error_code=*/absl::nullopt,
std::vector<uint8_t>({1}));
} else {
- pending = base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_FAILED,
- /*value=*/std::vector<uint8_t>());
+ pending =
+ base::BindOnce(std::move(callback),
+ BluetoothGattService::GattErrorCode::kFailed,
+ /*value=*/std::vector<uint8_t>());
}
device_ptr->PushPendingCallback(std::move(pending));
if (disconnect) {
@@ -1062,8 +1063,9 @@
if (succeeds) {
pending = std::move(callback);
} else {
- pending = base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED);
+ pending =
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed);
}
device_ptr->PushPendingCallback(std::move(pending));
if (disconnect) {
@@ -1085,8 +1087,9 @@
if (succeeds) {
pending = std::move(callback);
} else {
- pending = base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED);
+ pending =
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed);
}
device_ptr->PushPendingCallback(std::move(pending));
if (disconnect) {
@@ -1111,8 +1114,9 @@
std::move(callback),
GetBaseGATTNotifySession(measurement_ptr->GetWeakPtr()));
} else {
- pending = base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED);
+ pending =
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed);
}
device_ptr->PushPendingCallback(std::move(pending));
if (disconnect) {
@@ -1139,9 +1143,10 @@
/*error_code=*/absl::nullopt,
std::vector<uint8_t>({1}));
} else {
- pending = base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_FAILED,
- /*value=*/std::vector<uint8_t>());
+ pending =
+ base::BindOnce(std::move(callback),
+ BluetoothGattService::GattErrorCode::kFailed,
+ /*value=*/std::vector<uint8_t>());
}
device_ptr->PushPendingCallback(std::move(pending));
if (disconnect) {
@@ -1162,8 +1167,9 @@
if (succeeds) {
pending = std::move(callback);
} else {
- pending = base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED);
+ pending =
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed);
}
device_ptr->PushPendingCallback(std::move(pending));
if (disconnect) {
@@ -1309,8 +1315,8 @@
auto service(
GetBaseGATTService("Errors Service", device.get(), errorsServiceUUID));
- for (int error = BluetoothGattService::GATT_ERROR_UNKNOWN;
- error <= BluetoothGattService::GATT_ERROR_NOT_SUPPORTED; error++) {
+ for (int error = BluetoothGattService::GattErrorCode::kUnknown;
+ error <= BluetoothGattService::GattErrorCode::kNotSupported; error++) {
service->AddMockCharacteristic(GetErrorCharacteristic(
service.get(),
static_cast<BluetoothGattService::GattErrorCode>(error)));
@@ -1724,20 +1730,20 @@
ON_CALL(*characteristic, ReadRemoteCharacteristic_(_))
.WillByDefault(RunCallbackWithResult<0>(
- BluetoothGattService::GATT_ERROR_NOT_SUPPORTED,
+ BluetoothGattService::GattErrorCode::kNotSupported,
/*value=*/std::vector<uint8_t>()));
ON_CALL(*characteristic, WriteRemoteCharacteristic_(_, _, _, _))
.WillByDefault(
- RunCallback<3>(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED));
+ RunCallback<3>(BluetoothGattService::GattErrorCode::kNotSupported));
ON_CALL(*characteristic, DeprecatedWriteRemoteCharacteristic_(_, _, _))
.WillByDefault(
- RunCallback<2>(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED));
+ RunCallback<2>(BluetoothGattService::GattErrorCode::kNotSupported));
ON_CALL(*characteristic, StartNotifySession_(_, _))
.WillByDefault(
- RunCallback<1>(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED));
+ RunCallback<1>(BluetoothGattService::GattErrorCode::kNotSupported));
return characteristic;
}
diff --git a/content/web_test/browser/web_test_bluetooth_adapter_provider.h b/content/web_test/browser/web_test_bluetooth_adapter_provider.h
index 6236fde..a0884f2 100644
--- a/content/web_test/browser/web_test_bluetooth_adapter_provider.h
+++ b/content/web_test/browser/web_test_bluetooth_adapter_provider.h
@@ -475,28 +475,28 @@
// - ErrorsDevice
// - ErrorsService errorUUID(0xA0)
// - ErrorCharacteristic(
- // BluetoothGattService::GATT_ERROR_UNKNOWN)
+ // BluetoothGattService::GattErrorCode::kUnknown)
// errorUUID(0xA1)
// - ErrorCharacteristic(
- // BluetoothGattService::GATT_ERROR_FAILED)
+ // BluetoothGattService::GattErrorCode::kFailed)
// errorUUID(0xA2)
// - ErrorCharacteristic(
- // BluetoothGattService::GATT_ERROR_IN_PROGRESS)
+ // BluetoothGattService::GattErrorCode::kInProgress)
// errorUUID(0xA3)
// - ErrorCharacteristic(
- // BluetoothGattService::GATT_ERROR_INVALID_LENGTH)
+ // BluetoothGattService::GattErrorCode::kInvalidLength)
// errorUUID(0xA4)
// - ErrorCharacteristic(
- // BluetoothGattService::GATT_ERROR_NOT_PERMITTED)
+ // BluetoothGattService::GattErrorCode::kNotPermitted)
// errorUUID(0xA5)
// - ErrorCharacteristic(
- // BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED)
+ // BluetoothGattService::GattErrorCode::kNotAuthorized)
// errorUUID(0xA6)
// - ErrorCharacteristic(
- // BluetoothGattService::GATT_ERROR_NOT_PAIRED)
+ // BluetoothGattService::GattErrorCode::kNotPaired)
// errorUUID(0xA7)
// - ErrorCharacteristic(
- // BluetoothGattService::GATT_ERROR_NOT_SUPPORTED)
+ // BluetoothGattService::GattErrorCode::kNotSupported)
// errorUUID(0xA8)
// - Request Disconnection Service: - Characteristics as described in
// GetDisconnectingService
diff --git a/device/bluetooth/bluetooth_adapter_mac_metrics_unittest.mm b/device/bluetooth/bluetooth_adapter_mac_metrics_unittest.mm
index 55d1107..5b7f2ee 100644
--- a/device/bluetooth/bluetooth_adapter_mac_metrics_unittest.mm
+++ b/device/bluetooth/bluetooth_adapter_mac_metrics_unittest.mm
@@ -87,8 +87,8 @@
ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate(
BluetoothRemoteGattCharacteristic::PROPERTY_WRITE));
- SimulateGattCharacteristicReadError(characteristic_,
- BluetoothGattService::GATT_ERROR_FAILED);
+ SimulateGattCharacteristicReadError(
+ characteristic_, BluetoothGattService::GattErrorCode::kFailed);
histogram_tester.ExpectTotalCount("Bluetooth.MacOS.Errors.DidUpdateValue", 1);
}
@@ -97,8 +97,8 @@
ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate(
BluetoothRemoteGattCharacteristic::PROPERTY_WRITE));
- SimulateGattCharacteristicWriteError(characteristic_,
- BluetoothGattService::GATT_ERROR_FAILED);
+ SimulateGattCharacteristicWriteError(
+ characteristic_, BluetoothGattService::GattErrorCode::kFailed);
histogram_tester.ExpectTotalCount("Bluetooth.MacOS.Errors.DidWriteValue", 1);
}
@@ -116,8 +116,8 @@
GetGattErrorCallback(Call::EXPECTED));
ExpectedChangeNotifyValueAttempts(1);
ExpectedNotifyValue(NotifyValueState::NOTIFY);
- SimulateGattNotifySessionStartError(characteristic_,
- BluetoothGattService::GATT_ERROR_FAILED);
+ SimulateGattNotifySessionStartError(
+ characteristic_, BluetoothGattService::GattErrorCode::kFailed);
histogram_tester.ExpectTotalCount(
"Bluetooth.MacOS.Errors.DidUpdateNotificationState", 1);
}
@@ -144,8 +144,8 @@
characteristic_->GetDescriptors()[0];
descriptor->ReadRemoteDescriptor(
GetReadValueCallback(Call::EXPECTED, Result::FAILURE));
- SimulateGattDescriptorUpdateError(descriptor,
- BluetoothGattService::GATT_ERROR_FAILED);
+ SimulateGattDescriptorUpdateError(
+ descriptor, BluetoothGattService::GattErrorCode::kFailed);
base::RunLoop().RunUntilIdle();
histogram_tester.ExpectTotalCount(
"Bluetooth.MacOS.Errors.DidUpdateValueForDescriptor", 1);
@@ -166,8 +166,8 @@
descriptor->WriteRemoteDescriptor(empty_vector,
GetCallback(Call::NOT_EXPECTED),
GetGattErrorCallback(Call::EXPECTED));
- SimulateGattDescriptorWriteError(descriptor,
- BluetoothGattService::GATT_ERROR_FAILED);
+ SimulateGattDescriptorWriteError(
+ descriptor, BluetoothGattService::GattErrorCode::kFailed);
histogram_tester.ExpectTotalCount(
"Bluetooth.MacOS.Errors.DidWriteValueForDescriptor", 1);
}
diff --git a/device/bluetooth/bluetooth_device_mac.mm b/device/bluetooth/bluetooth_device_mac.mm
index 8e30b0f..f1dd73c4 100644
--- a/device/bluetooth/bluetooth_device_mac.mm
+++ b/device/bluetooth/bluetooth_device_mac.mm
@@ -55,15 +55,15 @@
BluetoothGattService::GattErrorCode gatt_error_code =
(BluetoothGattService::GattErrorCode)error.code;
if (gatt_error_code >= 0 ||
- gatt_error_code <= BluetoothGattService::GATT_ERROR_NOT_SUPPORTED) {
+ gatt_error_code <= BluetoothGattService::GattErrorCode::kNotSupported) {
return gatt_error_code;
}
NOTREACHED();
- return BluetoothGattService::GATT_ERROR_FAILED;
+ return BluetoothGattService::GattErrorCode::kFailed;
}
// TODO(http://crbug.com/619595): Need to convert the error code from
// CoreBluetooth to a GattErrorCode value.
- return BluetoothGattService::GATT_ERROR_FAILED;
+ return BluetoothGattService::GattErrorCode::kFailed;
}
} // namespace device
diff --git a/device/bluetooth/bluetooth_gatt_service.h b/device/bluetooth/bluetooth_gatt_service.h
index dfaf087..228080b8 100644
--- a/device/bluetooth/bluetooth_gatt_service.h
+++ b/device/bluetooth/bluetooth_gatt_service.h
@@ -26,15 +26,15 @@
// with the BluetoothGattServiceGattErrorCode enum in
// src/tools/metrics/histograms/enums.xml.
enum GattErrorCode {
- GATT_ERROR_UNKNOWN = 0,
- GATT_ERROR_FAILED = 1,
- GATT_ERROR_IN_PROGRESS = 2,
- GATT_ERROR_INVALID_LENGTH = 3,
- GATT_ERROR_NOT_PERMITTED = 4,
- GATT_ERROR_NOT_AUTHORIZED = 5,
- GATT_ERROR_NOT_PAIRED = 6,
- GATT_ERROR_NOT_SUPPORTED = 7,
- kMaxValue = GATT_ERROR_NOT_SUPPORTED,
+ kUnknown = 0,
+ kFailed = 1,
+ kInProgress = 2,
+ kInvalidLength = 3,
+ kNotPermitted = 4,
+ kNotAuthorized = 5,
+ kNotPaired = 6,
+ kNotSupported = 7,
+ kMaxValue = kNotSupported,
};
// The ErrorCallback is used by methods to asynchronously report errors.
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic.cc
index ea58ae6..a898b54 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic.cc
@@ -153,7 +153,7 @@
&BluetoothRemoteGattCharacteristic::CancelStartNotifySession,
GetWeakPtr(),
base::BindOnce(std::move(split_error_callback.second),
- BluetoothGattService::GATT_ERROR_FAILED)));
+ BluetoothGattService::GattErrorCode::kFailed)));
if (!notify_command_running_ && pending_notify_commands_.size() == 1) {
notify_command_running_ = true;
@@ -199,7 +199,7 @@
base::BindOnce(
&BluetoothRemoteGattCharacteristic::OnStartNotifySessionError,
GetWeakPtr(), std::move(error_callback),
- BluetoothGattService::GATT_ERROR_NOT_SUPPORTED));
+ BluetoothGattService::GattErrorCode::kNotSupported));
return;
}
@@ -229,8 +229,8 @@
&BluetoothRemoteGattCharacteristic::OnStartNotifySessionError,
GetWeakPtr(), std::move(error_callback),
(ccc_descriptor.size() == 0)
- ? BluetoothGattService::GATT_ERROR_NOT_SUPPORTED
- : BluetoothGattService::GATT_ERROR_FAILED));
+ ? BluetoothGattService::GattErrorCode::kNotSupported
+ : BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -337,7 +337,7 @@
base::BindOnce(
&BluetoothRemoteGattCharacteristic::OnStopNotifySessionError,
GetWeakPtr(), session, std::move(callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -364,7 +364,7 @@
base::BindOnce(
&BluetoothRemoteGattCharacteristic::OnStopNotifySessionError,
GetWeakPtr(), session, std::move(callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
index ecfe9ef..3df8d3c 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
@@ -57,14 +57,14 @@
AttachCurrentThread(), j_characteristic_);
if (read_callback_) {
std::move(read_callback_)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
}
if (!write_callback_.is_null()) {
DCHECK(!write_error_callback_.is_null());
std::move(write_error_callback_)
- .Run(BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(BluetoothGattService::GattErrorCode::kFailed);
}
}
@@ -129,9 +129,10 @@
ValueCallback callback) {
if (read_pending_ || write_pending_) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS,
- /*value=*/std::vector<uint8_t>()));
+ FROM_HERE,
+ base::BindOnce(std::move(callback),
+ BluetoothGattService::GattErrorCode::kInProgress,
+ /*value=*/std::vector<uint8_t>()));
return;
}
@@ -139,7 +140,7 @@
AttachCurrentThread(), j_characteristic_)) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_FAILED,
+ BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>()));
return;
}
@@ -157,7 +158,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS));
+ BluetoothGattService::GattErrorCode::kInProgress));
return;
}
@@ -176,8 +177,9 @@
env, j_characteristic_, base::android::ToJavaByteArray(env, value),
static_cast<int>(android_write_type))) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -194,7 +196,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS));
+ BluetoothGattService::GattErrorCode::kInProgress));
return;
}
@@ -203,8 +205,9 @@
env, j_characteristic_, base::android::ToJavaByteArray(env, value),
static_cast<int>(AndroidWriteType::kNone))) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -287,8 +290,9 @@
AttachCurrentThread(), j_characteristic_, true)) {
LOG(ERROR) << "Error enabling characteristic notification";
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -310,7 +314,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- device::BluetoothGattService::GATT_ERROR_FAILED));
+ device::BluetoothGattService::GattErrorCode::kFailed));
return;
}
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm b/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
index 34bdc60..0cfd76e2 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
@@ -87,12 +87,12 @@
destructor_called_ = true;
if (HasPendingRead()) {
std::move(read_characteristic_value_callback_)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
}
if (HasPendingWrite()) {
std::move(write_characteristic_value_callbacks_.second)
- .Run(BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(BluetoothGattService::GattErrorCode::kFailed);
}
}
@@ -137,16 +137,17 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_NOT_PERMITTED,
+ BluetoothGattService::GattErrorCode::kNotPermitted,
/*value=*/std::vector<uint8_t>()));
return;
}
if (destructor_called_ || HasPendingRead() || HasPendingWrite()) {
DVLOG(1) << *this << ": Characteristic read already in progress.";
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS,
- /*value=*/std::vector<uint8_t>()));
+ FROM_HERE,
+ base::BindOnce(std::move(callback),
+ BluetoothGattService::GattErrorCode::kInProgress,
+ /*value=*/std::vector<uint8_t>()));
return;
}
DVLOG(1) << *this << ": Read characteristic.";
@@ -164,7 +165,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS));
+ BluetoothGattService::GattErrorCode::kInProgress));
return;
}
DVLOG(1) << *this << ": Write characteristic.";
@@ -203,7 +204,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_NOT_PERMITTED));
+ BluetoothGattService::GattErrorCode::kNotPermitted));
return;
}
if (destructor_called_ || HasPendingRead() || HasPendingWrite()) {
@@ -211,7 +212,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS));
+ BluetoothGattService::GattErrorCode::kInProgress));
return;
}
DVLOG(1) << *this << ": Write characteristic.";
@@ -321,7 +322,8 @@
GetCBPeripheral().state != CBPeripheralStateConnected) {
std::pair<base::OnceClosure, ErrorCallback> callbacks;
callbacks.swap(write_characteristic_value_callbacks_);
- std::move(callbacks.second).Run(BluetoothGattService::GATT_ERROR_FAILED);
+ std::move(callbacks.second)
+ .Run(BluetoothGattService::GattErrorCode::kFailed);
return;
}
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
index 8f3c1c0..ed3e7d3 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
@@ -503,7 +503,7 @@
characteristic1_->ReadRemoteCharacteristic(base::BindLambdaForTesting(
[&](absl::optional<BluetoothGattService::GattErrorCode> error_code,
const std::vector<uint8_t>&) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
read_characteristic_failed = true;
// Retrying Read should fail:
characteristic1_->ReadRemoteCharacteristic(
@@ -513,7 +513,7 @@
DeleteDevice(device_); // TODO(576906) delete only the characteristic.
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(read_characteristic_failed);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
last_gatt_error_code_);
}
@@ -546,7 +546,7 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
// Retrying Write should fail:
characteristic1_->WriteRemoteCharacteristic(
{} /* value */, WriteType::kWithResponse,
@@ -556,8 +556,9 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
- error_code);
+ EXPECT_EQ(
+ BluetoothGattService::GattErrorCode::kInProgress,
+ error_code);
loop.Quit();
}));
}));
@@ -593,7 +594,7 @@
{} /* value */, GetCallback(Call::NOT_EXPECTED),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
write_error_callback_called = true;
// Retrying Write should fail:
characteristic1_->DeprecatedWriteRemoteCharacteristic(
@@ -604,7 +605,7 @@
DeleteDevice(device_); // TODO(576906) delete only the characteristic.
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(write_error_callback_called);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
last_gatt_error_code_);
}
@@ -685,7 +686,8 @@
SimulateDeviceBreaksConnection(adapter_->GetDevices()[0]);
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
// Dispatch read response after disconnection. See above explanation for why
// we don't do this in macOS on WinRT.
@@ -732,7 +734,7 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
loop.Quit();
}));
@@ -815,7 +817,7 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
loop.Quit();
}));
@@ -879,7 +881,8 @@
SimulateDeviceBreaksConnection(adapter_->GetDevices()[0]);
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
// Dispatch write response after disconnection. See above explanation for why
// we don't do this in macOS and WinRT.
@@ -1801,11 +1804,11 @@
characteristic1_->ReadRemoteCharacteristic(
GetReadValueCallback(Call::EXPECTED, Result::FAILURE));
SimulateGattCharacteristicReadError(
- characteristic1_, BluetoothGattService::GATT_ERROR_INVALID_LENGTH);
- SimulateGattCharacteristicReadError(characteristic1_,
- BluetoothGattService::GATT_ERROR_FAILED);
+ characteristic1_, BluetoothGattService::GattErrorCode::kInvalidLength);
+ SimulateGattCharacteristicReadError(
+ characteristic1_, BluetoothGattService::GattErrorCode::kFailed);
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_INVALID_LENGTH,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInvalidLength,
last_gatt_error_code_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
}
@@ -1837,15 +1840,15 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_INVALID_LENGTH,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInvalidLength,
error_code);
loop.Quit();
}));
SimulateGattCharacteristicWriteError(
- characteristic1_, BluetoothGattService::GATT_ERROR_INVALID_LENGTH);
+ characteristic1_, BluetoothGattService::GattErrorCode::kInvalidLength);
// Only the error above should be reported to the caller.
- SimulateGattCharacteristicWriteError(characteristic1_,
- BluetoothGattService::GATT_ERROR_FAILED);
+ SimulateGattCharacteristicWriteError(
+ characteristic1_, BluetoothGattService::GattErrorCode::kFailed);
loop.Run();
}
@@ -1872,12 +1875,12 @@
empty_vector, GetCallback(Call::NOT_EXPECTED),
GetGattErrorCallback(Call::EXPECTED));
SimulateGattCharacteristicWriteError(
- characteristic1_, BluetoothGattService::GATT_ERROR_INVALID_LENGTH);
- SimulateGattCharacteristicWriteError(characteristic1_,
- BluetoothGattService::GATT_ERROR_FAILED);
+ characteristic1_, BluetoothGattService::GattErrorCode::kInvalidLength);
+ SimulateGattCharacteristicWriteError(
+ characteristic1_, BluetoothGattService::GattErrorCode::kFailed);
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_INVALID_LENGTH,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInvalidLength,
last_gatt_error_code_);
}
@@ -1899,7 +1902,8 @@
base::RunLoop().RunUntilIdle();
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
// After failing once, can succeed:
ResetEventCounts();
@@ -1934,7 +1938,7 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
loop1.Quit();
}));
loop1.Run();
@@ -1978,7 +1982,8 @@
base::RunLoop().RunUntilIdle();
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
// After failing once, can succeed:
ResetEventCounts();
@@ -2023,7 +2028,7 @@
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
last_gatt_error_code_);
// Initial read should still succeed:
@@ -2078,7 +2083,8 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
+ error_code);
loop2.Quit();
}));
@@ -2125,7 +2131,7 @@
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
last_gatt_error_code_);
// Initial write should still succeed:
@@ -2175,7 +2181,7 @@
characteristic1_->ReadRemoteCharacteristic(base::BindLambdaForTesting(
[&](absl::optional<BluetoothGattService::GattErrorCode> error_code,
const std::vector<uint8_t>& data) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress, error_code);
loop2.Quit();
}));
@@ -2221,7 +2227,7 @@
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
last_gatt_error_code_);
// Initial write should still succeed:
@@ -2271,7 +2277,8 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
+ error_code);
loop2.Quit();
}));
loop2.Run();
@@ -2316,7 +2323,7 @@
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
last_gatt_error_code_);
// Initial read should still succeed:
@@ -2521,7 +2528,7 @@
EXPECT_EQ(0, error_callback_count_);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kNotSupported,
last_gatt_error_code_);
}
@@ -2555,7 +2562,7 @@
EXPECT_EQ(0, error_callback_count_);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kNotSupported,
last_gatt_error_code_);
}
@@ -2589,7 +2596,8 @@
EXPECT_EQ(0, error_callback_count_);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
}
#if BUILDFLAG(IS_ANDROID)
@@ -2799,13 +2807,14 @@
ExpectedChangeNotifyValueAttempts(1);
ExpectedNotifyValue(NotifyValueState::NOTIFY);
EXPECT_EQ(0, callback_count_);
- SimulateGattNotifySessionStartError(characteristic1_,
- BluetoothGattService::GATT_ERROR_FAILED);
+ SimulateGattNotifySessionStartError(
+ characteristic1_, BluetoothGattService::GattErrorCode::kFailed);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(2, error_callback_count_);
ASSERT_EQ(0u, notify_sessions_.size());
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
}
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC)
@@ -2882,7 +2891,8 @@
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
ASSERT_EQ(0u, notify_sessions_.size());
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
}
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC)
@@ -3008,8 +3018,8 @@
BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid().value());
ASSERT_EQ(1u, characteristic1_->GetDescriptors().size());
- SimulateGattNotifySessionStartError(characteristic1_,
- BluetoothGattService::GATT_ERROR_UNKNOWN);
+ SimulateGattNotifySessionStartError(
+ characteristic1_, BluetoothGattService::GattErrorCode::kUnknown);
characteristic1_->StartNotifySession(
GetReentrantStartNotifySessionSuccessCallback(Call::NOT_EXPECTED,
@@ -3348,8 +3358,8 @@
EXPECT_TRUE(characteristic1_->IsNotifying());
notify_sessions_[0]->Stop(GetStopNotifyCallback(Call::EXPECTED));
- SimulateGattNotifySessionStopError(characteristic1_,
- BluetoothGattService::GATT_ERROR_UNKNOWN);
+ SimulateGattNotifySessionStopError(
+ characteristic1_, BluetoothGattService::GattErrorCode::kUnknown);
base::RunLoop().RunUntilIdle();
// Check that the notify session is inactive.
@@ -3834,8 +3844,8 @@
EXPECT_FALSE(notify_sessions_[0]->IsActive());
EXPECT_FALSE(characteristic1_->IsNotifying());
- SimulateGattNotifySessionStartError(characteristic1_,
- BluetoothGattService::GATT_ERROR_FAILED);
+ SimulateGattNotifySessionStartError(
+ characteristic1_, BluetoothGattService::GattErrorCode::kFailed);
base::RunLoop().RunUntilIdle();
ASSERT_EQ(1u, notify_sessions_.size());
ASSERT_TRUE(notify_sessions_[0]);
@@ -4175,7 +4185,8 @@
GetReadValueCallback(Call::EXPECTED, Result::FAILURE));
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
}
#if BUILDFLAG(IS_ANDROID)
@@ -4206,7 +4217,7 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
loop.Quit();
}));
@@ -4239,7 +4250,8 @@
GetGattErrorCallback(Call::EXPECTED));
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
}
#if BUILDFLAG(IS_MAC)
@@ -4278,7 +4290,7 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
loop.Quit();
}));
SimulateDeviceBreaksConnection(adapter_->GetDevices()[0]);
@@ -4319,7 +4331,8 @@
SimulateDeviceBreaksConnection(adapter_->GetDevices()[0]);
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
}
// Tests that closing the GATT connection when a characteristic value write
@@ -4355,7 +4368,7 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
gatt_connections_[0]->Disconnect();
loop.Quit();
}));
@@ -4393,7 +4406,7 @@
std::vector<uint8_t>(), GetCallback(Call::NOT_EXPECTED),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
gatt_connections_[0]->Disconnect();
loop.Quit();
}));
@@ -4431,7 +4444,7 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
loop.Quit();
}));
gatt_connections_[0]->Disconnect();
@@ -4468,7 +4481,8 @@
gatt_connections_[0]->Disconnect();
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
SimulateGattDisconnection(device_);
base::RunLoop().RunUntilIdle();
@@ -4505,7 +4519,7 @@
}),
base::BindLambdaForTesting(
[&](BluetoothGattService::GattErrorCode error_code) {
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, error_code);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, error_code);
loop.Quit();
}));
loop.Run();
@@ -4541,7 +4555,8 @@
GetGattErrorCallback(Call::EXPECTED));
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
SimulateGattDisconnection(device_);
base::RunLoop().RunUntilIdle();
@@ -4577,7 +4592,8 @@
GetGattErrorCallback(Call::EXPECTED));
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
}
#if BUILDFLAG(IS_ANDROID)
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_win.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_win.cc
index 4f82fe0..2b7da36 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_win.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_win.cc
@@ -58,14 +58,14 @@
if (read_characteristic_value_callback_) {
std::move(read_characteristic_value_callback_)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
}
if (!write_characteristic_value_callbacks_.first.is_null()) {
DCHECK(!write_characteristic_value_callbacks_.second.is_null());
std::move(write_characteristic_value_callbacks_.second)
- .Run(BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(BluetoothGattService::GattErrorCode::kFailed);
}
}
@@ -135,13 +135,13 @@
DCHECK(ui_task_runner_->RunsTasksInCurrentSequence());
if (!characteristic_info_.get()->IsReadable) {
- std::move(callback).Run(BluetoothGattService::GATT_ERROR_NOT_PERMITTED,
+ std::move(callback).Run(BluetoothGattService::GattErrorCode::kNotPermitted,
std::vector<uint8_t>());
return;
}
if (characteristic_value_read_or_write_in_progress_) {
- std::move(callback).Run(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ std::move(callback).Run(BluetoothGattService::GattErrorCode::kInProgress,
std::vector<uint8_t>());
return;
}
@@ -163,7 +163,8 @@
DCHECK(ui_task_runner_->RunsTasksInCurrentSequence());
if (characteristic_value_read_or_write_in_progress_) {
- std::move(error_callback).Run(BluetoothGattService::GATT_ERROR_IN_PROGRESS);
+ std::move(error_callback)
+ .Run(BluetoothGattService::GattErrorCode::kInProgress);
return;
}
@@ -197,12 +198,13 @@
if (!characteristic_info_->IsWritable &&
!characteristic_info_->IsWritableWithoutResponse) {
std::move(error_callback)
- .Run(BluetoothGattService::GATT_ERROR_NOT_PERMITTED);
+ .Run(BluetoothGattService::GattErrorCode::kNotPermitted);
return;
}
if (characteristic_value_read_or_write_in_progress_) {
- std::move(error_callback).Run(BluetoothGattService::GATT_ERROR_IN_PROGRESS);
+ std::move(error_callback)
+ .Run(BluetoothGattService::GattErrorCode::kInProgress);
return;
}
@@ -388,20 +390,20 @@
BluetoothGattService::GattErrorCode
BluetoothRemoteGattCharacteristicWin::HRESULTToGattErrorCode(HRESULT hr) {
if (HRESULT_FROM_WIN32(ERROR_INVALID_USER_BUFFER) == hr)
- return BluetoothGattService::GATT_ERROR_INVALID_LENGTH;
+ return BluetoothGattService::GattErrorCode::kInvalidLength;
switch (hr) {
case E_BLUETOOTH_ATT_READ_NOT_PERMITTED:
case E_BLUETOOTH_ATT_WRITE_NOT_PERMITTED:
- return BluetoothGattService::GATT_ERROR_NOT_PERMITTED;
+ return BluetoothGattService::GattErrorCode::kNotPermitted;
case E_BLUETOOTH_ATT_UNKNOWN_ERROR:
- return BluetoothGattService::GATT_ERROR_UNKNOWN;
+ return BluetoothGattService::GattErrorCode::kUnknown;
case E_BLUETOOTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH:
- return BluetoothGattService::GATT_ERROR_INVALID_LENGTH;
+ return BluetoothGattService::GattErrorCode::kInvalidLength;
case E_BLUETOOTH_ATT_REQUEST_NOT_SUPPORTED:
- return BluetoothGattService::GATT_ERROR_NOT_SUPPORTED;
+ return BluetoothGattService::GattErrorCode::kNotSupported;
default:
- return BluetoothGattService::GATT_ERROR_FAILED;
+ return BluetoothGattService::GattErrorCode::kFailed;
}
}
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.cc
index 35793c93..a310753 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.cc
@@ -110,13 +110,13 @@
destructor_called_ = true;
if (pending_read_callback_) {
std::move(pending_read_callback_)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
}
if (pending_write_callbacks_) {
std::move(pending_write_callbacks_->error_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(BluetoothGattService::GattErrorCode::kFailed);
}
if (value_changed_token_)
@@ -158,7 +158,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_NOT_PERMITTED,
+ BluetoothGattService::GattErrorCode::kNotPermitted,
/*value=*/std::vector<uint8_t>()));
return;
}
@@ -166,9 +166,10 @@
if (destructor_called_ || pending_read_callback_ ||
pending_write_callbacks_) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS,
- /*value=*/std::vector<uint8_t>()));
+ FROM_HERE,
+ base::BindOnce(std::move(callback),
+ BluetoothGattService::GattErrorCode::kInProgress,
+ /*value=*/std::vector<uint8_t>()));
return;
}
@@ -181,7 +182,7 @@
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_FAILED,
+ BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>()));
return;
}
@@ -196,7 +197,7 @@
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_FAILED,
+ BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>()));
return;
}
@@ -214,7 +215,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS));
+ BluetoothGattService::GattErrorCode::kInProgress));
return;
}
@@ -224,8 +225,9 @@
BLUETOOTH_LOG(DEBUG) << "As IGattCharacteristic3 failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -235,8 +237,9 @@
BLUETOOTH_LOG(DEBUG) << "base::win::CreateIBufferFromData failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -258,8 +261,9 @@
<< "GattCharacteristic::WriteValueWithResultAndOptionAsync failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -273,8 +277,9 @@
BLUETOOTH_LOG(DEBUG) << "PostAsyncResults failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -291,7 +296,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_NOT_PERMITTED));
+ BluetoothGattService::GattErrorCode::kNotPermitted));
return;
}
@@ -348,8 +353,9 @@
if (!value_changed_token_) {
BLUETOOTH_LOG(DEBUG) << "Adding Value Changed Handler failed.";
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -371,7 +377,7 @@
base::OnceClosure callback, ErrorCallback error_callback) {
if (characteristic && !characteristic->RemoveValueChangedHandler()) {
std::move(error_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(BluetoothGattService::GattErrorCode::kFailed);
return;
}
@@ -422,8 +428,9 @@
BLUETOOTH_LOG(DEBUG) << "As IGattCharacteristic3 failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -438,8 +445,9 @@
" failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -453,8 +461,9 @@
BLUETOOTH_LOG(DEBUG) << "PostAsyncResults failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -470,7 +479,7 @@
if (!read_result) {
std::move(pending_read_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -481,7 +490,7 @@
BLUETOOTH_LOG(DEBUG) << "Getting GATT Communication Status failed: "
<< logging::SystemErrorCodeToString(hr);
std::move(pending_read_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -494,7 +503,7 @@
BLUETOOTH_LOG(DEBUG) << "As IGattReadResult2 failed: "
<< logging::SystemErrorCodeToString(hr);
std::move(pending_read_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -512,7 +521,7 @@
BLUETOOTH_LOG(DEBUG) << "Getting Characteristic Value failed: "
<< logging::SystemErrorCodeToString(hr);
std::move(pending_read_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -524,7 +533,7 @@
BLUETOOTH_LOG(DEBUG) << "Getting Pointer To Buffer Data failed: "
<< logging::SystemErrorCodeToString(hr);
std::move(pending_read_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -550,7 +559,7 @@
std::unique_ptr<PendingWriteCallbacks> callbacks) {
if (!write_result) {
std::move(callbacks->error_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(BluetoothGattService::GattErrorCode::kFailed);
return;
}
@@ -560,7 +569,7 @@
BLUETOOTH_LOG(DEBUG) << "Getting GATT Communication Status failed: "
<< logging::SystemErrorCodeToString(hr);
std::move(callbacks->error_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(BluetoothGattService::GattErrorCode::kFailed);
return;
}
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_android.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_android.cc
index 674642a..c172f43 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_android.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_android.cc
@@ -83,9 +83,10 @@
ValueCallback callback) {
if (read_pending_ || write_pending_) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS,
- /*value=*/std::vector<uint8_t>()));
+ FROM_HERE,
+ base::BindOnce(std::move(callback),
+ BluetoothGattService::GattErrorCode::kInProgress,
+ /*value=*/std::vector<uint8_t>()));
return;
}
@@ -93,7 +94,7 @@
AttachCurrentThread(), j_descriptor_)) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_FAILED,
+ BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>()));
return;
}
@@ -110,7 +111,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS));
+ BluetoothGattService::GattErrorCode::kInProgress));
return;
}
@@ -119,8 +120,9 @@
env, j_descriptor_, base::android::ToJavaByteArray(env, new_value))) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
- base::BindOnce(std::move(error_callback),
- BluetoothRemoteGattServiceAndroid::GATT_ERROR_FAILED));
+ base::BindOnce(
+ std::move(error_callback),
+ BluetoothRemoteGattServiceAndroid::GattErrorCode::kFailed));
return;
}
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_mac.mm b/device/bluetooth/bluetooth_remote_gatt_descriptor_mac.mm
index 96371abd..6838de29 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_mac.mm
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_mac.mm
@@ -76,12 +76,12 @@
destructor_called_ = true;
if (HasPendingRead()) {
std::move(read_value_callback_)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
}
if (HasPendingWrite()) {
std::move(write_value_callbacks_)
- .second.Run(BluetoothGattService::GATT_ERROR_FAILED);
+ .second.Run(BluetoothGattService::GattErrorCode::kFailed);
}
}
@@ -98,9 +98,10 @@
if (destructor_called_ || HasPendingRead() || HasPendingWrite()) {
DVLOG(1) << *this << ": Read failed, already in progress.";
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS,
- /*value=*/std::vector<uint8_t>()));
+ FROM_HERE,
+ base::BindOnce(std::move(callback),
+ BluetoothGattService::GattErrorCode::kInProgress,
+ /*value=*/std::vector<uint8_t>()));
return;
}
DVLOG(1) << *this << ": Read value.";
@@ -117,7 +118,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS));
+ BluetoothGattService::GattErrorCode::kInProgress));
return;
}
DVLOG(1) << *this << ": Write value.";
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc
index 2e4c1a0..987d4cb 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc
@@ -612,11 +612,11 @@
descriptor1_->ReadRemoteDescriptor(
GetReadValueCallback(Call::EXPECTED, Result::FAILURE));
SimulateGattDescriptorReadError(
- descriptor1_, BluetoothGattService::GATT_ERROR_INVALID_LENGTH);
+ descriptor1_, BluetoothGattService::GattErrorCode::kInvalidLength);
SimulateGattDescriptorReadError(descriptor1_,
- BluetoothGattService::GATT_ERROR_FAILED);
+ BluetoothGattService::GattErrorCode::kFailed);
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_INVALID_LENGTH,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInvalidLength,
last_gatt_error_code_);
}
@@ -642,12 +642,12 @@
GetCallback(Call::NOT_EXPECTED),
GetGattErrorCallback(Call::EXPECTED));
SimulateGattDescriptorWriteError(
- descriptor1_, BluetoothGattService::GATT_ERROR_INVALID_LENGTH);
- SimulateGattDescriptorWriteError(descriptor1_,
- BluetoothGattService::GATT_ERROR_FAILED);
+ descriptor1_, BluetoothGattService::GattErrorCode::kInvalidLength);
+ SimulateGattDescriptorWriteError(
+ descriptor1_, BluetoothGattService::GattErrorCode::kFailed);
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_INVALID_LENGTH,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInvalidLength,
last_gatt_error_code_);
}
@@ -673,7 +673,8 @@
base::RunLoop().RunUntilIdle();
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
// After failing once, can succeed:
ResetEventCounts();
@@ -711,7 +712,8 @@
base::RunLoop().RunUntilIdle();
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_gatt_error_code_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed,
+ last_gatt_error_code_);
// After failing once, can succeed:
ResetEventCounts();
@@ -753,7 +755,7 @@
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
last_gatt_error_code_);
// Initial read should still succeed:
@@ -797,7 +799,7 @@
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
last_gatt_error_code_);
// Initial write should still succeed:
@@ -839,7 +841,7 @@
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
last_gatt_error_code_);
// Initial write should still succeed:
@@ -881,7 +883,7 @@
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
last_gatt_error_code_);
// Initial read should still succeed:
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_win.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_win.cc
index d41f80cd..c498549 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_win.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_win.cc
@@ -73,7 +73,7 @@
DCHECK(ui_task_runner_->RunsTasksInCurrentSequence());
NOTIMPLEMENTED();
- std::move(callback).Run(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED,
+ std::move(callback).Run(BluetoothGattService::GattErrorCode::kNotSupported,
/*value=*/std::vector<uint8_t>());
}
@@ -84,7 +84,8 @@
DCHECK(ui_task_runner_->RunsTasksInCurrentSequence());
NOTIMPLEMENTED();
- std::move(error_callback).Run(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED);
+ std::move(error_callback)
+ .Run(BluetoothGattService::GattErrorCode::kNotSupported);
}
uint16_t BluetoothRemoteGattDescriptorWin::GetAttributeHandle() const {
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc
index caefb2c3..3042eef 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc
@@ -103,9 +103,10 @@
ValueCallback callback) {
if (pending_read_callback_ || pending_write_callbacks_) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS,
- /*value=*/std::vector<uint8_t>()));
+ FROM_HERE,
+ base::BindOnce(std::move(callback),
+ BluetoothGattService::GattErrorCode::kInProgress,
+ /*value=*/std::vector<uint8_t>()));
return;
}
@@ -118,7 +119,7 @@
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_FAILED,
+ BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>()));
return;
}
@@ -133,7 +134,7 @@
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback),
- BluetoothGattService::GATT_ERROR_FAILED,
+ BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>()));
return;
}
@@ -149,7 +150,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_IN_PROGRESS));
+ BluetoothGattService::GattErrorCode::kInProgress));
return;
}
@@ -159,8 +160,9 @@
BLUETOOTH_LOG(ERROR) << "As IGattDescriptor2 failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -170,8 +172,9 @@
BLUETOOTH_LOG(ERROR) << "base::win::CreateIBufferFromData failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -181,8 +184,9 @@
BLUETOOTH_LOG(ERROR) << "GattDescriptor::WriteValueWithResultAsync failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -196,8 +200,9 @@
BLUETOOTH_LOG(ERROR) << "PostAsyncResults failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ FROM_HERE,
+ base::BindOnce(std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
return;
}
@@ -242,7 +247,7 @@
BLUETOOTH_LOG(ERROR)
<< "GattDescriptor::ReadValueWithCacheModeAsync returned no result";
std::move(pending_read_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -253,7 +258,7 @@
BLUETOOTH_LOG(ERROR) << "Getting GATT Communication Status failed: "
<< logging::SystemErrorCodeToString(hr);
std::move(pending_read_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -266,7 +271,7 @@
BLUETOOTH_LOG(ERROR) << "As IGattReadResult2 failed: "
<< logging::SystemErrorCodeToString(hr);
std::move(pending_read_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -284,7 +289,7 @@
BLUETOOTH_LOG(ERROR) << "Getting Descriptor Value failed: "
<< logging::SystemErrorCodeToString(hr);
std::move(pending_read_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -296,7 +301,7 @@
BLUETOOTH_LOG(ERROR) << "Getting Pointer To Buffer Data failed: "
<< logging::SystemErrorCodeToString(hr);
std::move(pending_read_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED,
+ .Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -314,7 +319,7 @@
BLUETOOTH_LOG(ERROR)
<< "GattDescriptor::WriteValueWithResultAsync returned no result";
std::move(pending_write_callbacks->error_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(BluetoothGattService::GattErrorCode::kFailed);
return;
}
@@ -324,7 +329,7 @@
BLUETOOTH_LOG(ERROR) << "Getting GATT Communication Status failed: "
<< logging::SystemErrorCodeToString(hr);
std::move(pending_write_callbacks->error_callback)
- .Run(BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(BluetoothGattService::GattErrorCode::kFailed);
return;
}
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_android.cc b/device/bluetooth/bluetooth_remote_gatt_service_android.cc
index 3e4cf9b..5f2e7587 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_android.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_service_android.cc
@@ -61,18 +61,18 @@
// android values not yet represented. http://crbug.com/548498
switch (bluetooth_gatt_code) { // android.bluetooth.BluetoothGatt values:
case 0x00000101: // GATT_FAILURE
- return GATT_ERROR_FAILED;
+ return GattErrorCode::kFailed;
case 0x0000000d: // GATT_INVALID_ATTRIBUTE_LENGTH
- return GATT_ERROR_INVALID_LENGTH;
+ return GattErrorCode::kInvalidLength;
case 0x00000002: // GATT_READ_NOT_PERMITTED
- return GATT_ERROR_NOT_PERMITTED;
+ return GattErrorCode::kNotPermitted;
case 0x00000006: // GATT_REQUEST_NOT_SUPPORTED
- return GATT_ERROR_NOT_SUPPORTED;
+ return GattErrorCode::kNotSupported;
case 0x00000003: // GATT_WRITE_NOT_PERMITTED
- return GATT_ERROR_NOT_PERMITTED;
+ return GattErrorCode::kNotPermitted;
default:
DVLOG(1) << "Unhandled status: " << bluetooth_gatt_code;
- return BluetoothGattService::GATT_ERROR_UNKNOWN;
+ return BluetoothGattService::GattErrorCode::kUnknown;
}
}
@@ -82,24 +82,24 @@
// TODO(scheib) Create new BluetoothGattService::GattErrorCode enums for
// android values not yet represented. http://crbug.com/548498
switch (error_code) { // Return values from android.bluetooth.BluetoothGatt:
- case GATT_ERROR_UNKNOWN:
+ case GattErrorCode::kUnknown:
return 0x00000101; // GATT_FAILURE. No good match.
- case GATT_ERROR_FAILED:
+ case GattErrorCode::kFailed:
return 0x00000101; // GATT_FAILURE
- case GATT_ERROR_IN_PROGRESS:
+ case GattErrorCode::kInProgress:
return 0x00000101; // GATT_FAILURE. No good match.
- case GATT_ERROR_INVALID_LENGTH:
+ case GattErrorCode::kInvalidLength:
return 0x0000000d; // GATT_INVALID_ATTRIBUTE_LENGTH
- case GATT_ERROR_NOT_PERMITTED:
+ case GattErrorCode::kNotPermitted:
// Can't distinguish between:
// 0x00000002: // GATT_READ_NOT_PERMITTED
// 0x00000003: // GATT_WRITE_NOT_PERMITTED
return 0x00000101; // GATT_FAILURE. No good match.
- case GATT_ERROR_NOT_AUTHORIZED:
+ case GattErrorCode::kNotAuthorized:
return 0x00000101; // GATT_FAILURE. No good match.
- case GATT_ERROR_NOT_PAIRED:
+ case GattErrorCode::kNotPaired:
return 0x00000101; // GATT_FAILURE. No good match.
- case GATT_ERROR_NOT_SUPPORTED:
+ case GattErrorCode::kNotSupported:
return 0x00000006; // GATT_REQUEST_NOT_SUPPORTED
}
DVLOG(1) << "Unhandled error_code: " << error_code;
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_winrt.cc b/device/bluetooth/bluetooth_remote_gatt_service_winrt.cc
index 7a84cec..211ae1e 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_winrt.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_service_winrt.cc
@@ -116,21 +116,21 @@
uint8_t BluetoothRemoteGattServiceWinrt::ToProtocolError(
GattErrorCode error_code) {
switch (error_code) {
- case GATT_ERROR_UNKNOWN:
+ case GattErrorCode::kUnknown:
return 0xF0;
- case GATT_ERROR_FAILED:
+ case GattErrorCode::kFailed:
return 0x01;
- case GATT_ERROR_IN_PROGRESS:
+ case GattErrorCode::kInProgress:
return 0x09;
- case GATT_ERROR_INVALID_LENGTH:
+ case GattErrorCode::kInvalidLength:
return 0x0D;
- case GATT_ERROR_NOT_PERMITTED:
+ case GattErrorCode::kNotPermitted:
return 0x02;
- case GATT_ERROR_NOT_AUTHORIZED:
+ case GattErrorCode::kNotAuthorized:
return 0x08;
- case GATT_ERROR_NOT_PAIRED:
+ case GattErrorCode::kNotPaired:
return 0x0F;
- case GATT_ERROR_NOT_SUPPORTED:
+ case GattErrorCode::kNotSupported:
return 0x06;
}
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_winrt.h b/device/bluetooth/bluetooth_remote_gatt_service_winrt.h
index 522cd12..6a6b27d 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_winrt.h
+++ b/device/bluetooth/bluetooth_remote_gatt_service_winrt.h
@@ -62,12 +62,12 @@
if (FAILED(hr)) {
DVLOG(2) << "Getting Protocol Error Reference failed: "
<< logging::SystemErrorCodeToString(hr);
- return GattErrorCode::GATT_ERROR_UNKNOWN;
+ return GattErrorCode::kUnknown;
}
if (!protocol_error_ref) {
DVLOG(2) << "Got Null Protocol Error Reference.";
- return GattErrorCode::GATT_ERROR_UNKNOWN;
+ return GattErrorCode::kUnknown;
}
uint8_t protocol_error;
@@ -75,7 +75,7 @@
if (FAILED(hr)) {
DVLOG(2) << "Getting Protocol Error Value failed: "
<< logging::SystemErrorCodeToString(hr);
- return GattErrorCode::GATT_ERROR_UNKNOWN;
+ return GattErrorCode::kUnknown;
}
DVLOG(2) << "Got Protocol Error: " << static_cast<int>(protocol_error);
@@ -84,41 +84,41 @@
// Version 5.0 Vol 3, Part F, 3.4.1.1.
switch (protocol_error) {
case 0x01: // Invalid Handle
- return GATT_ERROR_FAILED;
+ return GattErrorCode::kFailed;
case 0x02: // Read Not Permitted
- return GATT_ERROR_NOT_PERMITTED;
+ return GattErrorCode::kNotPermitted;
case 0x03: // Write Not Permitted
- return GATT_ERROR_NOT_PERMITTED;
+ return GattErrorCode::kNotPermitted;
case 0x04: // Invalid PDU
- return GATT_ERROR_FAILED;
+ return GattErrorCode::kFailed;
case 0x05: // Insufficient Authentication
- return GATT_ERROR_NOT_AUTHORIZED;
+ return GattErrorCode::kNotAuthorized;
case 0x06: // Request Not Supported
- return GATT_ERROR_NOT_SUPPORTED;
+ return GattErrorCode::kNotSupported;
case 0x07: // Invalid Offset
- return GATT_ERROR_INVALID_LENGTH;
+ return GattErrorCode::kInvalidLength;
case 0x08: // Insufficient Authorization
- return GATT_ERROR_NOT_AUTHORIZED;
+ return GattErrorCode::kNotAuthorized;
case 0x09: // Prepare Queue Full
- return GATT_ERROR_IN_PROGRESS;
+ return GattErrorCode::kInProgress;
case 0x0A: // Attribute Not Found
- return GATT_ERROR_FAILED;
+ return GattErrorCode::kFailed;
case 0x0B: // Attribute Not Long
- return GATT_ERROR_FAILED;
+ return GattErrorCode::kFailed;
case 0x0C: // Insufficient Encryption Key Size
- return GATT_ERROR_FAILED;
+ return GattErrorCode::kFailed;
case 0x0D: // Invalid Attribute Value Length
- return GATT_ERROR_INVALID_LENGTH;
+ return GattErrorCode::kInvalidLength;
case 0x0E: // Unlikely Error
- return GATT_ERROR_FAILED;
+ return GattErrorCode::kFailed;
case 0x0F: // Insufficient Encryption
- return GATT_ERROR_NOT_PAIRED;
+ return GattErrorCode::kNotPaired;
case 0x10: // Unsupported Group Type
- return GATT_ERROR_FAILED;
+ return GattErrorCode::kFailed;
case 0x11: // Insufficient Resources
- return GATT_ERROR_FAILED;
+ return GattErrorCode::kFailed;
default:
- return GATT_ERROR_UNKNOWN;
+ return GattErrorCode::kUnknown;
}
}
diff --git a/device/bluetooth/bluez/bluetooth_adapter_bluez.cc b/device/bluetooth/bluez/bluetooth_adapter_bluez.cc
index 99913da..8693593 100644
--- a/device/bluetooth/bluez/bluetooth_adapter_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_adapter_bluez.cc
@@ -1574,7 +1574,7 @@
BLUETOOTH_LOG(ERROR)
<< "Re-registering a service that is already registered!";
std::move(error_callback)
- .Run(device::BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(device::BluetoothGattService::GattErrorCode::kFailed);
return;
}
@@ -1600,7 +1600,7 @@
<< "Unregistering a service that isn't registered! path: "
<< service->object_path().value();
std::move(error_callback)
- .Run(device::BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(device::BluetoothGattService::GattErrorCode::kFailed);
return;
}
diff --git a/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc
index b5fc52e..08579dc5 100644
--- a/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc
+++ b/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc
@@ -1047,7 +1047,7 @@
EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid());
EXPECT_EQ(0, success_callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kNotSupported,
last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
@@ -1070,7 +1070,7 @@
EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid());
EXPECT_EQ(0, success_callback_count_);
EXPECT_EQ(2, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_PERMITTED,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kNotPermitted,
last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
@@ -1113,7 +1113,7 @@
base::Unretained(this)));
EXPECT_EQ(1, success_callback_count_);
EXPECT_EQ(3, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_INVALID_LENGTH,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInvalidLength,
last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
@@ -1127,7 +1127,7 @@
base::Unretained(this)));
EXPECT_EQ(1, success_callback_count_);
EXPECT_EQ(4, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_service_error_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
// Issue a read request.
@@ -1174,7 +1174,8 @@
base::BindOnce(&BluetoothGattBlueZTest::ValueCallback,
base::Unretained(this)));
EXPECT_EQ(5, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS, last_service_error_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
+ last_service_error_);
// But previous call finished.
EXPECT_EQ(3, success_callback_count_);
@@ -1189,7 +1190,7 @@
base::Unretained(this)));
EXPECT_EQ(3, success_callback_count_);
EXPECT_EQ(6, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kNotAuthorized,
last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
fake_bluetooth_gatt_characteristic_client_->SetAuthorized(true);
@@ -1201,7 +1202,8 @@
base::Unretained(this)));
EXPECT_EQ(3, success_callback_count_);
EXPECT_EQ(7, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_PAIRED, last_service_error_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kNotPaired,
+ last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
fake_bluetooth_gatt_characteristic_client_->SetAuthenticated(true);
}
@@ -1256,7 +1258,7 @@
EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid());
EXPECT_EQ(0, success_callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kNotSupported,
last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
@@ -1279,7 +1281,7 @@
EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid());
EXPECT_EQ(0, success_callback_count_);
EXPECT_EQ(2, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_PERMITTED,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kNotPermitted,
last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
@@ -1322,7 +1324,7 @@
base::Unretained(this)));
EXPECT_EQ(1, success_callback_count_);
EXPECT_EQ(3, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_INVALID_LENGTH,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInvalidLength,
last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
@@ -1336,7 +1338,7 @@
base::Unretained(this)));
EXPECT_EQ(1, success_callback_count_);
EXPECT_EQ(4, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_service_error_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kFailed, last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
// Issue a read request.
@@ -1383,7 +1385,8 @@
base::BindOnce(&BluetoothGattBlueZTest::ValueCallback,
base::Unretained(this)));
EXPECT_EQ(5, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS, last_service_error_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kInProgress,
+ last_service_error_);
// But previous call finished.
EXPECT_EQ(3, success_callback_count_);
@@ -1398,7 +1401,7 @@
base::Unretained(this)));
EXPECT_EQ(3, success_callback_count_);
EXPECT_EQ(6, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kNotAuthorized,
last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
fake_bluetooth_gatt_characteristic_client_->SetAuthorized(true);
@@ -1410,7 +1413,8 @@
base::Unretained(this)));
EXPECT_EQ(3, success_callback_count_);
EXPECT_EQ(7, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_PAIRED, last_service_error_);
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kNotPaired,
+ last_service_error_);
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
fake_bluetooth_gatt_characteristic_client_->SetAuthenticated(true);
}
@@ -1896,7 +1900,7 @@
base::Unretained(this)));
EXPECT_EQ(1, success_callback_count_);
EXPECT_EQ(1, error_callback_count_);
- EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_PERMITTED,
+ EXPECT_EQ(BluetoothGattService::GattErrorCode::kNotPermitted,
last_service_error_);
EXPECT_TRUE(ValuesEqual(last_read_value_, descriptor->GetValue()));
EXPECT_FALSE(ValuesEqual(desc_value, descriptor->GetValue()));
diff --git a/device/bluetooth/bluez/bluetooth_gatt_service_bluez.cc b/device/bluetooth/bluez/bluetooth_gatt_service_bluez.cc
index d6dc393..6c13e76 100644
--- a/device/bluetooth/bluez/bluetooth_gatt_service_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_gatt_service_bluez.cc
@@ -27,21 +27,21 @@
// static
device::BluetoothGattService::GattErrorCode
BluetoothGattServiceBlueZ::DBusErrorToServiceError(std::string error_name) {
- device::BluetoothGattService::GattErrorCode code = GATT_ERROR_UNKNOWN;
+ auto code = device::BluetoothGattService::GattErrorCode::kUnknown;
if (error_name == bluetooth_gatt_service::kErrorFailed) {
- code = GATT_ERROR_FAILED;
+ code = device::BluetoothGattService::GattErrorCode::kFailed;
} else if (error_name == bluetooth_gatt_service::kErrorInProgress) {
- code = GATT_ERROR_IN_PROGRESS;
+ code = device::BluetoothGattService::GattErrorCode::kInProgress;
} else if (error_name == bluetooth_gatt_service::kErrorInvalidValueLength) {
- code = GATT_ERROR_INVALID_LENGTH;
+ code = device::BluetoothGattService::GattErrorCode::kInvalidLength;
} else if (error_name == bluetooth_gatt_service::kErrorNotPermitted) {
- code = GATT_ERROR_NOT_PERMITTED;
+ code = device::BluetoothGattService::GattErrorCode::kNotPermitted;
} else if (error_name == bluetooth_gatt_service::kErrorNotAuthorized) {
- code = GATT_ERROR_NOT_AUTHORIZED;
+ code = device::BluetoothGattService::GattErrorCode::kNotAuthorized;
} else if (error_name == bluetooth_gatt_service::kErrorNotPaired) {
- code = GATT_ERROR_NOT_PAIRED;
+ code = device::BluetoothGattService::GattErrorCode::kNotPaired;
} else if (error_name == bluetooth_gatt_service::kErrorNotSupported) {
- code = GATT_ERROR_NOT_SUPPORTED;
+ code = device::BluetoothGattService::GattErrorCode::kNotSupported;
}
return code;
}
diff --git a/device/bluetooth/cast/bluetooth_remote_gatt_characteristic_cast.cc b/device/bluetooth/cast/bluetooth_remote_gatt_characteristic_cast.cc
index 8548fc31..27e5505 100644
--- a/device/bluetooth/cast/bluetooth_remote_gatt_characteristic_cast.cc
+++ b/device/bluetooth/cast/bluetooth_remote_gatt_characteristic_cast.cc
@@ -82,7 +82,7 @@
if (success)
std::move(callback).Run();
else
- std::move(error_callback).Run(BluetoothGattService::GATT_ERROR_FAILED);
+ std::move(error_callback).Run(BluetoothGattService::GattErrorCode::kFailed);
}
} // namespace
@@ -216,7 +216,7 @@
std::move(callback).Run(/*error_code=*/absl::nullopt, result);
return;
}
- std::move(callback).Run(BluetoothGattService::GATT_ERROR_FAILED,
+ std::move(callback).Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
}
@@ -230,7 +230,7 @@
std::move(callback).Run();
return;
}
- std::move(error_callback).Run(BluetoothGattService::GATT_ERROR_FAILED);
+ std::move(error_callback).Run(BluetoothGattService::GattErrorCode::kFailed);
}
} // namespace device
diff --git a/device/bluetooth/cast/bluetooth_remote_gatt_descriptor_cast.cc b/device/bluetooth/cast/bluetooth_remote_gatt_descriptor_cast.cc
index ef64fe1..e2fc0a4 100644
--- a/device/bluetooth/cast/bluetooth_remote_gatt_descriptor_cast.cc
+++ b/device/bluetooth/cast/bluetooth_remote_gatt_descriptor_cast.cc
@@ -77,7 +77,7 @@
std::move(callback).Run(/*error_code=*/absl::nullopt, result);
return;
}
- std::move(callback).Run(BluetoothGattService::GATT_ERROR_FAILED,
+ std::move(callback).Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
}
@@ -91,7 +91,7 @@
std::move(callback).Run();
return;
}
- std::move(error_callback).Run(BluetoothGattService::GATT_ERROR_FAILED);
+ std::move(error_callback).Run(BluetoothGattService::GattErrorCode::kFailed);
}
} // namespace device
diff --git a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider_unittest.cc b/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider_unittest.cc
index 45347bbb..6fe7525 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider_unittest.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider_unittest.cc
@@ -82,7 +82,7 @@
EXPECT_FALSE(reader.PopArrayOfBytes(&bytes, &length));
callback_called = true;
}),
- device::BluetoothGattService::GATT_ERROR_FAILED, read_value);
+ device::BluetoothGattService::GattErrorCode::kFailed, read_value);
EXPECT_TRUE(callback_called);
}
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
index 9c13f8a..b13c680 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
@@ -127,15 +127,17 @@
bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
if (!fake_bluetooth_gatt_manager_client->IsServiceRegistered(service_path_)) {
DVLOG(1) << "GATT characteristic not registered.";
- std::move(callback).Run(device::BluetoothGattService::GATT_ERROR_FAILED,
- /*value=*/std::vector<uint8_t>());
+ std::move(callback).Run(
+ device::BluetoothGattService::GattErrorCode::kFailed,
+ /*value=*/std::vector<uint8_t>());
return;
}
if (!CanRead(flags_)) {
DVLOG(1) << "GATT characteristic not readable.";
- std::move(callback).Run(device::BluetoothGattService::GATT_ERROR_FAILED,
- /*value=*/std::vector<uint8_t>());
+ std::move(callback).Run(
+ device::BluetoothGattService::GattErrorCode::kFailed,
+ /*value=*/std::vector<uint8_t>());
return;
}
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc
index a0c78d6..3993738d 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc
@@ -116,14 +116,14 @@
characteristic->service_path())) {
DVLOG(1) << "GATT descriptor not registered.";
std::move(callback).Run(
- device::BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED,
+ device::BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
if (!CanRead(flags_)) {
std::move(callback).Run(
- device::BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED,
+ device::BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
diff --git a/device/bluetooth/public/mojom/gatt_result_type_converter.h b/device/bluetooth/public/mojom/gatt_result_type_converter.h
index 8472b770..87604f8 100644
--- a/device/bluetooth/public/mojom/gatt_result_type_converter.h
+++ b/device/bluetooth/public/mojom/gatt_result_type_converter.h
@@ -23,25 +23,21 @@
static bluetooth::mojom::GattResult Convert(
const device::BluetoothGattService::GattErrorCode& input) {
switch (input) {
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_UNKNOWN:
+ case device::BluetoothGattService::GattErrorCode::kUnknown:
return bluetooth::mojom::GattResult::UNKNOWN;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED:
+ case device::BluetoothGattService::GattErrorCode::kFailed:
return bluetooth::mojom::GattResult::FAILED;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_IN_PROGRESS:
+ case device::BluetoothGattService::GattErrorCode::kInProgress:
return bluetooth::mojom::GattResult::IN_PROGRESS;
- case device::BluetoothGattService::GattErrorCode::
- GATT_ERROR_INVALID_LENGTH:
+ case device::BluetoothGattService::GattErrorCode::kInvalidLength:
return bluetooth::mojom::GattResult::INVALID_LENGTH;
- case device::BluetoothGattService::GattErrorCode::
- GATT_ERROR_NOT_PERMITTED:
+ case device::BluetoothGattService::GattErrorCode::kNotPermitted:
return bluetooth::mojom::GattResult::NOT_PERMITTED;
- case device::BluetoothGattService::GattErrorCode::
- GATT_ERROR_NOT_AUTHORIZED:
+ case device::BluetoothGattService::GattErrorCode::kNotAuthorized:
return bluetooth::mojom::GattResult::NOT_AUTHORIZED;
- case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PAIRED:
+ case device::BluetoothGattService::GattErrorCode::kNotPaired:
return bluetooth::mojom::GattResult::NOT_PAIRED;
- case device::BluetoothGattService::GattErrorCode::
- GATT_ERROR_NOT_SUPPORTED:
+ case device::BluetoothGattService::GattErrorCode::kNotSupported:
return bluetooth::mojom::GattResult::NOT_SUPPORTED;
}
NOTREACHED();
diff --git a/device/bluetooth/test/bluetooth_test.cc b/device/bluetooth/test/bluetooth_test.cc
index f62b626e..c0de71d 100644
--- a/device/bluetooth/test/bluetooth_test.cc
+++ b/device/bluetooth/test/bluetooth_test.cc
@@ -429,7 +429,7 @@
if (error_in_reentrant) {
SimulateGattNotifySessionStartError(
- characteristic, BluetoothGattService::GATT_ERROR_UNKNOWN);
+ characteristic, BluetoothGattService::GattErrorCode::kUnknown);
characteristic->StartNotifySession(GetNotifyCallback(Call::NOT_EXPECTED),
GetGattErrorCallback(Call::EXPECTED));
} else {
diff --git a/device/bluetooth/test/bluetooth_test.h b/device/bluetooth/test/bluetooth_test.h
index eb99803c..a685b49 100644
--- a/device/bluetooth/test/bluetooth_test.h
+++ b/device/bluetooth/test/bluetooth_test.h
@@ -716,7 +716,7 @@
std::vector<uint8_t> last_read_value_;
std::vector<uint8_t> last_write_value_;
BluetoothGattService::GattErrorCode last_gatt_error_code_ =
- BluetoothGattService::GATT_ERROR_UNKNOWN;
+ BluetoothGattService::GattErrorCode::kUnknown;
int callback_count_ = 0;
int error_callback_count_ = 0;
diff --git a/device/bluetooth/test/bluetooth_test_win.cc b/device/bluetooth/test/bluetooth_test_win.cc
index 5826bf9..defbd64f 100644
--- a/device/bluetooth/test/bluetooth_test_win.cc
+++ b/device/bluetooth/test/bluetooth_test_win.cc
@@ -503,7 +503,7 @@
GetSimulatedCharacteristic(characteristic);
CHECK(target_characteristic);
HRESULT hr = HRESULT_FROM_WIN32(ERROR_SEM_TIMEOUT);
- if (error_code == BluetoothGattService::GATT_ERROR_INVALID_LENGTH)
+ if (error_code == BluetoothGattService::GattErrorCode::kInvalidLength)
hr = E_BLUETOOTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH;
fake_bt_le_wrapper_->SimulateGattCharacteristicReadError(
target_characteristic, hr);
@@ -523,7 +523,7 @@
GetSimulatedCharacteristic(characteristic);
CHECK(target_characteristic);
HRESULT hr = HRESULT_FROM_WIN32(ERROR_SEM_TIMEOUT);
- if (error_code == BluetoothGattService::GATT_ERROR_INVALID_LENGTH)
+ if (error_code == BluetoothGattService::GattErrorCode::kInvalidLength)
hr = E_BLUETOOTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH;
fake_bt_le_wrapper_->SimulateGattCharacteristicWriteError(
target_characteristic, hr);
@@ -565,7 +565,7 @@
win::GattCharacteristic* simulated_characteristic =
GetSimulatedCharacteristic(characteristic);
DCHECK(simulated_characteristic);
- DCHECK(error_code == BluetoothGattService::GATT_ERROR_UNKNOWN);
+ DCHECK(error_code == BluetoothGattService::GattErrorCode::kUnknown);
fake_bt_le_wrapper_->SimulateGattCharacteristicSetNotifyError(
simulated_characteristic, E_BLUETOOTH_ATT_UNKNOWN_ERROR);
}
diff --git a/device/bluetooth/test/fake_remote_gatt_characteristic.cc b/device/bluetooth/test/fake_remote_gatt_characteristic.cc
index d6966051..b1cf0fe 100644
--- a/device/bluetooth/test/fake_remote_gatt_characteristic.cc
+++ b/device/bluetooth/test/fake_remote_gatt_characteristic.cc
@@ -243,8 +243,9 @@
break;
case mojom::kGATTInvalidHandle:
DCHECK(!value);
- std::move(callback).Run(device::BluetoothGattService::GATT_ERROR_FAILED,
- std::vector<uint8_t>());
+ std::move(callback).Run(
+ device::BluetoothGattService::GattErrorCode::kFailed,
+ std::vector<uint8_t>());
break;
default:
NOTREACHED();
@@ -268,7 +269,7 @@
break;
case mojom::kGATTInvalidHandle:
std::move(error_callback)
- .Run(device::BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(device::BluetoothGattService::GattErrorCode::kFailed);
break;
default:
NOTREACHED();
@@ -288,7 +289,7 @@
break;
case mojom::kGATTInvalidHandle:
std::move(error_callback)
- .Run(device::BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(device::BluetoothGattService::GattErrorCode::kFailed);
break;
default:
NOTREACHED();
@@ -308,7 +309,7 @@
break;
case mojom::kGATTInvalidHandle:
std::move(error_callback)
- .Run(device::BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(device::BluetoothGattService::GattErrorCode::kFailed);
break;
default:
NOTREACHED();
diff --git a/device/bluetooth/test/fake_remote_gatt_descriptor.cc b/device/bluetooth/test/fake_remote_gatt_descriptor.cc
index 85f06516..49b2047 100644
--- a/device/bluetooth/test/fake_remote_gatt_descriptor.cc
+++ b/device/bluetooth/test/fake_remote_gatt_descriptor.cc
@@ -94,8 +94,9 @@
break;
case mojom::kGATTInvalidHandle:
DCHECK(!value);
- std::move(callback).Run(device::BluetoothGattService::GATT_ERROR_FAILED,
- /*value=*/std::vector<uint8_t>());
+ std::move(callback).Run(
+ device::BluetoothGattService::GattErrorCode::kFailed,
+ /*value=*/std::vector<uint8_t>());
break;
default:
NOTREACHED();
@@ -117,7 +118,7 @@
break;
case mojom::kGATTInvalidHandle:
std::move(error_callback)
- .Run(device::BluetoothGattService::GATT_ERROR_FAILED);
+ .Run(device::BluetoothGattService::GattErrorCode::kFailed);
break;
default:
NOTREACHED();
diff --git a/device/bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc b/device/bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc
index 495d55459..f104134 100644
--- a/device/bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc
+++ b/device/bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc
@@ -28,7 +28,7 @@
EXPECT_EQ(expected_characteristic_->GetIdentifier(),
characteristic->GetIdentifier());
if (should_fail_) {
- std::move(callback).Run(BluetoothGattService::GATT_ERROR_FAILED,
+ std::move(callback).Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
@@ -85,7 +85,7 @@
ValueCallback callback) {
EXPECT_EQ(expected_descriptor_->GetIdentifier(), descriptor->GetIdentifier());
if (should_fail_) {
- std::move(callback).Run(BluetoothGattService::GATT_ERROR_FAILED,
+ std::move(callback).Run(BluetoothGattService::GattErrorCode::kFailed,
/*value=*/std::vector<uint8_t>());
return;
}
diff --git a/device/fido/cable/fido_ble_connection.cc b/device/fido/cable/fido_ble_connection.cc
index cbed9d67..f83883b 100644
--- a/device/fido/cable/fido_ble_connection.cc
+++ b/device/fido/cable/fido_ble_connection.cc
@@ -56,21 +56,21 @@
constexpr const char* ToString(BluetoothGattService::GattErrorCode error_code) {
switch (error_code) {
- case BluetoothGattService::GATT_ERROR_UNKNOWN:
+ case BluetoothGattService::GattErrorCode::kUnknown:
return "GATT_ERROR_UNKNOWN";
- case BluetoothGattService::GATT_ERROR_FAILED:
+ case BluetoothGattService::GattErrorCode::kFailed:
return "GATT_ERROR_FAILED";
- case BluetoothGattService::GATT_ERROR_IN_PROGRESS:
+ case BluetoothGattService::GattErrorCode::kInProgress:
return "GATT_ERROR_IN_PROGRESS";
- case BluetoothGattService::GATT_ERROR_INVALID_LENGTH:
+ case BluetoothGattService::GattErrorCode::kInvalidLength:
return "GATT_ERROR_INVALID_LENGTH";
- case BluetoothGattService::GATT_ERROR_NOT_PERMITTED:
+ case BluetoothGattService::GattErrorCode::kNotPermitted:
return "GATT_ERROR_NOT_PERMITTED";
- case BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED:
+ case BluetoothGattService::GattErrorCode::kNotAuthorized:
return "GATT_ERROR_NOT_AUTHORIZED";
- case BluetoothGattService::GATT_ERROR_NOT_PAIRED:
+ case BluetoothGattService::GattErrorCode::kNotPaired:
return "GATT_ERROR_NOT_PAIRED";
- case BluetoothGattService::GATT_ERROR_NOT_SUPPORTED:
+ case BluetoothGattService::GattErrorCode::kNotSupported:
return "GATT_ERROR_NOT_SUPPORTED";
default:
NOTREACHED();
diff --git a/device/fido/cable/fido_ble_connection_unittest.cc b/device/fido/cable/fido_ble_connection_unittest.cc
index 4c7bb75..0c08826 100644
--- a/device/fido/cable/fido_ble_connection_unittest.cc
+++ b/device/fido/cable/fido_ble_connection_unittest.cc
@@ -210,7 +210,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
+ BluetoothGattService::GattErrorCode::kFailed));
}));
}
@@ -240,7 +240,7 @@
BluetoothRemoteGattCharacteristic::ValueCallback& callback) {
absl::optional<BluetoothGattService::GattErrorCode> error_code;
if (!success)
- error_code = BluetoothGattService::GATT_ERROR_FAILED;
+ error_code = BluetoothGattService::GattErrorCode::kFailed;
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(callback), error_code, value));
@@ -255,7 +255,7 @@
BluetoothRemoteGattCharacteristic::ValueCallback& callback) {
absl::optional<BluetoothGattService::GattErrorCode> error_code;
if (!success)
- error_code = BluetoothGattService::GATT_ERROR_FAILED;
+ error_code = BluetoothGattService::GattErrorCode::kFailed;
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(callback), error_code, value));
@@ -272,7 +272,7 @@
auto error_code =
success ? absl::nullopt
: absl::make_optional(
- BluetoothGattService::GATT_ERROR_FAILED);
+ BluetoothGattService::GattErrorCode::kFailed);
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(callback), error_code, value));
@@ -285,19 +285,19 @@
WriteRemoteCharacteristic_(
_, BluetoothRemoteGattCharacteristic::WriteType::kWithoutResponse,
_, _))
- .WillOnce(Invoke([success](
- const auto& data,
+ .WillOnce(
+ Invoke([success](const auto& data,
BluetoothRemoteGattCharacteristic::WriteType,
base::OnceClosure& callback,
BluetoothRemoteGattCharacteristic::ErrorCallback&
error_callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- success
- ? std::move(callback)
- : base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
- }));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ success ? std::move(callback)
+ : base::BindOnce(
+ std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
+ }));
}
void SetNextWriteServiceRevisionResponse(std::vector<uint8_t> expected_data,
@@ -307,19 +307,19 @@
WriteRemoteCharacteristic_(
expected_data,
BluetoothRemoteGattCharacteristic::WriteType::kWithResponse, _, _))
- .WillOnce(Invoke([success](
- const auto& data,
+ .WillOnce(
+ Invoke([success](const auto& data,
BluetoothRemoteGattCharacteristic::WriteType,
base::OnceClosure& callback,
BluetoothRemoteGattCharacteristic::ErrorCallback&
error_callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- success
- ? std::move(callback)
- : base::BindOnce(std::move(error_callback),
- BluetoothGattService::GATT_ERROR_FAILED));
- }));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ success ? std::move(callback)
+ : base::BindOnce(
+ std::move(error_callback),
+ BluetoothGattService::GattErrorCode::kFailed));
+ }));
}
void AddFidoService() {
diff --git a/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
index 7b8afc8..8fac887 100644
--- a/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
+++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
@@ -172,22 +172,24 @@
BluetoothGattService::GattErrorCode error_code) {
extensions::BluetoothLowEnergyEventRouter::Status error_status =
extensions::BluetoothLowEnergyEventRouter::kStatusErrorFailed;
- if (error_code == BluetoothGattService::GATT_ERROR_IN_PROGRESS) {
+ if (error_code == BluetoothGattService::GattErrorCode::kInProgress) {
error_status =
extensions::BluetoothLowEnergyEventRouter::kStatusErrorInProgress;
- } else if (error_code == BluetoothGattService::GATT_ERROR_INVALID_LENGTH) {
+ } else if (error_code ==
+ BluetoothGattService::GattErrorCode::kInvalidLength) {
error_status =
extensions::BluetoothLowEnergyEventRouter::kStatusErrorInvalidLength;
- } else if (error_code == BluetoothGattService::GATT_ERROR_NOT_PERMITTED) {
+ } else if (error_code == BluetoothGattService::GattErrorCode::kNotPermitted) {
error_status =
extensions::BluetoothLowEnergyEventRouter::kStatusErrorPermissionDenied;
- } else if (error_code == BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED) {
+ } else if (error_code ==
+ BluetoothGattService::GattErrorCode::kNotAuthorized) {
error_status = extensions::BluetoothLowEnergyEventRouter::
kStatusErrorInsufficientAuthorization;
- } else if (error_code == BluetoothGattService::GATT_ERROR_NOT_PAIRED) {
+ } else if (error_code == BluetoothGattService::GattErrorCode::kNotPaired) {
error_status =
extensions::BluetoothLowEnergyEventRouter::kStatusErrorHigherSecurity;
- } else if (error_code == BluetoothGattService::GATT_ERROR_NOT_SUPPORTED) {
+ } else if (error_code == BluetoothGattService::GattErrorCode::kNotSupported) {
error_status =
extensions::BluetoothLowEnergyEventRouter::kStatusErrorGattNotSupported;
}