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. [solved]how I can send multiply commands through serial interface using QByteArray
Forum Updated to NodeBB v4.3 + New Features

[solved]how I can send multiply commands through serial interface using QByteArray

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 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.
  • R Offline
    R Offline
    reem9611
    wrote on last edited by
    #1

    Hi,
    I am using Qt to creat a GUI to communicate with X device through RS232

    I use QByteArray to send a single request to x device

    @void SerialCom::onSendButtonClicked()
    {

    if (port->isOpen());
    
    QString r= ui->comboBox->currentText();
    
    if(R=="XXXX"){
        
        QByteArray msg("00RS\r\n"); 
        port->write(msg);
    
    }@
    

    I have a list of commands to initialize the sensor setting and I have to send all these commands in one function.
    My Question is how I can send multiply commands through serial interface ( example of the command to be send ->"00RS\r\n") ?! is it right to create QByteArray for each command ?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Why not build a complete list of command first and then send everything at once ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        reem9611
        wrote on last edited by
        #3

        how to do that can you please give me an example or any keyword so I can search about that and implement it in my code .
        [quote author="SGaist" date="1404977927"]Hi,

        Why not build a complete list of command first and then send everything at once ?[/quote]

        1 Reply Last reply
        0
        • R Offline
          R Offline
          reem9611
          wrote on last edited by
          #4

          Thanks , I put the list of commands as you suggest in QList<QByteArray> list;

          and it is work ..

          [quote author="SGaist" date="1404977927"]Hi,

          Why not build a complete list of command first and then send everything at once ?[/quote]

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            You're welcome !

            Since you have your transmission working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            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