| 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 #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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // BluetoothDevice: | 44 // BluetoothDevice: |
| 45 uint32 GetBluetoothClass() const override; | 45 uint32 GetBluetoothClass() const override; |
| 46 std::string GetAddress() const override; | 46 std::string GetAddress() const override; |
| 47 VendorIDSource GetVendorIDSource() const override; | 47 VendorIDSource GetVendorIDSource() const override; |
| 48 uint16 GetVendorID() const override; | 48 uint16 GetVendorID() const override; |
| 49 uint16 GetProductID() const override; | 49 uint16 GetProductID() const override; |
| 50 uint16 GetDeviceID() const override; | 50 uint16 GetDeviceID() const override; |
| 51 bool IsPaired() const override; | 51 bool IsPaired() const override; |
| 52 bool IsConnected() const override; | 52 bool IsConnected() const override; |
| 53 bool IsGattConnected() const override; |
| 53 bool IsConnectable() const override; | 54 bool IsConnectable() const override; |
| 54 bool IsConnecting() const override; | 55 bool IsConnecting() const override; |
| 55 UUIDList GetUUIDs() const override; | 56 UUIDList GetUUIDs() const override; |
| 56 int16 GetInquiryRSSI() const override; | 57 int16 GetInquiryRSSI() const override; |
| 57 int16 GetInquiryTxPower() const override; | 58 int16 GetInquiryTxPower() const override; |
| 58 bool ExpectingPinCode() const override; | 59 bool ExpectingPinCode() const override; |
| 59 bool ExpectingPasskey() const override; | 60 bool ExpectingPasskey() const override; |
| 60 bool ExpectingConfirmation() const override; | 61 bool ExpectingConfirmation() const override; |
| 61 void GetConnectionInfo(const ConnectionInfoCallback& callback) override; | 62 void GetConnectionInfo(const ConnectionInfoCallback& callback) override; |
| 62 void Connect(device::BluetoothDevice::PairingDelegate* pairing_delegate, | 63 void Connect(device::BluetoothDevice::PairingDelegate* pairing_delegate, |
| 63 const base::Closure& callback, | 64 const base::Closure& callback, |
| 64 const ConnectErrorCallback& error_callback) override; | 65 const ConnectErrorCallback& error_callback) override; |
| 65 void SetPinCode(const std::string& pincode) override; | 66 void SetPinCode(const std::string& pincode) override; |
| 66 void SetPasskey(uint32 passkey) override; | 67 void SetPasskey(uint32 passkey) override; |
| 67 void ConfirmPairing() override; | 68 void ConfirmPairing() override; |
| 68 void RejectPairing() override; | 69 void RejectPairing() override; |
| 69 void CancelPairing() override; | 70 void CancelPairing() override; |
| 70 void Disconnect(const base::Closure& callback, | 71 void Disconnect(const base::Closure& callback, |
| 71 const ErrorCallback& error_callback) override; | 72 const ErrorCallback& error_callback) override; |
| 72 void Forget(const ErrorCallback& error_callback) override; | 73 void Forget(const ErrorCallback& error_callback) override; |
| 73 void ConnectToService( | 74 void ConnectToService( |
| 74 const device::BluetoothUUID& uuid, | 75 const device::BluetoothUUID& uuid, |
| 75 const ConnectToServiceCallback& callback, | 76 const ConnectToServiceCallback& callback, |
| 76 const ConnectToServiceErrorCallback& error_callback) override; | 77 const ConnectToServiceErrorCallback& error_callback) override; |
| 77 void ConnectToServiceInsecurely( | 78 void ConnectToServiceInsecurely( |
| 78 const device::BluetoothUUID& uuid, | 79 const device::BluetoothUUID& uuid, |
| 79 const ConnectToServiceCallback& callback, | 80 const ConnectToServiceCallback& callback, |
| 80 const ConnectToServiceErrorCallback& error_callback) override; | 81 const ConnectToServiceErrorCallback& error_callback) override; |
| 81 void CreateGattConnection( | |
| 82 const GattConnectionCallback& callback, | |
| 83 const ConnectErrorCallback& error_callback) override; | |
| 84 | 82 |
| 85 protected: | 83 protected: |
| 86 BluetoothDeviceAndroid(BluetoothAdapterAndroid* adapter); | 84 BluetoothDeviceAndroid(BluetoothAdapterAndroid* adapter); |
| 87 | 85 |
| 88 // BluetoothDevice: | 86 // BluetoothDevice: |
| 89 std::string GetDeviceName() const override; | 87 std::string GetDeviceName() const override; |
| 88 void CreateGattConnectionImpl() override; |
| 89 void DisconnectGatt() override; |
| 90 | 90 |
| 91 // Java object org.chromium.device.bluetooth.ChromeBluetoothDevice. | 91 // Java object org.chromium.device.bluetooth.ChromeBluetoothDevice. |
| 92 base::android::ScopedJavaGlobalRef<jobject> j_device_; | 92 base::android::ScopedJavaGlobalRef<jobject> j_device_; |
| 93 | 93 |
| 94 bool gatt_connected_ = false; |
| 95 |
| 94 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceAndroid); | 96 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceAndroid); |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 } // namespace device | 99 } // namespace device |
| 98 | 100 |
| 99 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_ | 101 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_ |
| OLD | NEW |