OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDE
R_H_ | 5 #ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDE
R_H_ |
6 #define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDE
R_H_ | 6 #define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDE
R_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "dbus/object_path.h" | 14 #include "dbus/object_path.h" |
13 #include "device/bluetooth/bluetooth_export.h" | 15 #include "device/bluetooth/bluetooth_export.h" |
14 #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h
" | 16 #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h
" |
15 | 17 |
16 namespace bluez { | 18 namespace bluez { |
17 | 19 |
18 // FakeBluetoothGattCharacteristicServiceProvider simulates behavior of a local | 20 // FakeBluetoothGattCharacteristicServiceProvider simulates behavior of a local |
19 // GATT characteristic object and is used both in test cases in place of a mock | 21 // GATT characteristic object and is used both in test cases in place of a mock |
20 // and on the Linux desktop. | 22 // and on the Linux desktop. |
21 class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicServiceProvider | 23 class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicServiceProvider |
22 : public BluetoothGattCharacteristicServiceProvider { | 24 : public BluetoothGattCharacteristicServiceProvider { |
23 public: | 25 public: |
24 FakeBluetoothGattCharacteristicServiceProvider( | 26 FakeBluetoothGattCharacteristicServiceProvider( |
25 const dbus::ObjectPath& object_path, | 27 const dbus::ObjectPath& object_path, |
26 Delegate* delegate, | 28 Delegate* delegate, |
27 const std::string& uuid, | 29 const std::string& uuid, |
28 const std::vector<std::string>& flags, | 30 const std::vector<std::string>& flags, |
29 const std::vector<std::string>& permissions, | 31 const std::vector<std::string>& permissions, |
30 const dbus::ObjectPath& service_path); | 32 const dbus::ObjectPath& service_path); |
31 ~FakeBluetoothGattCharacteristicServiceProvider() override; | 33 ~FakeBluetoothGattCharacteristicServiceProvider() override; |
32 | 34 |
33 // BluetoothGattCharacteristicServiceProvider override. | 35 // BluetoothGattCharacteristicServiceProvider override. |
34 void SendValueChanged(const std::vector<uint8>& value) override; | 36 void SendValueChanged(const std::vector<uint8_t>& value) override; |
35 | 37 |
36 // Methods to simulate value get/set requests issued from a remote device. The | 38 // Methods to simulate value get/set requests issued from a remote device. The |
37 // methods do nothing, if the associated service was not registered with the | 39 // methods do nothing, if the associated service was not registered with the |
38 // GATT manager. | 40 // GATT manager. |
39 void GetValue(const Delegate::ValueCallback& callback, | 41 void GetValue(const Delegate::ValueCallback& callback, |
40 const Delegate::ErrorCallback& error_callback); | 42 const Delegate::ErrorCallback& error_callback); |
41 void SetValue(const std::vector<uint8>& value, | 43 void SetValue(const std::vector<uint8_t>& value, |
42 const base::Closure& callback, | 44 const base::Closure& callback, |
43 const Delegate::ErrorCallback& error_callback); | 45 const Delegate::ErrorCallback& error_callback); |
44 | 46 |
45 const dbus::ObjectPath& object_path() const { return object_path_; } | 47 const dbus::ObjectPath& object_path() const { return object_path_; } |
46 const std::string& uuid() const { return uuid_; } | 48 const std::string& uuid() const { return uuid_; } |
47 const dbus::ObjectPath& service_path() const { return service_path_; } | 49 const dbus::ObjectPath& service_path() const { return service_path_; } |
48 | 50 |
49 private: | 51 private: |
50 // D-Bus object path of the fake GATT characteristic. | 52 // D-Bus object path of the fake GATT characteristic. |
51 dbus::ObjectPath object_path_; | 53 dbus::ObjectPath object_path_; |
52 | 54 |
53 // 128-bit GATT characteristic UUID. | 55 // 128-bit GATT characteristic UUID. |
54 std::string uuid_; | 56 std::string uuid_; |
55 | 57 |
56 // Object path of the service that this characteristic belongs to. | 58 // Object path of the service that this characteristic belongs to. |
57 dbus::ObjectPath service_path_; | 59 dbus::ObjectPath service_path_; |
58 | 60 |
59 // The delegate that method calls are passed on to. | 61 // The delegate that method calls are passed on to. |
60 Delegate* delegate_; | 62 Delegate* delegate_; |
61 | 63 |
62 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattCharacteristicServiceProvider); | 64 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattCharacteristicServiceProvider); |
63 }; | 65 }; |
64 | 66 |
65 } // namespace bluez | 67 } // namespace bluez |
66 | 68 |
67 #endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROV
IDER_H_ | 69 #endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROV
IDER_H_ |
OLD | NEW |