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 #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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 BluetoothRemoteGattCharacteristicAndroid* characteristic_android = | 169 BluetoothRemoteGattCharacteristicAndroid* characteristic_android = |
170 static_cast<BluetoothRemoteGattCharacteristicAndroid*>(characteristic); | 170 static_cast<BluetoothRemoteGattCharacteristicAndroid*>(characteristic); |
171 | 171 |
172 Java_FakeBluetoothGattCharacteristic_rememberCharacteristicForSubsequentAction
( | 172 Java_FakeBluetoothGattCharacteristic_rememberCharacteristicForSubsequentAction
( |
173 base::android::AttachCurrentThread(), | 173 base::android::AttachCurrentThread(), |
174 characteristic_android->GetJavaObject().obj()); | 174 characteristic_android->GetJavaObject().obj()); |
175 } | 175 } |
176 | 176 |
177 void BluetoothTestAndroid::SimulateGattNotifySessionStarted( | 177 void BluetoothTestAndroid::SimulateGattNotifySessionStarted( |
178 BluetoothGattCharacteristic* characteristic) { | 178 BluetoothGattCharacteristic* characteristic) { |
179 BluetoothGattDescriptor* descriptor = characteristic->GetDescriptorForUUID( | 179 BluetoothGattDescriptor* descriptor = |
180 BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid()); | 180 characteristic |
| 181 ->GetDescriptorsByUUID( |
| 182 BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid()) |
| 183 .at(0); |
181 BluetoothRemoteGattDescriptorAndroid* descriptor_android = | 184 BluetoothRemoteGattDescriptorAndroid* descriptor_android = |
182 static_cast<BluetoothRemoteGattDescriptorAndroid*>(descriptor); | 185 static_cast<BluetoothRemoteGattDescriptorAndroid*>(descriptor); |
183 Java_FakeBluetoothGattDescriptor_valueWrite( | 186 Java_FakeBluetoothGattDescriptor_valueWrite( |
184 base::android::AttachCurrentThread(), | 187 base::android::AttachCurrentThread(), |
185 descriptor_android ? descriptor_android->GetJavaObject().obj() : nullptr, | 188 descriptor_android ? descriptor_android->GetJavaObject().obj() : nullptr, |
186 0); // android.bluetooth.BluetoothGatt.GATT_SUCCESS | 189 0); // android.bluetooth.BluetoothGatt.GATT_SUCCESS |
187 } | 190 } |
188 | 191 |
189 void BluetoothTestAndroid:: | 192 void BluetoothTestAndroid:: |
190 SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( | 193 SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 } | 439 } |
437 | 440 |
438 void BluetoothTestAndroid::OnFakeAdapterStateChanged( | 441 void BluetoothTestAndroid::OnFakeAdapterStateChanged( |
439 JNIEnv* env, | 442 JNIEnv* env, |
440 const JavaParamRef<jobject>& caller, | 443 const JavaParamRef<jobject>& caller, |
441 const bool powered) { | 444 const bool powered) { |
442 adapter_->NotifyAdapterStateChanged(powered); | 445 adapter_->NotifyAdapterStateChanged(powered); |
443 } | 446 } |
444 | 447 |
445 } // namespace device | 448 } // namespace device |
OLD | NEW |