I am creating a Qt application, where I connect the iOS with BLE board.
void EasyConnect::startDiscovery()
{
discoveryAgent = new QBluetoothDeviceDiscoveryAgent();
discoveryAgent->setLowEnergyDiscoveryTimeout(5000);
connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &EasyConnect::addDevice);
// connect(discoveryAgent, QOverload<QBluetoothDeviceDiscoveryAgent::Error>::of(&QBluetoothDeviceDiscoveryAgent::error), this, &Device::deviceScanError);
// connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, this, &Device::deviceScanFinished);
discoveryAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);
}
after read the ble component in near, i connect the Android device like this:
void EasyConnect::connectToService(QBluetoothAddress address)
{
m_control = new QLowEnergyController(address);
connect(m_control, &QLowEnergyController::serviceDiscovered, this, &EasyConnect::serviceDiscovered);
// connect(m_control, &QLowEnergyController::discoveryFinished,
// this, &DeviceHandler::serviceScanDone);
connect(m_control, static_cast<void (QLowEnergyController::*)(QLowEnergyController::Error)>(&QLowEnergyController::error),
this, [this](QLowEnergyController::Error error) {
Q_UNUSED(error);
qDebug() << "Cannot connect to remote device.";
});
connect(m_control, &QLowEnergyController::connected, this, [this]() {
qDebug() << "controller connect.";
m_control->discoverServices();
});
connect(m_control, &QLowEnergyController::disconnected, this, [this]() {
qDebug() << "controller disconneted.";
});
// Connect
m_control->connectToDevice();
}
so, on Android i get the mac address from
QBluetoothDeviceInfo
but iOS doesn't get me the mac address from ble, but only the UUID. I tried to search online on doc, but i didn't find something about connect the ios and bluetooth service through uuid.
There is a mode to convert uuid in mac address or there is a library to connect service ble device and ios with UUID.