Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > 814a2b4c48f3ef6444b2ff5bf854d05a > files > 63

qtconnectivity5-doc-5.12.6-1.mga7.noarch.rpm

<?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.12.6</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.12</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"><a href="qtbluetooth-index.html">Qt 5.12.6 Reference Documentation</a></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 &lt;QBluetoothDeviceDiscoveryAgent&gt;</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></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>
<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> = 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 &amp;<i>deviceAdapter</i>, QObject *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#dtor.QBluetoothDeviceDiscoveryAgent">~QBluetoothDeviceDiscoveryAgent</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QBluetoothDeviceInfo&gt; </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#discoveredDevices">discoveredDevices</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetoothDeviceDiscoveryAgent::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>
<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>(QBluetoothDeviceDiscoveryAgent::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>
<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 &amp;<i>info</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#deviceUpdated">deviceUpdated</a></b>(const QBluetoothDeviceInfo &amp;<i>info</i>, QBluetoothDeviceInfo::Fields <i>updatedFields</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>
<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"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#staticMetaObject-var">staticMetaObject</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetoothDeviceDiscoveryAgent::DiscoveryMethods </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothdevicediscoveryagent.html#supportedDiscoveryMethods">supportedDiscoveryMethods</a></b>()</td></tr>
</table></div>
<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">&gt;</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">&amp;</span>device)
  {
      qDebug() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;Found new device:&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> device<span class="operator">.</span>name() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="char">'('</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> device<span class="operator">.</span>address()<span class="operator">.</span>toString() <span class="operator">&lt;</span><span class="operator">&lt;</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><p><b>Note: </b>Due to API limitations it is only possible to find devices that have been paired using Windows' settings on Windows.</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="">QFlags</a>&lt;DiscoveryMethod&gt;. 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&#x2e;</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&#x2e;</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">QObject</span> *<i>parent</i> = 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> &amp;<i>deviceAdapter</i>, <span class="type">QObject</span> *<i>parent</i> = 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><code>[virtual] </code>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> &amp;<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) and manufacturer data updates. If the use case requires continuous manufacturer data or RSSI updates it is advisable to retrieve the device information via <a href="qbluetoothdevicediscoveryagent.html#discoveredDevices">discoveredDevices</a>() once the discovery has finished or listen to the <a href="qbluetoothdevicediscoveryagent.html#deviceUpdated">deviceUpdated</a>() signal.</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 -->
<!-- $$$deviceUpdated[overload1]$$$deviceUpdatedconstQBluetoothDeviceInfo&QBluetoothDeviceInfo::Fields -->
<h3 class="fn" id="deviceUpdated"><a name="deviceUpdated"></a><code>[signal] </code><span class="type">void</span> QBluetoothDeviceDiscoveryAgent::<span class="name">deviceUpdated</span>(const <span class="type"><a href="qbluetoothdeviceinfo.html">QBluetoothDeviceInfo</a></span> &amp;<i>info</i>, <span class="type"><a href="qbluetoothdeviceinfo.html#Field-enum">QBluetoothDeviceInfo::Fields</a></span> <i>updatedFields</i>)</h3>
<p>This signal is emitted when the agent receives additional information about the Bluetooth device described by <i>info</i>. The <i>updatedFields</i> flags tell which information has been updated.</p>
<p>During discovery, some information can change dynamically, such as <a href="qbluetoothdeviceinfo.html#rssi">signal strength</a> and <a href="qbluetoothdeviceinfo.html#manufacturerData-1">manufacturerData</a>. This signal informs you that if your application is displaying this data, it can be updated, rather than waiting until the discovery has finished.</p>
<p><b>Note: </b>This signal is only emitted on Android and <a href="qtbluetooth-attribution-bluez.html">BlueZ</a> 5.x&#x2e;</p><p><b>See also </b><a href="qbluetoothdeviceinfo.html#rssi">QBluetoothDeviceInfo::rssi</a>() and <a href="qbluetoothdevicediscoveryagent.html#lowEnergyDiscoveryTimeout">lowEnergyDiscoveryTimeout</a>().</p>
<!-- @@@deviceUpdated -->
<!-- $$$discoveredDevices[overload1]$$$discoveredDevices -->
<h3 class="fn" id="discoveredDevices"><a name="discoveredDevices"></a><span class="type">QList</span>&lt;<span class="type"><a href="qbluetoothdeviceinfo.html">QBluetoothDeviceInfo</a></span>&gt; 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">QBluetoothDeviceDiscoveryAgent::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 signal by using the function pointer syntax, Qt provides a convenient helper for obtaining the function pointer as shown in this example:<pre class="cpp">

  connect(bluetoothDeviceDiscoveryAgent<span class="operator">,</span> <span class="type">QOverload</span><span class="operator">&lt;</span><span class="type"><a href="qbluetoothdevicediscoveryagent.html#QBluetoothDeviceDiscoveryAgent">QBluetoothDeviceDiscoveryAgent</a></span><span class="operator">::</span>Error<span class="operator">&gt;</span><span class="operator">::</span>of(<span class="operator">&amp;</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">QString</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$$$startQBluetoothDeviceDiscoveryAgent::DiscoveryMethods -->
<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">QBluetoothDeviceDiscoveryAgent::DiscoveryMethods</a></span> <i>methods</i>)</h3>
<p>Starts 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><b>Note: </b><i>methods</i> only determines the type of discovery and does not imply the filtering of the results. For example, the search may still contain classic bluetooth devices despite <i>methods</i> being set to <a href="qbluetoothdevicediscoveryagent.html#DiscoveryMethod-enum">LowEnergyMethod</a> only. This may happen due to previously cached search results which may be incorporated into the search results.</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">QBluetoothDeviceDiscoveryAgent::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">&copy;</acronym> 2019 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>