Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. India
  4. Unable to read hex bytes from serial interface in Qt Creator

Unable to read hex bytes from serial interface in Qt Creator

Scheduled Pinned Locked Moved Unsolved India
2 Posts 2 Posters 1.1k 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.
  • S Offline
    S Offline
    SHUBHAM SINGH RAO
    wrote on 12 Feb 2019, 06:37 last edited by
    #1

    I am trying to read the data from modem in Qt through serial interface. While doing so, I am able to read the data till no hex byte is encountered. After that I fail to read the data!

    Sample Code attached here :

    QString a=0,Received_response=0
     if(serialDataAvail(fd))
    {
    a=serialGetchar(fd);
    Received_response.append(a);
     }
    

    Is there any limitation for QString (datatype) that it can't read the hex data?

    Or is there any other method to grab the hex bytes through serial interface in Qt ?

    J 1 Reply Last reply 12 Feb 2019, 06:44
    0
    • S SHUBHAM SINGH RAO
      12 Feb 2019, 06:37

      I am trying to read the data from modem in Qt through serial interface. While doing so, I am able to read the data till no hex byte is encountered. After that I fail to read the data!

      Sample Code attached here :

      QString a=0,Received_response=0
       if(serialDataAvail(fd))
      {
      a=serialGetchar(fd);
      Received_response.append(a);
       }
      

      Is there any limitation for QString (datatype) that it can't read the hex data?

      Or is there any other method to grab the hex bytes through serial interface in Qt ?

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 12 Feb 2019, 06:44 last edited by
      #2

      @SHUBHAM-SINGH-RAO
      you need to be more specific. But I can say with a high certainty that you're doing stuff wrong, or at the very least not what you want to do.

      What is transferred via serial port?

      Is it ascii characters representing hex values or can it be any arbitrary byte ?


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      3

      2/2

      12 Feb 2019, 06:44

      • Login

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