#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
#include <stdint.h>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "dbus/bus.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_export.h"
namespace bluez {
class DEVICE_BLUETOOTH_EXPORT BluetoothLEAdvertisementServiceProvider {
public:
using UUIDList = std::vector<std::string>;
using ManufacturerData = std::map<uint16_t, std::vector<uint8_t>>;
using ServiceData = std::map<std::string, std::vector<uint8_t>>;
using ScanResponseData = std::map<uint8_t, std::vector<uint8_t>>;
enum AdvertisementType {
ADVERTISEMENT_TYPE_BROADCAST,
ADVERTISEMENT_TYPE_PERIPHERAL
};
class Delegate {
public:
virtual ~Delegate() {}
virtual void Released() = 0;
};
BluetoothLEAdvertisementServiceProvider(
const BluetoothLEAdvertisementServiceProvider&) = delete;
BluetoothLEAdvertisementServiceProvider& operator=(
const BluetoothLEAdvertisementServiceProvider&) = delete;
virtual ~BluetoothLEAdvertisementServiceProvider();
const dbus::ObjectPath& object_path() { return object_path_; }
static std::unique_ptr<BluetoothLEAdvertisementServiceProvider> Create(
dbus::Bus* bus,
const dbus::ObjectPath& object_path,
Delegate* delegate,
bool adapter_support_ext_adv,
AdvertisementType type,
std::optional<UUIDList> service_uuids,
std::optional<ManufacturerData> manufacturer_data,
std::optional<UUIDList> solicit_uuids,
std::optional<ServiceData> service_data,
std::optional<ScanResponseData> scan_response_data);
protected:
BluetoothLEAdvertisementServiceProvider();
dbus::ObjectPath object_path_;
};
}
#endif