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

Unified Diff: device/bluetooth/device.h

Issue 2627243002: bluetooth: Add control for reading/writing of characteristics to internals page. (Closed)
Patch Set: DCHECK device 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 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
index eeda11f21f7da4084c3424bdfbfc73e742db4947..e32e112b1fda1b23c27e92af991bdcc66f483761 100644
--- a/device/bluetooth/device.h
+++ b/device/bluetooth/device.h
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_gatt_connection.h"
@@ -53,6 +54,15 @@ class Device : public mojom::Device, public device::BluetoothAdapter::Observer {
void GetServices(const GetServicesCallback& callback) override;
void GetCharacteristics(const std::string& service_id,
const GetCharacteristicsCallback& callback) override;
+ void ReadValueForCharacteristic(
+ const std::string& service_id,
+ const std::string& characteristic_id,
+ const ReadValueForCharacteristicCallback& callback) override;
+ void WriteValueForCharacteristic(
+ const std::string& service_id,
+ const std::string& characteristic_id,
+ const std::vector<uint8_t>& value,
+ const WriteValueForCharacteristicCallback& callback) override;
private:
Device(scoped_refptr<device::BluetoothAdapter> adapter,
@@ -66,6 +76,21 @@ class Device : public mojom::Device, public device::BluetoothAdapter::Observer {
void GetCharacteristicsImpl(const std::string& service_id,
const GetCharacteristicsCallback& callback);
+ void OnReadRemoteCharacteristic(
+ const ReadValueForCharacteristicCallback& callback,
+ const std::vector<uint8_t>& value);
+
+ void OnReadRemoteCharacteristicError(
+ const ReadValueForCharacteristicCallback& callback,
+ device::BluetoothGattService::GattErrorCode error_code);
+
+ void OnWriteRemoteCharacteristic(
+ const WriteValueForCharacteristicCallback& callback);
+
+ void OnWriteRemoteCharacteristicError(
+ const WriteValueForCharacteristicCallback& callback,
+ device::BluetoothGattService::GattErrorCode error_code);
+
const std::string& GetAddress();
// The current BluetoothAdapter.
@@ -80,6 +105,8 @@ class Device : public mojom::Device, public device::BluetoothAdapter::Observer {
// services to be discovered for this device.
std::vector<base::Closure> pending_services_requests_;
+ base::WeakPtrFactory<Device> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(Device);
};

Powered by Google App Engine
This is Rietveld 408576698