| 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/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "device/bluetooth/bluetooth_gatt_characteristic.h" | 10 #include "device/bluetooth/bluetooth_gatt_characteristic.h" |
| 11 | 11 |
| 12 namespace device { | 12 namespace device { |
| 13 | 13 |
| 14 // BluetoothRemoteGattCharacteristicAndroid along with its owned Java class | 14 // BluetoothRemoteGattCharacteristicAndroid along with its owned Java class |
| 15 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic | 15 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic |
| 16 // implement BluetootGattCharacteristic. | 16 // implement BluetootGattCharacteristic. |
| 17 // |
| 18 // TODO(crbug.com/551634): When notifications are enabled characteristic updates |
| 19 // should call observers' GattCharacteristicValueChanged. |
| 17 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid | 20 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid |
| 18 : public BluetoothGattCharacteristic { | 21 : public BluetoothGattCharacteristic { |
| 19 public: | 22 public: |
| 20 // Create a BluetoothRemoteGattCharacteristicAndroid instance and associated | 23 // Create a BluetoothRemoteGattCharacteristicAndroid instance and associated |
| 21 // Java | 24 // Java |
| 22 // ChromeBluetoothRemoteGattCharacteristic using the provided | 25 // ChromeBluetoothRemoteGattCharacteristic using the provided |
| 23 // |bluetooth_gatt_characteristic_wrapper|. | 26 // |bluetooth_gatt_characteristic_wrapper|. |
| 24 // | 27 // |
| 25 // The ChromeBluetoothRemoteGattCharacteristic instance will hold a Java | 28 // The ChromeBluetoothRemoteGattCharacteristic instance will hold a Java |
| 26 // reference | 29 // reference |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 void OnWrite(JNIEnv* env, jobject jcaller, int32_t status); | 71 void OnWrite(JNIEnv* env, jobject jcaller, int32_t status); |
| 69 | 72 |
| 70 private: | 73 private: |
| 71 BluetoothRemoteGattCharacteristicAndroid(const std::string& instanceId); | 74 BluetoothRemoteGattCharacteristicAndroid(const std::string& instanceId); |
| 72 | 75 |
| 73 // Java object | 76 // Java object |
| 74 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic. | 77 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic. |
| 75 base::android::ScopedJavaGlobalRef<jobject> j_characteristic_; | 78 base::android::ScopedJavaGlobalRef<jobject> j_characteristic_; |
| 76 | 79 |
| 77 // Adapter unique instance ID. | 80 // Adapter unique instance ID. |
| 78 std::string instanceId_; | 81 std::string instance_id_; |
| 79 | 82 |
| 80 // ReadRemoteCharacteristic callbacks and pending state. | 83 // ReadRemoteCharacteristic callbacks and pending state. |
| 81 bool read_pending_ = false; | 84 bool read_pending_ = false; |
| 82 ValueCallback read_callback_; | 85 ValueCallback read_callback_; |
| 83 ErrorCallback read_error_callback_; | 86 ErrorCallback read_error_callback_; |
| 84 | 87 |
| 85 // WriteRemoteCharacteristic callbacks and pending state. | 88 // WriteRemoteCharacteristic callbacks and pending state. |
| 86 bool write_pending_ = false; | 89 bool write_pending_ = false; |
| 87 base::Closure write_callback_; | 90 base::Closure write_callback_; |
| 88 ErrorCallback write_error_callback_; | 91 ErrorCallback write_error_callback_; |
| 89 | 92 |
| 90 std::vector<uint8> value_; | 93 std::vector<uint8> value_; |
| 91 | 94 |
| 92 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); | 95 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); |
| 93 }; | 96 }; |
| 94 | 97 |
| 95 } // namespace device | 98 } // namespace device |
| 96 | 99 |
| 97 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ | 100 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ |
| OLD | NEW |