Changeset 6031692 in subsurface


Ignore:
Timestamp:
Jul 4, 2017, 7:46:07 AM (5 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
d6b17fe
Parents:
f6768ced
git-author:
Jan Mulder <jlmulder@…> (07/03/17 11:56:44)
git-committer:
Dirk Hohndel <dirk@…> (07/04/17 07:46:07)
Message:

Use waitFor instead of timer

See e79bede0aa5b3bd. We rather use wait in combination
with spinning the event loop.

Signed-off-by: Jan Mulder <jlmulder@…>

Location:
core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/qt-ble.cpp

    rf6768ced r6031692  
    6161
    6262        receivedPackets.append(value);
    63         waitForPacket.exit();
    6463}
    6564
     
    156155                        return DC_STATUS_IO;
    157156
    158                 QTimer timer;
    159157                int msec = BLE_TIMEOUT;
    160                 timer.setSingleShot(true);
    161 
    162                 waitForPacket.connect(&timer, SIGNAL(timeout()), SLOT(quit()));
    163                 timer.start(msec);
    164                 waitForPacket.exec();
     158                while (msec > 0 && receivedPackets.isEmpty()) {
     159                        waitFor(100);
     160                        msec -= 100;
     161                };
    165162        }
    166163
  • core/qt-ble.h

    r6fe0388 r6031692  
    3737        QLowEnergyController *controller = nullptr;
    3838        QList<QByteArray> receivedPackets;
    39         QEventLoop waitForPacket;
    4039        bool isCharacteristicWritten;
    4140        dc_user_device_t *device;
Note: See TracChangeset for help on using the changeset viewer.