Index: device/bluetooth/public/interfaces/gatt_result_enum_traits.cc |
diff --git a/device/bluetooth/public/interfaces/gatt_result_enum_traits.cc b/device/bluetooth/public/interfaces/gatt_result_enum_traits.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1a8374df3ab7ff4cbbe3de209c33b481815b2bdf |
--- /dev/null |
+++ b/device/bluetooth/public/interfaces/gatt_result_enum_traits.cc |
@@ -0,0 +1,36 @@ |
+// 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. |
+ |
+#include "device/bluetooth/public/interfaces/gatt_result_enum_traits.h" |
+ |
+namespace mojo { |
+ |
+// static |
+bluetooth::mojom::GattResult |
+EnumTraits<bluetooth::mojom::GattResult, |
+ device::BluetoothGattService::GattErrorCode>:: |
+ ToMojom(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; |
+} |
+ |
+} // namespace mojo |