| Index: device/bluetooth/bluetooth_device.h
|
| diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h
|
| index 3c273ffcb775c01c8cb7a66118471e08c03b4778..8b570f826ad45f836d1f028e042220e7a8867dc1 100644
|
| --- a/device/bluetooth/bluetooth_device.h
|
| +++ b/device/bluetooth/bluetooth_device.h
|
| @@ -68,6 +68,22 @@ class BluetoothDevice {
|
| // The value returned if the RSSI or transmit power cannot be read.
|
| static const int kUnknownPower = 127;
|
|
|
| + struct ConnectionInfo {
|
| + int rssi;
|
| + int transmit_power;
|
| + int max_transmit_power;
|
| +
|
| + ConnectionInfo()
|
| + : rssi(kUnknownPower),
|
| + transmit_power(kUnknownPower),
|
| + max_transmit_power(kUnknownPower) {}
|
| +
|
| + ConnectionInfo(int rssi, int transmit_power, int max_transmit_power)
|
| + : rssi(rssi),
|
| + transmit_power(transmit_power),
|
| + max_transmit_power(max_transmit_power) {}
|
| + };
|
| +
|
| // Possible errors passed back to an error callback function in case of a
|
| // failed call to Connect().
|
| enum ConnectErrorCode {
|
| @@ -203,28 +219,6 @@ class BluetoothDevice {
|
| // DEVICE_PERIPHERAL.
|
| DeviceType GetDeviceType() const;
|
|
|
| - // Gets the "received signal strength indication" (RSSI) of the current
|
| - // connection to the device. The RSSI indicates the power present in the
|
| - // received radio signal, measured in dBm, to a resolution of 1dBm. Larger
|
| - // (typically, less negative) values indicate a stronger signal.
|
| - // If the device is not currently connected, then returns the RSSI read from
|
| - // the last inquiry that returned the device, where available. In case of an
|
| - // error, returns |kUnknownPower|. Otherwise, returns the connection's RSSI.
|
| - virtual int GetRSSI() const = 0;
|
| -
|
| - // These two methods are used to read the current or maximum transmit power
|
| - // ("Tx power") of the current connection to the device. The transmit power
|
| - // indicates the strength of the signal broadcast from the host's Bluetooth
|
| - // antenna when communicating with the device, measured in dBm, to a
|
| - // resolution of 1dBm. Larger (typically, less negative) values
|
| - // indicate a stronger signal.
|
| - // It is only meaningful to call this method when there is a connection
|
| - // established to the device. If there is no connection, or in case of an
|
| - // error, returns |kUnknownPower|. Otherwise, returns the connection's
|
| - // transmit power.
|
| - virtual int GetCurrentHostTransmitPower() const = 0;
|
| - virtual int GetMaximumHostTransmitPower() const = 0;
|
| -
|
| // Indicates whether the device is known to support pairing based on its
|
| // device class and address.
|
| bool IsPairable() const;
|
| @@ -269,6 +263,8 @@ class BluetoothDevice {
|
| // In the success case this callback is not called.
|
| typedef base::Callback<void(enum ConnectErrorCode)> ConnectErrorCallback;
|
|
|
| + typedef base::Callback<void(ConnectionInfo)> ConnectionInfoCallback;
|
| +
|
| // Indicates whether the device is currently pairing and expecting a
|
| // PIN Code to be returned.
|
| virtual bool ExpectingPinCode() const = 0;
|
| @@ -281,6 +277,21 @@ class BluetoothDevice {
|
| // confirmation of a displayed passkey.
|
| virtual bool ExpectingConfirmation() const = 0;
|
|
|
| + // Returns the RSSI and TX power of the active connection to the device:
|
| + //
|
| + // The RSSI indicates the power present in the received radio signal, measured
|
| + // in dBm, to a resolution of 1dBm. Larger (typically, less negative) values
|
| + // indicate a stronger signal.
|
| + //
|
| + // The transmit power indicates the strength of the signal broadcast from the
|
| + // host's Bluetooth antenna when communicating with the device, measured in
|
| + // dBm, to a resolution of 1dBm. Larger (typically, less negative) values
|
| + // indicate a stronger signal.
|
| + //
|
| + // If the device isn't connected, then the ConnectionInfo struct passed into
|
| + // the callback will filled by |kUnknownPower|.
|
| + virtual void GetConnectionInfo(const ConnectionInfoCallback& callback) = 0;
|
| +
|
| // Initiates a connection to the device, pairing first if necessary.
|
| //
|
| // Method calls will be made on the supplied object |pairing_delegate|
|
| @@ -384,12 +395,6 @@ class BluetoothDevice {
|
| const GattConnectionCallback& callback,
|
| const ConnectErrorCallback& error_callback) = 0;
|
|
|
| - // Starts monitoring the connection properties, RSSI and TX power. These
|
| - // properties will be tracked, and updated when their values change. Exactly
|
| - // one of |callback| or |error_callback| will be run.
|
| - virtual void StartConnectionMonitor(const base::Closure& callback,
|
| - const ErrorCallback& error_callback) = 0;
|
| -
|
| // Returns the list of discovered GATT services.
|
| virtual std::vector<BluetoothGattService*> GetGattServices() const;
|
|
|
|
|