Revert of "Log force-alt-protocols command line flag usage".
[chromium-blink-merge.git] / device / bluetooth / bluetooth_low_energy_device_mac.h
blobbb5ffca6a89a01316b646f5e317bac04c1d20af7
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_
8 #if defined(OS_IOS)
9 #import <CoreBluetooth/CoreBluetooth.h>
10 #else
11 #import <IOBluetooth/IOBluetooth.h>
12 #endif
14 #include "base/mac/scoped_nsobject.h"
15 #include "base/mac/sdk_forward_declarations.h"
16 #include "device/bluetooth/bluetooth_device.h"
18 namespace device {
20 class BluetoothLowEnergyDiscoverManagerMac;
22 class BluetoothLowEnergyDeviceMac : public BluetoothDevice {
23 public:
24 BluetoothLowEnergyDeviceMac(CBPeripheral* peripheral,
25 NSDictionary* advertisementData,
26 int rssi);
27 ~BluetoothLowEnergyDeviceMac() override;
29 int GetRSSI() const;
31 // BluetoothDevice overrides.
32 std::string GetIdentifier() const override;
33 uint32 GetBluetoothClass() const override;
34 std::string GetAddress() const override;
35 BluetoothDevice::VendorIDSource GetVendorIDSource() const override;
36 uint16 GetVendorID() const override;
37 uint16 GetProductID() const override;
38 uint16 GetDeviceID() const override;
39 bool IsPaired() const override;
40 bool IsConnected() const override;
41 bool IsConnectable() const override;
42 bool IsConnecting() const override;
43 BluetoothDevice::UUIDList GetUUIDs() const override;
44 bool ExpectingPinCode() const override;
45 bool ExpectingPasskey() const override;
46 bool ExpectingConfirmation() const override;
47 void GetConnectionInfo(const ConnectionInfoCallback& callback) override;
48 void Connect(PairingDelegate* pairing_delegate,
49 const base::Closure& callback,
50 const ConnectErrorCallback& error_callback) override;
51 void SetPinCode(const std::string& pincode) override;
52 void SetPasskey(uint32 passkey) override;
53 void ConfirmPairing() override;
54 void RejectPairing() override;
55 void CancelPairing() override;
56 void Disconnect(const base::Closure& callback,
57 const ErrorCallback& error_callback) override;
58 void Forget(const ErrorCallback& error_callback) override;
59 void ConnectToService(
60 const BluetoothUUID& uuid,
61 const ConnectToServiceCallback& callback,
62 const ConnectToServiceErrorCallback& error_callback) override;
63 void ConnectToServiceInsecurely(
64 const device::BluetoothUUID& uuid,
65 const ConnectToServiceCallback& callback,
66 const ConnectToServiceErrorCallback& error_callback) override;
67 void CreateGattConnection(
68 const GattConnectionCallback& callback,
69 const ConnectErrorCallback& error_callback) override;
71 protected:
72 // BluetoothDevice override.
73 std::string GetDeviceName() const override;
75 // Updates information about the device.
76 virtual void Update(CBPeripheral* peripheral,
77 NSDictionary* advertisementData,
78 int rssi);
80 static std::string GetPeripheralIdentifier(CBPeripheral* peripheral);
82 private:
83 friend class BluetoothLowEnergyDiscoveryManagerMac;
85 // CoreBluetooth data structure.
86 base::scoped_nsobject<CBPeripheral> peripheral_;
88 // RSSI value.
89 int rssi_;
91 // Whether the device is connectable.
92 bool connectable_;
94 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac);
97 } // namespace device
99 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_