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

Side by Side Diff: components/arc/bluetooth/bluetooth_struct_traits.h

Issue 2149713002: arc: bluetooth: Add SDP host side support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: arc: bluetooth: Add SDP host side support Created 4 years, 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_ 5 #ifndef COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_
6 #define COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_ 6 #define COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_
7 7
8 #include <map>
9 #include <utility>
10 #include <vector>
11
8 #include "components/arc/common/bluetooth.mojom.h" 12 #include "components/arc/common/bluetooth.mojom.h"
9 #include "device/bluetooth/bluetooth_common.h" 13 #include "device/bluetooth/bluetooth_common.h"
14 #include "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h"
15 #include "device/bluetooth/bluez/bluetooth_service_record_bluez.h"
16 #include "ipc/ipc_message_utils.h"
10 17
11 namespace mojo { 18 namespace mojo {
12 19
13 template <> 20 template <>
14 struct EnumTraits<arc::mojom::BluetoothDeviceType, 21 struct EnumTraits<arc::mojom::BluetoothDeviceType,
15 device::BluetoothTransport> { 22 device::BluetoothTransport> {
16 static arc::mojom::BluetoothDeviceType ToMojom( 23 static arc::mojom::BluetoothDeviceType ToMojom(
17 device::BluetoothTransport type) { 24 device::BluetoothTransport type) {
18 switch (type) { 25 switch (type) {
19 case device::BLUETOOTH_TRANSPORT_CLASSIC: 26 case device::BLUETOOTH_TRANSPORT_CLASSIC:
(...skipping 22 matching lines...) Expand all
42 *type = device::BLUETOOTH_TRANSPORT_DUAL; 49 *type = device::BLUETOOTH_TRANSPORT_DUAL;
43 break; 50 break;
44 default: 51 default:
45 NOTREACHED() << "Invalid type: " << static_cast<uint32_t>(mojom_type); 52 NOTREACHED() << "Invalid type: " << static_cast<uint32_t>(mojom_type);
46 return false; 53 return false;
47 } 54 }
48 return true; 55 return true;
49 } 56 }
50 }; 57 };
51 58
59 template <>
60 struct EnumTraits<arc::mojom::BluetoothSdpAttributeType,
61 bluez::BluetoothServiceAttributeValueBlueZ::Type> {
62 static arc::mojom::BluetoothSdpAttributeType ToMojom(
63 bluez::BluetoothServiceAttributeValueBlueZ::Type input);
64 static bool FromMojom(
65 arc::mojom::BluetoothSdpAttributeType input,
66 bluez::BluetoothServiceAttributeValueBlueZ::Type* output);
67 };
68
69 template <>
70 struct StructTraits<arc::mojom::BluetoothSdpAttributeLayer2DataView,
71 bluez::BluetoothServiceAttributeValueBlueZ> {
72 static void* SetUpContext(
73 const bluez::BluetoothServiceAttributeValueBlueZ& value);
74 static void TearDownContext(
75 const bluez::BluetoothServiceAttributeValueBlueZ& value,
76 void* context);
77
78 static bluez::BluetoothServiceAttributeValueBlueZ::Type type(
79 const bluez::BluetoothServiceAttributeValueBlueZ& value,
80 void* context);
81 static uint32_t type_size(
82 const bluez::BluetoothServiceAttributeValueBlueZ& value,
83 void* context);
84 static const base::ListValue& value(
85 const bluez::BluetoothServiceAttributeValueBlueZ& value,
86 void* context);
87
88 static bool Read(arc::mojom::BluetoothSdpAttributeLayer2DataView data,
89 bluez::BluetoothServiceAttributeValueBlueZ* output);
90 };
91
92 template <>
93 struct StructTraits<arc::mojom::BluetoothSdpAttributeLayer1DataView,
94 bluez::BluetoothServiceAttributeValueBlueZ> {
95 static void* SetUpContext(
96 const bluez::BluetoothServiceAttributeValueBlueZ& value);
97 static void TearDownContext(
98 const bluez::BluetoothServiceAttributeValueBlueZ& value,
99 void* context);
100
101 static bluez::BluetoothServiceAttributeValueBlueZ::Type type(
102 const bluez::BluetoothServiceAttributeValueBlueZ& value,
103 void* context);
104 static uint32_t type_size(
105 const bluez::BluetoothServiceAttributeValueBlueZ& value,
106 void* context);
107 static const base::ListValue& value(
108 const bluez::BluetoothServiceAttributeValueBlueZ& value,
109 void* context);
110 static const bluez::BluetoothServiceAttributeValueBlueZ::Sequence& sequence(
111 const bluez::BluetoothServiceAttributeValueBlueZ& value,
112 void* context);
113
114 static bool Read(arc::mojom::BluetoothSdpAttributeLayer1DataView data,
115 bluez::BluetoothServiceAttributeValueBlueZ* output);
116 };
117
118 template <>
119 struct StructTraits<arc::mojom::BluetoothSdpAttributeDataView,
120 bluez::BluetoothServiceAttributeValueBlueZ> {
121 static void* SetUpContext(
122 const bluez::BluetoothServiceAttributeValueBlueZ& value);
123 static void TearDownContext(
124 const bluez::BluetoothServiceAttributeValueBlueZ& value,
125 void* context);
126
127 static bluez::BluetoothServiceAttributeValueBlueZ::Type type(
128 const bluez::BluetoothServiceAttributeValueBlueZ& value,
129 void* context);
130 static uint32_t type_size(
131 const bluez::BluetoothServiceAttributeValueBlueZ& value,
132 void* context);
133 static const base::ListValue& value(
134 const bluez::BluetoothServiceAttributeValueBlueZ& value,
135 void* context);
136 static const bluez::BluetoothServiceAttributeValueBlueZ::Sequence& sequence(
137 const bluez::BluetoothServiceAttributeValueBlueZ& value,
138 void* context);
139
140 static bool Read(arc::mojom::BluetoothSdpAttributeDataView data,
141 bluez::BluetoothServiceAttributeValueBlueZ* output);
142 };
143
144 template <>
145 struct StructTraits<arc::mojom::BluetoothSdpRecordDataView,
146 bluez::BluetoothServiceRecordBlueZ> {
147 static void* SetUpContext(const bluez::BluetoothServiceRecordBlueZ& value);
148 static void TearDownContext(const bluez::BluetoothServiceRecordBlueZ& value,
149 void* context);
150
151 static const std::map<uint16_t, bluez::BluetoothServiceAttributeValueBlueZ>&
152 attrs(const bluez::BluetoothServiceRecordBlueZ& value, void* context);
153
154 static bool Read(arc::mojom::BluetoothSdpRecordDataView data,
155 bluez::BluetoothServiceRecordBlueZ* output);
156 };
157
52 } // namespace mojo 158 } // namespace mojo
53 159
54 #endif // COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_ 160 #endif // COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698