hci_inquiry timeout is wrong
-
I have an issue with my usage of hci_inquiry function. When no devices are detected ,that is another issue I have but I need to fix this one first, it does not timeout as expected by "len" parameter value. The "elapsed time " is random , most of the time around 7s. When devices are actually detected the "elapsed time" is pretty much as expected, the function does work. I realize when no devices are detected is more important than how long it took to run, but I feel it should follow the "len" parameter. Would appreciate help or suggestion what else I can do to verify the function(s) time/ timeout when no devices are detected, Thanks
len = 16; // 1.28 * len seconds timer max_rsp = 255;
flags = IREQ_CACHE_FLUSH; //always real scan
ii = (inquiry_info*)malloc(max_rsp * sizeof(inquiry_info));
QET->start(); // debug restart timernum\_rsp = hci\_inquiry(dev\_id, len, max\_rsp, NULL, &ii, flags); text = "\\nTASK elapsed time...\\n "; text += "num\_rsp = hci\_inquiry(d...."; //text += Q\_FUNC\_INFO; text += " @ line "; text += QString::number(\_\_LINE\_\_); text += "\\nElapsed time \\t"; text += QString::number(QET->elapsed()); text += " mS "; m\_ui->textEdit\_29->append(text); qDebug().noquote() << text; text = "\\nnum\_rsp = hci\_inquiry(dev\_id, len, max\_rsp, NULL, &ii, flags) \\t"; text += QString::number(num\_rsp); m\_ui->textEdit\_29->append(text); qDebug().noquote() << text;
-
I have an issue with my usage of hci_inquiry function. When no devices are detected ,that is another issue I have but I need to fix this one first, it does not timeout as expected by "len" parameter value. The "elapsed time " is random , most of the time around 7s. When devices are actually detected the "elapsed time" is pretty much as expected, the function does work. I realize when no devices are detected is more important than how long it took to run, but I feel it should follow the "len" parameter. Would appreciate help or suggestion what else I can do to verify the function(s) time/ timeout when no devices are detected, Thanks
len = 16; // 1.28 * len seconds timer max_rsp = 255;
flags = IREQ_CACHE_FLUSH; //always real scan
ii = (inquiry_info*)malloc(max_rsp * sizeof(inquiry_info));
QET->start(); // debug restart timernum\_rsp = hci\_inquiry(dev\_id, len, max\_rsp, NULL, &ii, flags); text = "\\nTASK elapsed time...\\n "; text += "num\_rsp = hci\_inquiry(d...."; //text += Q\_FUNC\_INFO; text += " @ line "; text += QString::number(\_\_LINE\_\_); text += "\\nElapsed time \\t"; text += QString::number(QET->elapsed()); text += " mS "; m\_ui->textEdit\_29->append(text); qDebug().noquote() << text; text = "\\nnum\_rsp = hci\_inquiry(dev\_id, len, max\_rsp, NULL, &ii, flags) \\t"; text += QString::number(num\_rsp); m\_ui->textEdit\_29->append(text); qDebug().noquote() << text;
According to [this:](https://people.csail.mit.edu/albert/bluez-intro/c404.html#:~:text=The inquiry lasts for at most 1.28 \* len seconds) the timeout is at most len * 1.28 seconds. Since you've got a value of 16 for ii, then you can expect
hci_inquiry()
to take no more than 20.48 seconds. Since ~7 < 20.48, it looks to me thathci_inquiry
is working as advertised."A little song, a little dance, a little seltzer down your pants" Chuckles the clown