| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright 2017 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. | 
|  | 4 #ifndef DEVICE_BLUETOOTH_TEST_FAKE_PERIPHERAL_H_ | 
|  | 5 #define DEVICE_BLUETOOTH_TEST_FAKE_PERIPHERAL_H_ | 
|  | 6 | 
|  | 7 #include <string> | 
|  | 8 | 
|  | 9 #include "base/compiler_specific.h" | 
|  | 10 #include "base/macros.h" | 
|  | 11 #include "base/optional.h" | 
|  | 12 #include "device/bluetooth/bluetooth_device.h" | 
|  | 13 #include "device/bluetooth/test/fake_central.h" | 
|  | 14 | 
|  | 15 namespace bluetooth { | 
|  | 16 | 
|  | 17 // Implements device::BluetoothDevice. Meant to be used by FakeCentral | 
|  | 18 // to keep track of the peripheral's state and attributes. | 
|  | 19 class FakePeripheral : public device::BluetoothDevice { | 
|  | 20  public: | 
|  | 21   FakePeripheral(FakeCentral* fake_central, const std::string& address); | 
|  | 22   ~FakePeripheral() override; | 
|  | 23 | 
|  | 24   // Changes the name of the device. | 
|  | 25   void SetName(base::Optional<std::string> name); | 
|  | 26 | 
|  | 27   // Set it to indicate if the Peripheral is connected or not. | 
|  | 28   void SetGattConnected(bool gatt_connected); | 
|  | 29 | 
|  | 30   // BluetoothDevice overrides: | 
|  | 31   uint32_t GetBluetoothClass() const override; | 
|  | 32 #if defined(OS_CHROMEOS) || defined(OS_LINUX) | 
|  | 33   device::BluetoothTransport GetType() const override; | 
|  | 34 #endif | 
|  | 35   std::string GetIdentifier() const override; | 
|  | 36   std::string GetAddress() const override; | 
|  | 37   VendorIDSource GetVendorIDSource() const override; | 
|  | 38   uint16_t GetVendorID() const override; | 
|  | 39   uint16_t GetProductID() const override; | 
|  | 40   uint16_t GetDeviceID() const override; | 
|  | 41   uint16_t GetAppearance() const override; | 
|  | 42   base::Optional<std::string> GetName() const override; | 
|  | 43   base::string16 GetNameForDisplay() const override; | 
|  | 44   bool IsPaired() const override; | 
|  | 45   bool IsConnected() const override; | 
|  | 46   bool IsGattConnected() const override; | 
|  | 47   bool IsConnectable() const override; | 
|  | 48   bool IsConnecting() const override; | 
|  | 49   UUIDSet GetUUIDs() const override; | 
|  | 50   bool ExpectingPinCode() const override; | 
|  | 51   bool ExpectingPasskey() const override; | 
|  | 52   bool ExpectingConfirmation() const override; | 
|  | 53   void GetConnectionInfo(const ConnectionInfoCallback& callback) override; | 
|  | 54   void Connect(PairingDelegate* pairing_delegate, | 
|  | 55                const base::Closure& callback, | 
|  | 56                const ConnectErrorCallback& error_callback) override; | 
|  | 57   void SetPinCode(const std::string& pincode) override; | 
|  | 58   void SetPasskey(uint32_t passkey) override; | 
|  | 59   void ConfirmPairing() override; | 
|  | 60   void RejectPairing() override; | 
|  | 61   void CancelPairing() override; | 
|  | 62   void Disconnect(const base::Closure& callback, | 
|  | 63                   const ErrorCallback& error_callback) override; | 
|  | 64   void Forget(const base::Closure& callback, | 
|  | 65               const ErrorCallback& error_callback) override; | 
|  | 66   void ConnectToService( | 
|  | 67       const device::BluetoothUUID& uuid, | 
|  | 68       const ConnectToServiceCallback& callback, | 
|  | 69       const ConnectToServiceErrorCallback& error_callback) override; | 
|  | 70   void ConnectToServiceInsecurely( | 
|  | 71       const device::BluetoothUUID& uuid, | 
|  | 72       const ConnectToServiceCallback& callback, | 
|  | 73       const ConnectToServiceErrorCallback& error_callback) override; | 
|  | 74 | 
|  | 75  protected: | 
|  | 76   void CreateGattConnectionImpl() override; | 
|  | 77   void DisconnectGatt() override; | 
|  | 78 | 
|  | 79  private: | 
|  | 80   const std::string address_; | 
|  | 81   base::Optional<std::string> name_; | 
|  | 82   bool gatt_connected_; | 
|  | 83 | 
|  | 84   DISALLOW_COPY_AND_ASSIGN(FakePeripheral); | 
|  | 85 }; | 
|  | 86 | 
|  | 87 }  // namespace bluetooth | 
|  | 88 | 
|  | 89 #endif  // DEVICE_BLUETOOTH_TEST_FAKE_PERIPHERAL_H_ | 
| OLD | NEW | 
|---|