summaryrefslogtreecommitdiffstats
path: root/device/bluetooth/bluetooth_remote_gatt_characteristic_android.h
diff options
context:
space:
mode:
authortommyt <tommyt@opera.com>2016-03-14 15:12:28 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-14 22:14:58 +0000
commit0348fa65c3d808f854f745fb9f8f185a5b74b922 (patch)
treea5dd2b2dc34bad55c18d974fb6d633ad13354493 /device/bluetooth/bluetooth_remote_gatt_characteristic_android.h
parent59d3539fc7ce60355ccf52c00733d33dde5e118a (diff)
downloadchromium_src-0348fa65c3d808f854f745fb9f8f185a5b74b922.zip
chromium_src-0348fa65c3d808f854f745fb9f8f185a5b74b922.tar.gz
chromium_src-0348fa65c3d808f854f745fb9f8f185a5b74b922.tar.bz2
bluetooth: android: Confirm the notify session after the descriptor has been written.
This change also implements WriteRemoteDescriptor and ReadRemoteDescriptor. Because of this, I've also added quite a few descriptor unit tests. These tests are pretty much the same as the read/write tests for characteristics. BUG=584369 Review URL: https://codereview.chromium.org/1712593002 Cr-Commit-Position: refs/heads/master@{#381088}
Diffstat (limited to 'device/bluetooth/bluetooth_remote_gatt_characteristic_android.h')
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_characteristic_android.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.h
index 4493a94..606b7d4 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.h
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.h
@@ -7,6 +7,8 @@
#include <stdint.h>
+#include <queue>
+
#include "base/android/jni_android.h"
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/macros.h"
@@ -73,18 +75,24 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid
const base::Closure& callback,
const ErrorCallback& error_callback) override;
+ // Called when StartNotifySession operation succeeds.
+ void OnStartNotifySessionSuccess();
+
+ // Called when StartNotifySession operation fails.
+ void OnStartNotifySessionError(BluetoothGattService::GattErrorCode error);
+
// Called when value changed event occurs.
void OnChanged(JNIEnv* env,
const base::android::JavaParamRef<jobject>& jcaller,
const base::android::JavaParamRef<jbyteArray>& value);
- // Callback after Read operation completes.
+ // Called when Read operation completes.
void OnRead(JNIEnv* env,
const base::android::JavaParamRef<jobject>& jcaller,
int32_t status,
const base::android::JavaParamRef<jbyteArray>& value);
- // Callback after Write operation completes.
+ // Called when Write operation completes.
void OnWrite(JNIEnv* env,
const base::android::JavaParamRef<jobject>& jcaller,
int32_t status);
@@ -123,6 +131,11 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicAndroid
// Adapter unique instance ID.
std::string instance_id_;
+ // StartNotifySession callbacks and pending state.
+ typedef std::pair<NotifySessionCallback, ErrorCallback>
+ PendingStartNotifyCall;
+ std::queue<PendingStartNotifyCall> pending_start_notify_calls_;
+
// ReadRemoteCharacteristic callbacks and pending state.
bool read_pending_ = false;
ValueCallback read_callback_;