| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "device/bluetooth/bluetooth_gatt_characteristic.h" | 9 #include "device/bluetooth/bluetooth_gatt_characteristic.h" |
| 10 | 10 |
| 11 namespace device { | 11 namespace device { |
| 12 | 12 |
| 13 // BluetoothRemoteGattCharacteristicAndroid along with its owned Java class | 13 // BluetoothRemoteGattCharacteristicAndroid along with its owned Java class |
| 14 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic | 14 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic |
| 15 // implement BluetootGattCharacteristic. | 15 // implement BluetootGattCharacteristic. |
| 16 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid | 16 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid |
| 17 : public BluetoothGattCharacteristic { | 17 : public BluetoothGattCharacteristic { |
| 18 public: | 18 public: |
| 19 // Create a BluetoothRemoteGattServiceAndroid instance and associated Java | 19 // Create a BluetoothRemoteGattServiceAndroid instance and associated Java |
| 20 // ChromeBluetoothRemoteGattService using the provided | 20 // ChromeBluetoothRemoteGattService using the provided |
| 21 // |bluetooth_remote_gatt_service_wrapper|. | 21 // |bluetooth_remote_gatt_service_wrapper|. |
| 22 // | 22 // |
| 23 // The ChromeBluetoothRemoteGattService instance will hold a Java reference | 23 // The ChromeBluetoothRemoteGattService instance will hold a Java reference |
| 24 // to |bluetooth_remote_gatt_service_wrapper|. | 24 // to |bluetooth_remote_gatt_service_wrapper|. |
| 25 // | 25 // |
| 26 // TODO(scheib): Actually create the Java object. crbug.com/545682 | 26 // TODO(scheib): Actually create the Java object. crbug.com/545682 |
| 27 static scoped_ptr<BluetoothRemoteGattCharacteristicAndroid> Create(); | 27 static scoped_ptr<BluetoothRemoteGattCharacteristicAndroid> Create( |
| 28 const std::string& instanceId); |
| 28 | 29 |
| 29 ~BluetoothRemoteGattCharacteristicAndroid() override; | 30 ~BluetoothRemoteGattCharacteristicAndroid() override; |
| 30 | 31 |
| 31 // BluetoothGattCharacteristic interface: | 32 // BluetoothGattCharacteristic interface: |
| 32 std::string GetIdentifier() const override; | 33 std::string GetIdentifier() const override; |
| 33 BluetoothUUID GetUUID() const override; | 34 BluetoothUUID GetUUID() const override; |
| 34 bool IsLocal() const override; | 35 bool IsLocal() const override; |
| 35 const std::vector<uint8>& GetValue() const override; | 36 const std::vector<uint8>& GetValue() const override; |
| 36 BluetoothGattService* GetService() const override; | 37 BluetoothGattService* GetService() const override; |
| 37 Properties GetProperties() const override; | 38 Properties GetProperties() const override; |
| 38 Permissions GetPermissions() const override; | 39 Permissions GetPermissions() const override; |
| 39 bool IsNotifying() const override; | 40 bool IsNotifying() const override; |
| 40 std::vector<BluetoothGattDescriptor*> GetDescriptors() const override; | 41 std::vector<BluetoothGattDescriptor*> GetDescriptors() const override; |
| 41 BluetoothGattDescriptor* GetDescriptor( | 42 BluetoothGattDescriptor* GetDescriptor( |
| 42 const std::string& identifier) const override; | 43 const std::string& identifier) const override; |
| 43 bool AddDescriptor(BluetoothGattDescriptor* descriptor) override; | 44 bool AddDescriptor(BluetoothGattDescriptor* descriptor) override; |
| 44 bool UpdateValue(const std::vector<uint8>& value) override; | 45 bool UpdateValue(const std::vector<uint8>& value) override; |
| 45 void StartNotifySession(const NotifySessionCallback& callback, | 46 void StartNotifySession(const NotifySessionCallback& callback, |
| 46 const ErrorCallback& error_callback) override; | 47 const ErrorCallback& error_callback) override; |
| 47 void ReadRemoteCharacteristic(const ValueCallback& callback, | 48 void ReadRemoteCharacteristic(const ValueCallback& callback, |
| 48 const ErrorCallback& error_callback) override; | 49 const ErrorCallback& error_callback) override; |
| 49 void WriteRemoteCharacteristic(const std::vector<uint8>& new_value, | 50 void WriteRemoteCharacteristic(const std::vector<uint8>& new_value, |
| 50 const base::Closure& callback, | 51 const base::Closure& callback, |
| 51 const ErrorCallback& error_callback) override; | 52 const ErrorCallback& error_callback) override; |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 BluetoothRemoteGattCharacteristicAndroid(); | 55 BluetoothRemoteGattCharacteristicAndroid(const std::string& instanceId); |
| 56 |
| 57 // Adapter unique instance ID. |
| 58 std::string instanceId_; |
| 55 | 59 |
| 56 std::vector<uint8> value_; | 60 std::vector<uint8> value_; |
| 57 | 61 |
| 58 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); | 62 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); |
| 59 }; | 63 }; |
| 60 | 64 |
| 61 } // namespace device | 65 } // namespace device |
| 62 | 66 |
| 63 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ | 67 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ |
| OLD | NEW |