vs2017 qt5.13.2
用法
[code=c][/code]
discoveryAgent = new QBluetoothDeviceDiscoveryAgent();
discoveryAgent->setLowEnergyDiscoveryTimeout(5000);//設定BLE的搜索時間
//當發現info描述的藍牙設備時發出此信號來進行動作
connect(discoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)), this, SLOT(addBlueToothDevicesToList(QBluetoothDeviceInfo)));
//完成信號發出進行動作
connect(discoveryAgent, SIGNAL(finished()), this, SLOT(DiscoveryFinish()));
connect(discoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)), this, SLOT(DiscoveryError(QBluetoothDeviceDiscoveryAgent::Error)));
//在DiscoveryFinish 回呼中 判斷是否連接上設備 沒連接上 就重新搜索
void BeaconBluetooth::DiscoveryFinish()
{
qDebug() << "DiscoveryFinish" ;
//沒找到重啟
if (m_controller ==NULL)
{
qDebug() << "DiscoveryFinish1";
discoveryAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);
//resNewDiscoveryTimer->start(10);
}
else
{
qDebug() << "DiscoveryFinish" << m_controller->state();
if (m_controller->state() != QLowEnergyController::DiscoveredState)
{
if (!discoveryTimer->isActive())
{
countDiscoveryTime = 0;
discoveryTimer->start(1000);
}
}
}
qDebug() << "DiscoveryFinish2";
}
onecoreuap\drivers\wdm\bluetooth\user\winrt\common\bluetoothutilities.cpp(509)\Windows.Devices.Bluetooth.dll!00007FFEA799A481: (caller: 00007FFEA79AA4C0) ReturnHr(15) tid(3abc) 80070490 找不到元素。
0x00007FFE773D52BA (Qt5Bluetoothd.dll)處(位于 ServerMiddleware.exe 中)引發的例外: 0xC0000005: 讀取位置 0xFFFFFFFFFFFFFFFF 時發生訪問沖突。
debug模式下 崩潰的源頭 就是在Qt5Bluetoothd.dll
uj5u.com熱心網友回復:
如果把 下一次把下一次重新搜索時間延長 崩潰會延遲很久 但是還是會崩潰轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/236272.html
標籤:工具平臺和程序庫
