btscanner example does not work, cannot find BLE host device
Unsolved
General and Desktop
-
Hi,
I am a newbie working on BLE examples; however none of the BLE examples work on both of my desktop with CyPress BLE dongle and my laptop.
Could anyone help me and tell what is happening?
I did a little modification on the btscanner example, and here is my own codes:
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(); } 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);
Unfortunately, I never find my BLE host device.
Please help me.
Thank you!