[solved]how I can send multiply commands through serial interface using QByteArray
-
wrote on 10 Jul 2014, 07:23 last edited by
Hi,
I am using Qt to creat a GUI to communicate with X device through RS232I 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 ? -
Hi,
Why not build a complete list of command first and then send everything at once ?
-
wrote on 10 Jul 2014, 07:46 last edited by
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]
-
wrote on 10 Jul 2014, 08:23 last edited by
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]
-
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 :)
1/5