#ifndef DEVICE_BLUETOOTH_FLOSS_FLOSS_BLUETOOTH_TELEPHONY_CLIENT_H_
#define DEVICE_BLUETOOTH_FLOSS_FLOSS_BLUETOOTH_TELEPHONY_CLIENT_H_
#include <memory>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "dbus/exported_object.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/floss/floss_dbus_client.h"
namespace floss {
class DEVICE_BLUETOOTH_EXPORT FlossBluetoothTelephonyClient
: public FlossDBusClient {
public:
static std::unique_ptr<FlossBluetoothTelephonyClient> Create();
FlossBluetoothTelephonyClient(const FlossBluetoothTelephonyClient&) = delete;
FlossBluetoothTelephonyClient& operator=(
const FlossBluetoothTelephonyClient&) = delete;
FlossBluetoothTelephonyClient();
~FlossBluetoothTelephonyClient() override;
virtual void SetPhoneOpsEnabled(ResponseCallback<Void> callback,
bool enabled);
void Init(dbus::Bus* bus,
const std::string& service_name,
const int adapter_index,
base::Version version,
base::OnceClosure on_ready) override;
protected:
friend class FlossBluetoothTelephonyClientTest;
raw_ptr<dbus::Bus> bus_ = nullptr;
dbus::ObjectPath bluetooth_telephony_adapter_path_;
std::string service_name_;
private:
friend class FlossBluetoothTelephonyClientTest;
template <typename R, typename... Args>
void CallBluetoothTelephonyMethod(ResponseCallback<R> callback,
const char* member,
Args... args) {
CallMethod(std::move(callback), bus_, service_name_,
kBluetoothTelephonyInterface, bluetooth_telephony_adapter_path_,
member, args...);
}
base::WeakPtrFactory<FlossBluetoothTelephonyClient> weak_ptr_factory_{this};
};
}
#endif