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. Hexa conversation problem "FF8AE8CB42" why he recupers "42" as "B" here "\xFF\x8A\xE8\xCB""B" ?

Hexa conversation problem "FF8AE8CB42" why he recupers "42" as "B" here "\xFF\x8A\xE8\xCB""B" ?

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

    Hello
    I get this in application output :
    trame Recupéré: "\xFF\x8A\xE8\xCB""B"

    insted of this: "\xFF\x8A\xE8\xCB\x42" hexa form of ""FF8AE8CB42""!

    //New Frame to send
                   QCanBusFrame frameconnect;
                   frameconnect.setFrameId(101);
                   QByteArray payloadconnect= QByteArray::fromHex("FF8AE8CB42");
                   frameconnect.setPayload(payloadconnect);
    
                   m_canDevice->writeFrame(frameconnect);
    
                   m_canDevice->waitForFramesReceived(2000); //attend reception trame 2sec snn out
                  //New Frame to received
    
    
                   QCanBusFrame frame_R = m_canDevice->readFrame(); //read m_canDevice trame et stocage dans la nouvelle "frametestconnect"
    
                   QByteArray data_R = frame_R.payload();//recupération de payload du trame
    
                   qDebug() << "trame Recupéré: " << frame_R.frameId();
                   qDebug() << "trame Recupéré: " << data_R;
    
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      But 'B' is 0x42 ...
      If you want a hex representation use QByteArray::toHex()

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      3
      • I Offline
        I Offline
        imene
        wrote on last edited by
        #3

        @Christian-Ehrlicher yess thanks this how it works : https://bytetool.web.app/en/ascii/

        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