qsensor.html 77.2 KB
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 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qsensor.cpp -->
  <title>QSensor Class | Qt Sensors 5.11</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 ><a href="../qtdoc/index.html">Qt 5.11</a></td><td ><a href="qtsensors-index.html">Qt Sensors</a></td><td ><a href="qtsensors-module.html">C++ Classes</a></td><td >QSensor</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.11.2 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#orientation">Orientation</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QSensor Class</h1>
<!-- $$$QSensor-brief -->
<p>The <a href="qsensor.html">QSensor</a> class represents a single hardware sensor. <a href="#details">More...</a></p>
<!-- @@@QSensor -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QSensor&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += sensors</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  Qt 5.1</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qobject.html">QObject</a></td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><a href="qaccelerometer.html">QAccelerometer</a>, <a href="qaltimeter.html">QAltimeter</a>, <a href="qambientlightsensor.html">QAmbientLightSensor</a>, <a href="qambienttemperaturesensor.html">QAmbientTemperatureSensor</a>, <a href="qcompass.html">QCompass</a>, <a href="qdistancesensor.html">QDistanceSensor</a>, <a href="qgyroscope.html">QGyroscope</a>, <a href="qholstersensor.html">QHolsterSensor</a>, <a href="qhumiditysensor.html">QHumiditySensor</a>, <a href="qirproximitysensor.html">QIRProximitySensor</a>, <a href="qlidsensor.html">QLidSensor</a>, <a href="qlightsensor.html">QLightSensor</a>, <a href="qmagnetometer.html">QMagnetometer</a>, <a href="qorientationsensor.html">QOrientationSensor</a>, <a href="qpressuresensor.html">QPressureSensor</a>, <a href="qproximitysensor.html">QProximitySensor</a>, <a href="qrotationsensor.html">QRotationSensor</a>, <a href="qtapsensor.html">QTapSensor</a>, and <a href="qtiltsensor.html">QTiltSensor</a></p>
</td></tr></table></div><ul>
<li><a href="qsensor-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="qsensor.html#AxesOrientationMode-enum">AxesOrientationMode</a></b> { FixedOrientation, AutomaticOrientation, UserOrientation }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#Feature-enum">Feature</a></b> { Buffering, AlwaysOn, SkipDuplicates, GeoValues, ..., AxesOrientation }</td></tr>
</table></div>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<div class="table"><table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn"><b><a href="qsensor.html#active-prop">active</a></b> : bool</li>
<li class="fn"><b><a href="qsensor.html#alwaysOn-prop">alwaysOn</a></b> : bool</li>
<li class="fn"><b><a href="qsensor.html#availableDataRates-prop">availableDataRates</a></b> : const qrangelist</li>
<li class="fn"><b><a href="qsensor.html#axesOrientationMode-prop">axesOrientationMode</a></b> : AxesOrientationMode</li>
<li class="fn"><b><a href="qsensor.html#bufferSize-prop">bufferSize</a></b> : int</li>
<li class="fn"><b><a href="qsensor.html#busy-prop">busy</a></b> : const bool</li>
<li class="fn"><b><a href="qsensor.html#connectedToBackend-prop">connectedToBackend</a></b> : const bool</li>
<li class="fn"><b><a href="qsensor.html#currentOrientation-prop">currentOrientation</a></b> : const int</li>
<li class="fn"><b><a href="qsensor.html#dataRate-prop">dataRate</a></b> : int</li>
<li class="fn"><b><a href="qsensor.html#description-prop">description</a></b> : const QString</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><b><a href="qsensor.html#efficientBufferSize-prop">efficientBufferSize</a></b> : const int</li>
<li class="fn"><b><a href="qsensor.html#error-prop">error</a></b> : const int</li>
<li class="fn"><b><a href="qsensor.html#identifier-prop">identifier</a></b> : QByteArray</li>
<li class="fn"><b><a href="qsensor.html#maxBufferSize-prop">maxBufferSize</a></b> : const int</li>
<li class="fn"><b><a href="qsensor.html#outputRange-prop">outputRange</a></b> : int</li>
<li class="fn"><b><a href="qsensor.html#outputRanges-prop">outputRanges</a></b> : const qoutputrangelist</li>
<li class="fn"><b><a href="qsensor.html#reading-prop">reading</a></b> : QSensorReading* const</li>
<li class="fn"><b><a href="qsensor.html#skipDuplicates-prop">skipDuplicates</a></b> : bool</li>
<li class="fn"><b><a href="qsensor.html#type-prop">type</a></b> : const QByteArray</li>
<li class="fn"><b><a href="qsensor.html#userOrientation-prop">userOrientation</a></b> : int</li>
</ul>
</td></tr>
</table></div>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#QSensor">QSensor</a></b>(const QByteArray &amp;<i>type</i>, QObject *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#dtor.QSensor">~QSensor</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#addFilter">addFilter</a></b>(QSensorFilter *<i>filter</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qrangelist </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#availableDataRates-prop">availableDataRates</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSensor::AxesOrientationMode </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#axesOrientationMode-prop">axesOrientationMode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#bufferSize-prop">bufferSize</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#connectToBackend">connectToBackend</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#currentOrientation-prop">currentOrientation</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#dataRate-prop">dataRate</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#description-prop">description</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#efficientBufferSize-prop">efficientBufferSize</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#error-prop">error</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QSensorFilter *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#filters">filters</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#identifier-prop">identifier</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#active-prop">isActive</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#alwaysOn-prop">isAlwaysOn</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#busy-prop">isBusy</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#connectedToBackend-prop">isConnectedToBackend</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#isFeatureSupported">isFeatureSupported</a></b>(QSensor::Feature <i>feature</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#maxBufferSize-prop">maxBufferSize</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#outputRange-prop">outputRange</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qoutputrangelist </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#outputRanges-prop">outputRanges</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSensorReading *</td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#reading-prop">reading</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#removeFilter">removeFilter</a></b>(QSensorFilter *<i>filter</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#active-prop">setActive</a></b>(bool <i>active</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#alwaysOn-prop">setAlwaysOn</a></b>(bool <i>alwaysOn</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#axesOrientationMode-prop">setAxesOrientationMode</a></b>(QSensor::AxesOrientationMode <i>axesOrientationMode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#bufferSize-prop">setBufferSize</a></b>(int <i>bufferSize</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#setCurrentOrientation">setCurrentOrientation</a></b>(int <i>currentOrientation</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#dataRate-prop">setDataRate</a></b>(int <i>rate</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#setEfficientBufferSize">setEfficientBufferSize</a></b>(int <i>efficientBufferSize</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#identifier-prop">setIdentifier</a></b>(const QByteArray &amp;<i>identifier</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#setMaxBufferSize">setMaxBufferSize</a></b>(int <i>maxBufferSize</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#outputRange-prop">setOutputRange</a></b>(int <i>index</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#setSkipDuplicates">setSkipDuplicates</a></b>(bool <i>skipDuplicates</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#userOrientation-prop">setUserOrientation</a></b>(int <i>userOrientation</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#skipDuplicates-prop">skipDuplicates</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#type-prop">type</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#userOrientation-prop">userOrientation</a></b>() const</td></tr>
</table></div>
<ul>
<li class="fn">34 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#start">start</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#stop">stop</a></b>()</td></tr>
</table></div>
<ul>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#activeChanged">activeChanged</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#alwaysOnChanged">alwaysOnChanged</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#availableSensorsChanged">availableSensorsChanged</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#axesOrientationMode-prop">axesOrientationModeChanged</a></b>(QSensor::AxesOrientationMode <i>axesOrientationMode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#bufferSize-prop">bufferSizeChanged</a></b>(int <i>bufferSize</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#busyChanged">busyChanged</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#currentOrientation-prop">currentOrientationChanged</a></b>(int <i>currentOrientation</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#dataRate-prop">dataRateChanged</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#efficientBufferSize-prop">efficientBufferSizeChanged</a></b>(int <i>efficientBufferSize</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#maxBufferSize-prop">maxBufferSizeChanged</a></b>(int <i>maxBufferSize</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#readingChanged">readingChanged</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#sensorError">sensorError</a></b>(int <i>error</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#skipDuplicatesChanged">skipDuplicatesChanged</a></b>(bool <i>skipDuplicates</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#userOrientation-prop">userOrientationChanged</a></b>(int <i>userOrientation</i>)</td></tr>
</table></div>
<ul>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#defaultSensorForType">defaultSensorForType</a></b>(const QByteArray &amp;<i>type</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QByteArray&gt; </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#sensorTypes">sensorTypes</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QByteArray&gt; </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#sensorsForType">sensorsForType</a></b>(const QByteArray &amp;<i>type</i>)</td></tr>
</table></div>
<ul>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="related-non-members"></a>
<h2 id="related-non-members">Related Non-Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#qoutputrangelist-typedef">qoutputrangelist</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#qrange-typedef">qrange</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qsensor.html#qrangelist-typedef">qrangelist</a></b></td></tr>
</table></div>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QSensor-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qsensor.html">QSensor</a> class represents a single hardware sensor.</p>
<p>The life cycle of a sensor is typically:</p>
<ul>
<li>Create a sub-class of <a href="qsensor.html">QSensor</a> on the stack or heap.</li>
<li>Setup as required by the application.</li>
<li>Start receiving values.</li>
<li>Sensor data is used by the application.</li>
<li>Stop receiving values.</li>
</ul>
<p>The sensor data is delivered via <a href="qsensorreading.html">QSensorReading</a> and its sub-classes.</p>
<a name="orientation"></a>
<h3 >Orientation</h3>
<p>Some sensors react to screen orientation changes, such as <a href="qaccelerometer.html">QAccelerometer</a>, <a href="qmagnetometer.html">QMagnetometer</a> and <a href="qrotationsensor.html">QRotationSensor</a>. These are so called <i>orientable</i> sensors. For orientable sensors, <a href="qsensor.html">QSensor</a> supports changing the reporting of the reading values based on the orientation of the screen.</p>
<p>For orientable sensors, the <a href="qsensor.html#axesOrientationMode-prop">axesOrientationMode</a> property controls how the orientation affects the reading values.</p>
<p>In the default mode, <a href="qsensor.html#AxesOrientationMode-enum">QSensor::FixedOrientation</a>, the reading values remain unaffected by the orientation. In the <a href="qsensor.html#AxesOrientationMode-enum">QSensor::AutomaticOrientation</a> mode, the reading values are automatically rotated by taking the current screen orientation into account. And finally, in the <a href="qsensor.html#AxesOrientationMode-enum">QSensor::UserOrientation</a> mode, the reading values are rotated according to a user-specified orientation.</p>
<p>The functionality of this is only available if it is supported by the backend and if the sensor is orientable, which can be checked by calling <a href="qsensor.html#isFeatureSupported">QSensor::isFeatureSupported</a>() with the <a href="qsensor.html#Feature-enum">QSensor::AxesOrientation</a> flag.</p>
<p>The orientation values here are always of the screen orientation, not the device orientation. The screen orientation is the orientation of the GUI. For example when rotating a device by 90 degrees counter-clockwise, the screen orientation compensates for that by rotating 90 degrees clockwise, to the effect that the GUI is still facing upright after the device has been rotated. Note that applications can lock the screen orientation, for example to force portrait or landscape mode. For locked orientations, orientable sensors will not react with reading changes if the device orientation is changed, as orientable sensors react to screen orientation changes only. This makes sense, as the purpose of orientable sensors is to keep the sensor orientation in sync with the screen orientation.</p>
<p>The orientation values range from 0 to 270 degrees. The orientation is applied in clockwise direction, e.g&#x2e; an orientation value of 90 degrees means that the screen has been rotated 90 degress to the right from its origin position, to compensate a device rotation of 90 degrees to the left.</p>
</div>
<p><b>See also </b><a href="qsensorreading.html">QSensorReading</a>.</p>
<!-- @@@QSensor -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$AxesOrientationMode$$$FixedOrientation$$$AutomaticOrientation$$$UserOrientation -->
<h3 class="fn" id="AxesOrientationMode-enum"><a name="AxesOrientationMode-enum"></a>enum QSensor::<span class="name">AxesOrientationMode</span></h3>
<p>Describes how reading values are affected by the screen orientation.</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>QSensor::FixedOrientation</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">No automatic rotation is applied to the reading values.</td></tr>
<tr><td class="topAlign"><code>QSensor::AutomaticOrientation</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The reading values are automatically rotated based on the screen orientation.</td></tr>
<tr><td class="topAlign"><code>QSensor::UserOrientation</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The reading values are rotated based on the angle of the <a href="qsensor.html#userOrientation-prop">userOrientation</a> property.</td></tr>
</table></div>
<p>This enum was introduced or modified in  Qt 5.1.</p>
<p><b>See also </b><a href="qsensor.html#axesOrientationMode-prop">QSensor::axesOrientationMode</a>.</p>
<!-- @@@AxesOrientationMode -->
<!-- $$$Feature$$$Buffering$$$AlwaysOn$$$GeoValues$$$FieldOfView$$$AccelerationMode$$$SkipDuplicates$$$AxesOrientation$$$PressureSensorTemperature$$$Reserved -->
<h3 class="fn" id="Feature-enum"><a name="Feature-enum"></a>enum QSensor::<span class="name">Feature</span></h3>
<p>Lists optional features a backend might support.</p>
<p>The features common to all sensor types are:</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>QSensor::Buffering</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The backend supports buffering of readings, controlled by the <a href="qsensor.html#bufferSize-prop">QSensor::bufferSize</a> property.</td></tr>
<tr><td class="topAlign"><code>QSensor::AlwaysOn</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The backend supports changing the policy on whether to suspend when idle, controlled by the <a href="qsensor.html#alwaysOn-prop">QSensor::alwaysOn</a> property.</td></tr>
<tr><td class="topAlign"><code>QSensor::SkipDuplicates</code></td><td class="topAlign tblval"><code>5</code></td><td class="topAlign">The backend supports skipping of same or very similar successive readings. This can be enabled by setting the <a href="qsensor.html#skipDuplicates-prop">QSensor::skipDuplicates</a> property to true.</td></tr>
</table></div>
<p>The features of <a href="qmagnetometer.html">QMagnetometer</a> are:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="even"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QSensor::GeoValues</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The backend supports returning geo values, which can be controlled with the <a href="qmagnetometer.html#returnGeoValues-prop">QMagnetometer::returnGeoValues</a> property.</td></tr>
</table></div>
<p>The features of <a href="qlightsensor.html">QLightSensor</a> are:</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>QSensor::FieldOfView</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">The backend specifies its field of view, which can be read from the <a href="qlightsensor.html#fieldOfView-prop">QLightSensor::fieldOfView</a> property.</td></tr>
</table></div>
<p>The features of <a href="qaccelerometer.html">QAccelerometer</a> are:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="even"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QSensor::AccelerationMode</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">The backend supports switching the acceleration mode of the acceleromter with the <a href="qaccelerometer.html#accelerationMode-prop">QAccelerometer::accelerationMode</a> property.</td></tr>
</table></div>
<p>The features of <a href="qpressuresensor.html">QPressureSensor</a> are:</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>QSensor::PressureSensorTemperature</code></td><td class="topAlign tblval"><code>7</code></td><td class="topAlign">The backend provides the pressure sensor's die temperature</td></tr>
</table></div>
<p>The features of all orientable sensors are:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="even"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QSensor::AxesOrientation</code></td><td class="topAlign tblval"><code>6</code></td><td class="topAlign">The backend supports changing the axes orientation from the default of <a href="qsensor.html#AxesOrientationMode-enum">QSensor::FixedOrientation</a> to something else.</td></tr>
</table></div>
<p>This enum was introduced or modified in  Qt 5.0.</p>
<p><b>See also </b><a href="qsensor.html#isFeatureSupported">QSensor::isFeatureSupported</a>().</p>
<!-- @@@Feature -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$active-prop$$$isActive$$$setActivebool$$$activeChanged -->
<h3 class="fn" id="active-prop"><a name="active-prop"></a><span class="name">active</span> : <span class="type">bool</span></h3>
<p>This property holds a value to indicate if the sensor is active.</p>
<p>This is true if the sensor is active (returning values). This is false otherwise.</p>
<p>Note that setting this value to true will not have an immediate effect. Instead, the sensor will be started once the event loop has been reached.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isActive</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setActive</b></span>(bool <i>active</i>)</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qsensor.html#activeChanged">activeChanged</a></b></span>()</td></tr>
</table></div>
<!-- @@@active -->
<!-- $$$alwaysOn-prop$$$isAlwaysOn$$$setAlwaysOnbool$$$alwaysOnChanged -->
<h3 class="fn" id="alwaysOn-prop"><a name="alwaysOn-prop"></a><span class="name">alwaysOn</span> : <span class="type">bool</span></h3>
<p>This property holds a value to indicate if the sensor should remain running when the screen is off.</p>
<p>Some platforms have a policy of suspending sensors when the screen turns off. Setting this property to true will ensure the sensor continues to run.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isAlwaysOn</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setAlwaysOn</b></span>(bool <i>alwaysOn</i>)</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qsensor.html#alwaysOnChanged">alwaysOnChanged</a></b></span>()</td></tr>
</table></div>
<!-- @@@alwaysOn -->
<!-- $$$availableDataRates-prop$$$availableDataRates -->
<h3 class="fn" id="availableDataRates-prop"><a name="availableDataRates-prop"></a><span class="name">availableDataRates</span> : const <span class="type"><a href="qsensor.html#qrangelist-typedef">qrangelist</a></span></h3>
<p>This property holds the data rates that the sensor supports.</p>
<p>This is a list of the data rates that the sensor supports. Measured in Hertz.</p>
<p>Entries in the list can represent discrete rates or a continuous range of rates. A discrete rate is noted by having both values the same.</p>
<p>See the <a href="qtsensors-sensor-explorer-example.html">sensor_explorer</a> example for an example of how to interpret and use this information.</p>
<p>Note that this information is not mandatory as not all sensors have a rate at which they run. In such cases, the list will be empty.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> qrangelist </td><td class="memItemRight bottomAlign"><span class="name"><b>availableDataRates</b></span>() const</td></tr>
</table></div>
<p><b>See also </b><a href="qsensor.html#dataRate-prop">QSensor::dataRate</a> and <a href="qsensor.html#qrangelist-typedef">qrangelist</a>.</p>
<!-- @@@availableDataRates -->
<!-- $$$axesOrientationMode-prop$$$axesOrientationMode$$$setAxesOrientationModeQSensor::AxesOrientationMode$$$axesOrientationModeChangedQSensor::AxesOrientationMode -->
<h3 class="fn" id="axesOrientationMode-prop"><a name="axesOrientationMode-prop"></a><span class="name">axesOrientationMode</span> : <span class="type"><a href="qsensor.html#AxesOrientationMode-enum">AxesOrientationMode</a></span></h3>
<p>This property holds the mode that affects how the screen orientation changes reading values.</p>
<p>When set to <a href="qsensor.html#AxesOrientationMode-enum">FixedOrientation</a>, which is the default mode, no automatic rotation is applied to the reading. This is the only mode available for backends that do not support the <a href="qsensor.html#Feature-enum">QSensor::AxesOrientation</a> feature.</p>
<p>When set to <a href="qsensor.html#AxesOrientationMode-enum">AutomaticOrientation</a>, the reading values are automatically rotated when the screen orientation changes. In effect, the screen orientation is canceled out.</p>
<p>As an example, assume the device is rotated by 180 degrees and therefore the screen orientation also is rotated by 180 degrees from the native orientation. Without automatic axes orientation, the reading values would now be changed: Both the X and the Y values would be negated, forcing an application developer to manually cancel out the negation in application code. Automatic axes orientation does this automatically, in this mode the X and Y values would be the same as with the default screen orientation.</p>
<p>This automatic rotation of the axes is handy is some usecases, for example in a bubble level application that measures how level a surface is by looking at the X axis value of an accelerometer. When the device and screen orientation change by 90 degrees, an application developer does not need to change anything, he can continue using the X axis value even though the device is rotated. Without automatic axes orientation, the application developer would need to look at the Y values instead, thereby adding code to the application that reads from a different axis depending on the screen orientation.</p>
<p>The <a href="qsensor.html#AxesOrientationMode-enum">UserOrientation</a> mode is quite similar to <a href="qsensor.html#AxesOrientationMode-enum">AutomaticOrientation</a>, only that the screen orientation is manually controlled instead of automatically determined. The angle of the <a href="qsensor.html#userOrientation-prop">userOrientation</a> property is then used for rotating the reading values.</p>
<p>Since the rotation of the reading values is based on the screen orientation, Z values will never change, as the Z axis is perpendicular to the screen. As screen orientation changes in 90 degree steps, rotating the reading values is also done in steps of 90 degrees.</p>
<p>This property is only used for orientable sensors.</p>
<p>This property was introduced in  Qt 5.1.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QSensor::AxesOrientationMode </td><td class="memItemRight bottomAlign"><span class="name"><b>axesOrientationMode</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setAxesOrientationMode</b></span>(QSensor::AxesOrientationMode <i>axesOrientationMode</i>)</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>axesOrientationModeChanged</b></span>(QSensor::AxesOrientationMode <i>axesOrientationMode</i>)</td></tr>
</table></div>
<!-- @@@axesOrientationMode -->
<!-- $$$bufferSize-prop$$$bufferSize$$$setBufferSizeint$$$bufferSizeChangedint -->
<h3 class="fn" id="bufferSize-prop"><a name="bufferSize-prop"></a><span class="name">bufferSize</span> : <span class="type">int</span></h3>
<p>This property holds the size of the buffer. By default, the buffer size is 1, which means no buffering. If the maximum buffer size is 1, then buffering is not supported by the sensor.</p>
<p>Setting bufferSize greater than <a href="qsensor.html#maxBufferSize-prop">maxBufferSize</a> will cause <a href="qsensor.html#maxBufferSize-prop">maxBufferSize</a> to be used.</p>
<p>Buffering is turned on when bufferSize is greater than 1. The sensor will collect the requested number of samples and deliver them all to the application at one time. They will be delivered to the application as a burst of changed readings so it is particularly important that the application processes each reading immediately or saves the values somewhere else.</p>
<p>If <a href="qsensor.html#stop">stop</a>() is called when buffering is on-going, the partial buffer is not delivered.</p>
<p>When the sensor is started with buffering option, values are collected from that moment onwards. There is no pre-existing buffer that can be utilized.</p>
<p>Some backends only support enabling or disabling the buffer and do not give control over the size. In this case, the <a href="qsensor.html#maxBufferSize-prop">maxBufferSize</a> and <a href="qsensor.html#efficientBufferSize-prop">efficientBufferSize</a> properties might not be set at all, even though buffering is supported. Setting the bufferSize property to any value greater than 1 will enable buffering. After the sensor has been started, the bufferSize property will be set to the actual value by the backend.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>bufferSize</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setBufferSize</b></span>(int <i>bufferSize</i>)</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>bufferSizeChanged</b></span>(int <i>bufferSize</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qsensor.html#maxBufferSize-prop">QSensor::maxBufferSize</a> and <a href="qsensor.html#efficientBufferSize-prop">QSensor::efficientBufferSize</a>.</p>
<!-- @@@bufferSize -->
<!-- $$$busy-prop$$$isBusy -->
<h3 class="fn" id="busy-prop"><a name="busy-prop"></a><span class="name">busy</span> : const <span class="type">bool</span></h3>
<p>This property holds a value to indicate if the sensor is busy.</p>
<p>Some sensors may be on the system but unavailable for use. This function will return true if the sensor is busy. You will not be able to <a href="qsensor.html#start">start</a>() the sensor.</p>
<p>Note that this function does not return true if you are using the sensor, only if another process is using the sensor.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isBusy</b></span>() const</td></tr>
</table></div>
<p><b>See also </b><a href="qsensor.html#busyChanged">busyChanged</a>().</p>
<!-- @@@busy -->
<!-- $$$connectedToBackend-prop$$$isConnectedToBackend -->
<h3 class="fn" id="connectedToBackend-prop"><a name="connectedToBackend-prop"></a><span class="name">connectedToBackend</span> : const <span class="type">bool</span></h3>
<p>This property holds a value indicating if the sensor has connected to a backend.</p>
<p>A sensor that has not been connected to a backend cannot do anything useful.</p>
<p>Call the <a href="qsensor.html#connectToBackend">connectToBackend</a>() method to force the sensor to connect to a backend immediately. This is automatically called if you call <a href="qsensor.html#start">start</a>() so you only need to do this if you need access to sensor properties (ie. to poll the sensor's meta-data before you use it).</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isConnectedToBackend</b></span>() const</td></tr>
</table></div>
<!-- @@@connectedToBackend -->
<!-- $$$currentOrientation-prop$$$currentOrientation$$$currentOrientationChangedint -->
<h3 class="fn" id="currentOrientation-prop"><a name="currentOrientation-prop"></a><span class="name">currentOrientation</span> : const <span class="type">int</span></h3>
<p>This property holds the current orientation that is used for rotating the reading values.</p>
<p>This might not be the same as the screen orientation. For example, in the <a href="qsensor.html#AxesOrientationMode-enum">FixedOrientation</a> mode, the reading values are not rotated, and therefore the property is 0.</p>
<p>In the <a href="qsensor.html#AxesOrientationMode-enum">UserOrientation</a> mode, the readings are rotated based on the <a href="qsensor.html#userOrientation-prop">userOrientation</a> property, and therefore this property is equal to the <a href="qsensor.html#userOrientation-prop">userOrientation</a> property.</p>
<p>In the <a href="qsensor.html#AxesOrientationMode-enum">AutomaticOrientation</a> mode, the readings are rotated based on the screen orientation, and therefore this property will be equal to the current screen orientation.</p>
<p>This property is set by the backend and only valid for orientable sensors.</p>
<p>This property was introduced in  Qt 5.1.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>currentOrientation</b></span>() const</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>currentOrientationChanged</b></span>(int <i>currentOrientation</i>)</td></tr>
</table></div>
<!-- @@@currentOrientation -->
<!-- $$$dataRate-prop$$$dataRate$$$setDataRateint$$$dataRateChanged -->
<h3 class="fn" id="dataRate-prop"><a name="dataRate-prop"></a><span class="name">dataRate</span> : <span class="type">int</span></h3>
<p>This property holds the data rate that the sensor should be run at.</p>
<p>Measured in Hertz.</p>
<p>The data rate is the maximum frequency at which the sensor can detect changes.</p>
<p>Setting this property is not portable and can cause conflicts with other applications. Check with the sensor backend and platform documentation for any policy regarding multiple applications requesting a data rate.</p>
<p>The default value (0) means that the app does not care what the data rate is. Applications should consider using a timer-based poll of the current value or ensure that the code that processes values can run very quickly as the platform may provide updates hundreds of times each second.</p>
<p>This should be set before calling <a href="qsensor.html#start">start</a>() because the sensor may not notice changes to this value while it is running.</p>
<p>Note that there is no mechanism to determine the current data rate in use by the platform.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>dataRate</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDataRate</b></span>(int <i>rate</i>)</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>dataRateChanged</b></span>()</td></tr>
</table></div>
<p><b>See also </b><a href="qsensor.html#availableDataRates-prop">QSensor::availableDataRates</a>.</p>
<!-- @@@dataRate -->
<!-- $$$description-prop$$$description -->
<h3 class="fn" id="description-prop"><a name="description-prop"></a><span class="name">description</span> : const <span class="type"><a href="../qtcore/qstring.html">QString</a></span></h3>
<p>This property holds a descriptive string for the sensor.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>description</b></span>() const</td></tr>
</table></div>
<!-- @@@description -->
<!-- $$$efficientBufferSize-prop$$$efficientBufferSize$$$efficientBufferSizeChangedint -->
<h3 class="fn" id="efficientBufferSize-prop"><a name="efficientBufferSize-prop"></a><span class="name">efficientBufferSize</span> : const <span class="type">int</span></h3>
<p>The property holds the most efficient buffer size. Normally this is 1 (which means no particular size is most efficient). Some sensor drivers have a FIFO buffer which makes it more efficient to deliver the FIFO's size worth of readings at one time.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>efficientBufferSize</b></span>() const</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>efficientBufferSizeChanged</b></span>(int <i>efficientBufferSize</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qsensor.html#bufferSize-prop">QSensor::bufferSize</a> and <a href="qsensor.html#maxBufferSize-prop">QSensor::maxBufferSize</a>.</p>
<!-- @@@efficientBufferSize -->
<!-- $$$error-prop$$$error$$$sensorErrorint -->
<h3 class="fn" id="error-prop"><a name="error-prop"></a><span class="name">error</span> : const <span class="type">int</span></h3>
<p>This property holds the last error code set on the sensor.</p>
<p>Note that error codes are sensor-specific.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>error</b></span>() const</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qsensor.html#sensorError">sensorError</a></b></span>(int <i>error</i>)</td></tr>
</table></div>
<!-- @@@error -->
<!-- $$$identifier-prop$$$identifier$$$setIdentifierconstQByteArray& -->
<h3 class="fn" id="identifier-prop"><a name="identifier-prop"></a><span class="name">identifier</span> : <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span></h3>
<p>This property holds the backend identifier for the sensor.</p>
<p>Note that the identifier is filled out automatically when the sensor is connected to a backend. If you want to connect a specific backend, you should call setIdentifier() before <a href="qsensor.html#connectToBackend">connectToBackend</a>().</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QByteArray </td><td class="memItemRight bottomAlign"><span class="name"><b>identifier</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setIdentifier</b></span>(const QByteArray &amp;<i>identifier</i>)</td></tr>
</table></div>
<!-- @@@identifier -->
<!-- $$$maxBufferSize-prop$$$maxBufferSize$$$maxBufferSizeChangedint -->
<h3 class="fn" id="maxBufferSize-prop"><a name="maxBufferSize-prop"></a><span class="name">maxBufferSize</span> : const <span class="type">int</span></h3>
<p>The property holds the maximum buffer size.</p>
<p>Note that this may be 1, in which case the sensor does not support any form of buffering. In that case, <a href="qsensor.html#isFeatureSupported">isFeatureSupported</a>(<a href="qsensor.html#Feature-enum">QSensor::Buffering</a>) will also return false.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>maxBufferSize</b></span>() const</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>maxBufferSizeChanged</b></span>(int <i>maxBufferSize</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qsensor.html#bufferSize-prop">QSensor::bufferSize</a> and <a href="qsensor.html#efficientBufferSize-prop">QSensor::efficientBufferSize</a>.</p>
<!-- @@@maxBufferSize -->
<!-- $$$outputRange-prop$$$outputRange$$$setOutputRangeint -->
<h3 class="fn" id="outputRange-prop"><a name="outputRange-prop"></a><span class="name">outputRange</span> : <span class="type">int</span></h3>
<p>This property holds the output range in use by the sensor.</p>
<p>This value represents the index in the <a href="qsensor.html#outputRanges-prop">QSensor::outputRanges</a> list to use.</p>
<p>Setting this property is not portable and can cause conflicts with other applications. Check with the sensor backend and platform documentation for any policy regarding multiple applications requesting an output range.</p>
<p>The default value (-1) means that the app does not care what the output range is.</p>
<p>Note that there is no mechanism to determine the current output range in use by the platform.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>outputRange</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setOutputRange</b></span>(int <i>index</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qsensor.html#outputRanges-prop">QSensor::outputRanges</a>.</p>
<!-- @@@outputRange -->
<!-- $$$outputRanges-prop$$$outputRanges -->
<h3 class="fn" id="outputRanges-prop"><a name="outputRanges-prop"></a><span class="name">outputRanges</span> : const <span class="type"><a href="qsensor.html#qoutputrangelist-typedef">qoutputrangelist</a></span></h3>
<p>This property holds a list of output ranges the sensor supports.</p>
<p>A sensor may have more than one output range. Typically this is done to give a greater measurement range at the cost of lowering accuracy.</p>
<p>Note that this information is not mandatory. This information is typically only available for sensors that have selectable output ranges (such as typical accelerometers).</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> qoutputrangelist </td><td class="memItemRight bottomAlign"><span class="name"><b>outputRanges</b></span>() const</td></tr>
</table></div>
<p><b>See also </b><a href="qsensor.html#outputRange-prop">QSensor::outputRange</a> and <a href="qsensor.html#qoutputrangelist-typedef">qoutputrangelist</a>.</p>
<!-- @@@outputRanges -->
<!-- $$$reading-prop$$$reading$$$readingChanged -->
<h3 class="fn" id="reading-prop"><a name="reading-prop"></a><span class="name">reading</span> : <span class="type"><a href="qsensorreading.html">QSensorReading</a></span>* const</h3>
<p>This property holds the reading class.</p>
<p>The reading class provides access to sensor readings. The reading object is a volatile cache of the most recent sensor reading that has been received so the application should process readings immediately or save the values somewhere for later processing.</p>
<p>Note that this will return 0 until a sensor backend is connected to a backend.</p>
<p>Also note that readings are not immediately available after <a href="qsensor.html#start">start</a>() is called. Applications must wait for the <a href="qsensor.html#readingChanged">readingChanged</a>() signal to be emitted.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QSensorReading *</td><td class="memItemRight bottomAlign"><span class="name"><b>reading</b></span>() const</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qsensor.html#readingChanged">readingChanged</a></b></span>()</td></tr>
</table></div>
<p><b>See also </b><a href="qsensor.html#connectedToBackend-prop">isConnectedToBackend</a>() and <a href="qsensor.html#start">start</a>().</p>
<!-- @@@reading -->
<!-- $$$skipDuplicates-prop$$$skipDuplicates$$$setSkipDuplicatesbool$$$skipDuplicatesChangedbool -->
<h3 class="fn" id="skipDuplicates-prop"><a name="skipDuplicates-prop"></a><span class="name">skipDuplicates</span> : <span class="type">bool</span></h3>
<p>Indicates whether duplicate reading values should be omitted.</p>
<p>When duplicate skipping is enabled, successive readings with the same or very similar values are omitted. This helps reducing the amount of processing done, as less sensor readings are made available. As a consequence, readings arrive at an irregular interval.</p>
<p>Duplicate skipping is not just enabled for readings that are exactly the same, but also for readings that are quite similar, as each sensor has a bit of jitter even if the device is not moved.</p>
<p>Support for this property depends on the backend. Use <a href="qsensor.html#isFeatureSupported">isFeatureSupported</a>() to check if it is supported on the current platform.</p>
<p>Duplicate skipping is disabled by default.</p>
<p>Duplicate skipping takes effect when the sensor is started, changing the property while the sensor is active has no immediate effect.</p>
<p>This property was introduced in  Qt 5.1.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>skipDuplicates</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qsensor.html#setSkipDuplicates">setSkipDuplicates</a></b></span>(bool <i>skipDuplicates</i>)</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qsensor.html#skipDuplicatesChanged">skipDuplicatesChanged</a></b></span>(bool <i>skipDuplicates</i>)</td></tr>
</table></div>
<!-- @@@skipDuplicates -->
<!-- $$$type-prop$$$type -->
<h3 class="fn" id="type-prop"><a name="type-prop"></a><span class="name">type</span> : const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span></h3>
<p>This property holds the type of the sensor.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QByteArray </td><td class="memItemRight bottomAlign"><span class="name"><b>type</b></span>() const</td></tr>
</table></div>
<!-- @@@type -->
<!-- $$$userOrientation-prop$$$userOrientation$$$setUserOrientationint$$$userOrientationChangedint -->
<h3 class="fn" id="userOrientation-prop"><a name="userOrientation-prop"></a><span class="name">userOrientation</span> : <span class="type">int</span></h3>
<p>This property holds the angle used for rotating the reading values in the <a href="qsensor.html#AxesOrientationMode-enum">UserOrientation</a> mode.</p>
<p>When the <a href="qsensor.html#axesOrientationMode-prop">axesOrientationMode</a> property is set to <a href="qsensor.html#AxesOrientationMode-enum">UserOrientation</a>, the angle for rotating the reading values is taken from this property. In other modes, the property has no effect.</p>
<p>The default is 0. The only valid values are 0, 90, 180 and 270, as those are the only possible screen orientations.</p>
<p>This property is only valid for orientable sensors.</p>
<p>This property was introduced in  Qt 5.1.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>userOrientation</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setUserOrientation</b></span>(int <i>userOrientation</i>)</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>userOrientationChanged</b></span>(int <i>userOrientation</i>)</td></tr>
</table></div>
<!-- @@@userOrientation -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QSensor[overload1]$$$QSensorconstQByteArray&QObject* -->
<h3 class="fn" id="QSensor"><a name="QSensor"></a>QSensor::<span class="name">QSensor</span>(const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &amp;<i>type</i>, <span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Construct the <i>type</i> sensor as a child of <i>parent</i>.</p>
<p>Do not use this constructor if a derived class exists for the specific sensor type.</p>
<p>The wrong way is to use the base class constructor:</p>
<pre class="cpp">

  <span class="type">QSensor</span> <span class="operator">*</span>magnetometer <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QSensor</span>(<span class="type"><a href="qmagnetometer.html">QMagnetometer</a></span><span class="operator">::</span>type<span class="operator">,</span> <span class="keyword">this</span>);

</pre>
<p>The right way is to create an instance of the derived class:</p>
<pre class="cpp">

  <span class="type"><a href="qmagnetometer.html">QMagnetometer</a></span> <span class="operator">*</span>magnetometer <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qmagnetometer.html">QMagnetometer</a></span>(<span class="keyword">this</span>);

</pre>
<p>The derived classes have additional properties and data members which are needed for certain features such as geo value support in <a href="qmagnetometer.html">QMagnetometer</a> or acceleration mode support in <a href="qaccelerometer.html">QAccelerometer</a>. These features will only work properly when creating a sensor instance from a <a href="qsensor.html">QSensor</a> subclass.</p>
<p>Only use this constructor if there is no derived sensor class available. Note that all built-in sensors have a derived class, so using this constructor should only be necessary when implementing custom sensors, like in the <a href="qtsensors-grue-example.html">Grue sensor example</a>.</p>
<!-- @@@QSensor -->
<!-- $$$~QSensor[overload1]$$$~QSensor -->
<h3 class="fn" id="dtor.QSensor"><a name="dtor.QSensor"></a><code>[virtual] </code>QSensor::<span class="name">~QSensor</span>()</h3>
<p>Destroy the sensor. Stops the sensor if it has not already been stopped.</p>
<!-- @@@~QSensor -->
<!-- $$$activeChanged -->
<h3 class="fn" id="activeChanged"><a name="activeChanged"></a><code>[signal] </code><span class="type">void</span> QSensor::<span class="name">activeChanged</span>()</h3>
<p>This signal is emitted when the <a href="qsensor.html#active-prop">QSensor::active</a> property has changed.</p>
<p><b>Note:</b> Notifier signal for property <a href="qsensor.html#active-prop">active</a>. </p><p><b>See also </b><a href="qsensor.html#active-prop">QSensor::active</a>.</p>
<!-- @@@activeChanged -->
<!-- $$$addFilter[overload1]$$$addFilterQSensorFilter* -->
<h3 class="fn" id="addFilter"><a name="addFilter"></a><span class="type">void</span> QSensor::<span class="name">addFilter</span>(<span class="type"><a href="qsensorfilter.html">QSensorFilter</a></span> *<i>filter</i>)</h3>
<p>Add a <i>filter</i> to the sensor.</p>
<p>The sensor does not take ownership of the filter. <a href="qsensorfilter.html">QSensorFilter</a> will inform the sensor if it is destroyed.</p>
<p><b>See also </b><a href="qsensorfilter.html">QSensorFilter</a>.</p>
<!-- @@@addFilter -->
<!-- $$$alwaysOnChanged -->
<h3 class="fn" id="alwaysOnChanged"><a name="alwaysOnChanged"></a><code>[signal] </code><span class="type">void</span> QSensor::<span class="name">alwaysOnChanged</span>()</h3>
<p>This signal is emitted when the <a href="qsensor.html#alwaysOn-prop">alwaysOn</a> property changes.</p>
<p><b>Note:</b> Notifier signal for property <a href="qsensor.html#alwaysOn-prop">alwaysOn</a>. </p><!-- @@@alwaysOnChanged -->
<!-- $$$availableSensorsChanged[overload1]$$$availableSensorsChanged -->
<h3 class="fn" id="availableSensorsChanged"><a name="availableSensorsChanged"></a><code>[signal] </code><span class="type">void</span> QSensor::<span class="name">availableSensorsChanged</span>()</h3>
<p>This signal is emitted when the list of available sensors has changed. The sensors available to a program will not generally change over time however some of the available sensors may represent hardware that is not permanently connected. For example, a game controller that is connected via bluetooth would become available when it was on and would become unavailable when it was off.</p>
<p><b>See also </b><a href="qsensor.html#sensorTypes">QSensor::sensorTypes</a>() and <a href="qsensor.html#sensorsForType">QSensor::sensorsForType</a>().</p>
<!-- @@@availableSensorsChanged -->
<!-- $$$busyChanged[overload1]$$$busyChanged -->
<h3 class="fn" id="busyChanged"><a name="busyChanged"></a><code>[signal] </code><span class="type">void</span> QSensor::<span class="name">busyChanged</span>()</h3>
<p>This signal is emitted when the sensor is no longer busy. This can be used to grab a sensor when it becomes available.</p>
<pre class="cpp">

  sensor<span class="operator">.</span>start();
  <span class="keyword">if</span> (sensor<span class="operator">.</span>isBusy()) {
      <span class="comment">// need to wait for busyChanged signal and try again</span>
  }

</pre>
<!-- @@@busyChanged -->
<!-- $$$connectToBackend[overload1]$$$connectToBackend -->
<h3 class="fn" id="connectToBackend"><a name="connectToBackend"></a><span class="type">bool</span> QSensor::<span class="name">connectToBackend</span>()</h3>
<p>Try to connect to a sensor backend.</p>
<p>Returns true if a suitable backend could be found, false otherwise.</p>
<p>The type must be set before calling this method if you are using <a href="qsensor.html">QSensor</a> directly.</p>
<p><b>Note: </b>This function can be invoked via the meta-object system and from QML. See <a href="../qtcore/qobject.html#Q_INVOKABLE">Q_INVOKABLE</a>.</p>
<p><b>See also </b><a href="qsensor.html#connectedToBackend-prop">isConnectedToBackend</a>().</p>
<!-- @@@connectToBackend -->
<!-- $$$defaultSensorForType[overload1]$$$defaultSensorForTypeconstQByteArray& -->
<h3 class="fn" id="defaultSensorForType"><a name="defaultSensorForType"></a><code>[static] </code><span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> QSensor::<span class="name">defaultSensorForType</span>(const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &amp;<i>type</i>)</h3>
<p>Returns the default sensor identifier for <i>type</i>. This is set in a config file and can be overridden if required. If no default is available the system will return the first registered sensor for <i>type</i>.</p>
<p>Note that there is special case logic to prevent the generic plugin's backends from becoming the default when another backend is registered for the same type. This logic means that a backend identifier starting with <code>generic.</code> will only be the default if no other backends have been registered for that type or if it is specified in <code>Sensors.conf</code>.</p>
<p><b>See also </b><a href="determining-the-default-sensor-for-a-type.html">Determining the default sensor for a type</a>.</p>
<!-- @@@defaultSensorForType -->
<!-- $$$filters[overload1]$$$filters -->
<h3 class="fn" id="filters"><a name="filters"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qsensorfilter.html">QSensorFilter</a></span> *&gt; QSensor::<span class="name">filters</span>() const</h3>
<p>Returns the filters currently attached to the sensor.</p>
<p><b>See also </b><a href="qsensorfilter.html">QSensorFilter</a>.</p>
<!-- @@@filters -->
<!-- $$$isFeatureSupported[overload1]$$$isFeatureSupportedQSensor::Feature -->
<h3 class="fn" id="isFeatureSupported"><a name="isFeatureSupported"></a><span class="type">bool</span> QSensor::<span class="name">isFeatureSupported</span>(<span class="type"><a href="qsensor.html#Feature-enum">QSensor::Feature</a></span> <i>feature</i>) const</h3>
<p>Checks if a specific feature is supported by the backend.</p>
<p><a href="qtsensors-module.html">QtSensors</a> supports a rich API for controlling and providing information about sensors. Naturally, not all of this functionality can be supported by all of the backends.</p>
<p>To check if the current backend supports the feature <i>feature</i>, call this function.</p>
<p>The backend needs to be connected, otherwise false will be returned. Calling <a href="qsensor.html#connectToBackend">connectToBackend</a>() or <a href="qsensor.html#start">start</a>() will create a connection to the backend.</p>
<p>Backends have to implement <a href="qsensorbackend.html#isFeatureSupported">QSensorBackend::isFeatureSupported</a>() to make this work.</p>
<p>Returns whether or not the feature is supported if the backend is connected, or false if the backend is not connected.</p>
<p>This function was introduced in  Qt 5.0.</p>
<p><b>Note: </b>This function can be invoked via the meta-object system and from QML. See <a href="../qtcore/qobject.html#Q_INVOKABLE">Q_INVOKABLE</a>.</p>
<!-- @@@isFeatureSupported -->
<!-- $$$readingChanged -->
<h3 class="fn" id="readingChanged"><a name="readingChanged"></a><code>[signal] </code><span class="type">void</span> QSensor::<span class="name">readingChanged</span>()</h3>
<p>This signal is emitted when a new sensor reading is received.</p>
<p>The sensor reading can be found in the <a href="qsensor.html#reading-prop">QSensor::reading</a> property. Note that the reading object is a volatile cache of the most recent sensor reading that has been received so the application should process the reading immediately or save the values somewhere for later processing.</p>
<p>Before this signal has been emitted for the first time, the reading object will have uninitialized data.</p>
<p><b>Note:</b> Notifier signal for property <a href="qsensor.html#reading-prop">reading</a>. </p><p><b>See also </b><a href="qsensor.html#start">start</a>().</p>
<!-- @@@readingChanged -->
<!-- $$$removeFilter[overload1]$$$removeFilterQSensorFilter* -->
<h3 class="fn" id="removeFilter"><a name="removeFilter"></a><span class="type">void</span> QSensor::<span class="name">removeFilter</span>(<span class="type"><a href="qsensorfilter.html">QSensorFilter</a></span> *<i>filter</i>)</h3>
<p>Remove <i>filter</i> from the sensor.</p>
<p><b>See also </b><a href="qsensorfilter.html">QSensorFilter</a>.</p>
<!-- @@@removeFilter -->
<!-- $$$sensorError -->
<h3 class="fn" id="sensorError"><a name="sensorError"></a><code>[signal] </code><span class="type">void</span> QSensor::<span class="name">sensorError</span>(<span class="type">int</span> <i>error</i>)</h3>
<p>This signal is emitted when an <i>error</i> code is set on the sensor. Note that some errors will cause the sensor to stop working. You should call <a href="qsensor.html#active-prop">isActive</a>() to determine if the sensor is still running.</p>
<p><b>Note:</b> Notifier signal for property <a href="qsensor.html#error-prop">error</a>. </p><!-- @@@sensorError -->
<!-- $$$sensorTypes[overload1]$$$sensorTypes -->
<h3 class="fn" id="sensorTypes"><a name="sensorTypes"></a><code>[static] </code><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span>&gt; QSensor::<span class="name">sensorTypes</span>()</h3>
<p>Returns a list of all sensor types.</p>
<!-- @@@sensorTypes -->
<!-- $$$sensorsForType[overload1]$$$sensorsForTypeconstQByteArray& -->
<h3 class="fn" id="sensorsForType"><a name="sensorsForType"></a><code>[static] </code><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span>&gt; QSensor::<span class="name">sensorsForType</span>(const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &amp;<i>type</i>)</h3>
<p>Returns a list of ids for each of the sensors for <i>type</i>. If there are no sensors of that type available the list will be empty.</p>
<!-- @@@sensorsForType -->
<!-- $$$setCurrentOrientation[overload1]$$$setCurrentOrientationint -->
<h3 class="fn" id="setCurrentOrientation"><a name="setCurrentOrientation"></a><span class="type">void</span> QSensor::<span class="name">setCurrentOrientation</span>(<span class="type">int</span> <i>currentOrientation</i>)</h3>
<p>Sets the current screen orientation to <i>currentOrientation</i>. This is to be called from the backend whenever the screen orientation or the <a href="qsensor.html#userOrientation-prop">userOrientation</a> property changes.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qsensor.html#currentOrientation-prop">currentOrientation</a>().</p>
<!-- @@@setCurrentOrientation -->
<!-- $$$setEfficientBufferSize[overload1]$$$setEfficientBufferSizeint -->
<h3 class="fn" id="setEfficientBufferSize"><a name="setEfficientBufferSize"></a><span class="type">void</span> QSensor::<span class="name">setEfficientBufferSize</span>(<span class="type">int</span> <i>efficientBufferSize</i>)</h3>
<p>Sets the efficient buffer size to <i>efficientBufferSize</i>. This is to be called from the backend.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qsensor.html#efficientBufferSize-prop">efficientBufferSize</a>().</p>
<!-- @@@setEfficientBufferSize -->
<!-- $$$setMaxBufferSize[overload1]$$$setMaxBufferSizeint -->
<h3 class="fn" id="setMaxBufferSize"><a name="setMaxBufferSize"></a><span class="type">void</span> QSensor::<span class="name">setMaxBufferSize</span>(<span class="type">int</span> <i>maxBufferSize</i>)</h3>
<p>Sets the maximum buffer size to <i>maxBufferSize</i>. This is to be called from the backend.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qsensor.html#maxBufferSize-prop">maxBufferSize</a>().</p>
<!-- @@@setMaxBufferSize -->
<!-- $$$setSkipDuplicates -->
<h3 class="fn" id="setSkipDuplicates"><a name="setSkipDuplicates"></a><span class="type">void</span> QSensor::<span class="name">setSkipDuplicates</span>(<span class="type">bool</span> <i>skipDuplicates</i>)</h3>
<p>Sets the duplicate skipping to <i>skipDuplicates</i>.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>Note:</b> Setter function for property <a href="qsensor.html#skipDuplicates-prop">skipDuplicates</a>. </p><p><b>See also </b><a href="qsensor.html#skipDuplicates-prop">skipDuplicates</a>().</p>
<!-- @@@setSkipDuplicates -->
<!-- $$$skipDuplicatesChanged -->
<h3 class="fn" id="skipDuplicatesChanged"><a name="skipDuplicatesChanged"></a><code>[signal] </code><span class="type">void</span> QSensor::<span class="name">skipDuplicatesChanged</span>(<span class="type">bool</span> <i>skipDuplicates</i>)</h3>
<p>This signal is emitted when the <i>skipDuplicates</i> property changes.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>Note:</b> Notifier signal for property <a href="qsensor.html#skipDuplicates-prop">skipDuplicates</a>. </p><!-- @@@skipDuplicatesChanged -->
<!-- $$$start[overload1]$$$start -->
<h3 class="fn" id="start"><a name="start"></a><code>[slot] </code><span class="type">bool</span> QSensor::<span class="name">start</span>()</h3>
<p>Start retrieving values from the sensor. Returns true if the sensor was started, false otherwise.</p>
<p>The sensor may fail to start for several reasons.</p>
<p>Once an application has started a sensor it must wait until the sensor receives a new value before it can query the sensor's values. This is due to how the sensor receives values from the system. Sensors do not (in general) poll for new values, rather new values are pushed to the sensors as they happen.</p>
<p>For example, this code will not work as intended.</p>
<pre class="cpp plain">

  sensor-&gt;start();
  sensor-&gt;reading()-&gt;x(); // no data available

</pre>
<p>To work correctly, the code that accesses the reading should ensure the <a href="qsensor.html#readingChanged">readingChanged</a>() signal has been emitted.</p>
<pre class="cpp">

      connect(sensor<span class="operator">,</span> SIGNAL(readingChanged())<span class="operator">,</span> <span class="keyword">this</span><span class="operator">,</span> SLOT(checkReading()));
      sensor<span class="operator">-</span><span class="operator">&gt;</span>start();
  }
  <span class="type">void</span> MyClass<span class="operator">::</span>checkReading() {
      sensor<span class="operator">-</span><span class="operator">&gt;</span>reading()<span class="operator">-</span><span class="operator">&gt;</span>x();

</pre>
<p><b>See also </b><a href="qsensor.html#busy-prop">QSensor::busy</a>.</p>
<!-- @@@start -->
<!-- $$$stop[overload1]$$$stop -->
<h3 class="fn" id="stop"><a name="stop"></a><code>[slot] </code><span class="type">void</span> QSensor::<span class="name">stop</span>()</h3>
<p>Stop retrieving values from the sensor.</p>
<p>This releases the sensor so that other processes can use it.</p>
<p><b>See also </b><a href="qsensor.html#busy-prop">QSensor::busy</a>.</p>
<!-- @@@stop -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$qoutputrangelist -->
<h3 class="fn" id="qoutputrangelist-typedef"><a name="qoutputrangelist-typedef"></a>typedef <span class="name">qoutputrangelist</span></h3>
<p>This type is defined as a list of qoutputrange values.</p>
<pre class="cpp">

  <span class="keyword">typedef</span> <span class="type"><a href="../qtcore/qlist.html">QList</a></span><span class="operator">&lt;</span>qoutputrange<span class="operator">&gt;</span> qoutputrangelist;

</pre>
<p>This typedef was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="../qtcore/qlist.html">QList</a>, <a href="qoutputrange.html">qoutputrange</a>, and <a href="qsensor.html#outputRanges-prop">QSensor::outputRanges</a>.</p>
<!-- @@@qoutputrangelist -->
<!-- $$$qrange -->
<h3 class="fn" id="qrange-typedef"><a name="qrange-typedef"></a>typedef <span class="name">qrange</span></h3>
<p>This type is defined as a <a href="../qtcore/qpair.html">QPair</a>.</p>
<pre class="cpp">

  <span class="keyword">typedef</span> <span class="type"><a href="../qtcore/qpair.html">QPair</a></span><span class="operator">&lt;</span><span class="type">int</span><span class="operator">,</span><span class="type">int</span><span class="operator">&gt;</span> qrange;

</pre>
<p>This typedef was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="../qtcore/qpair.html">QPair</a>, <a href="qsensor.html#qrangelist-typedef">qrangelist</a>, and <a href="qsensor.html#availableDataRates-prop">QSensor::availableDataRates</a>.</p>
<!-- @@@qrange -->
<!-- $$$qrangelist -->
<h3 class="fn" id="qrangelist-typedef"><a name="qrangelist-typedef"></a>typedef <span class="name">qrangelist</span></h3>
<p>This type is defined as a list of qrange values.</p>
<pre class="cpp">

  <span class="keyword">typedef</span> <span class="type"><a href="../qtcore/qlist.html">QList</a></span><span class="operator">&lt;</span>qrange<span class="operator">&gt;</span> qrangelist;

</pre>
<p>This typedef was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="../qtcore/qlist.html">QList</a>, <a href="qsensor.html#qrange-typedef">qrange</a>, and <a href="qsensor.html#availableDataRates-prop">QSensor::availableDataRates</a>.</p>
<!-- @@@qrangelist -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2018 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>