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

Unified Diff: device/bluetooth/device.h

Issue 2401193002: bluetooth: Add Device service for chrome://bluetooth-internals. (Closed)
Patch Set: Include ref_counted Created 4 years, 2 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: device/bluetooth/device.h
diff --git a/device/bluetooth/device.h b/device/bluetooth/device.h
new file mode 100644
index 0000000000000000000000000000000000000000..bf9b9386637f1663e17d9b38f9fc32c307acda7d
--- /dev/null
+++ b/device/bluetooth/device.h
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_BLUETOOTH_DEVICE_H_
+#define DEVICE_BLUETOOTH_DEVICE_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "device/bluetooth/bluetooth_adapter.h"
+#include "device/bluetooth/bluetooth_device.h"
+#include "device/bluetooth/public/interfaces/device.mojom.h"
+
+namespace bluetooth {
+
+// Implementation of Mojo Device located in
+// device/bluetooth/public/interfaces/le_device.mojom.
scheib 2016/10/10 20:23:51 Drop the "le_", and check to see if it's anywhere
mbrunson 2016/10/10 22:01:09 Oh I missed one. Done.
+// It handles requests to interact with Bluetooth Device.
+// Uses the platform abstraction of device/bluetooth.
+class Device : public mojom::Device {
+ public:
+ Device(const std::string& address,
+ scoped_refptr<device::BluetoothAdapter> adapter);
+ ~Device() override;
+
+ // Creates a mojom::DeviceInfo using info from the given |device|.
+ static mojom::DeviceInfoPtr ConstructDeviceInfoStruct(
+ const device::BluetoothDevice* device);
+
+ // mojom::Device overrides:
+ void GetInfo(const GetInfoCallback& callback) override;
+
+ private:
+ // The address of the Bluetooth device.
+ std::string address_;
+
+ // The current BluetoothAdapter.
+ scoped_refptr<device::BluetoothAdapter> adapter_;
+
+ DISALLOW_COPY_AND_ASSIGN(Device);
+};
+
+} // namespace bluetooth
+
+#endif // DEVICE_BLUETOOTH_DEVICE_H_

Powered by Google App Engine
This is Rietveld 408576698