View Full Version : Bluetooth LE Monitor
liziyuanhaha
12th November 2015, 18:12
Hi,
I am a newbie, trying to get data via BLE dongle in Qt. However, cannot even find the dongle device.
If possible, could anyone tell me where I can find a Qt example like BLE device monitor, or teach me which class should I use to open a BLE dongle on PC?
Thank you!
liziyuanhaha
15th November 2015, 02:12
I could not even find my host BLE device.
Could anyone help me?
Here is my code:
QString localDeviceName;
QBluetoothAddress dongleAddress;
QBluetoothHostInfo dongleHostInfo;
// Check if Bluetooth is available on this device
QList<QBluetoothHostInfo> dongleHostInfoList = QBluetoothLocalDevice::allDevices();
if (dongleHostInfoList.count() > 1){
QStringList dongleNameStringList;
for (int n=0; n<dongleHostInfoList.count(); n++){
dongleNameStringList << dongleHostInfoList.at(n).name();
// .description();//.deviceName();
}
QString dongleNameString = QInputDialog::getItem(0, QString("Sen Dongle Select"), QString("Please select your BLE Dongle."), dongleNameStringList, 0, false);
dongleAddress = dongleHostInfoList.at(dongleNameStringList.indexOf (dongleNameString)).address();
} else if(dongleHostInfoList.count() == 1){
dongleAddress = dongleHostInfoList.at(0).address();
}else {
qDebug() << QString ("No Device Detected");
}
localDevice = new QBluetoothLocalDevice(dongleAddress);
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.