I did some more investigation.  QT's wait functions are brain dead.
And I've got a couple other ideas to try.

Look at the bottom of this email at waitforReadyRead()...you ask for "are
you ready to read?" and inside it returns true if not ready to ready but
d->canWriteNotification is true.
So I moved the debug statement a little higher in send_command so I could
see the timing from send to receive better.
      if (!no_debug)
        {
#if WSJT_TRACE_CAT
          qDebug () << "HRDTransceiver::send_command:" << message;
#endif
        }

Then I added this based on the idea that you didn't get a reply if there
aren't any bytes available

  while (!replied && --retries)
    {
      hrd_->waitForReadyRead (socket_wait_time);
      auto mybytes = hrd_->bytesAvailable();
      replied = mybytes > 0;

Here's a snapshot of the log where you can there are no bytesAvailble first
time even though the wait returns...but there are the 2nd time.
Mon Sep 8 13:08:00 2014
GMT(C:\JTSDK-QT\src\wsjtx\HamlibTransceiver.cpp:432)Debug:
HamlibTransceiver::init_rig exit Transceiver::TransceiverState(online: no
Frequency {0Hz, 0Hz} UNK; SPLIT: unknown; PTT: off) reversed = false
Mon Sep 8 13:08:02 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 28
Mon Sep 8 13:08:02 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 28
Mon Sep 8 13:08:02 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get context" ): -> "775"
Mon Sep 8 13:08:05 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 54
Mon Sep 8 13:08:05 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 54
Mon Sep 8 13:08:05 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get id" ): -> "Ham Radio Deluxe"
Mon Sep 8 13:08:05 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:155)Debug: "Ham Radio Deluxe"
Mon Sep 8 13:08:06 2014
GMT(C:\JTSDK-QT\src\wsjtx\Configuration.cpp:502)Debug:
Configuration::transceiver_ptt: false Transceiver::TransceiverState(online:
yes Frequency {7076000Hz, 7043800Hz} USB; SPLIT: unknown; PTT: on)
Mon Sep 8 13:08:10 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 0
Mon Sep 8 13:08:14 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 54
Mon Sep 8 13:08:14 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 54
Mon Sep 8 13:08:14 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get version" ): -> "v6.2.72.293 b293"
Mon Sep 8 13:08:14 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:156)Debug: "v6.2.72.293 b293"
Mon Sep 8 13:08:19 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 0
Mon Sep 8 13:08:24 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 0
Mon Sep 8 13:08:29 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 0
Mon Sep 8 13:08:30 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 68
Mon Sep 8 13:08:30 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 68
Mon Sep 8 13:08:30 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get radios" ): -> "775:TT-OMNI VII (Radio)"
Mon Sep 8 13:08:30 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:176)Debug: radios:
Mon Sep 8 13:08:30 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:179)Debug: [ 775 ]  "TT-OMNI
VII (Radio)"
Mon Sep 8 13:08:34 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 60
Mon Sep 8 13:08:34 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 60
Mon Sep 8 13:08:34 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get radio" ): -> "TT-OMNI VII (Radio)"
Mon Sep 8 13:08:36 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 60
Mon Sep 8 13:08:36 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 60
Mon Sep 8 13:08:36 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get radio" ): -> "TT-OMNI VII (Radio)"
Mon Sep 8 13:08:41 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 0
Mon Sep 8 13:08:46 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 0
Mon Sep 8 13:08:51 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 0
Mon Sep 8 13:08:56 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 0
Mon Sep 8 13:08:56 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:781)Debug:
HRDTransceiver::send_command " "get vfo-count" " retries exhausted
Mon Sep 8 13:08:56 2014
GMT(C:\JTSDK-QT\src\wsjtx\Configuration.cpp:1968)Debug:
Configuration::handle_transceiver_failure: reason: "Ham Radio Deluxe retries
exhausted sending command "get vfo-count"



bool QAbstractSocket::waitForReadyRead(int msecs)
{
    Q_D(QAbstractSocket);
#if defined (QABSTRACTSOCKET_DEBUG)
    qDebug("QAbstractSocket::waitForReadyRead(%i)", msecs);
#endif

    // require calling connectToHost() before waitForReadyRead()
    if (state() == UnconnectedState) {
        /* If all you have is a QIODevice pointer to an abstractsocket, you
cannot check
           this, so you cannot avoid this warning. */
//        qWarning("QAbstractSocket::waitForReadyRead() is not allowed in
UnconnectedState");
        return false;
    }

    QElapsedTimer stopWatch;
    stopWatch.start();

    // handle a socket in connecting state
    if (state() == HostLookupState || state() == ConnectingState) {
        if (!waitForConnected(msecs))
            return false;
    }

    Q_ASSERT(d->socketEngine);
    do {
        bool readyToRead = false;
        bool readyToWrite = false;
        if (!d->socketEngine->waitForReadOrWrite(&readyToRead,
&readyToWrite, true, !d->writeBuffer.isEmpty(),
                                               qt_timeout_value(msecs,
stopWatch.elapsed()))) {
            d->socketError = d->socketEngine->error();
            setErrorString(d->socketEngine->errorString());
#if defined (QABSTRACTSOCKET_DEBUG)
            qDebug("QAbstractSocket::waitForReadyRead(%i) failed (%i, %s)",
                   msecs, d->socketError,
errorString().toLatin1().constData());
#endif
            emit error(d->socketError);
            if (d->socketError != SocketTimeoutError)
                close();
            return false;
        }

        if (readyToRead) {
            if (d->canReadNotification())
                return true;
        }

        if (readyToWrite)
            d->canWriteNotification();

        if (state() != ConnectedState)
            return false;
    } while (msecs == -1 || qt_timeout_value(msecs, stopWatch.elapsed()) >
0);
    return false;
}


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
wsjt-devel mailing list
wsjt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wsjt-devel

Reply via email to