/usr/share/qt5/doc/qtbluetooth/qbluetoothsocket.html is in qtconnectivity5-doc-html 5.5.1-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qbluetoothsocket.cpp -->
<title>QBluetoothSocket Class | Qt Bluetooth 5.5</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li>Qt 5.5</li>
<li><a href="qtbluetooth-index.html">Qt Bluetooth</a></li>
<li><a href="qtbluetooth-module.html">C++ Classes</a></li>
<li>QBluetoothSocket</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
</ul>
</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="#reimplemented-public-functions">Reimplemented Public Functions</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</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">QBluetoothSocket Class</h1>
<!-- $$$QBluetoothSocket-brief -->
<p>The <a href="qbluetoothsocket.html">QBluetoothSocket</a> class enables connection to a Bluetooth device running a bluetooth server. <a href="#details">More...</a></p>
<!-- @@@QBluetoothSocket -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QBluetoothSocket></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/qiodevice.html">QIODevice</a></td></tr></table></div><ul>
<li><a href="qbluetoothsocket-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="qbluetoothsocket.html#SocketError-enum">SocketError</a></b> { UnknownSocketError, NoSocketError, HostNotFoundError, ServiceNotFoundError, ..., OperationError }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#SocketState-enum">SocketState</a></b> { UnconnectedState, ServiceLookupState, ConnectingState, ConnectedState, ..., ListeningState }</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="qbluetoothsocket.html#QBluetoothSocket">QBluetoothSocket</a></b>(QBluetoothServiceInfo::Protocol<i> socketType</i>, QObject *<i> parent</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#QBluetoothSocket-2">QBluetoothSocket</a></b>(QObject *<i> parent</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#dtor.QBluetoothSocket">~QBluetoothSocket</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#abort">abort</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#connectToService">connectToService</a></b>(const QBluetoothServiceInfo &<i> service</i>, OpenMode<i> openMode</i> = ReadWrite)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#connectToService-2">connectToService</a></b>(const QBluetoothAddress &<i> address</i>, const QBluetoothUuid &<i> uuid</i>, OpenMode<i> openMode</i> = ReadWrite)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#connectToService-3">connectToService</a></b>(const QBluetoothAddress &<i> address</i>, quint16<i> port</i>, OpenMode<i> openMode</i> = ReadWrite)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#disconnectFromService">disconnectFromService</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> SocketError </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#error">error</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#errorString">errorString</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetoothAddress </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#localAddress">localAddress</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#localName">localName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> quint16 </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#localPort">localPort</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetoothAddress </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#peerAddress">peerAddress</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#peerName">peerName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> quint16 </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#peerPort">peerPort</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#setSocketDescriptor">setSocketDescriptor</a></b>(int<i> socketDescriptor</i>, QBluetoothServiceInfo::Protocol<i> socketType</i>, SocketState<i> socketState</i> = ConnectedState, OpenMode<i> openMode</i> = ReadWrite)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#socketDescriptor">socketDescriptor</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBluetoothServiceInfo::Protocol </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#socketType">socketType</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> SocketState </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#state">state</a></b>() const</td></tr>
</table></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#bytesAvailable">bytesAvailable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#bytesToWrite">bytesToWrite</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#canReadLine">canReadLine</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#close">close</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#isSequential">isSequential</a></b>() const</td></tr>
</table></div>
<ul>
<li class="fn">33 public functions inherited from <a href="../qtcore/qiodevice.html#public-functions">QIODevice</a></li>
<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="qbluetoothsocket.html#connected">connected</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#disconnected">disconnected</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#error-2">error</a></b>(QBluetoothSocket::SocketError<i> error</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#stateChanged">stateChanged</a></b>(QBluetoothSocket::SocketState<i> state</i>)</td></tr>
</table></div>
<ul>
<li class="fn">4 signals inherited from <a href="../qtcore/qiodevice.html#signals">QIODevice</a></li>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2 id="protected-functions">Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#doDeviceDiscovery">doDeviceDiscovery</a></b>(const QBluetoothServiceInfo &<i> service</i>, OpenMode<i> openMode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#setSocketError">setSocketError</a></b>(SocketError<i> error_</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#setSocketState">setSocketState</a></b>(SocketState<i> state</i>)</td></tr>
</table></div>
<a name="reimplemented-protected-functions"></a>
<h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#readData">readData</a></b>(char *<i> data</i>, qint64<i> maxSize</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qbluetoothsocket.html#writeData">writeData</a></b>(const char *<i> data</i>, qint64<i> maxSize</i>)</td></tr>
</table></div>
<ul>
<li class="fn">5 protected functions inherited from <a href="../qtcore/qiodevice.html#protected-functions">QIODevice</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">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">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QBluetoothSocket-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qbluetoothsocket.html">QBluetoothSocket</a> class enables connection to a Bluetooth device running a bluetooth server.</p>
<p><a href="qbluetoothsocket.html">QBluetoothSocket</a> supports two socket types, <a href="qbluetoothserviceinfo.html#Protocol-enum">L2CAP</a> and <a href="qbluetoothserviceinfo.html#Protocol-enum">RFCOMM</a>.</p>
<p><a href="qbluetoothserviceinfo.html#Protocol-enum">L2CAP</a> is a low level datagram-oriented Bluetooth socket. Android and BlackBerry do not support <a href="qbluetoothserviceinfo.html#Protocol-enum">L2CAP</a> for socket connections.</p>
<p><a href="qbluetoothserviceinfo.html#Protocol-enum">RFCOMM</a> is a reliable, stream-oriented socket. RFCOMM sockets emulate an RS-232 serial port.</p>
<p>To create a connection to a Bluetooth service, create a socket of the appropriate type and call <a href="qbluetoothsocket.html#connectToService">connectToService</a>() passing the Bluetooth address and port number. <a href="qbluetoothsocket.html">QBluetoothSocket</a> will emit the <a href="qbluetoothsocket.html#connected">connected</a>() signal when the connection is established.</p>
<p>If the <a href="qbluetoothserviceinfo.html#Protocol-enum">Protocol</a> is not supported on a platform, calling <a href="qbluetoothsocket.html#connectToService">connectToService</a>() will emit a <a href="qbluetoothsocket.html#SocketError-enum">UnsupportedProtocolError</a> error.</p>
</div>
<!-- @@@QBluetoothSocket -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$SocketError$$$NoSocketError$$$UnknownSocketError$$$HostNotFoundError$$$ServiceNotFoundError$$$NetworkError$$$UnsupportedProtocolError$$$OperationError -->
<h3 class="fn" id="SocketError-enum"><a name="SocketError-enum"></a>enum QBluetoothSocket::<span class="name">SocketError</span></h3>
<p>This enum describes Bluetooth socket 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>QBluetoothSocket::UnknownSocketError</code></td><td class="topAlign"><code>QAbstractSocket::UnknownSocketError</code></td><td class="topAlign">An unknown error has occurred.</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::NoSocketError</code></td><td class="topAlign"><code>-2</code></td><td class="topAlign">No error. Used for testing.</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::HostNotFoundError</code></td><td class="topAlign"><code>QAbstractSocket::HostNotFoundError</code></td><td class="topAlign">Could not find the remote host.</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::ServiceNotFoundError</code></td><td class="topAlign"><code>QAbstractSocket::SocketAddressNotAvailableError</code></td><td class="topAlign">Could not find the service UUID on remote host.</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::NetworkError</code></td><td class="topAlign"><code>QAbstractSocket::NetworkError</code></td><td class="topAlign">Attempt to read or write from socket returned an error</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::UnsupportedProtocolError</code></td><td class="topAlign"><code>8</code></td><td class="topAlign">The <a href="qbluetoothserviceinfo.html#Protocol-enum">Protocol</a> is not supported on this platform.</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::OperationError</code></td><td class="topAlign"><code>QAbstractSocket::OperationError</code></td><td class="topAlign">An operation was attempted while the socket was in a state that did not permit it.</td></tr>
</table></div>
<!-- @@@SocketError -->
<!-- $$$SocketState$$$UnconnectedState$$$ServiceLookupState$$$ConnectingState$$$ConnectedState$$$BoundState$$$ClosingState$$$ListeningState -->
<h3 class="fn" id="SocketState-enum"><a name="SocketState-enum"></a>enum QBluetoothSocket::<span class="name">SocketState</span></h3>
<p>This enum describes the state of the Bluetooth socket.</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>QBluetoothSocket::UnconnectedState</code></td><td class="topAlign"><code>QAbstractSocket::UnconnectedState</code></td><td class="topAlign">Socket is not connected.</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::ServiceLookupState</code></td><td class="topAlign"><code>QAbstractSocket::HostLookupState</code></td><td class="topAlign">Socket is querying connection parameters.</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::ConnectingState</code></td><td class="topAlign"><code>QAbstractSocket::ConnectingState</code></td><td class="topAlign">Socket is attempting to connect to a device.</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::ConnectedState</code></td><td class="topAlign"><code>QAbstractSocket::ConnectedState</code></td><td class="topAlign">Socket is connected to a device.</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::BoundState</code></td><td class="topAlign"><code>QAbstractSocket::BoundState</code></td><td class="topAlign">Socket is bound to a local address and port.</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::ClosingState</code></td><td class="topAlign"><code>QAbstractSocket::ClosingState</code></td><td class="topAlign">Socket is connected and will be closed once all pending data is written to the socket.</td></tr>
<tr><td class="topAlign"><code>QBluetoothSocket::ListeningState</code></td><td class="topAlign"><code>QAbstractSocket::ListeningState</code></td><td class="topAlign">Socket is listening for incoming connections.</td></tr>
</table></div>
<!-- @@@SocketState -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QBluetoothSocket[overload1]$$$QBluetoothSocketQBluetoothServiceInfo::ProtocolQObject* -->
<h3 class="fn" id="QBluetoothSocket"><a name="QBluetoothSocket"></a>QBluetoothSocket::<span class="name">QBluetoothSocket</span>(<span class="type"><a href="qbluetoothserviceinfo.html#Protocol-enum">QBluetoothServiceInfo::Protocol</a></span><i> socketType</i>, <span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i> parent</i> = 0)</h3>
<p>Constructs a Bluetooth socket of <i>socketType</i> type, with <i>parent</i>.</p>
<!-- @@@QBluetoothSocket -->
<!-- $$$QBluetoothSocket$$$QBluetoothSocketQObject* -->
<h3 class="fn" id="QBluetoothSocket-2"><a name="QBluetoothSocket-2"></a>QBluetoothSocket::<span class="name">QBluetoothSocket</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i> parent</i> = 0)</h3>
<p>Constructs a Bluetooth socket with <i>parent</i>.</p>
<!-- @@@QBluetoothSocket -->
<!-- $$$~QBluetoothSocket[overload1]$$$~QBluetoothSocket -->
<h3 class="fn" id="dtor.QBluetoothSocket"><a name="dtor.QBluetoothSocket"></a><code>[virtual] </code>QBluetoothSocket::<span class="name">~QBluetoothSocket</span>()</h3>
<p>Destroys the Bluetooth socket.</p>
<!-- @@@~QBluetoothSocket -->
<!-- $$$abort[overload1]$$$abort -->
<h3 class="fn" id="abort"><a name="abort"></a><span class="type">void</span> QBluetoothSocket::<span class="name">abort</span>()</h3>
<p>Aborts the current connection and resets the socket. Unlike <a href="qbluetoothsocket.html#disconnectFromService">disconnectFromService</a>(), this function immediately closes the socket, discarding any pending data in the write buffer.</p>
<p><b>Note: </b>On Android, aborting the socket requires asynchronous interaction with Android threads. Therefore the associated <a href="qbluetoothsocket.html#disconnected">disconnected</a>() and <a href="qbluetoothsocket.html#stateChanged">stateChanged</a>() signals are delayed until the threads have finished the closure.</p><p><b>See also </b><a href="qbluetoothsocket.html#disconnectFromService">disconnectFromService</a>() and <a href="qbluetoothsocket.html#close">close</a>().</p>
<!-- @@@abort -->
<!-- $$$bytesAvailable[overload1]$$$bytesAvailable -->
<h3 class="fn" id="bytesAvailable"><a name="bytesAvailable"></a><code>[virtual] </code><span class="type"><a href="../qtcore/qtglobal.html#qint64-typedef">qint64</a></span> QBluetoothSocket::<span class="name">bytesAvailable</span>() const</h3>
<p>Reimplemented from <a href="../qtcore/qiodevice.html#bytesAvailable">QIODevice::bytesAvailable</a>().</p>
<p>Returns the number of incoming bytes that are waiting to be read.</p>
<p><b>See also </b><a href="qbluetoothsocket.html#bytesToWrite">bytesToWrite</a>() and <a href="../qtcore/qiodevice.html#read">read</a>().</p>
<!-- @@@bytesAvailable -->
<!-- $$$bytesToWrite[overload1]$$$bytesToWrite -->
<h3 class="fn" id="bytesToWrite"><a name="bytesToWrite"></a><code>[virtual] </code><span class="type"><a href="../qtcore/qtglobal.html#qint64-typedef">qint64</a></span> QBluetoothSocket::<span class="name">bytesToWrite</span>() const</h3>
<p>Reimplemented from <a href="../qtcore/qiodevice.html#bytesToWrite">QIODevice::bytesToWrite</a>().</p>
<p>Returns the number of bytes that are waiting to be written. The bytes are written when control goes back to the event loop.</p>
<!-- @@@bytesToWrite -->
<!-- $$$canReadLine[overload1]$$$canReadLine -->
<h3 class="fn" id="canReadLine"><a name="canReadLine"></a><code>[virtual] </code><span class="type">bool</span> QBluetoothSocket::<span class="name">canReadLine</span>() const</h3>
<p>Reimplemented from <a href="../qtcore/qiodevice.html#canReadLine">QIODevice::canReadLine</a>().</p>
<p>Returns true if you can read at least one line from the device</p>
<!-- @@@canReadLine -->
<!-- $$$close[overload1]$$$close -->
<h3 class="fn" id="close"><a name="close"></a><code>[virtual] </code><span class="type">void</span> QBluetoothSocket::<span class="name">close</span>()</h3>
<p>Reimplemented from <a href="../qtcore/qiodevice.html#close">QIODevice::close</a>().</p>
<p>Disconnects the socket's connection with the device.</p>
<p><b>Note: </b>On Android, closing the socket requires asynchronous interaction with Android threads. Therefore the associated <a href="qbluetoothsocket.html#disconnected">disconnected</a>() and <a href="qbluetoothsocket.html#stateChanged">stateChanged</a>() signals are delayed until the threads have finished the closure.</p><!-- @@@close -->
<!-- $$$connectToService[overload1]$$$connectToServiceconstQBluetoothServiceInfo&OpenMode -->
<h3 class="fn" id="connectToService"><a name="connectToService"></a><span class="type">void</span> QBluetoothSocket::<span class="name">connectToService</span>(const <span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span> &<i> service</i>, <span class="type"><a href="../qtcore/qiodevice.html#OpenModeFlag-enum">OpenMode</a></span><i> openMode</i> = ReadWrite)</h3>
<p>Attempts to connect to the service described by <i>service</i>.</p>
<p>The socket is opened in the given <i>openMode</i>. The <a href="qbluetoothsocket.html#socketType">socketType</a>() may change depending on the protocol required by <i>service</i>.</p>
<p>The socket first enters <a href="qbluetoothsocket.html#SocketState-enum">ConnectingState</a> and attempts to connect to the device providing <i>service</i>. If a connection is established, <a href="qbluetoothsocket.html">QBluetoothSocket</a> enters <a href="qbluetoothsocket.html#SocketState-enum">ConnectedState</a> and emits <a href="qbluetoothsocket.html#connected">connected</a>().</p>
<p>At any point, the socket can emit <a href="qbluetoothsocket.html#error">error</a>() to signal that an error occurred.</p>
<p>Note that most platforms require a pairing prior to connecting to the remote device. Otherwise the connection process may fail.</p>
<p><b>See also </b><a href="qbluetoothsocket.html#state">state</a>() and <a href="qbluetoothsocket.html#disconnectFromService">disconnectFromService</a>().</p>
<!-- @@@connectToService -->
<!-- $$$connectToService$$$connectToServiceconstQBluetoothAddress&constQBluetoothUuid&OpenMode -->
<h3 class="fn" id="connectToService-2"><a name="connectToService-2"></a><span class="type">void</span> QBluetoothSocket::<span class="name">connectToService</span>(const <span class="type"><a href="qbluetoothaddress.html">QBluetoothAddress</a></span> &<i> address</i>, const <span class="type"><a href="qbluetoothuuid.html">QBluetoothUuid</a></span> &<i> uuid</i>, <span class="type"><a href="../qtcore/qiodevice.html#OpenModeFlag-enum">OpenMode</a></span><i> openMode</i> = ReadWrite)</h3>
<p>Attempts to make a connection to the service identified by <i>uuid</i> on the device with address <i>address</i>.</p>
<p>The socket is opened in the given <i>openMode</i>.</p>
<p>For BlueZ, the socket first enters the <a href="qbluetoothsocket.html#SocketState-enum">ServiceLookupState</a> and queries the connection parameters for <i>uuid</i>. If the service parameters are successfully retrieved the socket enters <a href="qbluetoothsocket.html#SocketState-enum">ConnectingState</a>, and attempts to connect to <i>address</i>. If a connection is established, <a href="qbluetoothsocket.html">QBluetoothSocket</a> enters Connected State and emits <a href="qbluetoothsocket.html#connected">connected</a>().</p>
<p>On BlackBerry and Android, the service connection can directly be established using the UUID of the remote service. Therefore these platforms do not require the <a href="qbluetoothsocket.html#SocketState-enum">ServiceLookupState</a> and <a href="qbluetoothsocket.html#socketType">socketType</a>() is always set to <a href="qbluetoothserviceinfo.html#Protocol-enum">QBluetoothServiceInfo::RfcommProtocol</a>.</p>
<p>At any point, the socket can emit <a href="qbluetoothsocket.html#error">error</a>() to signal that an error occurred.</p>
<p>Note that most platforms require a pairing prior to connecting to the remote device. Otherwise the connection process may fail.</p>
<p><b>See also </b><a href="qbluetoothsocket.html#state">state</a>() and <a href="qbluetoothsocket.html#disconnectFromService">disconnectFromService</a>().</p>
<!-- @@@connectToService -->
<!-- $$$connectToService$$$connectToServiceconstQBluetoothAddress&quint16OpenMode -->
<h3 class="fn" id="connectToService-3"><a name="connectToService-3"></a><span class="type">void</span> QBluetoothSocket::<span class="name">connectToService</span>(const <span class="type"><a href="qbluetoothaddress.html">QBluetoothAddress</a></span> &<i> address</i>, <span class="type"><a href="../qtcore/qtglobal.html#quint16-typedef">quint16</a></span><i> port</i>, <span class="type"><a href="../qtcore/qiodevice.html#OpenModeFlag-enum">OpenMode</a></span><i> openMode</i> = ReadWrite)</h3>
<p>Attempts to make a connection with <i>address</i> on the given <i>port</i>.</p>
<p>The socket is opened in the given <i>openMode</i>.</p>
<p>The socket first enters <a href="qbluetoothsocket.html#SocketState-enum">ConnectingState</a>, and attempts to connect to <i>address</i>. If a connection is established, <a href="qbluetoothsocket.html">QBluetoothSocket</a> enters <a href="qbluetoothsocket.html#SocketState-enum">ConnectedState</a> and emits <a href="qbluetoothsocket.html#connected">connected</a>().</p>
<p>At any point, the socket can emit <a href="qbluetoothsocket.html#error">error</a>() to signal that an error occurred.</p>
<p>On BlackBerry and Android, a connection to a service can not be established using a port. Calling this function will emit a <a href="qbluetoothsocket.html#SocketError-enum">ServiceNotFoundError</a></p>
<p>Note that most platforms require a pairing prior to connecting to the remote device. Otherwise the connection process may fail.</p>
<p><b>See also </b><a href="qbluetoothsocket.html#state">state</a>() and <a href="qbluetoothsocket.html#disconnectFromService">disconnectFromService</a>().</p>
<!-- @@@connectToService -->
<!-- $$$connected[overload1]$$$connected -->
<h3 class="fn" id="connected"><a name="connected"></a><code>[signal] </code><span class="type">void</span> QBluetoothSocket::<span class="name">connected</span>()</h3>
<p>This signal is emitted when a connection is established.</p>
<p><b>See also </b><a href="qbluetoothsocket.html#SocketState-enum">QBluetoothSocket::ConnectedState</a> and <a href="qbluetoothsocket.html#stateChanged">stateChanged</a>().</p>
<!-- @@@connected -->
<!-- $$$disconnectFromService[overload1]$$$disconnectFromService -->
<h3 class="fn" id="disconnectFromService"><a name="disconnectFromService"></a><span class="type">void</span> QBluetoothSocket::<span class="name">disconnectFromService</span>()</h3>
<p>Attempts to close the socket. If there is pending data waiting to be written <a href="qbluetoothsocket.html">QBluetoothSocket</a> will enter <a href="qbluetoothsocket.html#SocketState-enum">ClosingState</a> and wait until all data has been written. Eventually, it will enter <a href="qbluetoothsocket.html#SocketState-enum">UnconnectedState</a> and emit the <a href="qbluetoothsocket.html#disconnected">disconnected</a>() signal.</p>
<p><b>See also </b><a href="qbluetoothsocket.html#connectToService">connectToService</a>().</p>
<!-- @@@disconnectFromService -->
<!-- $$$disconnected[overload1]$$$disconnected -->
<h3 class="fn" id="disconnected"><a name="disconnected"></a><code>[signal] </code><span class="type">void</span> QBluetoothSocket::<span class="name">disconnected</span>()</h3>
<p>This signal is emitted when the socket is disconnected.</p>
<p><b>See also </b><a href="qbluetoothsocket.html#SocketState-enum">QBluetoothSocket::UnconnectedState</a> and <a href="qbluetoothsocket.html#stateChanged">stateChanged</a>().</p>
<!-- @@@disconnected -->
<!-- $$$doDeviceDiscovery[overload1]$$$doDeviceDiscoveryconstQBluetoothServiceInfo&OpenMode -->
<h3 class="fn" id="doDeviceDiscovery"><a name="doDeviceDiscovery"></a><code>[protected] </code><span class="type">void</span> QBluetoothSocket::<span class="name">doDeviceDiscovery</span>(const <span class="type"><a href="qbluetoothserviceinfo.html">QBluetoothServiceInfo</a></span> &<i> service</i>, <span class="type"><a href="../qtcore/qiodevice.html#OpenModeFlag-enum">OpenMode</a></span><i> openMode</i>)</h3>
<p>Start device discovery for <i>service</i> and open the socket with <i>openMode</i>. If the socket is created with a service uuid device address, use service discovery to find the port number to connect to.</p>
<!-- @@@doDeviceDiscovery -->
<!-- $$$error[overload1]$$$error -->
<h3 class="fn" id="error"><a name="error"></a><span class="type"><a href="qbluetoothsocket.html#SocketError-enum">SocketError</a></span> QBluetoothSocket::<span class="name">error</span>() const</h3>
<p>Returns the last error.</p>
<!-- @@@error -->
<!-- $$$error$$$errorQBluetoothSocket::SocketError -->
<h3 class="fn" id="error-2"><a name="error-2"></a><code>[signal] </code><span class="type">void</span> QBluetoothSocket::<span class="name">error</span>(<span class="type"><a href="qbluetoothsocket.html#SocketError-enum">QBluetoothSocket::SocketError</a></span><i> error</i>)</h3>
<p>This signal is emitted when an <i>error</i> occurs.</p>
<p><b>See also </b><a href="qbluetoothsocket.html#error">error</a>().</p>
<!-- @@@error -->
<!-- $$$errorString[overload1]$$$errorString -->
<h3 class="fn" id="errorString"><a name="errorString"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QBluetoothSocket::<span class="name">errorString</span>() const</h3>
<p>Returns a user displayable text string for the error.</p>
<!-- @@@errorString -->
<!-- $$$isSequential[overload1]$$$isSequential -->
<h3 class="fn" id="isSequential"><a name="isSequential"></a><code>[virtual] </code><span class="type">bool</span> QBluetoothSocket::<span class="name">isSequential</span>() const</h3>
<p>Reimplemented from <a href="../qtcore/qiodevice.html#isSequential">QIODevice::isSequential</a>().</p>
<!-- @@@isSequential -->
<!-- $$$localAddress[overload1]$$$localAddress -->
<h3 class="fn" id="localAddress"><a name="localAddress"></a><span class="type"><a href="qbluetoothaddress.html">QBluetoothAddress</a></span> QBluetoothSocket::<span class="name">localAddress</span>() const</h3>
<p>Returns the address of the local device.</p>
<p>Although some platforms may differ the socket must generally be connected to guarantee the return of a valid address. In particular, this is true when dealing with platforms that support multiple local Bluetooth adapters.</p>
<!-- @@@localAddress -->
<!-- $$$localName[overload1]$$$localName -->
<h3 class="fn" id="localName"><a name="localName"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QBluetoothSocket::<span class="name">localName</span>() const</h3>
<p>Returns the name of the local device.</p>
<p>Although some platforms may differ the socket must generally be connected to guarantee the return of a valid name. In particular, this is true when dealing with platforms that support multiple local Bluetooth adapters.</p>
<!-- @@@localName -->
<!-- $$$localPort[overload1]$$$localPort -->
<h3 class="fn" id="localPort"><a name="localPort"></a><span class="type"><a href="../qtcore/qtglobal.html#quint16-typedef">quint16</a></span> QBluetoothSocket::<span class="name">localPort</span>() const</h3>
<p>Returns the port number of the local socket if available, otherwise returns 0. Although some platforms may differ the socket must generally be connected to guarantee the return of a valid port number.</p>
<p>On BlackBerry, Android and OS X, this feature is not supported and returns 0.</p>
<!-- @@@localPort -->
<!-- $$$peerAddress[overload1]$$$peerAddress -->
<h3 class="fn" id="peerAddress"><a name="peerAddress"></a><span class="type"><a href="qbluetoothaddress.html">QBluetoothAddress</a></span> QBluetoothSocket::<span class="name">peerAddress</span>() const</h3>
<p>Returns the address of the peer device.</p>
<!-- @@@peerAddress -->
<!-- $$$peerName[overload1]$$$peerName -->
<h3 class="fn" id="peerName"><a name="peerName"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QBluetoothSocket::<span class="name">peerName</span>() const</h3>
<p>Returns the name of the peer device.</p>
<!-- @@@peerName -->
<!-- $$$peerPort[overload1]$$$peerPort -->
<h3 class="fn" id="peerPort"><a name="peerPort"></a><span class="type"><a href="../qtcore/qtglobal.html#quint16-typedef">quint16</a></span> QBluetoothSocket::<span class="name">peerPort</span>() const</h3>
<p>Return the port number of the peer socket if available, otherwise returns 0. On BlackBerry and Android, this feature is not supported.</p>
<!-- @@@peerPort -->
<!-- $$$readData[overload1]$$$readDatachar*qint64 -->
<h3 class="fn" id="readData"><a name="readData"></a><code>[virtual protected] </code><span class="type"><a href="../qtcore/qtglobal.html#qint64-typedef">qint64</a></span> QBluetoothSocket::<span class="name">readData</span>(<span class="type">char</span> *<i> data</i>, <span class="type"><a href="../qtcore/qtglobal.html#qint64-typedef">qint64</a></span><i> maxSize</i>)</h3>
<p>Reimplemented from <a href="../qtcore/qiodevice.html#readData">QIODevice::readData</a>().</p>
<!-- @@@readData -->
<!-- $$$setSocketDescriptor[overload1]$$$setSocketDescriptorintQBluetoothServiceInfo::ProtocolSocketStateOpenMode -->
<h3 class="fn" id="setSocketDescriptor"><a name="setSocketDescriptor"></a><span class="type">bool</span> QBluetoothSocket::<span class="name">setSocketDescriptor</span>(<span class="type">int</span><i> socketDescriptor</i>, <span class="type"><a href="qbluetoothserviceinfo.html#Protocol-enum">QBluetoothServiceInfo::Protocol</a></span><i> socketType</i>, <span class="type"><a href="qbluetoothsocket.html#SocketState-enum">SocketState</a></span><i> socketState</i> = ConnectedState, <span class="type"><a href="../qtcore/qiodevice.html#OpenModeFlag-enum">OpenMode</a></span><i> openMode</i> = ReadWrite)</h3>
<p>Set the socket to use <i>socketDescriptor</i> with a type of <i>socketType</i>, which is in state, <i>socketState</i>, and mode, <i>openMode</i>.</p>
<p>Returns true on success</p>
<p><b>See also </b><a href="qbluetoothsocket.html#socketDescriptor">socketDescriptor</a>().</p>
<!-- @@@setSocketDescriptor -->
<!-- $$$setSocketError[overload1]$$$setSocketErrorSocketError -->
<h3 class="fn" id="setSocketError"><a name="setSocketError"></a><code>[protected] </code><span class="type">void</span> QBluetoothSocket::<span class="name">setSocketError</span>(<span class="type"><a href="qbluetoothsocket.html#SocketError-enum">SocketError</a></span><i> error_</i>)</h3>
<p>Sets the type of error that last occurred to <i>error_</i>.</p>
<!-- @@@setSocketError -->
<!-- $$$setSocketState[overload1]$$$setSocketStateSocketState -->
<h3 class="fn" id="setSocketState"><a name="setSocketState"></a><code>[protected] </code><span class="type">void</span> QBluetoothSocket::<span class="name">setSocketState</span>(<span class="type"><a href="qbluetoothsocket.html#SocketState-enum">SocketState</a></span><i> state</i>)</h3>
<p>Sets the socket state to <i>state</i>.</p>
<!-- @@@setSocketState -->
<!-- $$$socketDescriptor[overload1]$$$socketDescriptor -->
<h3 class="fn" id="socketDescriptor"><a name="socketDescriptor"></a><span class="type">int</span> QBluetoothSocket::<span class="name">socketDescriptor</span>() const</h3>
<p>Returns the platform-specific socket descriptor, if available. This function returns -1 if the descriptor is not available or an error has occurred.</p>
<p><b>See also </b><a href="qbluetoothsocket.html#setSocketDescriptor">setSocketDescriptor</a>().</p>
<!-- @@@socketDescriptor -->
<!-- $$$socketType[overload1]$$$socketType -->
<h3 class="fn" id="socketType"><a name="socketType"></a><span class="type"><a href="qbluetoothserviceinfo.html#Protocol-enum">QBluetoothServiceInfo::Protocol</a></span> QBluetoothSocket::<span class="name">socketType</span>() const</h3>
<p>Returns the socket type. The socket automatically adjusts to the protocol offered by the remote service.</p>
<p>Blackberry and Android only support <a href="qbluetoothserviceinfo.html#Protocol-enum">RFCOMM</a> based sockets.</p>
<!-- @@@socketType -->
<!-- $$$state[overload1]$$$state -->
<h3 class="fn" id="state"><a name="state"></a><span class="type"><a href="qbluetoothsocket.html#SocketState-enum">SocketState</a></span> QBluetoothSocket::<span class="name">state</span>() const</h3>
<p>Returns the current state of the socket.</p>
<!-- @@@state -->
<!-- $$$stateChanged[overload1]$$$stateChangedQBluetoothSocket::SocketState -->
<h3 class="fn" id="stateChanged"><a name="stateChanged"></a><code>[signal] </code><span class="type">void</span> QBluetoothSocket::<span class="name">stateChanged</span>(<span class="type"><a href="qbluetoothsocket.html#SocketState-enum">QBluetoothSocket::SocketState</a></span><i> state</i>)</h3>
<p>This signal is emitted when the socket state changes to <i>state</i>.</p>
<p><b>See also </b><a href="qbluetoothsocket.html#connected">connected</a>(), <a href="qbluetoothsocket.html#disconnected">disconnected</a>(), <a href="qbluetoothsocket.html#state">state</a>(), and <a href="qbluetoothsocket.html#SocketState-enum">QBluetoothSocket::SocketState</a>.</p>
<!-- @@@stateChanged -->
<!-- $$$writeData[overload1]$$$writeDataconstchar*qint64 -->
<h3 class="fn" id="writeData"><a name="writeData"></a><code>[virtual protected] </code><span class="type"><a href="../qtcore/qtglobal.html#qint64-typedef">qint64</a></span> QBluetoothSocket::<span class="name">writeData</span>(const <span class="type">char</span> *<i> data</i>, <span class="type"><a href="../qtcore/qtglobal.html#qint64-typedef">qint64</a></span><i> maxSize</i>)</h3>
<p>Reimplemented from <a href="../qtcore/qiodevice.html#writeData">QIODevice::writeData</a>().</p>
<!-- @@@writeData -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2015 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>
|