Roll src/third_party/skia d32087a:1052f51
[chromium-blink-merge.git] / device / bluetooth / bluetooth_device_android.h
blob1e608f1df9f42cc6821bfc96e7edb5b0e1b04625
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
3 // found in the LICENSE file.
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_
8 #include "base/android/jni_android.h"
9 #include "base/memory/weak_ptr.h"
10 #include "device/bluetooth/bluetooth_device.h"
12 namespace device {
14 class BluetoothAdapterAndroid;
16 // BluetoothDeviceAndroid along with the Java class
17 // org.chromium.device.bluetooth.ChromeBluetoothDevice implement
18 // BluetoothDevice.
19 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceAndroid final
20 : public BluetoothDevice {
21 public:
22 // Create a BluetoothDeviceAndroid instance and associated Java
23 // ChromeBluetoothDevice using the provided |java_bluetooth_device_wrapper|.
25 // The ChromeBluetoothDevice instance will hold a Java reference
26 // to |bluetooth_device_wrapper|.
28 // TODO(scheib): Return a scoped_ptr<>, but then adapter will need to handle
29 // this correctly. http://crbug.com/506416
30 static BluetoothDeviceAndroid* Create(
31 BluetoothAdapterAndroid* adapter,
32 jobject bluetooth_device_wrapper); // Java Type: bluetoothDeviceWrapper
34 ~BluetoothDeviceAndroid() override;
36 // Register C++ methods exposed to Java using JNI.
37 static bool RegisterJNI(JNIEnv* env);
39 // Updates cached copy of advertised UUIDs discovered during a scan.
40 // Returns true if new UUIDs differed from cached values.
41 bool UpdateAdvertisedUUIDs(
42 jobject advertised_uuids); // Java Type: List<ParcelUuid>
44 // BluetoothDevice:
45 uint32 GetBluetoothClass() const override;
46 std::string GetAddress() const override;
47 VendorIDSource GetVendorIDSource() const override;
48 uint16 GetVendorID() const override;
49 uint16 GetProductID() const override;
50 uint16 GetDeviceID() const override;
51 bool IsPaired() const override;
52 bool IsConnected() const override;
53 bool IsConnectable() const override;
54 bool IsConnecting() const override;
55 UUIDList GetUUIDs() const override;
56 int16 GetInquiryRSSI() const override;
57 int16 GetInquiryTxPower() const override;
58 bool ExpectingPinCode() const override;
59 bool ExpectingPasskey() const override;
60 bool ExpectingConfirmation() const override;
61 void GetConnectionInfo(const ConnectionInfoCallback& callback) override;
62 void Connect(device::BluetoothDevice::PairingDelegate* pairing_delegate,
63 const base::Closure& callback,
64 const ConnectErrorCallback& error_callback) override;
65 void SetPinCode(const std::string& pincode) override;
66 void SetPasskey(uint32 passkey) override;
67 void ConfirmPairing() override;
68 void RejectPairing() override;
69 void CancelPairing() override;
70 void Disconnect(const base::Closure& callback,
71 const ErrorCallback& error_callback) override;
72 void Forget(const ErrorCallback& error_callback) override;
73 void ConnectToService(
74 const device::BluetoothUUID& uuid,
75 const ConnectToServiceCallback& callback,
76 const ConnectToServiceErrorCallback& error_callback) override;
77 void ConnectToServiceInsecurely(
78 const device::BluetoothUUID& uuid,
79 const ConnectToServiceCallback& callback,
80 const ConnectToServiceErrorCallback& error_callback) override;
81 void CreateGattConnection(
82 const GattConnectionCallback& callback,
83 const ConnectErrorCallback& error_callback) override;
85 protected:
86 BluetoothDeviceAndroid(BluetoothAdapterAndroid* adapter);
88 // BluetoothDevice:
89 std::string GetDeviceName() const override;
91 // Java object org.chromium.device.bluetooth.ChromeBluetoothDevice.
92 base::android::ScopedJavaGlobalRef<jobject> j_device_;
94 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceAndroid);
97 } // namespace device
99 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_