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

Side by Side 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: Revert "Remove TypeConverter, add EnumTraits for GattResult" 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 unified diff | Download patch
« no previous file with comments | « device/bluetooth/public/interfaces/device.mojom ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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.
dcheng 2017/01/26 22:22:47 Nit: add a note that this is a type converter need
scheib 2017/01/26 22:56:13 BTW I'd recently updated https://bugs.chromium.org
mbrunson 2017/01/27 01:22:54 Done.
17 template <>
18 struct TypeConverter<bluetooth::mojom::GattResult,
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_
OLDNEW
« no previous file with comments | « device/bluetooth/public/interfaces/device.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698