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

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

Issue 1765773002: bluetooth: Refactor GetDescriptorForUUID to GetDescriptorsForUUID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-notify-tommyt-
Patch Set: Created 4 years, 9 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 BluetoothGattDescriptor* descriptor = characteristic->GetDescriptorForUUID( 179 BluetoothGattDescriptor* descriptor = characteristic->GetDescriptorForUUID(
180 BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid()); 180 BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid());
181 BluetoothRemoteGattDescriptorAndroid* descriptor_android = 181 BluetoothRemoteGattDescriptorAndroid* descriptor_android =
182 static_cast<BluetoothRemoteGattDescriptorAndroid*>(descriptor); 182 static_cast<BluetoothRemoteGattDescriptorAndroid*>(descriptor);
183 Java_FakeBluetoothGattDescriptor_valueWrite( 183 Java_FakeBluetoothGattDescriptor_valueWrite(
184 base::android::AttachCurrentThread(), 184 base::android::AttachCurrentThread(),
185 descriptor_android ? descriptor_android->GetJavaObject().obj() : nullptr, 185 descriptor_android ? descriptor_android->GetJavaObject().obj() : nullptr,
186 0); // android.bluetooth.BluetoothGatt.GATT_SUCCESS 186 0); // android.bluetooth.BluetoothGatt.GATT_SUCCESS
187 } 187 }
188 188
189 void BluetoothTestAndroid::SimulateGattNotifySessionStartError(
190 BluetoothGattCharacteristic* characteristic,
191 BluetoothGattService::GattErrorCode error_code) {
192 BluetoothGattDescriptor* descriptor = characteristic->GetDescriptorForUUID(
193 BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid());
194 BluetoothRemoteGattDescriptorAndroid* descriptor_android =
195 static_cast<BluetoothRemoteGattDescriptorAndroid*>(descriptor);
196 Java_FakeBluetoothGattDescriptor_valueWrite(
197 base::android::AttachCurrentThread(),
198 descriptor_android ? descriptor_android->GetJavaObject().obj() : nullptr,
199 BluetoothRemoteGattServiceAndroid::GetAndroidErrorCode(error_code));
200 }
201
189 void BluetoothTestAndroid:: 202 void BluetoothTestAndroid::
190 SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( 203 SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce(
191 BluetoothGattCharacteristic* characteristic) { 204 BluetoothGattCharacteristic* characteristic) {
192 BluetoothRemoteGattCharacteristicAndroid* characteristic_android = 205 BluetoothRemoteGattCharacteristicAndroid* characteristic_android =
193 static_cast<BluetoothRemoteGattCharacteristicAndroid*>(characteristic); 206 static_cast<BluetoothRemoteGattCharacteristicAndroid*>(characteristic);
194 JNIEnv* env = base::android::AttachCurrentThread(); 207 JNIEnv* env = base::android::AttachCurrentThread();
195 208
196 Java_FakeBluetoothGattCharacteristic_setCharacteristicNotificationWillFailSync hronouslyOnce( 209 Java_FakeBluetoothGattCharacteristic_setCharacteristicNotificationWillFailSync hronouslyOnce(
197 env, characteristic_android->GetJavaObject().obj()); 210 env, characteristic_android->GetJavaObject().obj());
198 } 211 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } 449 }
437 450
438 void BluetoothTestAndroid::OnFakeAdapterStateChanged( 451 void BluetoothTestAndroid::OnFakeAdapterStateChanged(
439 JNIEnv* env, 452 JNIEnv* env,
440 const JavaParamRef<jobject>& caller, 453 const JavaParamRef<jobject>& caller,
441 const bool powered) { 454 const bool powered) {
442 adapter_->NotifyAdapterStateChanged(powered); 455 adapter_->NotifyAdapterStateChanged(powered);
443 } 456 }
444 457
445 } // namespace device 458 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698