/usr/share/qt5/doc/qtbluetooth/qbluetoothdevicediscoveryagent.html is in qtconnectivity5-doc-html 5.9.5-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qbluetoothdevicediscoveryagent.cpp -->
<title>QBluetoothDeviceDiscoveryAgent Class | Qt Bluetooth 5.9</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
// loading style sheet breaks anchors that were jumped to before
// so force jumping to anchor again
setTimeout(function() {
var anchor = location.hash;
// need to jump to different anchor first (e.g. none)
location.hash = "#";
setTimeout(function() {
location.hash = anchor;
}, 0);
}, 0);
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<table><tr>
<td >Qt 5.9</td><td ><a href="qtbluetooth-index.html">Qt Bluetooth</a></td><td ><a href="qtbluetooth-module.html">C++ Classes</a></td><td >QBluetoothDeviceDiscoveryAgent</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.5 Reference Documentation</td>
</tr></table>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QBluetoothDeviceDiscoveryAgent Class</h1>
<!-- $$$QBluetoothDeviceDiscoveryAgent-brief -->
<p>The <a href="qbluetoothdevicediscoveryagent.html">QBluetoothDeviceDiscoveryAgent</a> class discovers the Bluetooth devices nearby. <a href="#details">More...</a></p>
<!-- @@@QBluetoothDeviceDiscoveryAgent -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QBluetoothDeviceDiscoveryAgent></span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += bluetooth</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.2</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qobject.html">QObject</a></td></tr></table></div><ul>
<li><a href="qbluetoothdevicediscoveryagent-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#DiscoveryMethod-enum">DiscoveryMethod</a></b> { NoMethod, ClassicMethod, LowEnergyMethod }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#DiscoveryMethod-enum">DiscoveryMethods</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#Error-enum">Error</a></b> { NoError, PoweredOffError, InputOutputError, InvalidBluetoothAdapterError, ..., UnknownError }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#InquiryType-enum">InquiryType</a></b> { GeneralUnlimitedInquiry, LimitedInquiry }</td></tr>
</table></div>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><a href="qbluetoothdevicediscoveryagent.html#inquiryType-prop">inquiryType</a></b> : QBluetoothDeviceDiscoveryAgent::InquiryType</li>
</ul>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#QBluetoothDeviceDiscoveryAgent">QBluetoothDeviceDiscoveryAgent</a></b>(QObject *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#QBluetoothDeviceDiscoveryAgent-1">QBluetoothDeviceDiscoveryAgent</a></b>(const QBluetoothAddress &<i>deviceAdapter</i>, QObject *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#dtor.QBluetoothDeviceDiscoveryAgent">~QBluetoothDeviceDiscoveryAgent</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList<QBluetoothDeviceInfo> </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#discoveredDevices">discoveredDevices</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Error </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#error">error</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#errorString">errorString</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetoothDeviceDiscoveryAgent::InquiryType </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#inquiryType-prop">inquiryType</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#isActive">isActive</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#lowEnergyDiscoveryTimeout">lowEnergyDiscoveryTimeout</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#inquiryType-prop">setInquiryType</a></b>(QBluetoothDeviceDiscoveryAgent::InquiryType <i>type</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#setLowEnergyDiscoveryTimeout">setLowEnergyDiscoveryTimeout</a></b>(int <i>timeout</i>)</td></tr>
</table></div>
<ul>
<li class="fn">32 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#start">start</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#start-1">start</a></b>(DiscoveryMethods <i>methods</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#stop">stop</a></b>()</td></tr>
</table></div>
<ul>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#canceled">canceled</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#deviceDiscovered">deviceDiscovered</a></b>(const QBluetoothDeviceInfo &<i>info</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#error-1">error</a></b>(QBluetoothDeviceDiscoveryAgent::Error <i>error</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#finished">finished</a></b>()</td></tr>
</table></div>
<ul>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> DiscoveryMethods </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#supportedDiscoveryMethods">supportedDiscoveryMethods</a></b>()</td></tr>
</table></div>
<ul>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QBluetoothDeviceDiscoveryAgent-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qbluetoothdevicediscoveryagent.html">QBluetoothDeviceDiscoveryAgent</a> class discovers the Bluetooth devices nearby.</p>
<p>To discover the nearby Bluetooth devices:</p>
<ul>
<li>create an instance of <a href="qbluetoothdevicediscoveryagent.html">QBluetoothDeviceDiscoveryAgent</a>,</li>
<li>connect to either the <a href="qbluetoothdevicediscoveryagent.html#deviceDiscovered">deviceDiscovered</a>() or <a href="qbluetoothdevicediscoveryagent.html#finished">finished</a>() signals,</li>
<li>and call <a href="qbluetoothdevicediscoveryagent.html#start">start</a>().</li>
</ul>
<pre class="cpp">
<span class="type">void</span> MyClass<span class="operator">::</span>startDeviceDiscovery()
{
<span class="comment">// Create a discovery agent and connect to its signals</span>
<span class="type"><a href="qbluetoothdevicediscoveryagent.html#QBluetoothDeviceDiscoveryAgent">QBluetoothDeviceDiscoveryAgent</a></span> <span class="operator">*</span>discoveryAgent <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qbluetoothdevicediscoveryagent.html#QBluetoothDeviceDiscoveryAgent">QBluetoothDeviceDiscoveryAgent</a></span>(<span class="keyword">this</span>);
connect(discoveryAgent<span class="operator">,</span> SIGNAL(deviceDiscovered(<span class="type"><a href="qbluetoothdeviceinfo.html">QBluetoothDeviceInfo</a></span>))<span class="operator">,</span>
<span class="keyword">this</span><span class="operator">,</span> SLOT(deviceDiscovered(<span class="type"><a href="qbluetoothdeviceinfo.html">QBluetoothDeviceInfo</a></span>)));
<span class="comment">// Start a discovery</span>
discoveryAgent<span class="operator">-</span><span class="operator">></span>start();
<span class="comment">//...</span>
}
<span class="comment">// In your local slot, read information about the found devices</span>
<span class="type">void</span> MyClass<span class="operator">::</span>deviceDiscovered(<span class="keyword">const</span> <span class="type"><a href="qbluetoothdeviceinfo.html">QBluetoothDeviceInfo</a></span> <span class="operator">&</span>device)
{
<a href="../qtcore/qtglobal.html#qDebug">qDebug</a>() <span class="operator"><</span><span class="operator"><</span> <span class="string">"Found new device:"</span> <span class="operator"><</span><span class="operator"><</span> device<span class="operator">.</span>name() <span class="operator"><</span><span class="operator"><</span> <span class="char">'('</span> <span class="operator"><</span><span class="operator"><</span> device<span class="operator">.</span>address()<span class="operator">.</span>toString() <span class="operator"><</span><span class="operator"><</span> <span class="char">')'</span>;
}
</pre>
<p>To retrieve results asynchronously, connect to the <a href="qbluetoothdevicediscoveryagent.html#deviceDiscovered">deviceDiscovered</a>() signal. To get a list of all discovered devices, call <a href="qbluetoothdevicediscoveryagent.html#discoveredDevices">discoveredDevices</a>() after the <a href="qbluetoothdevicediscoveryagent.html#finished">finished</a>() signal.</p>
<p>This class can be used to discover Classic and Low Energy Bluetooth devices. The individual device type can be determined via the <a href="qbluetoothdeviceinfo.html#coreConfigurations">QBluetoothDeviceInfo::coreConfigurations</a>() attribute. In most cases the list returned by <a href="qbluetoothdevicediscoveryagent.html#discoveredDevices">discoveredDevices</a>() contains both types of devices. However not every platform can detect both types of devices. On platforms with this limitation (for example iOS only suports Low Energy discovery), the discovery process will limit the search to the type which is supported.</p>
<p><b>Note: </b>Since Android 6.0 the ability to detect devices requires ACCESS_COARSE_LOCATION.</p></div>
<!-- @@@QBluetoothDeviceDiscoveryAgent -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$DiscoveryMethod$$$NoMethod$$$ClassicMethod$$$LowEnergyMethod -->
<h3 class="flags" id="DiscoveryMethod-enum"><a name="DiscoveryMethod-enum"></a>enum QBluetoothDeviceDiscoveryAgent::<span class="name">DiscoveryMethod</span><br/>flags QBluetoothDeviceDiscoveryAgent::<span class="name">DiscoveryMethods</span></h3>
<p>This enum descibes the type of discovery method employed by the <a href="qbluetoothdevicediscoveryagent.html">QBluetoothDeviceDiscoveryAgent</a>.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::NoMethod</code></td><td class="topAlign tblval"><code>0x0</code></td><td class="topAlign">The discovery is not possible. None of the available methods are supported.</td></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::ClassicMethod</code></td><td class="topAlign tblval"><code>0x01</code></td><td class="topAlign">The discovery process searches for Bluetooth Classic (BaseRate) devices.</td></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::LowEnergyMethod</code></td><td class="topAlign tblval"><code>0x02</code></td><td class="topAlign">The discovery process searches for Bluetooth Low Energy devices.</td></tr>
</table></div>
<p>This enum was introduced or modified in Qt 5.8.</p>
<p>The DiscoveryMethods type is a typedef for <a href="../qtcore/qflags.html">QFlags</a><DiscoveryMethod>. It stores an OR combination of DiscoveryMethod values.</p>
<p><b>See also </b><a href="qbluetoothdevicediscoveryagent.html#supportedDiscoveryMethods">supportedDiscoveryMethods</a>().</p>
<!-- @@@DiscoveryMethod -->
<!-- $$$Error$$$NoError$$$InputOutputError$$$PoweredOffError$$$InvalidBluetoothAdapterError$$$UnsupportedPlatformError$$$UnsupportedDiscoveryMethod$$$UnknownError -->
<h3 class="fn" id="Error-enum"><a name="Error-enum"></a>enum QBluetoothDeviceDiscoveryAgent::<span class="name">Error</span></h3>
<p>Indicates all possible error conditions found during Bluetooth device discovery.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::NoError</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">No error has occurred.</td></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::PoweredOffError</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The Bluetooth adaptor is powered off, power it on before doing discovery.</td></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::InputOutputError</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">Writing or reading from the device resulted in an error.</td></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">The passed local adapter address does not match the physical adapter address of any local Bluetooth device.</td></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::UnsupportedPlatformError</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">Device discovery is not possible or implemented on the current platform. The error is set in response to a call to <a href="qbluetoothdevicediscoveryagent.html#start">start</a>(). An example for such cases are iOS versions below 5.0 which do not support Bluetooth device search at all. This value was introduced by Qt 5.5.</td></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::UnsupportedDiscoveryMethod</code></td><td class="topAlign tblval"><code>5</code></td><td class="topAlign">One of the requested discovery methods is not supported by the current platform. This value was introduced by Qt 5.8.</td></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::UnknownError</code></td><td class="topAlign tblval"><code>100</code></td><td class="topAlign">An unknown error has occurred.</td></tr>
</table></div>
<!-- @@@Error -->
<!-- $$$InquiryType$$$GeneralUnlimitedInquiry$$$LimitedInquiry -->
<h3 class="fn" id="InquiryType-enum"><a name="InquiryType-enum"></a>enum QBluetoothDeviceDiscoveryAgent::<span class="name">InquiryType</span></h3>
<p>This enum describes the inquiry type used while discovering Bluetooth devices.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::GeneralUnlimitedInquiry</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">A general unlimited inquiry. Discovers all visible Bluetooth devices in the local vicinity.</td></tr>
<tr><td class="topAlign"><code>QBluetoothDeviceDiscoveryAgent::LimitedInquiry</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">A limited inquiry discovers devices that are in limited inquiry mode.</td></tr>
</table></div>
<p>LimitedInquiry is not supported on all platforms. If it is requested on a platform that does not support it, GeneralUnlimitedInquiry will be used instead. Setting LimitedInquiry is useful for multi-player Bluetooth-based games that needs faster communication between the devices. The phone scans for devices in LimitedInquiry and Service Discovery is done on one or two devices to speed up the service scan. After the game has connected to the device it intended to, the device returns to GeneralUnlimitedInquiry.</p>
<!-- @@@InquiryType -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$inquiryType-prop$$$inquiryType$$$setInquiryTypeQBluetoothDeviceDiscoveryAgent::InquiryType -->
<h3 class="fn" id="inquiryType-prop"><a name="inquiryType-prop"></a><span class="name">inquiryType</span> : <span class="type"><a href="qbluetoothdevicediscoveryagent.html#InquiryType-enum">QBluetoothDeviceDiscoveryAgent::InquiryType</a></span></h3>
<p>type of inquiry scan to be used while discovering devices</p>
<p>This property affects the type of inquiry scan which is performed while discovering devices.</p>
<p>By default, this property is set to <a href="qbluetoothdevicediscoveryagent.html#InquiryType-enum">GeneralUnlimitedInquiry</a>.</p>
<p>Not all platforms support <a href="qbluetoothdevicediscoveryagent.html#InquiryType-enum">LimitedInquiry</a>.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QBluetoothDeviceDiscoveryAgent::InquiryType </td><td class="memItemRight bottomAlign"><span class="name"><b>inquiryType</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setInquiryType</b></span>(QBluetoothDeviceDiscoveryAgent::InquiryType <i>type</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qbluetoothdevicediscoveryagent.html#InquiryType-enum">InquiryType</a>.</p>
<!-- @@@inquiryType -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QBluetoothDeviceDiscoveryAgent[overload1]$$$QBluetoothDeviceDiscoveryAgentQObject* -->
<h3 class="fn" id="QBluetoothDeviceDiscoveryAgent"><a name="QBluetoothDeviceDiscoveryAgent"></a>QBluetoothDeviceDiscoveryAgent::<span class="name">QBluetoothDeviceDiscoveryAgent</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a new Bluetooth device discovery agent with parent <i>parent</i>.</p>
<!-- @@@QBluetoothDeviceDiscoveryAgent -->
<!-- $$$QBluetoothDeviceDiscoveryAgent$$$QBluetoothDeviceDiscoveryAgentconstQBluetoothAddress&QObject* -->
<h3 class="fn" id="QBluetoothDeviceDiscoveryAgent-1"><a name="QBluetoothDeviceDiscoveryAgent-1"></a>QBluetoothDeviceDiscoveryAgent::<span class="name">QBluetoothDeviceDiscoveryAgent</span>(const <span class="type"><a href="qbluetoothaddress.html">QBluetoothAddress</a></span> &<i>deviceAdapter</i>, <span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a new Bluetooth device discovery agent with <i>parent</i>.</p>
<p>It uses <i>deviceAdapter</i> for the device search. If <i>deviceAdapter</i> is default constructed the resulting <a href="qbluetoothdevicediscoveryagent.html">QBluetoothDeviceDiscoveryAgent</a> object will use the local default Bluetooth adapter.</p>
<p>If a <i>deviceAdapter</i> is specified that is not a local adapter <a href="qbluetoothdevicediscoveryagent.html#error">error</a>() will be set to <a href="qbluetoothdevicediscoveryagent.html#Error-enum">InvalidBluetoothAdapterError</a>. Therefore it is recommended to test the error flag immediately after using this constructor.</p>
<p><b>See also </b><a href="qbluetoothdevicediscoveryagent.html#error">error</a>().</p>
<!-- @@@QBluetoothDeviceDiscoveryAgent -->
<!-- $$$~QBluetoothDeviceDiscoveryAgent[overload1]$$$~QBluetoothDeviceDiscoveryAgent -->
<h3 class="fn" id="dtor.QBluetoothDeviceDiscoveryAgent"><a name="dtor.QBluetoothDeviceDiscoveryAgent"></a>QBluetoothDeviceDiscoveryAgent::<span class="name">~QBluetoothDeviceDiscoveryAgent</span>()</h3>
<p>Destructor for ~<a href="qbluetoothdevicediscoveryagent.html#QBluetoothDeviceDiscoveryAgent">QBluetoothDeviceDiscoveryAgent</a>()</p>
<!-- @@@~QBluetoothDeviceDiscoveryAgent -->
<!-- $$$canceled[overload1]$$$canceled -->
<h3 class="fn" id="canceled"><a name="canceled"></a><code>[signal] </code><span class="type">void</span> QBluetoothDeviceDiscoveryAgent::<span class="name">canceled</span>()</h3>
<p>This signal is emitted when device discovery is aborted by a call to <a href="qbluetoothdevicediscoveryagent.html#stop">stop</a>().</p>
<!-- @@@canceled -->
<!-- $$$deviceDiscovered[overload1]$$$deviceDiscoveredconstQBluetoothDeviceInfo& -->
<h3 class="fn" id="deviceDiscovered"><a name="deviceDiscovered"></a><code>[signal] </code><span class="type">void</span> QBluetoothDeviceDiscoveryAgent::<span class="name">deviceDiscovered</span>(const <span class="type"><a href="qbluetoothdeviceinfo.html">QBluetoothDeviceInfo</a></span> &<i>info</i>)</h3>
<p>This signal is emitted when the Bluetooth device described by <i>info</i> is discovered.</p>
<p>The signal is emitted as soon as the most important device information has been collected. However, as long as the <a href="qbluetoothdevicediscoveryagent.html#finished">finished</a>() signal has not been emitted the information collection continues even for already discovered devices. This is particularly true for signal strength information (RSSI). If signal strength information is required it is advisable to retrieve the device information via <a href="qbluetoothdevicediscoveryagent.html#discoveredDevices">discoveredDevices</a>() once the discovery has finished. This will yield the most recent RSSI information.</p>
<p>If <a href="qbluetoothdevicediscoveryagent.html#lowEnergyDiscoveryTimeout">lowEnergyDiscoveryTimeout</a>() is larger than 0 the signal is only ever emitted when at least one attribute of <i>info</i> changes. This reflects the desire to receive updates as more precise information becomes available. The exception to this behavior is the case when <a href="qbluetoothdevicediscoveryagent.html#lowEnergyDiscoveryTimeout">lowEnergyDiscoveryTimeout</a> is set to <code>0</code>. A timeout of <code>0</code> expresses the desire to monitor the appearance and disappearance of Low Energy devices over time. Under this condition the deviceDiscovered() signal is emitted even if <i>info</i> has not changed since the last signal emission.</p>
<p><b>See also </b><a href="qbluetoothdeviceinfo.html#rssi">QBluetoothDeviceInfo::rssi</a>() and <a href="qbluetoothdevicediscoveryagent.html#lowEnergyDiscoveryTimeout">lowEnergyDiscoveryTimeout</a>().</p>
<!-- @@@deviceDiscovered -->
<!-- $$$discoveredDevices[overload1]$$$discoveredDevices -->
<h3 class="fn" id="discoveredDevices"><a name="discoveredDevices"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span><<span class="type"><a href="qbluetoothdeviceinfo.html">QBluetoothDeviceInfo</a></span>> QBluetoothDeviceDiscoveryAgent::<span class="name">discoveredDevices</span>() const</h3>
<p>Returns a list of all discovered Bluetooth devices.</p>
<!-- @@@discoveredDevices -->
<!-- $$$error[overload1]$$$error -->
<h3 class="fn" id="error"><a name="error"></a><span class="type"><a href="qbluetoothdevicediscoveryagent.html#Error-enum">Error</a></span> QBluetoothDeviceDiscoveryAgent::<span class="name">error</span>() const</h3>
<p>Returns the last error.</p>
<!-- @@@error -->
<!-- $$$error$$$errorQBluetoothDeviceDiscoveryAgent::Error -->
<h3 class="fn" id="error-1"><a name="error-1"></a><code>[signal] </code><span class="type">void</span> QBluetoothDeviceDiscoveryAgent::<span class="name">error</span>(<span class="type"><a href="qbluetoothdevicediscoveryagent.html#Error-enum">QBluetoothDeviceDiscoveryAgent::Error</a></span> <i>error</i>)</h3>
<p>This signal is emitted when an <i>error</i> occurs during Bluetooth device discovery. The <i>error</i> parameter describes the error that occurred.</p>
<p><b>Note:</b> Signal <i>error</i> is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:<pre class="cpp">
connect(bluetoothDeviceDiscoveryAgent<span class="operator">,</span> <span class="keyword">static_cast</span><span class="operator"><</span><span class="type">void</span>(<span class="type"><a href="qbluetoothdevicediscoveryagent.html#QBluetoothDeviceDiscoveryAgent">QBluetoothDeviceDiscoveryAgent</a></span><span class="operator">::</span><span class="operator">*</span>)(<span class="type"><a href="qbluetoothdevicediscoveryagent.html#QBluetoothDeviceDiscoveryAgent">QBluetoothDeviceDiscoveryAgent</a></span><span class="operator">::</span>Error)<span class="operator">></span>(<span class="operator">&</span><span class="type"><a href="qbluetoothdevicediscoveryagent.html#QBluetoothDeviceDiscoveryAgent">QBluetoothDeviceDiscoveryAgent</a></span><span class="operator">::</span>error)<span class="operator">,</span>
<span class="operator">[</span><span class="operator">=</span><span class="operator">]</span>(<span class="type"><a href="qbluetoothdevicediscoveryagent.html#QBluetoothDeviceDiscoveryAgent">QBluetoothDeviceDiscoveryAgent</a></span><span class="operator">::</span>Error error){ <span class="comment">/* ... */</span> });
</pre>
<p><b>See also </b><a href="qbluetoothdevicediscoveryagent.html#error">error</a>() and <a href="qbluetoothdevicediscoveryagent.html#errorString">errorString</a>().</p>
<!-- @@@error -->
<!-- $$$errorString[overload1]$$$errorString -->
<h3 class="fn" id="errorString"><a name="errorString"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QBluetoothDeviceDiscoveryAgent::<span class="name">errorString</span>() const</h3>
<p>Returns a human-readable description of the last error.</p>
<!-- @@@errorString -->
<!-- $$$finished[overload1]$$$finished -->
<h3 class="fn" id="finished"><a name="finished"></a><code>[signal] </code><span class="type">void</span> QBluetoothDeviceDiscoveryAgent::<span class="name">finished</span>()</h3>
<p>This signal is emitted when Bluetooth device discovery completes. The signal is not going to be emitted if the device discovery finishes with an error.</p>
<!-- @@@finished -->
<!-- $$$isActive[overload1]$$$isActive -->
<h3 class="fn" id="isActive"><a name="isActive"></a><span class="type">bool</span> QBluetoothDeviceDiscoveryAgent::<span class="name">isActive</span>() const</h3>
<p>Returns true if the agent is currently discovering Bluetooth devices, otherwise returns false.</p>
<!-- @@@isActive -->
<!-- $$$lowEnergyDiscoveryTimeout[overload1]$$$lowEnergyDiscoveryTimeout -->
<h3 class="fn" id="lowEnergyDiscoveryTimeout"><a name="lowEnergyDiscoveryTimeout"></a><span class="type">int</span> QBluetoothDeviceDiscoveryAgent::<span class="name">lowEnergyDiscoveryTimeout</span>() const</h3>
<p>Returns a timeout in milliseconds that is applied to the Bluetooth Low Energy device search. A value of <code>-1</code> implies that the platform does not support this property and the timeout for the device search cannot be adjusted. A return value of <code>0</code> implies a never-ending search which must be manually stopped via <a href="qbluetoothdevicediscoveryagent.html#stop">stop</a>().</p>
<p>This function was introduced in Qt 5.8.</p>
<p><b>See also </b><a href="qbluetoothdevicediscoveryagent.html#setLowEnergyDiscoveryTimeout">setLowEnergyDiscoveryTimeout</a>().</p>
<!-- @@@lowEnergyDiscoveryTimeout -->
<!-- $$$setLowEnergyDiscoveryTimeout[overload1]$$$setLowEnergyDiscoveryTimeoutint -->
<h3 class="fn" id="setLowEnergyDiscoveryTimeout"><a name="setLowEnergyDiscoveryTimeout"></a><span class="type">void</span> QBluetoothDeviceDiscoveryAgent::<span class="name">setLowEnergyDiscoveryTimeout</span>(<span class="type">int</span> <i>timeout</i>)</h3>
<p>Sets the maximum search time for Bluetooth Low Energy device search to <i>timeout</i> in milliseconds. If <i>timeout</i> is <code>0</code> the discovery runs until <a href="qbluetoothdevicediscoveryagent.html#stop">stop</a>() is called.</p>
<p>This reflects the fact that the discovery process for Bluetooth Low Energy devices is mostly open ended. The platform continues to look for more devices until the search is manually stopped. The timeout ensures that the search is aborted after <i>timeout</i> milliseconds. Of course, it is still possible to manually abort the discovery by calling <a href="qbluetoothdevicediscoveryagent.html#stop">stop</a>().</p>
<p>The new timeout value does not take effect until the device search is restarted. In addition the timeout does not affect the classic Bluetooth device search. Depending on the platform the classic search may add more time to the total discovery process beyond <i>timeout</i>.</p>
<p>This function was introduced in Qt 5.8.</p>
<p><b>See also </b><a href="qbluetoothdevicediscoveryagent.html#lowEnergyDiscoveryTimeout">lowEnergyDiscoveryTimeout</a>().</p>
<!-- @@@setLowEnergyDiscoveryTimeout -->
<!-- $$$start[overload1]$$$start -->
<h3 class="fn" id="start"><a name="start"></a><code>[slot] </code><span class="type">void</span> QBluetoothDeviceDiscoveryAgent::<span class="name">start</span>()</h3>
<p>Starts Bluetooth device discovery, if it is not already started.</p>
<p>The <a href="qbluetoothdevicediscoveryagent.html#deviceDiscovered">deviceDiscovered</a>() signal is emitted as each device is discovered. The <a href="qbluetoothdevicediscoveryagent.html#finished">finished</a>() signal is emitted once device discovery is complete. The discovery utilizes the maximum set of supported discovery methods on the platform.</p>
<p><b>See also </b><a href="qbluetoothdevicediscoveryagent.html#supportedDiscoveryMethods">supportedDiscoveryMethods</a>().</p>
<!-- @@@start -->
<!-- $$$start$$$startDiscoveryMethods -->
<h3 class="fn" id="start-1"><a name="start-1"></a><code>[slot] </code><span class="type">void</span> QBluetoothDeviceDiscoveryAgent::<span class="name">start</span>(<span class="type"><a href="qbluetoothdevicediscoveryagent.html#DiscoveryMethod-enum">DiscoveryMethods</a></span> <i>methods</i>)</h3>
<p>Start Bluetooth device discovery, if it is not already started and the provided <i>methods</i> are supported. The discovery <i>methods</i> limit the scope of the device search. For example, if the target service or device is a Bluetooth Low Energy device, this function could be used to limit the search to Bluetooth Low Energy devices and thereby reduces the discovery time significantly.</p>
<p>This function was introduced in Qt 5.8.</p>
<!-- @@@start -->
<!-- $$$stop[overload1]$$$stop -->
<h3 class="fn" id="stop"><a name="stop"></a><code>[slot] </code><span class="type">void</span> QBluetoothDeviceDiscoveryAgent::<span class="name">stop</span>()</h3>
<p>Stops Bluetooth device discovery. The cancel() signal is emitted once the device discovery is canceled. <a href="qbluetoothdevicediscoveryagent.html#start">start</a>() maybe called before the cancel signal is received. Once <a href="qbluetoothdevicediscoveryagent.html#start">start</a>() has been called the cancel signal from the prior discovery will be discarded.</p>
<!-- @@@stop -->
<!-- $$$supportedDiscoveryMethods[overload1]$$$supportedDiscoveryMethods -->
<h3 class="fn" id="supportedDiscoveryMethods"><a name="supportedDiscoveryMethods"></a><code>[static] </code><span class="type"><a href="qbluetoothdevicediscoveryagent.html#DiscoveryMethod-enum">DiscoveryMethods</a></span> QBluetoothDeviceDiscoveryAgent::<span class="name">supportedDiscoveryMethods</span>()</h3>
<p>This function returns the discovery methods supported by the current platform. It can be used to limit the scope of the device discovery.</p>
<p>This function was introduced in Qt 5.8.</p>
<!-- @@@supportedDiscoveryMethods -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|