Revert of Roll src/third_party/WebKit e0eac24:489c548 (svn 193311:193320) (patchset...
[chromium-blink-merge.git] / chromeos / dbus / fake_bluetooth_gatt_characteristic_service_provider.h
blob8a8440ba13cf6a8883682f90cfb5f3702f9083a9
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_CHARACTERISTIC_SERVICE_PROVIDER_H_
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
8 #include <string>
9 #include <vector>
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h"
13 #include "dbus/object_path.h"
15 namespace chromeos {
17 // FakeBluetoothGattCharacteristicServiceProvider simulates behavior of a local
18 // GATT characteristic object and is used both in test cases in place of a mock
19 // and on the Linux desktop.
20 class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicServiceProvider
21 : public BluetoothGattCharacteristicServiceProvider {
22 public:
23 FakeBluetoothGattCharacteristicServiceProvider(
24 const dbus::ObjectPath& object_path,
25 Delegate* delegate,
26 const std::string& uuid,
27 const std::vector<std::string>& flags,
28 const std::vector<std::string>& permissions,
29 const dbus::ObjectPath& service_path);
30 ~FakeBluetoothGattCharacteristicServiceProvider() override;
32 // BluetoothGattCharacteristicServiceProvider override.
33 void SendValueChanged(const std::vector<uint8>& value) override;
35 // Methods to simulate value get/set requests issued from a remote device. The
36 // methods do nothing, if the associated service was not registered with the
37 // GATT manager.
38 void GetValue(const Delegate::ValueCallback& callback,
39 const Delegate::ErrorCallback& error_callback);
40 void SetValue(const std::vector<uint8>& value,
41 const base::Closure& callback,
42 const Delegate::ErrorCallback& error_callback);
44 const dbus::ObjectPath& object_path() const { return object_path_; }
45 const std::string& uuid() const { return uuid_; }
46 const dbus::ObjectPath& service_path() const { return service_path_; }
48 private:
49 // D-Bus object path of the fake GATT characteristic.
50 dbus::ObjectPath object_path_;
52 // 128-bit GATT characteristic UUID.
53 std::string uuid_;
55 // Object path of the service that this characteristic belongs to.
56 dbus::ObjectPath service_path_;
58 // The delegate that method calls are passed on to.
59 Delegate* delegate_;
61 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattCharacteristicServiceProvider);
64 } // namespace chromeos
66 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_