Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: device/bluetooth/test/bluetooth_test_android.cc

Issue 1577623002: bluetooth: android: Implement Descriptor Write as needed for notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-descriptors-
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "device/bluetooth/test/bluetooth_test_android.h" 5 #include "device/bluetooth/test/bluetooth_test_android.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 const std::string& uuid) { 270 const std::string& uuid) {
271 BluetoothRemoteGattCharacteristicAndroid* characteristic_android = 271 BluetoothRemoteGattCharacteristicAndroid* characteristic_android =
272 static_cast<BluetoothRemoteGattCharacteristicAndroid*>(characteristic); 272 static_cast<BluetoothRemoteGattCharacteristicAndroid*>(characteristic);
273 JNIEnv* env = base::android::AttachCurrentThread(); 273 JNIEnv* env = base::android::AttachCurrentThread();
274 274
275 Java_FakeBluetoothGattCharacteristic_addDescriptor( 275 Java_FakeBluetoothGattCharacteristic_addDescriptor(
276 env, characteristic_android->GetJavaObject().obj(), 276 env, characteristic_android->GetJavaObject().obj(),
277 base::android::ConvertUTF8ToJavaString(env, uuid).obj()); 277 base::android::ConvertUTF8ToJavaString(env, uuid).obj());
278 } 278 }
279 279
280 void BluetoothTestAndroid::SimulateGattDescriptorWriteWillFailSynchronouslyOnce(
281 BluetoothGattDescriptor* descriptor) {
282 BluetoothRemoteGattDescriptorAndroid* descriptor_android =
283 static_cast<BluetoothRemoteGattDescriptorAndroid*>(descriptor);
284 Java_FakeBluetoothGattDescriptor_setWriteDescriptorWillFailSynchronouslyOnce(
285 base::android::AttachCurrentThread(),
286 descriptor_android->GetJavaObject().obj());
287 }
288
280 void BluetoothTestAndroid::OnFakeBluetoothDeviceConnectGattCalled( 289 void BluetoothTestAndroid::OnFakeBluetoothDeviceConnectGattCalled(
281 JNIEnv* env, 290 JNIEnv* env,
282 const JavaParamRef<jobject>& caller) { 291 const JavaParamRef<jobject>& caller) {
283 gatt_connection_attempts_++; 292 gatt_connection_attempts_++;
284 } 293 }
285 294
286 void BluetoothTestAndroid::OnFakeBluetoothGattDisconnect( 295 void BluetoothTestAndroid::OnFakeBluetoothGattDisconnect(
287 JNIEnv* env, 296 JNIEnv* env,
288 const JavaParamRef<jobject>& caller) { 297 const JavaParamRef<jobject>& caller) {
289 gatt_disconnection_attempts_++; 298 gatt_disconnection_attempts_++;
(...skipping 18 matching lines...) Expand all
308 } 317 }
309 318
310 void BluetoothTestAndroid::OnFakeBluetoothGattWriteCharacteristic( 319 void BluetoothTestAndroid::OnFakeBluetoothGattWriteCharacteristic(
311 JNIEnv* env, 320 JNIEnv* env,
312 const JavaParamRef<jobject>& caller, 321 const JavaParamRef<jobject>& caller,
313 const JavaParamRef<jbyteArray>& value) { 322 const JavaParamRef<jbyteArray>& value) {
314 gatt_write_characteristic_attempts_++; 323 gatt_write_characteristic_attempts_++;
315 base::android::JavaByteArrayToByteVector(env, value, &last_write_value_); 324 base::android::JavaByteArrayToByteVector(env, value, &last_write_value_);
316 } 325 }
317 326
327 void BluetoothTestAndroid::OnFakeBluetoothGattWriteDescriptor(
328 JNIEnv* env,
329 const JavaParamRef<jobject>& caller,
330 const JavaParamRef<jbyteArray>& value) {
331 gatt_write_descriptor_attempts_++;
332 base::android::JavaByteArrayToByteVector(env, value, &last_write_value_);
333 }
334
318 } // namespace device 335 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698