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); |
}; |