#include "../common/BackendBase.h"
#include "../common/BackendUtils.h"
#include "CommonUtils.h"
#include "AdapterMac.h"
namespace SimpleBLE {
class BackendCoreBluetooth : public BackendSingleton<BackendCoreBluetooth> {
public:
BackendCoreBluetooth(buildToken);
virtual ~BackendCoreBluetooth() = default;
virtual std::vector<std::shared_ptr<AdapterBase>> adapters() override;
virtual bool bluetooth_enabled() override;
virtual std::string identifier() const noexcept override;
virtual bool is_active() override { return true; }
private:
std::shared_ptr<AdapterMac> _adapter;
};
std::shared_ptr<BackendBase> BACKEND_MACOS() { return BackendCoreBluetooth::get(); }
BackendCoreBluetooth::BackendCoreBluetooth(buildToken) : _adapter{std::make_shared<AdapterMac>()} {}
SharedPtrVector<AdapterBase> BackendCoreBluetooth::adapters() {
SharedPtrVector<AdapterBase> adapter_list;
adapter_list.push_back(_adapter);
return adapter_list;
}
bool BackendCoreBluetooth::bluetooth_enabled() {
return _adapter->bluetooth_enabled();
}
std::string BackendCoreBluetooth::identifier() const noexcept { return "CoreBluetooth"; }
}