#ifndef DEVICE_BLUETOOTH_TEST_FAKE_LOCAL_GATT_CHARACTERISTIC_H_
#define DEVICE_BLUETOOTH_TEST_FAKE_LOCAL_GATT_CHARACTERISTIC_H_
#include "device/bluetooth/bluetooth_local_gatt_characteristic.h"
#include "device/bluetooth/public/cpp/bluetooth_uuid.h"
namespace device {
class BluetoothLocalGattService;
}
namespace bluetooth {
class FakeLocalGattCharacteristic
: public device::BluetoothLocalGattCharacteristic {
public:
FakeLocalGattCharacteristic(const std::string& characteristic_id,
const device::BluetoothUUID& characteristic_uuid,
device::BluetoothLocalGattService* service,
Properties properties,
Permissions permissions);
~FakeLocalGattCharacteristic() override;
std::string GetIdentifier() const override;
device::BluetoothUUID GetUUID() const override;
Properties GetProperties() const override;
Permissions GetPermissions() const override;
NotificationStatus NotifyValueChanged(const device::BluetoothDevice* device,
const std::vector<uint8_t>& new_value,
bool indicate) override;
device::BluetoothLocalGattService* GetService() const override;
std::vector<device::BluetoothLocalGattDescriptor*> GetDescriptors()
const override;
base::WeakPtr<FakeLocalGattCharacteristic> GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
private:
Properties properties_ = Property::PROPERTY_NONE;
Permissions permissions_ = Permission::PERMISSION_NONE;
const std::string characteristic_id_;
const device::BluetoothUUID characteristic_uuid_;
raw_ptr<device::BluetoothLocalGattService> service_ = nullptr;
std::vector<uint8_t> value_;
base::WeakPtrFactory<FakeLocalGattCharacteristic> weak_ptr_factory_{this};
};
}
#endif