| 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_DESCRIPTOR_SERVICE_PROVIDER_H_ | 5 #ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_ | 
| 6 #define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_ | 6 #define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_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_descriptor_service_provider.h" | 16 #include "device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h" | 
| 15 | 17 | 
| 16 namespace bluez { | 18 namespace bluez { | 
| 17 | 19 | 
| 18 // FakeBluetoothGattDescriptorServiceProvider simulates behavior of a local | 20 // FakeBluetoothGattDescriptorServiceProvider simulates behavior of a local | 
| 19 // GATT descriptor object and is used both in test cases in place of a mock | 21 // GATT descriptor 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 FakeBluetoothGattDescriptorServiceProvider | 23 class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattDescriptorServiceProvider | 
| 22     : public BluetoothGattDescriptorServiceProvider { | 24     : public BluetoothGattDescriptorServiceProvider { | 
| 23  public: | 25  public: | 
| 24   FakeBluetoothGattDescriptorServiceProvider( | 26   FakeBluetoothGattDescriptorServiceProvider( | 
| 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>& permissions, | 30       const std::vector<std::string>& permissions, | 
| 29       const dbus::ObjectPath& characteristic_path); | 31       const dbus::ObjectPath& characteristic_path); | 
| 30   ~FakeBluetoothGattDescriptorServiceProvider() override; | 32   ~FakeBluetoothGattDescriptorServiceProvider() override; | 
| 31 | 33 | 
| 32   // BluetoothGattDescriptorServiceProvider override. | 34   // BluetoothGattDescriptorServiceProvider override. | 
| 33   void SendValueChanged(const std::vector<uint8>& value) override; | 35   void SendValueChanged(const std::vector<uint8_t>& value) override; | 
| 34 | 36 | 
| 35   // Methods to simulate value get/set requests issued from a remote device. The | 37   // 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 | 38   // methods do nothing, if the associated service was not registered with the | 
| 37   // GATT manager. | 39   // GATT manager. | 
| 38   void GetValue(const Delegate::ValueCallback& callback, | 40   void GetValue(const Delegate::ValueCallback& callback, | 
| 39                 const Delegate::ErrorCallback& error_callback); | 41                 const Delegate::ErrorCallback& error_callback); | 
| 40   void SetValue(const std::vector<uint8>& value, | 42   void SetValue(const std::vector<uint8_t>& value, | 
| 41                 const base::Closure& callback, | 43                 const base::Closure& callback, | 
| 42                 const Delegate::ErrorCallback& error_callback); | 44                 const Delegate::ErrorCallback& error_callback); | 
| 43 | 45 | 
| 44   const dbus::ObjectPath& object_path() const { return object_path_; } | 46   const dbus::ObjectPath& object_path() const { return object_path_; } | 
| 45   const std::string& uuid() const { return uuid_; } | 47   const std::string& uuid() const { return uuid_; } | 
| 46   const dbus::ObjectPath& characteristic_path() const { | 48   const dbus::ObjectPath& characteristic_path() const { | 
| 47     return characteristic_path_; | 49     return characteristic_path_; | 
| 48   } | 50   } | 
| 49 | 51 | 
| 50  private: | 52  private: | 
| 51   // D-Bus object path of the fake GATT descriptor. | 53   // D-Bus object path of the fake GATT descriptor. | 
| 52   dbus::ObjectPath object_path_; | 54   dbus::ObjectPath object_path_; | 
| 53 | 55 | 
| 54   // 128-bit GATT descriptor UUID. | 56   // 128-bit GATT descriptor UUID. | 
| 55   std::string uuid_; | 57   std::string uuid_; | 
| 56 | 58 | 
| 57   // Object path of the characteristic that this descriptor belongs to. | 59   // Object path of the characteristic that this descriptor belongs to. | 
| 58   dbus::ObjectPath characteristic_path_; | 60   dbus::ObjectPath characteristic_path_; | 
| 59 | 61 | 
| 60   // The delegate that method calls are passed on to. | 62   // The delegate that method calls are passed on to. | 
| 61   Delegate* delegate_; | 63   Delegate* delegate_; | 
| 62 | 64 | 
| 63   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorServiceProvider); | 65   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorServiceProvider); | 
| 64 }; | 66 }; | 
| 65 | 67 | 
| 66 }  // namespace bluez | 68 }  // namespace bluez | 
| 67 | 69 | 
| 68 #endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER
    _H_ | 70 #endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER
    _H_ | 
| OLD | NEW | 
|---|