Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSerialPort readyRead() signal not emited
Qt 6.11 is out! See what's new in the release blog

QSerialPort readyRead() signal not emited

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VrasI
    wrote on last edited by
    #1
    connect(serialScanner->serialPort, SIGNAL(readyRead()), serialScanner, SLOT(handleReadyRead()));
    

    Why is it than with the respective serial port opened, my code never gets into the connected function that is handleReadyRead()?

    The code below is my alternative implementation within the class constructor, so as everything has the same scope.

    if (scanConnectedSerialDevices()){
           serialPort = new QSerialPort();
           portPath = serialPortName;
           serialPort->setPortName(portPath);
           qDebug()<<serialPort->portName();
           serialPort->setBaudRate(this->serialPortBaudeRate);
           connect(serialPort, SIGNAL(readyRead()), this, SLOT(handleReadyRead()));        
           connect(serialPort, SIGNAL(bytesWritten(qint64)), this, SLOT(handleBytesWritten(qint64)));
           serialPort.openPort(QIODevice::ReadOnly);
    

    edit: Changing the Device, thus the Driver due to the scanner being from a different manufacturer my code works just fine??????

    jsulmJ 1 Reply Last reply
    0
    • V VrasI
      connect(serialScanner->serialPort, SIGNAL(readyRead()), serialScanner, SLOT(handleReadyRead()));
      

      Why is it than with the respective serial port opened, my code never gets into the connected function that is handleReadyRead()?

      The code below is my alternative implementation within the class constructor, so as everything has the same scope.

      if (scanConnectedSerialDevices()){
             serialPort = new QSerialPort();
             portPath = serialPortName;
             serialPort->setPortName(portPath);
             qDebug()<<serialPort->portName();
             serialPort->setBaudRate(this->serialPortBaudeRate);
             connect(serialPort, SIGNAL(readyRead()), this, SLOT(handleReadyRead()));        
             connect(serialPort, SIGNAL(bytesWritten(qint64)), this, SLOT(handleBytesWritten(qint64)));
             serialPort.openPort(QIODevice::ReadOnly);
      

      edit: Changing the Device, thus the Driver due to the scanner being from a different manufacturer my code works just fine??????

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @VrasI said in QSerialPort readyRead() signal not emited:

      serialPort.openPort(QIODevice::ReadOnly);

      What does it return?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      V 1 Reply Last reply
      0
      • jsulmJ jsulm

        @VrasI said in QSerialPort readyRead() signal not emited:

        serialPort.openPort(QIODevice::ReadOnly);

        What does it return?

        V Offline
        V Offline
        VrasI
        wrote on last edited by
        #3

        @jsulm It Returns TRUE. The port gets succesfully opened

        jsulmJ 1 Reply Last reply
        0
        • V VrasI

          @jsulm It Returns TRUE. The port gets succesfully opened

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @VrasI I suggest to add error handling:
          https://doc.qt.io/qt-5/qserialport.html#error-prop
          https://doc.qt.io/qt-5/qserialport.html#errorOccurred
          https://doc.qt.io/qt-5/qiodevice.html#errorString

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          V 1 Reply Last reply
          0
          • jsulmJ jsulm

            @VrasI I suggest to add error handling:
            https://doc.qt.io/qt-5/qserialport.html#error-prop
            https://doc.qt.io/qt-5/qserialport.html#errorOccurred
            https://doc.qt.io/qt-5/qiodevice.html#errorString

            V Offline
            V Offline
            VrasI
            wrote on last edited by
            #5

            @jsulm I do use it... No error gets returned

            mrjjM 1 Reply Last reply
            0
            • V VrasI

              @jsulm I do use it... No error gets returned

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @VrasI
              Hi
              But if same code works with another scanner on same pc, doesn't that mean the
              the first scanner is not really working?

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved