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> |
| 9 |
8 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "device/bluetooth/bluetooth_gatt_characteristic.h" | 12 #include "device/bluetooth/bluetooth_gatt_characteristic.h" |
11 | 13 |
12 namespace device { | 14 namespace device { |
13 | 15 |
14 // BluetoothRemoteGattCharacteristicAndroid along with its owned Java class | 16 // BluetoothRemoteGattCharacteristicAndroid along with its owned Java class |
15 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic | 17 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic |
16 // implement BluetootGattCharacteristic. | 18 // implement BluetootGattCharacteristic. |
17 // | 19 // |
(...skipping 21 matching lines...) Expand all Loading... |
39 // Register C++ methods exposed to Java using JNI. | 41 // Register C++ methods exposed to Java using JNI. |
40 static bool RegisterJNI(JNIEnv* env); | 42 static bool RegisterJNI(JNIEnv* env); |
41 | 43 |
42 // Returns the associated ChromeBluetoothRemoteGattCharacteristic Java object. | 44 // Returns the associated ChromeBluetoothRemoteGattCharacteristic Java object. |
43 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 45 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
44 | 46 |
45 // BluetoothGattCharacteristic interface: | 47 // BluetoothGattCharacteristic interface: |
46 std::string GetIdentifier() const override; | 48 std::string GetIdentifier() const override; |
47 BluetoothUUID GetUUID() const override; | 49 BluetoothUUID GetUUID() const override; |
48 bool IsLocal() const override; | 50 bool IsLocal() const override; |
49 const std::vector<uint8>& GetValue() const override; | 51 const std::vector<uint8_t>& GetValue() const override; |
50 BluetoothGattService* GetService() const override; | 52 BluetoothGattService* GetService() const override; |
51 Properties GetProperties() const override; | 53 Properties GetProperties() const override; |
52 Permissions GetPermissions() const override; | 54 Permissions GetPermissions() const override; |
53 bool IsNotifying() const override; | 55 bool IsNotifying() const override; |
54 std::vector<BluetoothGattDescriptor*> GetDescriptors() const override; | 56 std::vector<BluetoothGattDescriptor*> GetDescriptors() const override; |
55 BluetoothGattDescriptor* GetDescriptor( | 57 BluetoothGattDescriptor* GetDescriptor( |
56 const std::string& identifier) const override; | 58 const std::string& identifier) const override; |
57 bool AddDescriptor(BluetoothGattDescriptor* descriptor) override; | 59 bool AddDescriptor(BluetoothGattDescriptor* descriptor) override; |
58 bool UpdateValue(const std::vector<uint8>& value) override; | 60 bool UpdateValue(const std::vector<uint8_t>& value) override; |
59 void StartNotifySession(const NotifySessionCallback& callback, | 61 void StartNotifySession(const NotifySessionCallback& callback, |
60 const ErrorCallback& error_callback) override; | 62 const ErrorCallback& error_callback) override; |
61 void ReadRemoteCharacteristic(const ValueCallback& callback, | 63 void ReadRemoteCharacteristic(const ValueCallback& callback, |
62 const ErrorCallback& error_callback) override; | 64 const ErrorCallback& error_callback) override; |
63 void WriteRemoteCharacteristic(const std::vector<uint8>& new_value, | 65 void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value, |
64 const base::Closure& callback, | 66 const base::Closure& callback, |
65 const ErrorCallback& error_callback) override; | 67 const ErrorCallback& error_callback) override; |
66 | 68 |
67 // Callback after Read operation completes. | 69 // Callback after Read operation completes. |
68 void OnRead(JNIEnv* env, | 70 void OnRead(JNIEnv* env, |
69 const base::android::JavaParamRef<jobject>& jcaller, | 71 const base::android::JavaParamRef<jobject>& jcaller, |
70 int32_t status, | 72 int32_t status, |
71 const base::android::JavaParamRef<jbyteArray>& value); | 73 const base::android::JavaParamRef<jbyteArray>& value); |
72 | 74 |
73 // Callback after Write operation completes. | 75 // Callback after Write operation completes. |
(...skipping 14 matching lines...) Expand all Loading... |
88 // ReadRemoteCharacteristic callbacks and pending state. | 90 // ReadRemoteCharacteristic callbacks and pending state. |
89 bool read_pending_ = false; | 91 bool read_pending_ = false; |
90 ValueCallback read_callback_; | 92 ValueCallback read_callback_; |
91 ErrorCallback read_error_callback_; | 93 ErrorCallback read_error_callback_; |
92 | 94 |
93 // WriteRemoteCharacteristic callbacks and pending state. | 95 // WriteRemoteCharacteristic callbacks and pending state. |
94 bool write_pending_ = false; | 96 bool write_pending_ = false; |
95 base::Closure write_callback_; | 97 base::Closure write_callback_; |
96 ErrorCallback write_error_callback_; | 98 ErrorCallback write_error_callback_; |
97 | 99 |
98 std::vector<uint8> value_; | 100 std::vector<uint8_t> value_; |
99 | 101 |
100 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); | 102 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); |
101 }; | 103 }; |
102 | 104 |
103 } // namespace device | 105 } // namespace device |
104 | 106 |
105 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ | 107 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ |
OLD | NEW |