Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chromeos / dbus / fake_bluetooth_gatt_descriptor_service_provider.h
blobe9099b91371f4d311dd6786a09227cbed3a22b08
1 // Copyright 2014 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 CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
8 #include <string>
9 #include <vector>
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/bluetooth_gatt_descriptor_service_provider.h"
13 #include "dbus/object_path.h"
15 namespace chromeos {
17 // FakeBluetoothGattDescriptorServiceProvider simulates behavior of a local
18 // GATT descriptor object and is used both in test cases in place of a mock
19 // and on the Linux desktop.
20 class CHROMEOS_EXPORT FakeBluetoothGattDescriptorServiceProvider
21 : public BluetoothGattDescriptorServiceProvider {
22 public:
23 FakeBluetoothGattDescriptorServiceProvider(
24 const dbus::ObjectPath& object_path,
25 Delegate* delegate,
26 const std::string& uuid,
27 const std::vector<std::string>& permissions,
28 const dbus::ObjectPath& characteristic_path);
29 ~FakeBluetoothGattDescriptorServiceProvider() override;
31 // BluetoothGattDescriptorServiceProvider override.
32 void SendValueChanged(const std::vector<uint8>& value) override;
34 // Methods to simulate value get/set requests issued from a remote device. The
35 // methods do nothing, if the associated service was not registered with the
36 // GATT manager.
37 void GetValue(const Delegate::ValueCallback& callback,
38 const Delegate::ErrorCallback& error_callback);
39 void SetValue(const std::vector<uint8>& value,
40 const base::Closure& callback,
41 const Delegate::ErrorCallback& error_callback);
43 const dbus::ObjectPath& object_path() const { return object_path_; }
44 const std::string& uuid() const { return uuid_; }
45 const dbus::ObjectPath& characteristic_path() const {
46 return characteristic_path_;
49 private:
50 // D-Bus object path of the fake GATT descriptor.
51 dbus::ObjectPath object_path_;
53 // 128-bit GATT descriptor UUID.
54 std::string uuid_;
56 // Object path of the characteristic that this descriptor belongs to.
57 dbus::ObjectPath characteristic_path_;
59 // The delegate that method calls are passed on to.
60 Delegate* delegate_;
62 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorServiceProvider);
65 } // namespace chromeos
67 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_