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

Unified Diff: device/bluetooth/bluetooth_device.h

Issue 1941923002: bluetooth: Return int8_t and use -128 for unknown tx power. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Moar fixes Created 4 years, 8 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
Index: device/bluetooth/bluetooth_device.h
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h
index 2d7f4b96d6991375155559beb44fb2ee72ea7b53..5f55f65a7575f432d9cf12825d11a6368a10b679 100644
--- a/device/bluetooth/bluetooth_device.h
+++ b/device/bluetooth/bluetooth_device.h
@@ -77,18 +77,23 @@ 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 RSSI cannot be read.
scheib 2016/05/04 01:18:37 Helps to cite the location of the Bluetooth spec t
ortuno 2016/05/04 16:44:11 Done. Let me know if you prefer another format.
+ static constexpr int8_t kUnknownRSSI = 127;
+ // The value returned if the TxPower cannot be read.
+ static constexpr int8_t kUnknownTxPower = -128;
+
// 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;
+ int8_t rssi;
+ int8_t transmit_power;
+ int8_t max_transmit_power;
ConnectionInfo();
- ConnectionInfo(int rssi, int transmit_power, int max_transmit_power);
+ ConnectionInfo(int8_t rssi,
+ int8_t transmit_power,
+ int8_t max_transmit_power);
~ConnectionInfo();
};
@@ -284,14 +289,14 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// 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;
+ // this method will return |kUnknownRSSI|.
+ virtual 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;
+ // method will return |kUnknownTxPower|.
+ virtual 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 +333,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 |kUnknownRSSI| and |kUnknownTxPower|.
virtual void GetConnectionInfo(const ConnectionInfoCallback& callback) = 0;
// Initiates a connection to the device, pairing first if necessary.

Powered by Google App Engine
This is Rietveld 408576698