I want to send multiple CAN signals of type QCanBusFrame. Currently, I can send one signal at a time and it can run till the signal cycle length. I want to send multiple signals at the same time and receive their output. Currently, if I send a second signal, it goes into a loop and I have to wait until the first signal end to get the output of the second signal. Can anyone help me with this problem?
Should I use multithreading to get output in GUI?
This is an excerpt of sending signals :
	
	- foreach (QString-  payload_id, payload_send_final ) {
-             frame = QCanBusFrame(frameId, payload); 
-   
-             if(m_ui->cycle_check->isChecked()) 
-                 emit sendFrame(frame,cycle_len.at(i)); 
-             else 
-                 emit sendFrame(frame,"1"); 
-   
-             i = i + 1; 
-         } 
        foreach(QString payload_id, payload_send_final) {
            const QByteArray payload = QByteArray::fromHex(payload_id.remove(QLatin1Char(' ')).toLatin1());
            frame = QCanBusFrame(frameId, payload);
            if(m_ui->cycle_check->isChecked())
                emit sendFrame(frame,cycle_len.at(i));
            else
                emit sendFrame(frame,"1");
            i = i + 1;
        }
To copy to clipboard, switch view to plain text mode 
  
and receiving part is connected with the "connect" statement to the below slot:
	
	- void-  MainWindow ::sendFrame(const-  QCanBusFrame  &- frame, QString-  cycle )
 
- { 
-   
-     if (!m_canDevice) 
-         return; 
-   
-     m_frame_list.enqueue(frame); 
-     send_frame_str = frame.toString(); 
-     int i = 1; 
-   
-     while (!m_frame_list.isEmpty()) { 
-         QCanBusFrame m_frame = m_frame_list.dequeue(); 
-         while ( i <= cycle.toInt()) { 
-             m_canDevice->writeFrame(frame); 
-             delay(5500); 
-             i = i+1; 
-         } 
-     } 
- } 
        void MainWindow::sendFrame(const QCanBusFrame &frame,QString cycle)
{
    if (!m_canDevice)
        return;
    m_frame_list.enqueue(frame);
    send_frame_str = frame.toString();
    int i = 1;
    while (!m_frame_list.isEmpty()) {
        QCanBusFrame m_frame = m_frame_list.dequeue();
        while ( i <= cycle.toInt()) {
            m_canDevice->writeFrame(frame);
            delay(5500);
            i = i+1;
        }
    }
}
To copy to clipboard, switch view to plain text mode 
  
Please help me with suggestions?
Thanks in advance
				
			
Bookmarks