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

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: Merge upstream, add comment detail for type converter 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.
17 // This TypeConverter is needed to work around the fact that the Mojo enum,
18 // GattResult, has more values than the C++ enum, GattErrorCode.
19 template <>
20 struct TypeConverter<bluetooth::mojom::GattResult,
21 device::BluetoothGattService::GattErrorCode> {
22 static bluetooth::mojom::GattResult Convert(
23 const device::BluetoothGattService::GattErrorCode& input) {
24 switch (input) {
25 case device::BluetoothGattService::GattErrorCode::GATT_ERROR_UNKNOWN:
26 return bluetooth::mojom::GattResult::UNKNOWN;
27 case device::BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED:
28 return bluetooth::mojom::GattResult::FAILED;
29 case device::BluetoothGattService::GattErrorCode::GATT_ERROR_IN_PROGRESS:
30 return bluetooth::mojom::GattResult::IN_PROGRESS;
31 case device::BluetoothGattService::GattErrorCode::
32 GATT_ERROR_INVALID_LENGTH:
33 return bluetooth::mojom::GattResult::INVALID_LENGTH;
34 case device::BluetoothGattService::GattErrorCode::
35 GATT_ERROR_NOT_PERMITTED:
36 return bluetooth::mojom::GattResult::NOT_PERMITTED;
37 case device::BluetoothGattService::GattErrorCode::
38 GATT_ERROR_NOT_AUTHORIZED:
39 return bluetooth::mojom::GattResult::NOT_AUTHORIZED;
40 case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PAIRED:
41 return bluetooth::mojom::GattResult::NOT_PAIRED;
42 case device::BluetoothGattService::GattErrorCode::
43 GATT_ERROR_NOT_SUPPORTED:
44 return bluetooth::mojom::GattResult::NOT_SUPPORTED;
45 }
46 NOTREACHED();
47 return bluetooth::mojom::GattResult::NOT_SUPPORTED;
48 }
49 };
50 }
51
52 #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