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

Unified 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: Remove unused includes Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/arc/bluetooth/bluetooth_struct_traits.h
diff --git a/components/arc/bluetooth/bluetooth_struct_traits.h b/components/arc/bluetooth/bluetooth_struct_traits.h
index 2178fc1365103a6822c674453ac619a97ee65449..d72006c9f1ecc22d737ad4c447cb5ab722a0ff7a 100644
--- a/components/arc/bluetooth/bluetooth_struct_traits.h
+++ b/components/arc/bluetooth/bluetooth_struct_traits.h
@@ -5,8 +5,15 @@
#ifndef COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_
#define COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_
+#include <map>
+#include <utility>
+#include <vector>
+
#include "components/arc/common/bluetooth.mojom.h"
#include "device/bluetooth/bluetooth_common.h"
+#include "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h"
+#include "device/bluetooth/bluez/bluetooth_service_record_bluez.h"
+#include "ipc/ipc_message_utils.h"
namespace mojo {
@@ -49,6 +56,65 @@ struct EnumTraits<arc::mojom::BluetoothDeviceType,
}
};
+template <>
+struct EnumTraits<arc::mojom::BluetoothSdpAttrType,
+ bluez::BluetoothServiceAttributeValueBlueZ::Type> {
+ static arc::mojom::BluetoothSdpAttrType ToMojom(
+ bluez::BluetoothServiceAttributeValueBlueZ::Type input);
+ static bool FromMojom(
+ arc::mojom::BluetoothSdpAttrType input,
+ bluez::BluetoothServiceAttributeValueBlueZ::Type* output);
+};
+
+template <>
+struct StructTraits<arc::mojom::BluetoothSdpServiceAttr,
+ bluez::BluetoothServiceAttributeValueBlueZ> {
+ static bluez::BluetoothServiceAttributeValueBlueZ::Type type(
+ const bluez::BluetoothServiceAttributeValueBlueZ& value) {
+ return value.type();
+ }
+
+ static size_t type_size(
+ const bluez::BluetoothServiceAttributeValueBlueZ& value) {
+ return value.size();
+ }
+
+ static const base::ListValue& value(
+ const bluez::BluetoothServiceAttributeValueBlueZ& value) {
+ base::ListValue list_value;
+ list_value.Append(value.value().CreateDeepCopy());
+ return std::move(list_value);
dcheng 2016/08/20 02:39:19 Nit: std::move() has no effect here. More problem
yzshen1 2016/08/22 23:42:14 Ah, I think that is because we don't have any IPC:
Miao 2016/08/25 16:51:36 Added the SetUpContext / TearDownContext feature f
+ }
+
+ static const std::vector<bluez::BluetoothServiceAttributeValueBlueZ>&
+ sequence(const bluez::BluetoothServiceAttributeValueBlueZ& value) {
+ return value.sequence();
+ }
+
+ static bool Read(arc::mojom::BluetoothSdpServiceAttrDataView data,
+ bluez::BluetoothServiceAttributeValueBlueZ* output);
+};
+
+template <>
+struct StructTraits<arc::mojom::BluetoothSdpRecord,
+ bluez::BluetoothServiceRecordBlueZ> {
+ static const std::map<uint16_t, bluez::BluetoothServiceAttributeValueBlueZ>
+ attrs(const bluez::BluetoothServiceRecordBlueZ& value) {
+ std::map<uint16_t, bluez::BluetoothServiceAttributeValueBlueZ> attributes;
dcheng 2016/08/20 02:39:19 Similar comment here: if we really need to create
Miao 2016/08/25 16:51:36 Done.
+ std::vector<uint16_t> attribute_ids = value.GetAttributeIds();
+
+ for (auto it : attribute_ids) {
+ attributes[it] = std::move(bluez::BluetoothServiceAttributeValueBlueZ(
dcheng 2016/08/20 02:39:19 Note that std::move() here doesn't have an effect,
Miao 2016/08/25 16:51:36 Done.
+ value.GetAttributeValue(it)));
+ }
+
+ return attributes;
+ }
+
+ static bool Read(arc::mojom::BluetoothSdpRecordDataView data,
+ bluez::BluetoothServiceRecordBlueZ* output);
+};
+
} // namespace mojo
#endif // COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698