simplersble 0.10.4-dev44

The all-in-one Bluetooth library that makes it easy to add wireless connectivity to your projects.
Documentation
#include <simpleble/Peripheral.h>

#include "AdapterDongl.h"
#include "BuilderBase.h"
#include "CommonUtils.h"
#include "PeripheralBase.h"
#include "PeripheralDongl.h"

#include "cmd/Commands.h"
#include <memory>
#include <thread>

using namespace SimpleBLE;

bool AdapterDongl::bluetooth_enabled() { return true; }

AdapterDongl::AdapterDongl(const std::string& device_path) : _usb_helper(std::make_unique<Dongl::USB::UsbHelper>(device_path)) {
    fmt::print("Dongl adapter created with device path: {}\n", device_path);

    _usb_helper->set_rx_callback([this](const kvn::bytearray& data) {
        fmt::print("Received data: {}\n", data.toHex(true));
    });

    auto readVersionCommand = Dongl::CMD::UartReadDeviceIdCommand();
    _usb_helper->tx(readVersionCommand.to_bytes());

    std::this_thread::sleep_for(std::chrono::milliseconds(100));

}

AdapterDongl::~AdapterDongl() {}

void* AdapterDongl::underlying() const { return nullptr; }

std::string AdapterDongl::identifier() { return "Dongl Adapter"; }

BluetoothAddress AdapterDongl::address() { return "AA:BB:CC:DD:EE:FF"; }

void AdapterDongl::power_on() {}

void AdapterDongl::power_off() {}

bool AdapterDongl::is_powered() { return true; }

void AdapterDongl::scan_start() {}

void AdapterDongl::scan_stop() {}

void AdapterDongl::scan_for(int timeout_ms) {
    scan_start();
    std::this_thread::sleep_for(std::chrono::milliseconds(timeout_ms));
    scan_stop();
}

bool AdapterDongl::scan_is_active() { return false; }

SharedPtrVector<PeripheralBase> AdapterDongl::scan_get_results() { return {}; }

SharedPtrVector<PeripheralBase> AdapterDongl::get_paired_peripherals() { return {}; }