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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
13 #include "base/containers/scoped_ptr_hash_map.h" | 13 #include "base/containers/scoped_ptr_hash_map.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 15 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
16 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 16 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
17 | 17 |
18 namespace device { | 18 namespace device { |
19 | 19 |
20 class BluetoothAdapterAndroid; | 20 class BluetoothAdapterAndroid; |
21 class BluetoothRemoteGattDescriptorAndroid; | 21 class BluetoothRemoteGattDescriptorAndroid; |
22 class BluetoothRemoteGattServiceAndroid; | 22 class BluetoothRemoteGattServiceAndroid; |
23 | 23 |
24 // BluetoothRemoteGattCharacteristicAndroid along with its owned Java class | 24 // BluetoothRemoteGattCharacteristicAndroid along with its owned Java class |
25 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic | 25 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic |
26 // implement BluetootGattCharacteristic. | 26 // implement BluetootGattCharacteristic. |
27 // | |
28 // TODO(crbug.com/551634): When notifications are enabled characteristic updates | |
29 // should call observers' GattCharacteristicValueChanged. | |
30 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid | 27 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid |
31 : public BluetoothRemoteGattCharacteristic { | 28 : public BluetoothRemoteGattCharacteristic { |
32 public: | 29 public: |
33 // Create a BluetoothRemoteGattCharacteristicAndroid instance and associated | 30 // Create a BluetoothRemoteGattCharacteristicAndroid instance and associated |
34 // Java | 31 // Java |
35 // ChromeBluetoothRemoteGattCharacteristic using the provided | 32 // ChromeBluetoothRemoteGattCharacteristic using the provided |
36 // |bluetooth_gatt_characteristic_wrapper|. | 33 // |bluetooth_gatt_characteristic_wrapper|. |
37 // | 34 // |
38 // The ChromeBluetoothRemoteGattCharacteristic instance will hold a Java | 35 // The ChromeBluetoothRemoteGattCharacteristic instance will hold a Java |
39 // reference | 36 // reference |
(...skipping 19 matching lines...) Expand all Loading... |
59 BluetoothUUID GetUUID() const override; | 56 BluetoothUUID GetUUID() const override; |
60 const std::vector<uint8_t>& GetValue() const override; | 57 const std::vector<uint8_t>& GetValue() const override; |
61 BluetoothRemoteGattService* GetService() const override; | 58 BluetoothRemoteGattService* GetService() const override; |
62 Properties GetProperties() const override; | 59 Properties GetProperties() const override; |
63 Permissions GetPermissions() const override; | 60 Permissions GetPermissions() const override; |
64 std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override; | 61 std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override; |
65 BluetoothRemoteGattDescriptor* GetDescriptor( | 62 BluetoothRemoteGattDescriptor* GetDescriptor( |
66 const std::string& identifier) const override; | 63 const std::string& identifier) const override; |
67 void ReadRemoteCharacteristic(const ValueCallback& callback, | 64 void ReadRemoteCharacteristic(const ValueCallback& callback, |
68 const ErrorCallback& error_callback) override; | 65 const ErrorCallback& error_callback) override; |
69 void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value, | 66 void WriteRemoteCharacteristic(const std::vector<uint8_t>& value, |
70 const base::Closure& callback, | 67 const base::Closure& callback, |
71 const ErrorCallback& error_callback) override; | 68 const ErrorCallback& error_callback) override; |
72 | 69 |
73 // Called when value changed event occurs. | 70 // Called when value changed event occurs. |
74 void OnChanged(JNIEnv* env, | 71 void OnChanged(JNIEnv* env, |
75 const base::android::JavaParamRef<jobject>& jcaller, | 72 const base::android::JavaParamRef<jobject>& jcaller, |
76 const base::android::JavaParamRef<jbyteArray>& value); | 73 const base::android::JavaParamRef<jbyteArray>& value); |
77 | 74 |
78 // Called when Read operation completes. | 75 // Called when Read operation completes. |
79 void OnRead(JNIEnv* env, | 76 void OnRead(JNIEnv* env, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 base::ScopedPtrHashMap<std::string, | 142 base::ScopedPtrHashMap<std::string, |
146 std::unique_ptr<BluetoothRemoteGattDescriptorAndroid>> | 143 std::unique_ptr<BluetoothRemoteGattDescriptorAndroid>> |
147 descriptors_; | 144 descriptors_; |
148 | 145 |
149 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); | 146 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); |
150 }; | 147 }; |
151 | 148 |
152 } // namespace device | 149 } // namespace device |
153 | 150 |
154 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ | 151 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ |
OLD | NEW |