/usr/share/qt5/doc/qtbluetooth/qbluetoothservicediscoveryagent.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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qbluetoothservicediscoveryagent.cpp -->
<title>QBluetoothServiceDiscoveryAgent 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 >QBluetoothServiceDiscoveryAgent</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="#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="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QBluetoothServiceDiscoveryAgent Class</h1>
<!-- $$$QBluetoothServiceDiscoveryAgent-brief -->
<p>The <a href="qbluetoothservicediscoveryagent.html">QBluetoothServiceDiscoveryAgent</a> class enables you to query for Bluetooth services. <a href="#details">More...</a></p>
<!-- @@@QBluetoothServiceDiscoveryAgent -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QBluetoothServiceDiscoveryAgent></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="qbluetoothservicediscoveryagent-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="qbluetoothservicediscoveryagent.html#DiscoveryMode-enum">DiscoveryMode</a></b> { MinimalDiscovery, FullDiscovery }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#Error-enum">Error</a></b> { NoError, PoweredOffError, InputOutputError, InvalidBluetoothAdapterError, UnknownError }</td></tr>
</table></div>
<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="qbluetoothservicediscoveryagent.html#QBluetoothServiceDiscoveryAgent">QBluetoothServiceDiscoveryAgent</a></b>(QObject *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#QBluetoothServiceDiscoveryAgent-1">QBluetoothServiceDiscoveryAgent</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="qbluetoothservicediscoveryagent.html#dtor.QBluetoothServiceDiscoveryAgent">~QBluetoothServiceDiscoveryAgent</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList<QBluetoothServiceInfo> </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#discoveredServices">discoveredServices</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Error </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#error">error</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#errorString">errorString</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#isActive">isActive</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetoothAddress </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#remoteAddress">remoteAddress</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#setRemoteAddress">setRemoteAddress</a></b>(const QBluetoothAddress &<i>address</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#setUuidFilter">setUuidFilter</a></b>(const QList<QBluetoothUuid> &<i>uuids</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#setUuidFilter-1">setUuidFilter</a></b>(const QBluetoothUuid &<i>uuid</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList<QBluetoothUuid> </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#uuidFilter">uuidFilter</a></b>() const</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="qbluetoothservicediscoveryagent.html#clear">clear</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#start">start</a></b>(DiscoveryMode <i>mode</i> = MinimalDiscovery)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.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="qbluetoothservicediscoveryagent.html#canceled">canceled</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#error-1">error</a></b>(QBluetoothServiceDiscoveryAgent::Error <i>error</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#finished">finished</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothservicediscoveryagent.html#serviceDiscovered">serviceDiscovered</a></b>(const QBluetoothServiceInfo &<i>info</i>)</td></tr>
</table></div>
<ul>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">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>
<!-- $$$QBluetoothServiceDiscoveryAgent-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qbluetoothservicediscoveryagent.html">QBluetoothServiceDiscoveryAgent</a> class enables you to query for Bluetooth services.</p>
<p>The discovery process relies on the Bluetooth Service Discovery Process (SDP). The following steps are required to query the services provided by all contactable Bluetooth devices:</p>
<ul>
<li>create an instance of <a href="qbluetoothservicediscoveryagent.html">QBluetoothServiceDiscoveryAgent</a>,</li>
<li>connect to either the <a href="qbluetoothservicediscoveryagent.html#serviceDiscovered">serviceDiscovered</a>() or <a href="qbluetoothservicediscoveryagent.html#finished">finished</a>() signals,</li>
<li>and call <a href="qbluetoothservicediscoveryagent.html#start">start</a>().</li>
</ul>
<pre class="cpp">
<span class="type">void</span> MyClass<span class="operator">::</span>startServiceDiscovery()
{
<span class="comment">// Create a discovery agent and connect to its signals</span>
<span class="type"><a href="qbluetoothservicediscoveryagent.html#QBluetoothServiceDiscoveryAgent">QBluetoothServiceDiscoveryAgent</a></span> <span class="operator">*</span>discoveryAgent <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qbluetoothservicediscoveryagent.html#QBluetoothServiceDiscoveryAgent">QBluetoothServiceDiscoveryAgent</a></span>(<span class="keyword">this</span>);
connect(discoveryAgent<span class="operator">,</span> SIGNAL(serviceDiscovered(<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span>))<span class="operator">,</span>
<span class="keyword">this</span><span class="operator">,</span> SLOT(serviceDiscovered(<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</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>serviceDiscovered(<span class="keyword">const</span> <span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span> <span class="operator">&</span>service)
{
<a href="../qtcore/qtglobal.html#qDebug">qDebug</a>() <span class="operator"><</span><span class="operator"><</span> <span class="string">"Found new service:"</span> <span class="operator"><</span><span class="operator"><</span> service<span class="operator">.</span>serviceName()
<span class="operator"><</span><span class="operator"><</span> <span class="char">'('</span> <span class="operator"><</span><span class="operator"><</span> service<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>By default a minimal service discovery is performed. In this mode, the returned <a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a> objects are guaranteed to contain only device and service UUID information. Depending on platform and device capabilities, other service information may also be available. The minimal service discovery mode relies on cached SDP data of the platform. Therefore it is possible that this discovery does not find a device although it is physically available. In such cases a full discovery must be performed to force an update of the platform cache. However for most use cases a minimal discovery is adequate as it is much quicker and other classes which require up-to-date information such as <a href="qbluetoothsocket.html#connectToService">QBluetoothSocket::connectToService</a>() will perform additional discovery if required. If the full service information is required, pass <a href="qbluetoothservicediscoveryagent.html#DiscoveryMode-enum">FullDiscovery</a> as the discoveryMode parameter to <a href="qbluetoothservicediscoveryagent.html#start">start</a>().</p>
<p>This class may internally utilize <a href="qbluetoothdevicediscoveryagent.html">QBluetoothDeviceDiscoveryAgent</a> to find unknown devices.</p>
<p>The service discovery may find Bluetooth Low Energy services too if the target device is a combination of a classic and Low Energy device. Those devices are required to advertise their Low Energy services via SDP. If the target device only supports Bluetooth Low Energy services, it is likely to not advertise them via SDP. The <a href="qlowenergycontroller.html">QLowEnergyController</a> class should be utilized to perform the service discovery on Low Energy devices.</p>
</div>
<p><b>See also </b><a href="qbluetoothdevicediscoveryagent.html">QBluetoothDeviceDiscoveryAgent</a> and <a href="qlowenergycontroller.html">QLowEnergyController</a>.</p>
<!-- @@@QBluetoothServiceDiscoveryAgent -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$DiscoveryMode$$$MinimalDiscovery$$$FullDiscovery -->
<h3 class="fn" id="DiscoveryMode-enum"><a name="DiscoveryMode-enum"></a>enum QBluetoothServiceDiscoveryAgent::<span class="name">DiscoveryMode</span></h3>
<p>This enum describes the service discovery mode.</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>QBluetoothServiceDiscoveryAgent::MinimalDiscovery</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Performs a minimal service discovery. The <a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a> objects returned may be incomplete and are only guaranteed to contain device and service UUID information. Since a minimal discovery relies on cached SDP data it may not find a physically existing device until a <code>FullDiscovery</code> is performed.</td></tr>
<tr><td class="topAlign"><code>QBluetoothServiceDiscoveryAgent::FullDiscovery</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">Performs a full service discovery.</td></tr>
</table></div>
<!-- @@@DiscoveryMode -->
<!-- $$$Error$$$NoError$$$InputOutputError$$$PoweredOffError$$$InvalidBluetoothAdapterError$$$UnknownError -->
<h3 class="fn" id="Error-enum"><a name="Error-enum"></a>enum QBluetoothServiceDiscoveryAgent::<span class="name">Error</span></h3>
<p>This enum describes errors that can occur during service 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>QBluetoothServiceDiscoveryAgent::NoError</code></td><td class="topAlign tblval"><code>QBluetoothDeviceDiscoveryAgent::NoError</code></td><td class="topAlign">No error has occurred.</td></tr>
<tr><td class="topAlign"><code>QBluetoothServiceDiscoveryAgent::PoweredOffError</code></td><td class="topAlign tblval"><code>QBluetoothDeviceDiscoveryAgent::PoweredOffError</code></td><td class="topAlign">The Bluetooth adaptor is powered off, power it on before doing discovery.</td></tr>
<tr><td class="topAlign"><code>QBluetoothServiceDiscoveryAgent::InputOutputError</code></td><td class="topAlign tblval"><code>QBluetoothDeviceDiscoveryAgent::InputOutputError</code></td><td class="topAlign">Writing or reading from the device resulted in an error.</td></tr>
<tr><td class="topAlign"><code>QBluetoothServiceDiscoveryAgent::InvalidBluetoothAdapterError</code></td><td class="topAlign tblval"><code>QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError</code></td><td class="topAlign">The passed local adapter address does not match the physical adapter address of any local Bluetooth device. This value was introduced by Qt 5.3.</td></tr>
<tr><td class="topAlign"><code>QBluetoothServiceDiscoveryAgent::UnknownError</code></td><td class="topAlign tblval"><code>QBluetoothDeviceDiscoveryAgent::UnknownError</code></td><td class="topAlign">An unknown error has occurred.</td></tr>
</table></div>
<!-- @@@Error -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QBluetoothServiceDiscoveryAgent[overload1]$$$QBluetoothServiceDiscoveryAgentQObject* -->
<h3 class="fn" id="QBluetoothServiceDiscoveryAgent"><a name="QBluetoothServiceDiscoveryAgent"></a>QBluetoothServiceDiscoveryAgent::<span class="name">QBluetoothServiceDiscoveryAgent</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a new <a href="qbluetoothservicediscoveryagent.html">QBluetoothServiceDiscoveryAgent</a> with <i>parent</i>. The search is performed via the local default Bluetooth adapter.</p>
<!-- @@@QBluetoothServiceDiscoveryAgent -->
<!-- $$$QBluetoothServiceDiscoveryAgent$$$QBluetoothServiceDiscoveryAgentconstQBluetoothAddress&QObject* -->
<h3 class="fn" id="QBluetoothServiceDiscoveryAgent-1"><a name="QBluetoothServiceDiscoveryAgent-1"></a>QBluetoothServiceDiscoveryAgent::<span class="name">QBluetoothServiceDiscoveryAgent</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 <a href="qbluetoothservicediscoveryagent.html">QBluetoothServiceDiscoveryAgent</a> for <i>deviceAdapter</i> and with <i>parent</i>.</p>
<p>It uses <i>deviceAdapter</i> for the service search. If <i>deviceAdapter</i> is default constructed the resulting <a href="qbluetoothservicediscoveryagent.html">QBluetoothServiceDiscoveryAgent</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="qbluetoothservicediscoveryagent.html#error">error</a>() will be set to <a href="qbluetoothservicediscoveryagent.html#Error-enum">InvalidBluetoothAdapterError</a>. Therefore it is recommended to test the error flag immediately after using this constructor.</p>
<p><b>Note: </b>On WinRT the passed adapter address will be ignored.</p><p><b>See also </b><a href="qbluetoothservicediscoveryagent.html#error">error</a>().</p>
<!-- @@@QBluetoothServiceDiscoveryAgent -->
<!-- $$$~QBluetoothServiceDiscoveryAgent[overload1]$$$~QBluetoothServiceDiscoveryAgent -->
<h3 class="fn" id="dtor.QBluetoothServiceDiscoveryAgent"><a name="dtor.QBluetoothServiceDiscoveryAgent"></a>QBluetoothServiceDiscoveryAgent::<span class="name">~QBluetoothServiceDiscoveryAgent</span>()</h3>
<p>Destructor for <a href="qbluetoothservicediscoveryagent.html">QBluetoothServiceDiscoveryAgent</a></p>
<!-- @@@~QBluetoothServiceDiscoveryAgent -->
<!-- $$$canceled[overload1]$$$canceled -->
<h3 class="fn" id="canceled"><a name="canceled"></a><code>[signal] </code><span class="type">void</span> QBluetoothServiceDiscoveryAgent::<span class="name">canceled</span>()</h3>
<p>This signal is triggered when the service discovery was canceled via a call to <a href="qbluetoothservicediscoveryagent.html#stop">stop</a>().</p>
<!-- @@@canceled -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn" id="clear"><a name="clear"></a><code>[slot] </code><span class="type">void</span> QBluetoothServiceDiscoveryAgent::<span class="name">clear</span>()</h3>
<p>Clears the results of previous service discoveries and resets <a href="qbluetoothservicediscoveryagent.html#uuidFilter">uuidFilter</a>(). This function does nothing during an ongoing service discovery (see <a href="qbluetoothservicediscoveryagent.html#isActive">isActive</a>()).</p>
<p><b>See also </b><a href="qbluetoothservicediscoveryagent.html#discoveredServices">discoveredServices</a>().</p>
<!-- @@@clear -->
<!-- $$$discoveredServices[overload1]$$$discoveredServices -->
<h3 class="fn" id="discoveredServices"><a name="discoveredServices"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span><<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span>> QBluetoothServiceDiscoveryAgent::<span class="name">discoveredServices</span>() const</h3>
<p>Returns the list of all discovered services.</p>
<p>This list of services accumulates newly discovered services from multiple calls to <a href="qbluetoothservicediscoveryagent.html#start">start</a>(). Unless <a href="qbluetoothservicediscoveryagent.html#clear">clear</a>() is called the list cannot decrease in size. This implies that if a remote Bluetooth device moves out of range in between two subsequent calls to <a href="qbluetoothservicediscoveryagent.html#start">start</a>() the list may contain stale entries.</p>
<p><b>Note: </b>The list of services should always be cleared before the discovery mode is changed.</p><p><b>See also </b><a href="qbluetoothservicediscoveryagent.html#clear">clear</a>().</p>
<!-- @@@discoveredServices -->
<!-- $$$error[overload1]$$$error -->
<h3 class="fn" id="error"><a name="error"></a><span class="type"><a href="qbluetoothservicediscoveryagent.html#Error-enum">Error</a></span> QBluetoothServiceDiscoveryAgent::<span class="name">error</span>() const</h3>
<p>Returns the type of error that last occurred. If the service discovery is done for a single <a href="qbluetoothservicediscoveryagent.html#remoteAddress">remoteAddress</a>() it will return errors that occurred while trying to discover services on that device. If the <a href="qbluetoothservicediscoveryagent.html#remoteAddress">remoteAddress</a>() is not set and devices are discovered by a scan, errors during service discovery on individual devices are not saved and no signals are emitted. In this case, errors are fairly normal as some devices may not respond to discovery or may no longer be in range. Such errors are surpressed. If no services are returned, it can be assumed no services could be discovered.</p>
<!-- @@@error -->
<!-- $$$error$$$errorQBluetoothServiceDiscoveryAgent::Error -->
<h3 class="fn" id="error-1"><a name="error-1"></a><code>[signal] </code><span class="type">void</span> QBluetoothServiceDiscoveryAgent::<span class="name">error</span>(<span class="type"><a href="qbluetoothservicediscoveryagent.html#Error-enum">QBluetoothServiceDiscoveryAgent::Error</a></span> <i>error</i>)</h3>
<p>This signal is emitted when an <i>error</i> occurs. 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(bluetoothServiceDiscoveryAgent<span class="operator">,</span> <span class="keyword">static_cast</span><span class="operator"><</span><span class="type">void</span>(<span class="type"><a href="qbluetoothservicediscoveryagent.html#QBluetoothServiceDiscoveryAgent">QBluetoothServiceDiscoveryAgent</a></span><span class="operator">::</span><span class="operator">*</span>)(<span class="type"><a href="qbluetoothservicediscoveryagent.html#QBluetoothServiceDiscoveryAgent">QBluetoothServiceDiscoveryAgent</a></span><span class="operator">::</span>Error)<span class="operator">></span>(<span class="operator">&</span><span class="type"><a href="qbluetoothservicediscoveryagent.html#QBluetoothServiceDiscoveryAgent">QBluetoothServiceDiscoveryAgent</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="qbluetoothservicediscoveryagent.html#QBluetoothServiceDiscoveryAgent">QBluetoothServiceDiscoveryAgent</a></span><span class="operator">::</span>Error error){ <span class="comment">/* ... */</span> });
</pre>
<!-- @@@error -->
<!-- $$$errorString[overload1]$$$errorString -->
<h3 class="fn" id="errorString"><a name="errorString"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QBluetoothServiceDiscoveryAgent::<span class="name">errorString</span>() const</h3>
<p>Returns a human-readable description of the last error that occurred during the service discovery.</p>
<!-- @@@errorString -->
<!-- $$$finished[overload1]$$$finished -->
<h3 class="fn" id="finished"><a name="finished"></a><code>[signal] </code><span class="type">void</span> QBluetoothServiceDiscoveryAgent::<span class="name">finished</span>()</h3>
<p>This signal is emitted when the Bluetooth service discovery completes.</p>
<p>Unlike the <a href="qbluetoothdevicediscoveryagent.html#finished">QBluetoothDeviceDiscoveryAgent::finished</a>() signal this signal will even be emitted when an error occurred during the service discovery. Therefore it is recommended to check the <a href="qbluetoothservicediscoveryagent.html#error">error</a>() signal to evaluate the success of the service discovery discovery.</p>
<!-- @@@finished -->
<!-- $$$isActive[overload1]$$$isActive -->
<h3 class="fn" id="isActive"><a name="isActive"></a><span class="type">bool</span> QBluetoothServiceDiscoveryAgent::<span class="name">isActive</span>() const</h3>
<p>Returns <code>true</code> if the service discovery is currently active; otherwise returns <code>false</code>. An active discovery can be stopped by calling <a href="qbluetoothservicediscoveryagent.html#stop">stop</a>().</p>
<!-- @@@isActive -->
<!-- $$$remoteAddress[overload1]$$$remoteAddress -->
<h3 class="fn" id="remoteAddress"><a name="remoteAddress"></a><span class="type"><a href="qbluetoothaddress.html">QBluetoothAddress</a></span> QBluetoothServiceDiscoveryAgent::<span class="name">remoteAddress</span>() const</h3>
<p>Returns the remote device address. If <a href="qbluetoothservicediscoveryagent.html#setRemoteAddress">setRemoteAddress</a>() is not called, the function will return a default constructed <a href="qbluetoothaddress.html">QBluetoothAddress</a>.</p>
<p><b>See also </b><a href="qbluetoothservicediscoveryagent.html#setRemoteAddress">setRemoteAddress</a>().</p>
<!-- @@@remoteAddress -->
<!-- $$$serviceDiscovered[overload1]$$$serviceDiscoveredconstQBluetoothServiceInfo& -->
<h3 class="fn" id="serviceDiscovered"><a name="serviceDiscovered"></a><code>[signal] </code><span class="type">void</span> QBluetoothServiceDiscoveryAgent::<span class="name">serviceDiscovered</span>(const <span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span> &<i>info</i>)</h3>
<p>This signal is emitted when the Bluetooth service described by <i>info</i> is discovered.</p>
<p><b>Note: </b>The passed <a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a> parameter may contain a Bluetooth Low Energy service if the target device advertises the service via SDP. This is required from device which support both, classic Bluetooth (BaseRate) and Low Energy services.</p><p><b>See also </b><a href="qbluetoothdeviceinfo.html#coreConfigurations">QBluetoothDeviceInfo::coreConfigurations</a>().</p>
<!-- @@@serviceDiscovered -->
<!-- $$$setRemoteAddress[overload1]$$$setRemoteAddressconstQBluetoothAddress& -->
<h3 class="fn" id="setRemoteAddress"><a name="setRemoteAddress"></a><span class="type">bool</span> QBluetoothServiceDiscoveryAgent::<span class="name">setRemoteAddress</span>(const <span class="type"><a href="qbluetoothaddress.html">QBluetoothAddress</a></span> &<i>address</i>)</h3>
<p>Sets the remote device address to <i>address</i>. If <i>address</i> is default constructed, services will be discovered on all contactable Bluetooth devices. A new remote address can only be set while there is no service discovery in progress; otherwise this function returns false.</p>
<p>On some platforms the service discovery might lead to pairing requests. Therefore it is not recommended to do service discoveries on all devices. This function can be used to restrict the service discovery to a particular device.</p>
<p><b>See also </b><a href="qbluetoothservicediscoveryagent.html#remoteAddress">remoteAddress</a>().</p>
<!-- @@@setRemoteAddress -->
<!-- $$$setUuidFilter[overload1]$$$setUuidFilterconstQList<QBluetoothUuid>& -->
<h3 class="fn" id="setUuidFilter"><a name="setUuidFilter"></a><span class="type">void</span> QBluetoothServiceDiscoveryAgent::<span class="name">setUuidFilter</span>(const <span class="type"><a href="../qtcore/qlist.html">QList</a></span><<span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span>> &<i>uuids</i>)</h3>
<p>Sets the UUID filter to <i>uuids</i>. Only services matching the UUIDs in <i>uuids</i> will be returned. The matching applies to the service's <a href="qbluetoothserviceinfo.html#AttributeId-enum">ServiceId</a> and <a href="qbluetoothserviceinfo.html#AttributeId-enum">ServiceClassIds</a> attributes.</p>
<p>An empty UUID list is equivalent to a list containing only <a href="qbluetoothuuid.html#ServiceClassUuid-enum">QBluetoothUuid::PublicBrowseGroup</a>.</p>
<p><b>See also </b><a href="qbluetoothservicediscoveryagent.html#uuidFilter">uuidFilter</a>().</p>
<!-- @@@setUuidFilter -->
<!-- $$$setUuidFilter$$$setUuidFilterconstQBluetoothUuid& -->
<h3 class="fn" id="setUuidFilter-1"><a name="setUuidFilter-1"></a><span class="type">void</span> QBluetoothServiceDiscoveryAgent::<span class="name">setUuidFilter</span>(const <span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span> &<i>uuid</i>)</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Sets the UUID filter to a list containing the single element <i>uuid</i>. The matching applies to the service's <a href="qbluetoothserviceinfo.html#AttributeId-enum">ServiceId</a> and <a href="qbluetoothserviceinfo.html#AttributeId-enum">ServiceClassIds</a> attributes.</p>
<p><b>See also </b><a href="qbluetoothservicediscoveryagent.html#uuidFilter">uuidFilter</a>().</p>
<!-- @@@setUuidFilter -->
<!-- $$$start[overload1]$$$startDiscoveryMode -->
<h3 class="fn" id="start"><a name="start"></a><code>[slot] </code><span class="type">void</span> QBluetoothServiceDiscoveryAgent::<span class="name">start</span>(<span class="type"><a href="qbluetoothservicediscoveryagent.html#DiscoveryMode-enum">DiscoveryMode</a></span> <i>mode</i> = MinimalDiscovery)</h3>
<p>Starts service discovery. <i>mode</i> specifies the type of service discovery to perform.</p>
<p>On some platforms, device discovery may lead to pairing requests.</p>
<p><b>See also </b><a href="qbluetoothservicediscoveryagent.html#DiscoveryMode-enum">DiscoveryMode</a>.</p>
<!-- @@@start -->
<!-- $$$stop[overload1]$$$stop -->
<h3 class="fn" id="stop"><a name="stop"></a><code>[slot] </code><span class="type">void</span> QBluetoothServiceDiscoveryAgent::<span class="name">stop</span>()</h3>
<p>Stops the service discovery process. The <a href="qbluetoothservicediscoveryagent.html#canceled">canceled</a>() signal will be emitted once the search has stopped.</p>
<!-- @@@stop -->
<!-- $$$uuidFilter[overload1]$$$uuidFilter -->
<h3 class="fn" id="uuidFilter"><a name="uuidFilter"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span><<span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span>> QBluetoothServiceDiscoveryAgent::<span class="name">uuidFilter</span>() const</h3>
<p>Returns the UUID filter.</p>
<p><b>See also </b><a href="qbluetoothservicediscoveryagent.html#setUuidFilter">setUuidFilter</a>().</p>
<!-- @@@uuidFilter -->
</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>
|