| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_DESCRIPTOR_ANDROID_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 11 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 13 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 13 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" | 14 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
| 14 | 15 |
| 15 namespace device { | 16 namespace device { |
| 16 | 17 |
| 17 // BluetoothRemoteGattDescriptorAndroid along with its owned Java class | 18 // BluetoothRemoteGattDescriptorAndroid along with its owned Java class |
| 18 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattDescriptor | 19 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattDescriptor |
| 19 // implement BluetootGattDescriptor. | 20 // implement BluetootGattDescriptor. |
| 20 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattDescriptorAndroid | 21 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattDescriptorAndroid |
| 21 : public BluetoothRemoteGattDescriptor { | 22 : public BluetoothRemoteGattDescriptor { |
| 22 public: | 23 public: |
| 23 // Create a BluetoothRemoteGattDescriptorAndroid instance and associated | 24 // Create a BluetoothRemoteGattDescriptorAndroid instance and associated |
| 24 // Java ChromeBluetoothRemoteGattDescriptor using the provided | 25 // Java ChromeBluetoothRemoteGattDescriptor using the provided |
| 25 // |bluetooth_gatt_descriptor_wrapper|. | 26 // |bluetooth_gatt_descriptor_wrapper|. |
| 26 // | 27 // |
| 27 // The ChromeBluetoothRemoteGattDescriptor instance will hold a Java | 28 // The ChromeBluetoothRemoteGattDescriptor instance will hold a Java |
| 28 // reference to |bluetooth_gatt_descriptor_wrapper|. | 29 // reference to |bluetooth_gatt_descriptor_wrapper|. |
| 29 static std::unique_ptr<BluetoothRemoteGattDescriptorAndroid> Create( | 30 static std::unique_ptr<BluetoothRemoteGattDescriptorAndroid> Create( |
| 30 const std::string& instanceId, | 31 const std::string& instanceId, |
| 31 jobject /* BluetoothGattDescriptorWrapper */ | 32 const base::android::JavaRef<jobject>& /* BluetoothGattDescriptorWrapper |
| 33 */ |
| 32 bluetooth_gatt_descriptor_wrapper, | 34 bluetooth_gatt_descriptor_wrapper, |
| 33 jobject /* chromeBluetoothDevice */ chrome_bluetooth_device); | 35 const base::android::JavaRef< |
| 36 jobject>& /* chromeBluetoothDevice */ chrome_bluetooth_device); |
| 34 | 37 |
| 35 ~BluetoothRemoteGattDescriptorAndroid() override; | 38 ~BluetoothRemoteGattDescriptorAndroid() override; |
| 36 | 39 |
| 37 // Register C++ methods exposed to Java using JNI. | 40 // Register C++ methods exposed to Java using JNI. |
| 38 static bool RegisterJNI(JNIEnv* env); | 41 static bool RegisterJNI(JNIEnv* env); |
| 39 | 42 |
| 40 // Returns the associated ChromeBluetoothRemoteGattDescriptor Java object. | 43 // Returns the associated ChromeBluetoothRemoteGattDescriptor Java object. |
| 41 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 44 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 42 | 45 |
| 43 // BluetoothRemoteGattDescriptor interface: | 46 // BluetoothRemoteGattDescriptor interface: |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 ErrorCallback write_error_callback_; | 88 ErrorCallback write_error_callback_; |
| 86 | 89 |
| 87 std::vector<uint8_t> value_; | 90 std::vector<uint8_t> value_; |
| 88 | 91 |
| 89 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorAndroid); | 92 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorAndroid); |
| 90 }; | 93 }; |
| 91 | 94 |
| 92 } // namespace device | 95 } // namespace device |
| 93 | 96 |
| 94 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ | 97 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ |
| OLD | NEW |