Index: device/bluetooth/bluetooth_device.h |
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h |
index 2d7f4b96d6991375155559beb44fb2ee72ea7b53..92513ce6eee42a73a176ab52c8a1650059735427 100644 |
--- a/device/bluetooth/bluetooth_device.h |
+++ b/device/bluetooth/bluetooth_device.h |
@@ -17,6 +17,7 @@ |
#include "base/containers/scoped_ptr_hash_map.h" |
#include "base/gtest_prod_util.h" |
#include "base/memory/ref_counted.h" |
+#include "base/optional.h" |
#include "base/strings/string16.h" |
#include "device/bluetooth/bluetooth_export.h" |
#include "device/bluetooth/bluetooth_uuid.h" |
@@ -77,18 +78,18 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice { |
DEVICE_KEYBOARD_MOUSE_COMBO |
}; |
- // The value returned if the RSSI or transmit power cannot be read. |
- static const int kUnknownPower = 127; |
// The value returned if the appearance is not present. |
static const uint16_t kAppearanceNotPresent = 0xffc0; |
struct DEVICE_BLUETOOTH_EXPORT ConnectionInfo { |
- int rssi; |
- int transmit_power; |
- int max_transmit_power; |
+ base::Optional<int8_t> rssi; |
+ base::Optional<int8_t> transmit_power; |
+ base::Optional<int8_t> max_transmit_power; |
ConnectionInfo(); |
- ConnectionInfo(int rssi, int transmit_power, int max_transmit_power); |
+ ConnectionInfo(const base::Optional<int8_t>& rssi, |
+ const base::Optional<int8_t>& transmit_power, |
+ const base::Optional<int8_t>& max_transmit_power); |
~ConnectionInfo(); |
}; |
@@ -283,15 +284,15 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice { |
virtual UUIDList GetUUIDs() const = 0; |
// The received signal strength, in dBm. This field is avaliable and valid |
- // only during discovery. If not during discovery, or RSSI wasn't reported, |
- // this method will return |kUnknownPower|. |
- virtual int16_t GetInquiryRSSI() const = 0; |
+ // only during discovery. If not during discovery, or RSSI wasn't reported |
+ // this value will be absent. |
+ virtual base::Optional<int8_t> GetInquiryRSSI() const = 0; |
// The transmitted power level. This field is avaliable only for LE devices |
// that include this field in AD. It is avaliable and valid only during |
// discovery. If not during discovery, or TxPower wasn't reported, this |
- // method will return |kUnknownPower|. |
- virtual int16_t GetInquiryTxPower() const = 0; |
+ // value will be absent. |
+ virtual base::Optional<int8_t> GetInquiryTxPower() const = 0; |
// The ErrorCallback is used for methods that can fail in which case it |
// is called, in the success case the callback is simply not called. |
@@ -328,7 +329,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice { |
// indicate a stronger signal. |
// |
// If the device isn't connected, then the ConnectionInfo struct passed into |
- // the callback will be populated with |kUnknownPower|. |
+ // the callback will be populated with absent values. |
virtual void GetConnectionInfo(const ConnectionInfoCallback& callback) = 0; |
// Initiates a connection to the device, pairing first if necessary. |