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

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: Rewind to the previous approach using generic attribute and type converter 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..cd845db7f50aa68870ecac8dbc73331852b8c654 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>
puthik_chromium 2016/08/28 00:05:39 We didn't need all these #include except one in li
Miao 2016/09/01 18:37:24 Done.
+#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,49 @@ struct EnumTraits<arc::mojom::BluetoothDeviceType,
}
};
+template <>
+struct EnumTraits<arc::mojom::BluetoothSdpAttributeType,
+ bluez::BluetoothServiceAttributeValueBlueZ::Type> {
+ static arc::mojom::BluetoothSdpAttributeType ToMojom(
+ bluez::BluetoothServiceAttributeValueBlueZ::Type input) {
+ switch (input) {
+ case bluez::BluetoothServiceAttributeValueBlueZ::NULLTYPE:
+ case bluez::BluetoothServiceAttributeValueBlueZ::UINT:
+ case bluez::BluetoothServiceAttributeValueBlueZ::INT:
+ case bluez::BluetoothServiceAttributeValueBlueZ::UUID:
+ case bluez::BluetoothServiceAttributeValueBlueZ::STRING:
+ case bluez::BluetoothServiceAttributeValueBlueZ::BOOL:
+ case bluez::BluetoothServiceAttributeValueBlueZ::SEQUENCE:
+ case bluez::BluetoothServiceAttributeValueBlueZ::URL:
+ return static_cast<arc::mojom::BluetoothSdpAttributeType>(input);
+ default:
+ NOTREACHED() << "Invalid type: " << static_cast<uint32_t>(input);
+ return arc::mojom::BluetoothSdpAttributeType::NULLTYPE;
+ }
+ }
+
+ static bool FromMojom(
+ arc::mojom::BluetoothSdpAttributeType input,
+ bluez::BluetoothServiceAttributeValueBlueZ::Type* output) {
+ switch (input) {
+ case arc::mojom::BluetoothSdpAttributeType::NULLTYPE:
+ case arc::mojom::BluetoothSdpAttributeType::UINT:
+ case arc::mojom::BluetoothSdpAttributeType::INT:
+ case arc::mojom::BluetoothSdpAttributeType::UUID:
+ case arc::mojom::BluetoothSdpAttributeType::STRING:
+ case arc::mojom::BluetoothSdpAttributeType::BOOL:
+ case arc::mojom::BluetoothSdpAttributeType::SEQUENCE:
+ case arc::mojom::BluetoothSdpAttributeType::URL:
+ *output = static_cast<bluez::BluetoothServiceAttributeValueBlueZ::Type>(
+ input);
+ return true;
+ default:
+ NOTREACHED() << "Invalid type: " << static_cast<uint32_t>(input);
+ return false;
+ }
+ }
+};
+
} // namespace mojo
#endif // COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698