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

Side by Side Diff: device/bluetooth/bluetooth_device_android.h

Issue 1256313002: bluetooth: android: Implement & test CreateGattConnection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split tests up into smaller tests Created 5 years, 3 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
« no previous file with comments | « device/bluetooth/bluetooth_device.cc ('k') | device/bluetooth/bluetooth_device_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_
7 7
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "device/bluetooth/bluetooth_device.h" 10 #include "device/bluetooth/bluetooth_device.h"
(...skipping 18 matching lines...) Expand all
29 // this correctly. http://crbug.com/506416 29 // this correctly. http://crbug.com/506416
30 static BluetoothDeviceAndroid* Create( 30 static BluetoothDeviceAndroid* Create(
31 BluetoothAdapterAndroid* adapter, 31 BluetoothAdapterAndroid* adapter,
32 jobject bluetooth_device_wrapper); // Java Type: bluetoothDeviceWrapper 32 jobject bluetooth_device_wrapper); // Java Type: bluetoothDeviceWrapper
33 33
34 ~BluetoothDeviceAndroid() override; 34 ~BluetoothDeviceAndroid() override;
35 35
36 // Register C++ methods exposed to Java using JNI. 36 // Register C++ methods exposed to Java using JNI.
37 static bool RegisterJNI(JNIEnv* env); 37 static bool RegisterJNI(JNIEnv* env);
38 38
39 // Returns the associated ChromeBluetoothDevice Java object.
40 base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
41
39 // Updates cached copy of advertised UUIDs discovered during a scan. 42 // Updates cached copy of advertised UUIDs discovered during a scan.
40 // Returns true if new UUIDs differed from cached values. 43 // Returns true if new UUIDs differed from cached values.
41 bool UpdateAdvertisedUUIDs( 44 bool UpdateAdvertisedUUIDs(
42 jobject advertised_uuids); // Java Type: List<ParcelUuid> 45 jobject advertised_uuids); // Java Type: List<ParcelUuid>
43 46
44 // BluetoothDevice: 47 // BluetoothDevice:
45 uint32 GetBluetoothClass() const override; 48 uint32 GetBluetoothClass() const override;
46 std::string GetAddress() const override; 49 std::string GetAddress() const override;
47 VendorIDSource GetVendorIDSource() const override; 50 VendorIDSource GetVendorIDSource() const override;
48 uint16 GetVendorID() const override; 51 uint16 GetVendorID() const override;
(...skipping 24 matching lines...) Expand all
73 void Forget(const ErrorCallback& error_callback) override; 76 void Forget(const ErrorCallback& error_callback) override;
74 void ConnectToService( 77 void ConnectToService(
75 const device::BluetoothUUID& uuid, 78 const device::BluetoothUUID& uuid,
76 const ConnectToServiceCallback& callback, 79 const ConnectToServiceCallback& callback,
77 const ConnectToServiceErrorCallback& error_callback) override; 80 const ConnectToServiceErrorCallback& error_callback) override;
78 void ConnectToServiceInsecurely( 81 void ConnectToServiceInsecurely(
79 const device::BluetoothUUID& uuid, 82 const device::BluetoothUUID& uuid,
80 const ConnectToServiceCallback& callback, 83 const ConnectToServiceCallback& callback,
81 const ConnectToServiceErrorCallback& error_callback) override; 84 const ConnectToServiceErrorCallback& error_callback) override;
82 85
86 // Callback indicating when GATT client has connected/disconnected.
87 // See android.bluetooth.BluetoothGattCallback.onConnectionStateChange.
88 void OnConnectionStateChange(JNIEnv* env,
89 jobject jcaller,
90 int32_t status,
91 bool connected);
92
83 protected: 93 protected:
84 BluetoothDeviceAndroid(BluetoothAdapterAndroid* adapter); 94 BluetoothDeviceAndroid(BluetoothAdapterAndroid* adapter);
85 95
86 // BluetoothDevice: 96 // BluetoothDevice:
87 std::string GetDeviceName() const override; 97 std::string GetDeviceName() const override;
88 void CreateGattConnectionImpl() override; 98 void CreateGattConnectionImpl() override;
89 void DisconnectGatt() override; 99 void DisconnectGatt() override;
90 100
91 // Java object org.chromium.device.bluetooth.ChromeBluetoothDevice. 101 // Java object org.chromium.device.bluetooth.ChromeBluetoothDevice.
92 base::android::ScopedJavaGlobalRef<jobject> j_device_; 102 base::android::ScopedJavaGlobalRef<jobject> j_device_;
93 103
94 bool gatt_connected_ = false; 104 bool gatt_connected_ = false;
95 105
96 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceAndroid); 106 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceAndroid);
97 }; 107 };
98 108
99 } // namespace device 109 } // namespace device
100 110
101 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_ 111 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device.cc ('k') | device/bluetooth/bluetooth_device_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698