#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_IMPL_H_
#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_IMPL_H_
#include <string>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/platform_thread.h"
#include "dbus/bus.h"
#include "dbus/exported_object.h"
#include "dbus/message.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h"
namespace bluez {
class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProviderImpl
: public BluetoothGattServiceServiceProvider {
public:
BluetoothGattServiceServiceProviderImpl(
dbus::Bus* bus,
const dbus::ObjectPath& object_path,
const std::string& uuid,
bool is_primary,
const std::vector<dbus::ObjectPath>& includes);
BluetoothGattServiceServiceProviderImpl(
const BluetoothGattServiceServiceProviderImpl&) = delete;
BluetoothGattServiceServiceProviderImpl& operator=(
const BluetoothGattServiceServiceProviderImpl&) = delete;
~BluetoothGattServiceServiceProviderImpl() override;
private:
bool OnOriginThread();
void Get(dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender);
void Set(dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender);
void GetAll(dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender);
void WriteProperties(dbus::MessageWriter* writer) override;
void OnExported(const std::string& interface_name,
const std::string& method_name,
bool success);
const dbus::ObjectPath& object_path() const override;
base::PlatformThreadId origin_thread_id_;
std::string uuid_;
bool is_primary_;
std::vector<dbus::ObjectPath> includes_;
raw_ptr<dbus::Bus> bus_;
dbus::ObjectPath object_path_;
scoped_refptr<dbus::ExportedObject> exported_object_;
base::WeakPtrFactory<BluetoothGattServiceServiceProviderImpl>
weak_ptr_factory_{this};
};
}
#endif