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. How can I read a specific point using QSerialPort?
Qt 6.11 is out! See what's new in the release blog

How can I read a specific point using QSerialPort?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 284 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.
  • D Offline
    D Offline
    Dragocitch
    wrote on last edited by Dragocitch
    #1

    Hello!

    I send serial data to pc by DSP

    Serial data's form like "!%d%d,%03d,%03d\n?"
    Starts with "!"
    Ends with "?"

    When I read serial data to readAll() Function, data comes like this.

    "\u00150,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,e47\n?!00,000,347\n?!00,000,347\n"
    "?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,3"
    "47\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,00"
    "0,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00"
    ",000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?"
    "!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,34"

    I want to read just between '!' to '?'
    In this case, what function makes me read some specific points only?

    Always, thanks for your help :)

    JKSHJ 1 Reply Last reply
    0
    • D Dragocitch

      Hello!

      I send serial data to pc by DSP

      Serial data's form like "!%d%d,%03d,%03d\n?"
      Starts with "!"
      Ends with "?"

      When I read serial data to readAll() Function, data comes like this.

      "\u00150,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,e47\n?!00,000,347\n?!00,000,347\n"
      "?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,3"
      "47\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,00"
      "0,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00"
      ",000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?"
      "!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,34"

      I want to read just between '!' to '?'
      In this case, what function makes me read some specific points only?

      Always, thanks for your help :)

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      @Dragocitch said in How can I read a specific point using QSerialPort?:

      what function makes me read some specific points only?

      Such a function does not exist, so you must write it yourself.

      Are you familiar with regular expressions (regex)? If not, there are many tutorials online.

      Use QRegularExpression to extract data from your DSP's text stream: https://doc.qt.io/qt-5/qregularexpression.html

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      2
      • D Offline
        D Offline
        Dragocitch
        wrote on last edited by
        #3

        Thanks.

        I'll check that :)

        1 Reply Last reply
        0

        • Login

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