Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2665)

Unified Diff: device/bluetooth/public/interfaces/gatt_result_type_converter.h

Issue 2627243002: bluetooth: Add control for reading/writing of characteristics to internals page. (Closed)
Patch Set: DCHECK device Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/public/interfaces/gatt_result_type_converter.h
diff --git a/device/bluetooth/public/interfaces/gatt_result_type_converter.h b/device/bluetooth/public/interfaces/gatt_result_type_converter.h
new file mode 100644
index 0000000000000000000000000000000000000000..12fa091cba5e7f2781810064a956115eced61526
--- /dev/null
+++ b/device/bluetooth/public/interfaces/gatt_result_type_converter.h
@@ -0,0 +1,50 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_BLUETOOTH_GATT_RESULT_TYPE_CONVERTER_H_
+#define DEVICE_BLUETOOTH_GATT_RESULT_TYPE_CONVERTER_H_
+
+#include "device/bluetooth/bluetooth_gatt_service.h"
+#include "device/bluetooth/public/interfaces/device.mojom.h"
+#include "mojo/public/cpp/bindings/type_converter.h"
+
+namespace mojo {
+
+// TypeConverter to translate from
+// device::BluetoothGattService::GattErrorCode to bluetooth.mojom.GattResult.
+// TODO(crbug.com/666561): Replace because TypeConverter is deprecated.
+template <>
+struct TypeConverter<bluetooth::mojom::GattResult,
ortuno 2017/01/22 22:38:01 Why are we not using a typemap?
mbrunson 2017/01/24 00:25:31 This is a similar situation we had with mojom::Con
+ device::BluetoothGattService::GattErrorCode> {
+ static bluetooth::mojom::GattResult Convert(
+ const device::BluetoothGattService::GattErrorCode& input) {
+ switch (input) {
+ case device::BluetoothGattService::GattErrorCode::GATT_ERROR_UNKNOWN:
+ return bluetooth::mojom::GattResult::UNKNOWN;
+ case device::BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED:
+ return bluetooth::mojom::GattResult::FAILED;
+ case device::BluetoothGattService::GattErrorCode::GATT_ERROR_IN_PROGRESS:
+ return bluetooth::mojom::GattResult::IN_PROGRESS;
+ case device::BluetoothGattService::GattErrorCode::
+ GATT_ERROR_INVALID_LENGTH:
+ return bluetooth::mojom::GattResult::INVALID_LENGTH;
+ case device::BluetoothGattService::GattErrorCode::
+ GATT_ERROR_NOT_PERMITTED:
+ return bluetooth::mojom::GattResult::NOT_PERMITTED;
+ case device::BluetoothGattService::GattErrorCode::
+ GATT_ERROR_NOT_AUTHORIZED:
+ return bluetooth::mojom::GattResult::NOT_AUTHORIZED;
+ case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PAIRED:
+ return bluetooth::mojom::GattResult::NOT_PAIRED;
+ case device::BluetoothGattService::GattErrorCode::
+ GATT_ERROR_NOT_SUPPORTED:
+ return bluetooth::mojom::GattResult::NOT_SUPPORTED;
+ }
+ NOTREACHED();
+ return bluetooth::mojom::GattResult::NOT_SUPPORTED;
+ }
+};
+}
+
+#endif // DEVICE_BLUETOOTH_GATT_RESULT_TYPE_CONVERTER_H_
« device/bluetooth/device.cc ('K') | « device/bluetooth/public/interfaces/device.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698