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

Side by Side Diff: device/bluetooth/test/fake_peripheral.h

Issue 2867713008: bluetooth: Implement known_service_uuids for Peripherals. (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « device/bluetooth/test/fake_central.cc ('k') | device/bluetooth/test/fake_peripheral.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 #ifndef DEVICE_BLUETOOTH_TEST_FAKE_PERIPHERAL_H_ 4 #ifndef DEVICE_BLUETOOTH_TEST_FAKE_PERIPHERAL_H_
5 #define DEVICE_BLUETOOTH_TEST_FAKE_PERIPHERAL_H_ 5 #define DEVICE_BLUETOOTH_TEST_FAKE_PERIPHERAL_H_
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/optional.h" 11 #include "base/optional.h"
12 #include "device/bluetooth/bluetooth_device.h" 12 #include "device/bluetooth/bluetooth_device.h"
13 #include "device/bluetooth/test/fake_central.h" 13 #include "device/bluetooth/test/fake_central.h"
14 14
15 namespace bluetooth { 15 namespace bluetooth {
16 16
17 // Implements device::BluetoothDevice. Meant to be used by FakeCentral 17 // Implements device::BluetoothDevice. Meant to be used by FakeCentral
18 // to keep track of the peripheral's state and attributes. 18 // to keep track of the peripheral's state and attributes.
19 class FakePeripheral : public device::BluetoothDevice { 19 class FakePeripheral : public device::BluetoothDevice {
20 public: 20 public:
21 FakePeripheral(FakeCentral* fake_central, const std::string& address); 21 FakePeripheral(FakeCentral* fake_central, const std::string& address);
22 ~FakePeripheral() override; 22 ~FakePeripheral() override;
23 23
24 // Changes the name of the device. 24 // Changes the name of the device.
25 void SetName(base::Optional<std::string> name); 25 void SetName(base::Optional<std::string> name);
26 26
27 // Set it to indicate if the Peripheral is connected or not. 27 // Set it to indicate if the Peripheral is connected or not.
28 void SetGattConnected(bool gatt_connected); 28 void SetGattConnected(bool gatt_connected);
29 29
30 // Updates the peripheral's UUIDs that are returned by
31 // BluetoothDevice::GetUUIDs().
32 void SetServiceUUIDs(UUIDSet service_uuids);
33
30 // BluetoothDevice overrides: 34 // BluetoothDevice overrides:
31 uint32_t GetBluetoothClass() const override; 35 uint32_t GetBluetoothClass() const override;
32 #if defined(OS_CHROMEOS) || defined(OS_LINUX) 36 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
33 device::BluetoothTransport GetType() const override; 37 device::BluetoothTransport GetType() const override;
34 #endif 38 #endif
35 std::string GetIdentifier() const override; 39 std::string GetIdentifier() const override;
36 std::string GetAddress() const override; 40 std::string GetAddress() const override;
37 VendorIDSource GetVendorIDSource() const override; 41 VendorIDSource GetVendorIDSource() const override;
38 uint16_t GetVendorID() const override; 42 uint16_t GetVendorID() const override;
39 uint16_t GetProductID() const override; 43 uint16_t GetProductID() const override;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 const ConnectToServiceErrorCallback& error_callback) override; 77 const ConnectToServiceErrorCallback& error_callback) override;
74 78
75 protected: 79 protected:
76 void CreateGattConnectionImpl() override; 80 void CreateGattConnectionImpl() override;
77 void DisconnectGatt() override; 81 void DisconnectGatt() override;
78 82
79 private: 83 private:
80 const std::string address_; 84 const std::string address_;
81 base::Optional<std::string> name_; 85 base::Optional<std::string> name_;
82 bool gatt_connected_; 86 bool gatt_connected_;
87 UUIDSet service_uuids_;
83 88
84 DISALLOW_COPY_AND_ASSIGN(FakePeripheral); 89 DISALLOW_COPY_AND_ASSIGN(FakePeripheral);
85 }; 90 };
86 91
87 } // namespace bluetooth 92 } // namespace bluetooth
88 93
89 #endif // DEVICE_BLUETOOTH_TEST_FAKE_PERIPHERAL_H_ 94 #endif // DEVICE_BLUETOOTH_TEST_FAKE_PERIPHERAL_H_
OLDNEW
« no previous file with comments | « device/bluetooth/test/fake_central.cc ('k') | device/bluetooth/test/fake_peripheral.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698