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. Parsing received serial
Qt 6.11 is out! See what's new in the release blog

Parsing received serial

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 430 Views
  • 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.
  • A Offline
    A Offline
    Aeroplane123
    wrote on last edited by
    #1

    I want to parse some received serial data, the data is a reply from an external device.

     uint8_t reply[32];
     char* getReply = (char *) reply;
    		
     serial->read(getReply, 17);
     QByteArray ba(getReply, 17);
     qDebug() << "Received: " << ba;
    
     serialBuffer += ba;
     qDebug() << "Serial Data: " << serialBuffer;
    

    The first reply is read as...
    "Serial Data: \u001B\u0001 "

    The second reply is...
    "Serial Data: \u001B\u00018888?"

    The 8888 is the data that i am interested in, what is the best way to parse this?

    JonBJ 1 Reply Last reply
    0
    • A Aeroplane123

      I want to parse some received serial data, the data is a reply from an external device.

       uint8_t reply[32];
       char* getReply = (char *) reply;
      		
       serial->read(getReply, 17);
       QByteArray ba(getReply, 17);
       qDebug() << "Received: " << ba;
      
       serialBuffer += ba;
       qDebug() << "Serial Data: " << serialBuffer;
      

      The first reply is read as...
      "Serial Data: \u001B\u0001 "

      The second reply is...
      "Serial Data: \u001B\u00018888?"

      The 8888 is the data that i am interested in, what is the best way to parse this?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Aeroplane123
      Maybe you mean you want to look at what comes after the first 2 bytes?

      A 1 Reply Last reply
      0
      • JonBJ JonB

        @Aeroplane123
        Maybe you mean you want to look at what comes after the first 2 bytes?

        A Offline
        A Offline
        Aeroplane123
        wrote on last edited by
        #3

        @JonB yes, exactly!

        JonBJ 1 Reply Last reply
        0
        • A Aeroplane123

          @JonB yes, exactly!

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Aeroplane123
          Then do so! QByteArray::mid(2).

          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