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/android/scoped_java_ref.h" |
13 #include "base/containers/scoped_ptr_hash_map.h" | 14 #include "base/containers/scoped_ptr_hash_map.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 16 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
16 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 17 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
17 | 18 |
18 namespace device { | 19 namespace device { |
19 | 20 |
20 class BluetoothAdapterAndroid; | 21 class BluetoothAdapterAndroid; |
21 class BluetoothRemoteGattDescriptorAndroid; | 22 class BluetoothRemoteGattDescriptorAndroid; |
22 class BluetoothRemoteGattServiceAndroid; | 23 class BluetoothRemoteGattServiceAndroid; |
23 | 24 |
24 // BluetoothRemoteGattCharacteristicAndroid along with its owned Java class | 25 // BluetoothRemoteGattCharacteristicAndroid along with its owned Java class |
25 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic | 26 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic |
26 // implement BluetootGattCharacteristic. | 27 // implement BluetootGattCharacteristic. |
27 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid | 28 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid |
28 : public BluetoothRemoteGattCharacteristic { | 29 : public BluetoothRemoteGattCharacteristic { |
29 public: | 30 public: |
30 // Create a BluetoothRemoteGattCharacteristicAndroid instance and associated | 31 // Create a BluetoothRemoteGattCharacteristicAndroid instance and associated |
31 // Java | 32 // Java |
32 // ChromeBluetoothRemoteGattCharacteristic using the provided | 33 // ChromeBluetoothRemoteGattCharacteristic using the provided |
33 // |bluetooth_gatt_characteristic_wrapper|. | 34 // |bluetooth_gatt_characteristic_wrapper|. |
34 // | 35 // |
35 // The ChromeBluetoothRemoteGattCharacteristic instance will hold a Java | 36 // The ChromeBluetoothRemoteGattCharacteristic instance will hold a Java |
36 // reference | 37 // reference |
37 // to |bluetooth_gatt_characteristic_wrapper|. | 38 // to |bluetooth_gatt_characteristic_wrapper|. |
38 static std::unique_ptr<BluetoothRemoteGattCharacteristicAndroid> Create( | 39 static std::unique_ptr<BluetoothRemoteGattCharacteristicAndroid> Create( |
39 BluetoothAdapterAndroid* adapter, | 40 BluetoothAdapterAndroid* adapter, |
40 BluetoothRemoteGattServiceAndroid* service, | 41 BluetoothRemoteGattServiceAndroid* service, |
41 const std::string& instance_id, | 42 const std::string& instance_id, |
42 jobject /* BluetoothGattCharacteristicWrapper */ | 43 const base::android::JavaRef< |
| 44 jobject>& /* BluetoothGattCharacteristicWrapper */ |
43 bluetooth_gatt_characteristic_wrapper, | 45 bluetooth_gatt_characteristic_wrapper, |
44 jobject /* ChromeBluetoothDevice */ chrome_bluetooth_device); | 46 const base::android::JavaRef< |
| 47 jobject>& /* ChromeBluetoothDevice */ chrome_bluetooth_device); |
45 | 48 |
46 ~BluetoothRemoteGattCharacteristicAndroid() override; | 49 ~BluetoothRemoteGattCharacteristicAndroid() override; |
47 | 50 |
48 // Register C++ methods exposed to Java using JNI. | 51 // Register C++ methods exposed to Java using JNI. |
49 static bool RegisterJNI(JNIEnv* env); | 52 static bool RegisterJNI(JNIEnv* env); |
50 | 53 |
51 // Returns the associated ChromeBluetoothRemoteGattCharacteristic Java object. | 54 // Returns the associated ChromeBluetoothRemoteGattCharacteristic Java object. |
52 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 55 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
53 | 56 |
54 // BluetoothRemoteGattCharacteristic interface: | 57 // BluetoothRemoteGattCharacteristic interface: |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 base::ScopedPtrHashMap<std::string, | 145 base::ScopedPtrHashMap<std::string, |
143 std::unique_ptr<BluetoothRemoteGattDescriptorAndroid>> | 146 std::unique_ptr<BluetoothRemoteGattDescriptorAndroid>> |
144 descriptors_; | 147 descriptors_; |
145 | 148 |
146 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); | 149 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); |
147 }; | 150 }; |
148 | 151 |
149 } // namespace device | 152 } // namespace device |
150 | 153 |
151 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ | 154 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ |
OLD | NEW |