/usr/share/qt5/doc/qtbluetooth/qbluetoothserver.html is in qtconnectivity5-doc-html 5.7.1~20161021-2.
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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qbluetoothserver.cpp -->
<title>QBluetoothServer Class | Qt Bluetooth 5.7</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
window.onload = function(){document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");};
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<table><tr>
<td >Qt 5.7</td><td ><a href="qtbluetooth-index.html">Qt Bluetooth</a></td><td ><a href="qtbluetooth-module.html">C++ Classes</a></td><td >QBluetoothServer</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.7.1 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="#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">QBluetoothServer Class</h1>
<!-- $$$QBluetoothServer-brief -->
<p>The <a href="qbluetoothserver.html">QBluetoothServer</a> class uses the RFCOMM or L2cap protocol to communicate with a Bluetooth device. <a href="#details">More...</a></p>
<!-- @@@QBluetoothServer -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QBluetoothServer></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="qbluetoothserver-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="qbluetoothserver.html#Error-enum">Error</a></b> { NoError, UnknownError, PoweredOffError, InputOutputError, ServiceAlreadyRegisteredError, UnsupportedProtocolError }</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="qbluetoothserver.html#QBluetoothServer">QBluetoothServer</a></b>(QBluetoothServiceInfo::Protocol <i>serverType</i>, QObject *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#dtor.QBluetoothServer">~QBluetoothServer</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#close">close</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Error </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#error">error</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#hasPendingConnections">hasPendingConnections</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#isListening">isListening</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#listen">listen</a></b>(const QBluetoothAddress &<i>address</i> = QBluetoothAddress(), quint16 <i>port</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetoothServiceInfo </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#listen-1">listen</a></b>(const QBluetoothUuid &<i>uuid</i>, const QString &<i>serviceName</i> = QString())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#maxPendingConnections">maxPendingConnections</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetoothSocket *</td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#nextPendingConnection">nextPendingConnection</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetooth::SecurityFlags </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#securityFlags">securityFlags</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetoothAddress </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#serverAddress">serverAddress</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> quint16 </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#serverPort">serverPort</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetoothServiceInfo::Protocol </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#serverType">serverType</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#setMaxPendingConnections">setMaxPendingConnections</a></b>(int <i>numConnections</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#setSecurityFlags">setSecurityFlags</a></b>(QBluetooth::SecurityFlags <i>security</i>)</td></tr>
</table></div>
<ul>
<li class="fn">31 public functions inherited from <a href="../qtcore/qobject.html#public-functions">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="qbluetoothserver.html#error-1">error</a></b>(QBluetoothServer::Error <i>error</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothserver.html#newConnection">newConnection</a></b>()</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 slot inherited from <a href="../qtcore/qobject.html#public-slots">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>
<!-- $$$QBluetoothServer-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qbluetoothserver.html">QBluetoothServer</a> class uses the RFCOMM or L2cap protocol to communicate with a Bluetooth device.</p>
<p><a href="qbluetoothserver.html">QBluetoothServer</a> is used to implement Bluetooth services over RFCOMM or L2cap.</p>
<p>Start listening for incoming connections with <a href="qbluetoothserver.html#listen">listen</a>(). Wait till the <a href="qbluetoothserver.html#newConnection">newConnection</a>() signal is emitted when a new connection is established, and call <a href="qbluetoothserver.html#nextPendingConnection">nextPendingConnection</a>() to get a <a href="qbluetoothsocket.html">QBluetoothSocket</a> for the new connection.</p>
<p>To enable other devices to find your service, create a <a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a> with the applicable attributes for your service and register it using <a href="qbluetoothserviceinfo.html#registerService">QBluetoothServiceInfo::registerService</a>(). Call <a href="qbluetoothserver.html#serverPort">serverPort</a>() to get the channel number that is being used.</p>
<p>If the <a href="qbluetoothserviceinfo.html#Protocol-enum">QBluetoothServiceInfo::Protocol</a> is not supported by a platform, <a href="qbluetoothserver.html#listen">listen</a>() will return <code>false</code>.</p>
</div>
<p><b>See also </b><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a> and <a href="qbluetoothsocket.html">QBluetoothSocket</a>.</p>
<!-- @@@QBluetoothServer -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Error$$$NoError$$$UnknownError$$$PoweredOffError$$$InputOutputError$$$ServiceAlreadyRegisteredError$$$UnsupportedProtocolError -->
<h3 class="fn" id="Error-enum"><a name="Error-enum"></a>enum QBluetoothServer::<span class="name">Error</span></h3>
<p>This enum describes Bluetooth server error types.</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>QBluetoothServer::NoError</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">No error.</td></tr>
<tr><td class="topAlign"><code>QBluetoothServer::UnknownError</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">An unknown error occurred.</td></tr>
<tr><td class="topAlign"><code>QBluetoothServer::PoweredOffError</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The Bluetooth adapter is powered off.</td></tr>
<tr><td class="topAlign"><code>QBluetoothServer::InputOutputError</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">An input output error occurred.</td></tr>
<tr><td class="topAlign"><code>QBluetoothServer::ServiceAlreadyRegisteredError</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">The service or port was already registered</td></tr>
<tr><td class="topAlign"><code>QBluetoothServer::UnsupportedProtocolError</code></td><td class="topAlign tblval"><code>5</code></td><td class="topAlign">The <a href="qbluetoothserviceinfo.html#Protocol-enum">Protocol</a> is not supported on this platform.</td></tr>
</table></div>
<!-- @@@Error -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QBluetoothServer[overload1]$$$QBluetoothServerQBluetoothServiceInfo::ProtocolQObject* -->
<h3 class="fn" id="QBluetoothServer"><a name="QBluetoothServer"></a>QBluetoothServer::<span class="name">QBluetoothServer</span>(<span class="type"><a href="qbluetoothserviceinfo.html#Protocol-enum">QBluetoothServiceInfo::Protocol</a></span> <i>serverType</i>, <span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a bluetooth server with <i>parent</i> and <i>serverType</i>.</p>
<!-- @@@QBluetoothServer -->
<!-- $$$~QBluetoothServer[overload1]$$$~QBluetoothServer -->
<h3 class="fn" id="dtor.QBluetoothServer"><a name="dtor.QBluetoothServer"></a>QBluetoothServer::<span class="name">~QBluetoothServer</span>()</h3>
<p>Destroys the bluetooth server.</p>
<!-- @@@~QBluetoothServer -->
<!-- $$$close[overload1]$$$close -->
<h3 class="fn" id="close"><a name="close"></a><span class="type">void</span> QBluetoothServer::<span class="name">close</span>()</h3>
<p>Closes and resets the listening socket. Any already established <a href="qbluetoothsocket.html">QBluetoothSocket</a> continues to operate and must be separately <a href="qbluetoothsocket.html#close">closed</a>.</p>
<!-- @@@close -->
<!-- $$$error[overload1]$$$error -->
<h3 class="fn" id="error"><a name="error"></a><span class="type"><a href="qbluetoothserver.html#Error-enum">Error</a></span> QBluetoothServer::<span class="name">error</span>() const</h3>
<p>Returns the last error of the <a href="qbluetoothserver.html">QBluetoothServer</a>.</p>
<!-- @@@error -->
<!-- $$$error$$$errorQBluetoothServer::Error -->
<h3 class="fn" id="error-1"><a name="error-1"></a><code>[signal] </code><span class="type">void</span> QBluetoothServer::<span class="name">error</span>(<span class="type"><a href="qbluetoothserver.html#Error-enum">QBluetoothServer::Error</a></span> <i>error</i>)</h3>
<p>This signal is emitted when an <i>error</i> occurs.</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(bluetoothServer<span class="operator">,</span> <span class="keyword">static_cast</span><span class="operator"><</span><span class="type">void</span>(<span class="type"><a href="qbluetoothserver.html#QBluetoothServer">QBluetoothServer</a></span><span class="operator">::</span><span class="operator">*</span>)(<span class="type"><a href="qbluetoothserver.html#QBluetoothServer">QBluetoothServer</a></span><span class="operator">::</span>Error)<span class="operator">></span>(<span class="operator">&</span><span class="type"><a href="qbluetoothserver.html#QBluetoothServer">QBluetoothServer</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="qbluetoothserver.html#QBluetoothServer">QBluetoothServer</a></span><span class="operator">::</span>Error error){ <span class="comment">/* ... */</span> });
</pre>
<p><b>See also </b><a href="qbluetoothserver.html#error">error</a>() and <a href="qbluetoothserver.html#Error-enum">QBluetoothServer::Error</a>.</p>
<!-- @@@error -->
<!-- $$$hasPendingConnections[overload1]$$$hasPendingConnections -->
<h3 class="fn" id="hasPendingConnections"><a name="hasPendingConnections"></a><span class="type">bool</span> QBluetoothServer::<span class="name">hasPendingConnections</span>() const</h3>
<p>Returns true if a connection is pending, otherwise false.</p>
<!-- @@@hasPendingConnections -->
<!-- $$$isListening[overload1]$$$isListening -->
<h3 class="fn" id="isListening"><a name="isListening"></a><span class="type">bool</span> QBluetoothServer::<span class="name">isListening</span>() const</h3>
<p>Returns true if the server is listening for incoming connections, otherwise false.</p>
<!-- @@@isListening -->
<!-- $$$listen[overload1]$$$listenconstQBluetoothAddress&quint16 -->
<h3 class="fn" id="listen"><a name="listen"></a><span class="type">bool</span> QBluetoothServer::<span class="name">listen</span>(const <span class="type"><a href="qbluetoothaddress.html">QBluetoothAddress</a></span> &<i>address</i> = QBluetoothAddress(), <span class="type"><a href="../qtcore/qtglobal.html#quint16-typedef">quint16</a></span> <i>port</i> = 0)</h3>
<p>Start listening for incoming connections to <i>address</i> on <i>port</i>. <i>address</i> must be a local Bluetooth adapter address and <i>port</i> must be larger than zero and not be taken already by another Bluetooth server object. It is recommended to avoid setting a port number to enable the system to automatically choose a port.</p>
<p>Returns <code>true</code> if the operation succeeded and the server is listening for incoming connections, otherwise returns <code>false</code>.</p>
<p>If the server object is already listening for incoming connections this function always returns <code>false</code>. <a href="qbluetoothserver.html#close">close</a>() should be called before calling this function.</p>
<p><b>See also </b><a href="qbluetoothserver.html#isListening">isListening</a>() and <a href="qbluetoothserver.html#newConnection">newConnection</a>().</p>
<!-- @@@listen -->
<!-- $$$listen$$$listenconstQBluetoothUuid&constQString& -->
<h3 class="fn" id="listen-1"><a name="listen-1"></a><span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span> QBluetoothServer::<span class="name">listen</span>(const <span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span> &<i>uuid</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>serviceName</i> = QString())</h3>
<p>Convenience function for registering an SPP service with <i>uuid</i> and <i>serviceName</i>. Because this function already registers the service, the <a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a> object which is returned can not be changed any more. To shutdown the server later on it is required to call <a href="qbluetoothserviceinfo.html#unregisterService">QBluetoothServiceInfo::unregisterService</a>() and <a href="qbluetoothserver.html#close">close</a>() on this server object.</p>
<p>Returns a registered <a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a> instance if sucessful otherwise an invalid <a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a>. This function always assumes that the default Bluetooth adapter should be used.</p>
<p>If the server object is already listening for incoming connections this function returns an invalid <a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a>.</p>
<p>For an RFCOMM server this function is equivalent to following code snippet.</p>
<pre class="cpp">
<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span> serviceInfo;
serviceInfo<span class="operator">.</span>setAttribute(<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span><span class="operator">::</span>ServiceName<span class="operator">,</span> serviceName);
<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span><span class="operator">::</span>Sequence browseSequence;
browseSequence <span class="operator"><</span><span class="operator"><</span> <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span><span class="operator">::</span>fromValue(<span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span>(<span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span><span class="operator">::</span>PublicBrowseGroup));
serviceInfo<span class="operator">.</span>setAttribute(<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span><span class="operator">::</span>BrowseGroupList<span class="operator">,</span>
browseSequence);
<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span><span class="operator">::</span>Sequence classId;
classId <span class="operator"><</span><span class="operator"><</span> <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span><span class="operator">::</span>fromValue(<span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span>(<span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span><span class="operator">::</span>SerialPort));
serviceInfo<span class="operator">.</span>setAttribute(<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span><span class="operator">::</span>BluetoothProfileDescriptorList<span class="operator">,</span>
classId);
<span class="comment">//Android requires custom uuid to be set as service class</span>
classId<span class="operator">.</span>prepend(<span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span><span class="operator">::</span>fromValue(uuid));
serviceInfo<span class="operator">.</span>setAttribute(<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span><span class="operator">::</span>ServiceClassIds<span class="operator">,</span> classId);
serviceInfo<span class="operator">.</span>setServiceUuid(uuid);
<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span><span class="operator">::</span>Sequence protocolDescriptorList;
<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span><span class="operator">::</span>Sequence protocol;
protocol <span class="operator"><</span><span class="operator"><</span> <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span><span class="operator">::</span>fromValue(<span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span>(<span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span><span class="operator">::</span>L2cap));
<span class="keyword">if</span> (d<span class="operator">-</span><span class="operator">></span>serverType <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span><span class="operator">::</span>L2capProtocol)
protocol <span class="operator"><</span><span class="operator"><</span> <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span><span class="operator">::</span>fromValue(serverPort());
protocolDescriptorList<span class="operator">.</span>append(<span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span><span class="operator">::</span>fromValue(protocol));
protocol<span class="operator">.</span>clear();
protocol <span class="operator"><</span><span class="operator"><</span> <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span><span class="operator">::</span>fromValue(<span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span>(<span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span><span class="operator">::</span>Rfcomm))
<span class="operator"><</span><span class="operator"><</span> <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span><span class="operator">::</span>fromValue(<span class="type"><a href="../qtcore/qtglobal.html#quint8-typedef">quint8</a></span>(serverPort()));
protocolDescriptorList<span class="operator">.</span>append(<span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span><span class="operator">::</span>fromValue(protocol));
serviceInfo<span class="operator">.</span>setAttribute(<span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span><span class="operator">::</span>ProtocolDescriptorList<span class="operator">,</span>
protocolDescriptorList);
bool result <span class="operator">=</span> serviceInfo<span class="operator">.</span>registerService();
</pre>
<p><b>See also </b><a href="qbluetoothserver.html#isListening">isListening</a>(), <a href="qbluetoothserver.html#newConnection">newConnection</a>(), and <a href="qbluetoothserver.html#listen">listen</a>().</p>
<!-- @@@listen -->
<!-- $$$maxPendingConnections[overload1]$$$maxPendingConnections -->
<h3 class="fn" id="maxPendingConnections"><a name="maxPendingConnections"></a><span class="type">int</span> QBluetoothServer::<span class="name">maxPendingConnections</span>() const</h3>
<p>Returns the maximum number of pending connections.</p>
<p><b>See also </b><a href="qbluetoothserver.html#setMaxPendingConnections">setMaxPendingConnections</a>().</p>
<!-- @@@maxPendingConnections -->
<!-- $$$newConnection[overload1]$$$newConnection -->
<h3 class="fn" id="newConnection"><a name="newConnection"></a><code>[signal] </code><span class="type">void</span> QBluetoothServer::<span class="name">newConnection</span>()</h3>
<p>This signal is emitted when a new connection is available.</p>
<p>The connected slot should call <a href="qbluetoothserver.html#nextPendingConnection">nextPendingConnection</a>() to get a <a href="qbluetoothsocket.html">QBluetoothSocket</a> object to send and receive data over the connection.</p>
<p><b>See also </b><a href="qbluetoothserver.html#nextPendingConnection">nextPendingConnection</a>() and <a href="qbluetoothserver.html#hasPendingConnections">hasPendingConnections</a>().</p>
<!-- @@@newConnection -->
<!-- $$$nextPendingConnection[overload1]$$$nextPendingConnection -->
<h3 class="fn" id="nextPendingConnection"><a name="nextPendingConnection"></a><span class="type"><a href="qbluetoothsocket.html">QBluetoothSocket</a></span> *QBluetoothServer::<span class="name">nextPendingConnection</span>()</h3>
<p>Returns a pointer to the <a href="qbluetoothsocket.html">QBluetoothSocket</a> for the next pending connection. It is the callers responsibility to delete the pointer.</p>
<!-- @@@nextPendingConnection -->
<!-- $$$securityFlags[overload1]$$$securityFlags -->
<h3 class="fn" id="securityFlags"><a name="securityFlags"></a><span class="type"><a href="qbluetooth.html#Security-enum">QBluetooth::SecurityFlags</a></span> QBluetoothServer::<span class="name">securityFlags</span>() const</h3>
<p>Returns the Bluetooth security flags.</p>
<p><b>See also </b><a href="qbluetoothserver.html#setSecurityFlags">setSecurityFlags</a>().</p>
<!-- @@@securityFlags -->
<!-- $$$serverAddress[overload1]$$$serverAddress -->
<h3 class="fn" id="serverAddress"><a name="serverAddress"></a><span class="type"><a href="qbluetoothaddress.html">QBluetoothAddress</a></span> QBluetoothServer::<span class="name">serverAddress</span>() const</h3>
<p>Returns the server address.</p>
<!-- @@@serverAddress -->
<!-- $$$serverPort[overload1]$$$serverPort -->
<h3 class="fn" id="serverPort"><a name="serverPort"></a><span class="type"><a href="../qtcore/qtglobal.html#quint16-typedef">quint16</a></span> QBluetoothServer::<span class="name">serverPort</span>() const</h3>
<p>Returns the server port number.</p>
<!-- @@@serverPort -->
<!-- $$$serverType[overload1]$$$serverType -->
<h3 class="fn" id="serverType"><a name="serverType"></a><span class="type"><a href="qbluetoothserviceinfo.html#Protocol-enum">QBluetoothServiceInfo::Protocol</a></span> QBluetoothServer::<span class="name">serverType</span>() const</h3>
<p>Returns the type of the <a href="qbluetoothserver.html">QBluetoothServer</a>.</p>
<!-- @@@serverType -->
<!-- $$$setMaxPendingConnections[overload1]$$$setMaxPendingConnectionsint -->
<h3 class="fn" id="setMaxPendingConnections"><a name="setMaxPendingConnections"></a><span class="type">void</span> QBluetoothServer::<span class="name">setMaxPendingConnections</span>(<span class="type">int</span> <i>numConnections</i>)</h3>
<p>Sets the maximum number of pending connections to <i>numConnections</i>. If the number of pending sockets exceeds this limit new sockets will be rejected.</p>
<p><b>See also </b><a href="qbluetoothserver.html#maxPendingConnections">maxPendingConnections</a>().</p>
<!-- @@@setMaxPendingConnections -->
<!-- $$$setSecurityFlags[overload1]$$$setSecurityFlagsQBluetooth::SecurityFlags -->
<h3 class="fn" id="setSecurityFlags"><a name="setSecurityFlags"></a><span class="type">void</span> QBluetoothServer::<span class="name">setSecurityFlags</span>(<span class="type"><a href="qbluetooth.html#Security-enum">QBluetooth::SecurityFlags</a></span> <i>security</i>)</h3>
<p>Sets the Bluetooth security flags to <i>security</i>. This function must be called before calling <a href="qbluetoothserver.html#listen">listen</a>(). The Bluetooth link will always be encrypted when using Bluetooth 2.1 devices as encryption is mandatory.</p>
<p>Android only supports two levels of security (secure and non-secure). If this flag is set to <a href="qbluetooth.html#Security-enum">QBluetooth::NoSecurity</a> the server object will not employ any authentication or encryption. Any other security flag combination will trigger a secure Bluetooth connection.</p>
<p>On macOS, security flags are not supported and will be ignored.</p>
<p><b>See also </b><a href="qbluetoothserver.html#securityFlags">securityFlags</a>().</p>
<!-- @@@setSecurityFlags -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2016 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>
|