title: Visualization of data process on BananaPI (in C/ C++)
body: <p>My visualization will show booking status of seats in the bus. You can see whole bus with seats which should change colours and also numbers of free/ busy seats below the main picture. For example: at first there are 42 free green seats so we can see text: "42 free"; "0 busy". Let's say 2 people will sit on two seats. Main pic will change: there will be 40 seats green and 2 red one. Same with the text below: "40 free" and "2 busy".</p>
  
  <p>I managed to synchronize signals from module box (CAN bus line) to BananaPi using TI SN65HVD230D transceiver. I got information from each ID seat section per one frame (seats 1-32 , 33-64 and status of each seat - free, taken, error and not available). I attach receive.c file (<a href="http://svn.code.sf.net/p/can4linux/code/trunk/can4linux-examples/receive.c" rel="nofollow">http://svn.code.sf.net/p/can4linux/code/trunk/can4linux-examples/receive.c</a>) which I'm using to check the frames (in Terminal typing ./receive -t3 -H). </p>
  
  <p>First I thought about writing a timer which will collect the data from receive.c. each 1s - I wonder how exactly I should declare data to be seen in Qt in my QTimer and QProcess. Could someone provide a example code how it should work?</p>
  
  <p>After I done that I thought to visualize state of seats - I think I should use slots and signals of each seat depending of its state (for free seat - graphic with green seat, and for taken/busy one - a red graphic seat). Is this a good idea?</p>
  
  <p>Thank you in advance for each tip.</p>
  
  <p>Example of frames:</p>
  
  <p>0.167986 938/0x000003aa : bD ( 8 ): 00 fc ff ff ff ff ff 3f - noone is sitting</p>
  
  <p>0.167963 938/0x000003aa : bD ( 8 ): 01 fc ff ff ff ff ff 3f - seat no 1 is taken/ busy</p>
  
  <p>0.167972 938/0x000003aa : bD ( 8 ): 04 fc ff ff ff ff ff 3f - seat no 2 is taken/ busy</p>
  
  <p>0.167973 938/0x000003aa : bD ( 8 ): 10 00 fc ff ff ff ff 3f - seat no 3 is taken/busy</p>
  
  <p>0.167973 938/0x000003aa : bD ( 8 ): 40 00 fc ff ff ff ff 3f - seat no 4 is taken/busy</p>
  
  <p>0.167981 938/0x000003aa : bD ( 8 ): 00 01 fc ff ff ff ff 3f - seat no 5 is taken/busy</p>
  
  <p>0.168021 938/0x000003aa : bD ( 8 ): 00 04 fc ff ff ff ff 3f - seat no 6 is taken/busy</p>
  
  <p>0.167986 938/0x000003aa : bD ( 8 ): 00 10 fc ff ff ff ff 3f - seat no 7 is taken/busy</p>
  
  <p>0.167988 938/0x000003aa : bD ( 8 ): 00 40 fc ff ff ff ff 3f - seat no 8 is taken/busy</p>
  
  <p>0.168017 938/0x000003aa : bD ( 8 ): 00 00 fd ff ff ff ff 3f - seat no 9 is taken/busy</p>
  
  <p>0.168023 938/0x000003aa : bD ( 8 ): 00 00 fc ff ff ff ff 7f - seat no 32 is taken/busy</p>
  
  <p>0.167001 939/0x000003ab : bD ( 8 ): ff ff ff ff ff fc ff ff - seat no 53 is free</p>
  
  <p>0.167023 939/0x000003ab : bD ( 8 ): ff ff ff ff ff fd ff ff - seat no 53 is taken/busy</p>
  
  <p>0.167992 938/0x000003aa : bD ( 8 ): 00 01 fc ff ff ff ff 7f - seat no 5 &amp; 32 are taken/ busy</p>
  
  <p>0.167986 938/0x000003aa : bD ( 8 ): 05 00 fc ff ff ff ff 3f - seat no 1 &amp; 2 are taken/ busy</p>
  
  <p>0.167965 938/0x000003aa : bD ( 8 ): 40 01 fc ff ff ff ff 3f - seat no 4 &amp; 5 are taken/ busy</p>
  
  <p>0.167971 938/0x000003aa : bD ( 8 ): 50 01 fc ff ff ff ff 3f - seat no 3, 4 and 5 are taken/busy</p>
  
  <p>First of all I'd like to see outputs signals (frames) in Qty. When I push the button after debugging I only see in Application Output:</p>
  
  <ol>
  <li>" "</li>
  <li>Gotowe!</li>
  <li>0</li>
  </ol>
  
  <p>and so on after pushing the button each time.</p>
  
  <p>My code:
  mywindow.cpp</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include &lt;QProcess&gt;
  #include &lt;QDebug&gt;
  #include &lt;QByteArray&gt;
  
  MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent),
   ui(new Ui::MainWindow)
   {
   ui-&gt;setupUi(this);
   }
  
  MainWindow::~MainWindow()
  {
   delete ui;
  }
  
  void MainWindow::on_pushButton_clicked()
  {
  QProcess process(this);
  QByteArray byteArray = process.readAllStandardOutput();
  process.setProcessChannelMode(QProcess::MergedChannels);
  process.start("test.sh");
  process.waitForReadyRead();
  qDebug() &lt;&lt; process.readAll();
  qDebug("Gotowe!");
  process.waitForBytesWritten();
  process.waitForFinished();
  qDebug() &lt;&lt; process.exitCode();
  </code></pre>
  
  <p>test.sh is simple bash script to load ./receive with commands "-t3 -H)</p>
  
  <pre><code>#!/bin/bash
  ./receive -t3 -H
  </code></pre>