Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef DEVICE_BLUETOOTH_GATT_RESULT_TYPE_CONVERTER_H_ | |
| 6 #define DEVICE_BLUETOOTH_GATT_RESULT_TYPE_CONVERTER_H_ | |
| 7 | |
| 8 #include "device/bluetooth/bluetooth_gatt_service.h" | |
| 9 #include "device/bluetooth/public/interfaces/device.mojom.h" | |
| 10 #include "mojo/public/cpp/bindings/type_converter.h" | |
| 11 | |
| 12 namespace mojo { | |
| 13 | |
| 14 // TypeConverter to translate from | |
| 15 // device::BluetoothGattService::GattErrorCode to bluetooth.mojom.GattResult. | |
| 16 // TODO(crbug.com/666561): Replace because TypeConverter is deprecated. | |
| 17 template <> | |
| 18 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
| |
| 19 device::BluetoothGattService::GattErrorCode> { | |
| 20 static bluetooth::mojom::GattResult Convert( | |
| 21 const device::BluetoothGattService::GattErrorCode& input) { | |
| 22 switch (input) { | |
| 23 case device::BluetoothGattService::GattErrorCode::GATT_ERROR_UNKNOWN: | |
| 24 return bluetooth::mojom::GattResult::UNKNOWN; | |
| 25 case device::BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED: | |
| 26 return bluetooth::mojom::GattResult::FAILED; | |
| 27 case device::BluetoothGattService::GattErrorCode::GATT_ERROR_IN_PROGRESS: | |
| 28 return bluetooth::mojom::GattResult::IN_PROGRESS; | |
| 29 case device::BluetoothGattService::GattErrorCode:: | |
| 30 GATT_ERROR_INVALID_LENGTH: | |
| 31 return bluetooth::mojom::GattResult::INVALID_LENGTH; | |
| 32 case device::BluetoothGattService::GattErrorCode:: | |
| 33 GATT_ERROR_NOT_PERMITTED: | |
| 34 return bluetooth::mojom::GattResult::NOT_PERMITTED; | |
| 35 case device::BluetoothGattService::GattErrorCode:: | |
| 36 GATT_ERROR_NOT_AUTHORIZED: | |
| 37 return bluetooth::mojom::GattResult::NOT_AUTHORIZED; | |
| 38 case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PAIRED: | |
| 39 return bluetooth::mojom::GattResult::NOT_PAIRED; | |
| 40 case device::BluetoothGattService::GattErrorCode:: | |
| 41 GATT_ERROR_NOT_SUPPORTED: | |
| 42 return bluetooth::mojom::GattResult::NOT_SUPPORTED; | |
| 43 } | |
| 44 NOTREACHED(); | |
| 45 return bluetooth::mojom::GattResult::NOT_SUPPORTED; | |
| 46 } | |
| 47 }; | |
| 48 } | |
| 49 | |
| 50 #endif // DEVICE_BLUETOOTH_GATT_RESULT_TYPE_CONVERTER_H_ | |
| OLD | NEW |