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

Unified Diff: device/bluetooth/bluetooth_device_mac.mm

Issue 735893002: Add GetConnectionInfo function for BluetoothDevice, replacing the existing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile errors on other platforms Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_device_mac.h ('k') | device/bluetooth/bluetooth_device_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device_mac.mm
diff --git a/device/bluetooth/bluetooth_device_mac.mm b/device/bluetooth/bluetooth_device_mac.mm
index 4aad7cf8032c392e9a8c2870b4e885c1a17d7496..536d8d7f8fd53b12ada50fe93138979f57918bfb 100644
--- a/device/bluetooth/bluetooth_device_mac.mm
+++ b/device/bluetooth/bluetooth_device_mac.mm
@@ -93,30 +93,6 @@ uint16 BluetoothDeviceMac::GetDeviceID() const {
return 0;
}
-int BluetoothDeviceMac::GetRSSI() const {
- if (![device_ isConnected]) {
- NOTIMPLEMENTED();
- return kUnknownPower;
- }
-
- int rssi = [device_ rawRSSI];
-
- // The API guarantees that +127 is returned in case the RSSI is not readable:
- // http://goo.gl/bpURYv
- if (rssi == 127)
- return kUnknownPower;
-
- return rssi;
-}
-
-int BluetoothDeviceMac::GetCurrentHostTransmitPower() const {
- return GetHostTransmitPower(kReadCurrentTransmitPowerLevel);
-}
-
-int BluetoothDeviceMac::GetMaximumHostTransmitPower() const {
- return GetHostTransmitPower(kReadMaximumTransmitPowerLevel);
-}
-
bool BluetoothDeviceMac::IsPaired() const {
return [device_ isPaired];
}
@@ -164,6 +140,28 @@ bool BluetoothDeviceMac::ExpectingConfirmation() const {
return false;
}
+void BluetoothDeviceMac::GetConnectionInfo(
+ const ConnectionInfoCallback& callback) {
+ ConnectionInfo connection_info;
+ if (![device_ isConnected]) {
+ callback.Run(connection_info);
+ return;
+ }
+
+ connection_info.rssi = [device_ rawRSSI];
+ // The API guarantees that +127 is returned in case the RSSI is not readable:
+ // http://goo.gl/bpURYv
+ if (connection_info.rssi == 127)
+ connection_info.rssi = kUnknownPower;
+
+ connection_info.transmit_power =
+ GetHostTransmitPower(kReadCurrentTransmitPowerLevel);
+ connection_info.max_transmit_power =
+ GetHostTransmitPower(kReadMaximumTransmitPowerLevel);
+
+ callback.Run(connection_info);
+}
+
void BluetoothDeviceMac::Connect(
PairingDelegate* pairing_delegate,
const base::Closure& callback,
@@ -223,12 +221,6 @@ void BluetoothDeviceMac::CreateGattConnection(
error_callback.Run(ERROR_UNSUPPORTED_DEVICE);
}
-void BluetoothDeviceMac::StartConnectionMonitor(
- const base::Closure& callback,
- const ErrorCallback& error_callback) {
- NOTIMPLEMENTED();
-}
-
NSDate* BluetoothDeviceMac::GetLastInquiryUpdate() {
return [device_ getLastInquiryUpdate];
}
« no previous file with comments | « device/bluetooth/bluetooth_device_mac.h ('k') | device/bluetooth/bluetooth_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698