| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_LOW_ENERGY_DEVICE_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
| 7 | 7 |
| 8 #if defined(OS_IOS) | 8 #if defined(OS_IOS) |
| 9 #import <CoreBluetooth/CoreBluetooth.h> | 9 #import <CoreBluetooth/CoreBluetooth.h> |
| 10 #else // !defined(OS_IOS) | 10 #else // !defined(OS_IOS) |
| 11 #import <IOBluetooth/IOBluetooth.h> | 11 #import <IOBluetooth/IOBluetooth.h> |
| 12 #endif // defined(OS_IOS) | 12 #endif // defined(OS_IOS) |
| 13 | 13 |
| 14 #include <stdint.h> |
| 15 |
| 14 #include <set> | 16 #include <set> |
| 15 | 17 |
| 16 #include "base/mac/scoped_nsobject.h" | 18 #include "base/mac/scoped_nsobject.h" |
| 17 #include "base/mac/sdk_forward_declarations.h" | 19 #include "base/mac/sdk_forward_declarations.h" |
| 20 #include "base/macros.h" |
| 21 #include "build/build_config.h" |
| 18 #include "crypto/sha2.h" | 22 #include "crypto/sha2.h" |
| 19 #include "device/bluetooth/bluetooth_device_mac.h" | 23 #include "device/bluetooth/bluetooth_device_mac.h" |
| 20 | 24 |
| 21 namespace device { | 25 namespace device { |
| 22 | 26 |
| 23 class BluetoothAdapterMac; | 27 class BluetoothAdapterMac; |
| 24 class BluetoothLowEnergyDiscoverManagerMac; | 28 class BluetoothLowEnergyDiscoverManagerMac; |
| 25 | 29 |
| 26 class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyDeviceMac | 30 class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyDeviceMac |
| 27 : public BluetoothDeviceMac { | 31 : public BluetoothDeviceMac { |
| 28 public: | 32 public: |
| 29 BluetoothLowEnergyDeviceMac(BluetoothAdapterMac* adapter, | 33 BluetoothLowEnergyDeviceMac(BluetoothAdapterMac* adapter, |
| 30 CBPeripheral* peripheral, | 34 CBPeripheral* peripheral, |
| 31 NSDictionary* advertisement_data, | 35 NSDictionary* advertisement_data, |
| 32 int rssi); | 36 int rssi); |
| 33 ~BluetoothLowEnergyDeviceMac() override; | 37 ~BluetoothLowEnergyDeviceMac() override; |
| 34 | 38 |
| 35 int GetRSSI() const; | 39 int GetRSSI() const; |
| 36 | 40 |
| 37 // BluetoothDevice overrides. | 41 // BluetoothDevice overrides. |
| 38 std::string GetIdentifier() const override; | 42 std::string GetIdentifier() const override; |
| 39 uint32 GetBluetoothClass() const override; | 43 uint32_t GetBluetoothClass() const override; |
| 40 std::string GetAddress() const override; | 44 std::string GetAddress() const override; |
| 41 BluetoothDevice::VendorIDSource GetVendorIDSource() const override; | 45 BluetoothDevice::VendorIDSource GetVendorIDSource() const override; |
| 42 uint16 GetVendorID() const override; | 46 uint16_t GetVendorID() const override; |
| 43 uint16 GetProductID() const override; | 47 uint16_t GetProductID() const override; |
| 44 uint16 GetDeviceID() const override; | 48 uint16_t GetDeviceID() const override; |
| 45 bool IsPaired() const override; | 49 bool IsPaired() const override; |
| 46 bool IsConnected() const override; | 50 bool IsConnected() const override; |
| 47 bool IsGattConnected() const override; | 51 bool IsGattConnected() const override; |
| 48 bool IsConnectable() const override; | 52 bool IsConnectable() const override; |
| 49 bool IsConnecting() const override; | 53 bool IsConnecting() const override; |
| 50 BluetoothDevice::UUIDList GetUUIDs() const override; | 54 BluetoothDevice::UUIDList GetUUIDs() const override; |
| 51 int16 GetInquiryRSSI() const override; | 55 int16_t GetInquiryRSSI() const override; |
| 52 int16 GetInquiryTxPower() const override; | 56 int16_t GetInquiryTxPower() const override; |
| 53 bool ExpectingPinCode() const override; | 57 bool ExpectingPinCode() const override; |
| 54 bool ExpectingPasskey() const override; | 58 bool ExpectingPasskey() const override; |
| 55 bool ExpectingConfirmation() const override; | 59 bool ExpectingConfirmation() const override; |
| 56 void GetConnectionInfo(const ConnectionInfoCallback& callback) override; | 60 void GetConnectionInfo(const ConnectionInfoCallback& callback) override; |
| 57 void Connect(PairingDelegate* pairing_delegate, | 61 void Connect(PairingDelegate* pairing_delegate, |
| 58 const base::Closure& callback, | 62 const base::Closure& callback, |
| 59 const ConnectErrorCallback& error_callback) override; | 63 const ConnectErrorCallback& error_callback) override; |
| 60 void SetPinCode(const std::string& pincode) override; | 64 void SetPinCode(const std::string& pincode) override; |
| 61 void SetPasskey(uint32 passkey) override; | 65 void SetPasskey(uint32_t passkey) override; |
| 62 void ConfirmPairing() override; | 66 void ConfirmPairing() override; |
| 63 void RejectPairing() override; | 67 void RejectPairing() override; |
| 64 void CancelPairing() override; | 68 void CancelPairing() override; |
| 65 void Disconnect(const base::Closure& callback, | 69 void Disconnect(const base::Closure& callback, |
| 66 const ErrorCallback& error_callback) override; | 70 const ErrorCallback& error_callback) override; |
| 67 void Forget(const base::Closure& callback, | 71 void Forget(const base::Closure& callback, |
| 68 const ErrorCallback& error_callback) override; | 72 const ErrorCallback& error_callback) override; |
| 69 void ConnectToService( | 73 void ConnectToService( |
| 70 const BluetoothUUID& uuid, | 74 const BluetoothUUID& uuid, |
| 71 const ConnectToServiceCallback& callback, | 75 const ConnectToServiceCallback& callback, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 132 |
| 129 // The services (identified by UUIDs) that this device provides. | 133 // The services (identified by UUIDs) that this device provides. |
| 130 std::set<BluetoothUUID> advertised_uuids_; | 134 std::set<BluetoothUUID> advertised_uuids_; |
| 131 | 135 |
| 132 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); | 136 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); |
| 133 }; | 137 }; |
| 134 | 138 |
| 135 } // namespace device | 139 } // namespace device |
| 136 | 140 |
| 137 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ | 141 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
| OLD | NEW |