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 "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_descriptor.h" | 10 #include "device/bluetooth/bluetooth_gatt_descriptor.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 bool IsLocal() const override; | 43 bool IsLocal() const override; |
44 const std::vector<uint8_t>& GetValue() const override; | 44 const std::vector<uint8_t>& GetValue() const override; |
45 BluetoothGattCharacteristic* GetCharacteristic() const override; | 45 BluetoothGattCharacteristic* GetCharacteristic() const override; |
46 BluetoothGattCharacteristic::Permissions GetPermissions() const override; | 46 BluetoothGattCharacteristic::Permissions GetPermissions() const override; |
47 void ReadRemoteDescriptor(const ValueCallback& callback, | 47 void ReadRemoteDescriptor(const ValueCallback& callback, |
48 const ErrorCallback& error_callback) override; | 48 const ErrorCallback& error_callback) override; |
49 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value, | 49 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value, |
50 const base::Closure& callback, | 50 const base::Closure& callback, |
51 const ErrorCallback& error_callback) override; | 51 const ErrorCallback& error_callback) override; |
52 | 52 |
53 // Callback after Read operation completes. | |
scheib
2016/02/26 04:27:01
Called when
tommyt
2016/03/01 14:45:15
Done.
| |
54 void OnRead(JNIEnv* env, | |
55 const base::android::JavaParamRef<jobject>& jcaller, | |
56 int32_t status, | |
57 const base::android::JavaParamRef<jbyteArray>& value); | |
58 | |
59 // Callback after Write operation completes. | |
scheib
2016/02/26 04:27:01
Called when
tommyt
2016/03/01 14:45:15
Done.
| |
60 void OnWrite(JNIEnv* env, | |
61 const base::android::JavaParamRef<jobject>& jcaller, | |
62 int32_t status); | |
63 | |
53 private: | 64 private: |
54 BluetoothRemoteGattDescriptorAndroid(const std::string& instanceId); | 65 BluetoothRemoteGattDescriptorAndroid(const std::string& instanceId); |
55 | 66 |
56 // Java object | 67 // Java object |
57 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattDescriptor. | 68 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattDescriptor. |
58 base::android::ScopedJavaGlobalRef<jobject> j_descriptor_; | 69 base::android::ScopedJavaGlobalRef<jobject> j_descriptor_; |
59 | 70 |
60 // Adapter unique instance ID. | 71 // Adapter unique instance ID. |
61 std::string instance_id_; | 72 std::string instance_id_; |
62 | 73 |
74 // ReadRemoteCharacteristic callbacks and pending state. | |
75 bool read_pending_ = false; | |
76 ValueCallback read_callback_; | |
77 ErrorCallback read_error_callback_; | |
78 | |
79 // WriteRemoteCharacteristic callbacks and pending state. | |
80 bool write_pending_ = false; | |
81 base::Closure write_callback_; | |
82 ErrorCallback write_error_callback_; | |
83 | |
84 std::vector<uint8_t> value_; | |
85 | |
63 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorAndroid); | 86 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorAndroid); |
64 }; | 87 }; |
65 | 88 |
66 } // namespace device | 89 } // namespace device |
67 | 90 |
68 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ | 91 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ |
OLD | NEW |