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

Side by Side Diff: device/bluetooth/bluetooth_device_mac.h

Issue 246603008: Expose device RSSI and Tx power via the chrome.bluetooth API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implemented as a property of the Device object Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_
7 7
8 #import <IOBluetooth/IOBluetooth.h>
9
8 #include <string> 10 #include <string>
9 11
10 #include "base/basictypes.h" 12 #include "base/basictypes.h"
11 #include "base/mac/scoped_nsobject.h" 13 #include "base/mac/scoped_nsobject.h"
12 #include "base/observer_list.h" 14 #include "base/observer_list.h"
13 #include "device/bluetooth/bluetooth_device.h" 15 #include "device/bluetooth/bluetooth_device.h"
14 16
15 @class IOBluetoothDevice; 17 @class IOBluetoothDevice;
16 18
17 namespace device { 19 namespace device {
18 20
19 class BluetoothDeviceMac : public BluetoothDevice { 21 class BluetoothDeviceMac : public BluetoothDevice {
20 public: 22 public:
21 explicit BluetoothDeviceMac(IOBluetoothDevice* device); 23 explicit BluetoothDeviceMac(IOBluetoothDevice* device);
22 virtual ~BluetoothDeviceMac(); 24 virtual ~BluetoothDeviceMac();
23 25
24 // BluetoothDevice override 26 // BluetoothDevice override
25 virtual void AddObserver( 27 virtual void AddObserver(
26 device::BluetoothDevice::Observer* observer) OVERRIDE; 28 device::BluetoothDevice::Observer* observer) OVERRIDE;
27 virtual void RemoveObserver( 29 virtual void RemoveObserver(
28 device::BluetoothDevice::Observer* observer) OVERRIDE; 30 device::BluetoothDevice::Observer* observer) OVERRIDE;
29 virtual uint32 GetBluetoothClass() const OVERRIDE; 31 virtual uint32 GetBluetoothClass() const OVERRIDE;
30 virtual std::string GetAddress() const OVERRIDE; 32 virtual std::string GetAddress() const OVERRIDE;
31 virtual VendorIDSource GetVendorIDSource() const OVERRIDE; 33 virtual VendorIDSource GetVendorIDSource() const OVERRIDE;
32 virtual uint16 GetVendorID() const OVERRIDE; 34 virtual uint16 GetVendorID() const OVERRIDE;
33 virtual uint16 GetProductID() const OVERRIDE; 35 virtual uint16 GetProductID() const OVERRIDE;
34 virtual uint16 GetDeviceID() const OVERRIDE; 36 virtual uint16 GetDeviceID() const OVERRIDE;
37 virtual int GetRSSI() const OVERRIDE;
38 virtual int GetCurrentHostTransmitPower() const OVERRIDE;
39 virtual int GetMaximumHostTransmitPower() const OVERRIDE;
35 virtual bool IsPaired() const OVERRIDE; 40 virtual bool IsPaired() const OVERRIDE;
36 virtual bool IsConnected() const OVERRIDE; 41 virtual bool IsConnected() const OVERRIDE;
37 virtual bool IsConnectable() const OVERRIDE; 42 virtual bool IsConnectable() const OVERRIDE;
38 virtual bool IsConnecting() const OVERRIDE; 43 virtual bool IsConnecting() const OVERRIDE;
39 virtual UUIDList GetUUIDs() const OVERRIDE; 44 virtual UUIDList GetUUIDs() const OVERRIDE;
40 virtual bool ExpectingPinCode() const OVERRIDE; 45 virtual bool ExpectingPinCode() const OVERRIDE;
41 virtual bool ExpectingPasskey() const OVERRIDE; 46 virtual bool ExpectingPasskey() const OVERRIDE;
42 virtual bool ExpectingConfirmation() const OVERRIDE; 47 virtual bool ExpectingConfirmation() const OVERRIDE;
43 virtual void Connect( 48 virtual void Connect(
44 PairingDelegate* pairing_delegate, 49 PairingDelegate* pairing_delegate,
(...skipping 20 matching lines...) Expand all
65 const base::Closure& callback, 70 const base::Closure& callback,
66 const ErrorCallback& error_callback) OVERRIDE; 71 const ErrorCallback& error_callback) OVERRIDE;
67 72
68 protected: 73 protected:
69 // BluetoothDevice override 74 // BluetoothDevice override
70 virtual std::string GetDeviceName() const OVERRIDE; 75 virtual std::string GetDeviceName() const OVERRIDE;
71 76
72 private: 77 private:
73 friend class BluetoothAdapterMac; 78 friend class BluetoothAdapterMac;
74 79
80 // Implementation to read the host's transmit power level of type
81 // |power_level_type|.
82 int GetHostTransmitPower(
83 BluetoothHCITransmitPowerLevelType power_level_type) const;
84
75 // List of observers interested in event notifications from us. 85 // List of observers interested in event notifications from us.
76 ObserverList<Observer> observers_; 86 ObserverList<Observer> observers_;
77 87
78 base::scoped_nsobject<IOBluetoothDevice> device_; 88 base::scoped_nsobject<IOBluetoothDevice> device_;
79 89
80 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac); 90 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac);
81 }; 91 };
82 92
83 } // namespace device 93 } // namespace device
84 94
85 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ 95 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698