| 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/bluetooth_device_android.h" | 5 #include "device/bluetooth/bluetooth_device_android.h" |
| 6 | 6 |
| 7 #include "base/android/context_utils.h" | 7 #include "base/android/context_utils.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // static | 43 // static |
| 44 bool BluetoothDeviceAndroid::RegisterJNI(JNIEnv* env) { | 44 bool BluetoothDeviceAndroid::RegisterJNI(JNIEnv* env) { |
| 45 return RegisterNativesImpl(env); // Generated in ChromeBluetoothDevice_jni.h | 45 return RegisterNativesImpl(env); // Generated in ChromeBluetoothDevice_jni.h |
| 46 } | 46 } |
| 47 | 47 |
| 48 base::android::ScopedJavaLocalRef<jobject> | 48 base::android::ScopedJavaLocalRef<jobject> |
| 49 BluetoothDeviceAndroid::GetJavaObject() { | 49 BluetoothDeviceAndroid::GetJavaObject() { |
| 50 return base::android::ScopedJavaLocalRef<jobject>(j_device_); | 50 return base::android::ScopedJavaLocalRef<jobject>(j_device_); |
| 51 } | 51 } |
| 52 | 52 |
| 53 uint32 BluetoothDeviceAndroid::GetBluetoothClass() const { | 53 uint32_t BluetoothDeviceAndroid::GetBluetoothClass() const { |
| 54 return Java_ChromeBluetoothDevice_getBluetoothClass(AttachCurrentThread(), | 54 return Java_ChromeBluetoothDevice_getBluetoothClass(AttachCurrentThread(), |
| 55 j_device_.obj()); | 55 j_device_.obj()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 std::string BluetoothDeviceAndroid::GetAddress() const { | 58 std::string BluetoothDeviceAndroid::GetAddress() const { |
| 59 return ConvertJavaStringToUTF8(Java_ChromeBluetoothDevice_getAddress( | 59 return ConvertJavaStringToUTF8(Java_ChromeBluetoothDevice_getAddress( |
| 60 AttachCurrentThread(), j_device_.obj())); | 60 AttachCurrentThread(), j_device_.obj())); |
| 61 } | 61 } |
| 62 | 62 |
| 63 BluetoothDevice::VendorIDSource BluetoothDeviceAndroid::GetVendorIDSource() | 63 BluetoothDevice::VendorIDSource BluetoothDeviceAndroid::GetVendorIDSource() |
| 64 const { | 64 const { |
| 65 // Android API does not provide Vendor ID. | 65 // Android API does not provide Vendor ID. |
| 66 return VENDOR_ID_UNKNOWN; | 66 return VENDOR_ID_UNKNOWN; |
| 67 } | 67 } |
| 68 | 68 |
| 69 uint16 BluetoothDeviceAndroid::GetVendorID() const { | 69 uint16_t BluetoothDeviceAndroid::GetVendorID() const { |
| 70 // Android API does not provide Vendor ID. | 70 // Android API does not provide Vendor ID. |
| 71 return 0; | 71 return 0; |
| 72 } | 72 } |
| 73 | 73 |
| 74 uint16 BluetoothDeviceAndroid::GetProductID() const { | 74 uint16_t BluetoothDeviceAndroid::GetProductID() const { |
| 75 // Android API does not provide Product ID. | 75 // Android API does not provide Product ID. |
| 76 return 0; | 76 return 0; |
| 77 } | 77 } |
| 78 | 78 |
| 79 uint16 BluetoothDeviceAndroid::GetDeviceID() const { | 79 uint16_t BluetoothDeviceAndroid::GetDeviceID() const { |
| 80 // Android API does not provide Device ID. | 80 // Android API does not provide Device ID. |
| 81 return 0; | 81 return 0; |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool BluetoothDeviceAndroid::IsPaired() const { | 84 bool BluetoothDeviceAndroid::IsPaired() const { |
| 85 return Java_ChromeBluetoothDevice_isPaired(AttachCurrentThread(), | 85 return Java_ChromeBluetoothDevice_isPaired(AttachCurrentThread(), |
| 86 j_device_.obj()); | 86 j_device_.obj()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool BluetoothDeviceAndroid::IsConnected() const { | 89 bool BluetoothDeviceAndroid::IsConnected() const { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 111 env, Java_ChromeBluetoothDevice_getUuids(env, j_device_.obj()).obj(), | 111 env, Java_ChromeBluetoothDevice_getUuids(env, j_device_.obj()).obj(), |
| 112 &uuid_strings); | 112 &uuid_strings); |
| 113 BluetoothDevice::UUIDList uuids; | 113 BluetoothDevice::UUIDList uuids; |
| 114 uuids.reserve(uuid_strings.size()); | 114 uuids.reserve(uuid_strings.size()); |
| 115 for (auto uuid_string : uuid_strings) { | 115 for (auto uuid_string : uuid_strings) { |
| 116 uuids.push_back(BluetoothUUID(uuid_string)); | 116 uuids.push_back(BluetoothUUID(uuid_string)); |
| 117 } | 117 } |
| 118 return uuids; | 118 return uuids; |
| 119 } | 119 } |
| 120 | 120 |
| 121 int16 BluetoothDeviceAndroid::GetInquiryRSSI() const { | 121 int16_t BluetoothDeviceAndroid::GetInquiryRSSI() const { |
| 122 NOTIMPLEMENTED(); | 122 NOTIMPLEMENTED(); |
| 123 return kUnknownPower; | 123 return kUnknownPower; |
| 124 } | 124 } |
| 125 | 125 |
| 126 int16 BluetoothDeviceAndroid::GetInquiryTxPower() const { | 126 int16_t BluetoothDeviceAndroid::GetInquiryTxPower() const { |
| 127 NOTIMPLEMENTED(); | 127 NOTIMPLEMENTED(); |
| 128 return kUnknownPower; | 128 return kUnknownPower; |
| 129 } | 129 } |
| 130 | 130 |
| 131 bool BluetoothDeviceAndroid::ExpectingPinCode() const { | 131 bool BluetoothDeviceAndroid::ExpectingPinCode() const { |
| 132 NOTIMPLEMENTED(); | 132 NOTIMPLEMENTED(); |
| 133 return false; | 133 return false; |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool BluetoothDeviceAndroid::ExpectingPasskey() const { | 136 bool BluetoothDeviceAndroid::ExpectingPasskey() const { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 153 PairingDelegate* pairing_delegate, | 153 PairingDelegate* pairing_delegate, |
| 154 const base::Closure& callback, | 154 const base::Closure& callback, |
| 155 const ConnectErrorCallback& error_callback) { | 155 const ConnectErrorCallback& error_callback) { |
| 156 NOTIMPLEMENTED(); | 156 NOTIMPLEMENTED(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void BluetoothDeviceAndroid::SetPinCode(const std::string& pincode) { | 159 void BluetoothDeviceAndroid::SetPinCode(const std::string& pincode) { |
| 160 NOTIMPLEMENTED(); | 160 NOTIMPLEMENTED(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void BluetoothDeviceAndroid::SetPasskey(uint32 passkey) { | 163 void BluetoothDeviceAndroid::SetPasskey(uint32_t passkey) { |
| 164 NOTIMPLEMENTED(); | 164 NOTIMPLEMENTED(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void BluetoothDeviceAndroid::ConfirmPairing() { | 167 void BluetoothDeviceAndroid::ConfirmPairing() { |
| 168 NOTIMPLEMENTED(); | 168 NOTIMPLEMENTED(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void BluetoothDeviceAndroid::RejectPairing() { | 171 void BluetoothDeviceAndroid::RejectPairing() { |
| 172 NOTIMPLEMENTED(); | 172 NOTIMPLEMENTED(); |
| 173 } | 173 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 AttachCurrentThread(), j_device_.obj(), | 268 AttachCurrentThread(), j_device_.obj(), |
| 269 base::android::GetApplicationContext()); | 269 base::android::GetApplicationContext()); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void BluetoothDeviceAndroid::DisconnectGatt() { | 272 void BluetoothDeviceAndroid::DisconnectGatt() { |
| 273 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(), | 273 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(), |
| 274 j_device_.obj()); | 274 j_device_.obj()); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace device | 277 } // namespace device |
| OLD | NEW |