Qt World Summit: Register Today!

How do I use QCanBusDevice::framesToWrite() ?

  • Using QtSerialBus (5.7.0) and taking the CAN-bus example from Qt I have modified sendMessage() method simulating a heavy-download. I send the same frame i times consecutively (being i >1000 per example). I tried this:

    for(int i=0; i<m_ui->loopBox->currentData().toInt(); i++){
        while(m_canDevice->framesToWrite() > 0){/*do nothing*/}

    But I still getting "No buffer space available" errors, which happens when the tx queue has been overflowed, resulting on packets loss.
    If I print framesToWrite() it always returns me 0.

    The documentation specifies:

    qint64 QCanBusDevice::framesToWrite() const
    Returns the number of frames waiting to be written.

    So why it doesn't work as I'm expecting?

    My configuration:

    Socketcan backend, 1MB/s bitrate, 4B data frame

Log in to reply