Roomba App  1.0
frameThread.cpp
Go to the documentation of this file.
1 
12 #include <QDebug>
13 #include <QSerialPort>
14 
15 #include "communication.hh"
16 #include "frameThread.hh"
17 
18 FrameThread::FrameThread(Communication* communication /* = nullptr */, QObject* parent /* = nullptr */)
19  : QThread(parent), _communication(communication)
20 {
21 }
22 
24 {
25  QSerialPort serial;
26  _communication->setDevice(&serial);
27 
29  {
30  emit error(tr("Watek nie mogl otworzyc portu"));
31  return;
32  }
33 
34  emit info(tr("Otwarto port szeregowy"));
35 
38 }
The Communication class.
void receiveData()
Receive line one by one in loop until end of communication.
bool closeSerialPort()
Close serial port.
void setDevice(QSerialPort *device)
Set serial device.
bool openSerialPort(const char *serialPort)
Open serial port.
void run() override
Start thread with all functionality.
Definition: frameThread.cpp:23
FrameThread(Communication *communication=nullptr, QObject *parent=nullptr)
Construct new FrameThread object.
Definition: frameThread.cpp:18
Communication * _communication
Communication class handle;.
Definition: frameThread.hh:29
void info(const QString &info)
Signal to be emmited to add information to logs.
void error(const QString &error)
Signal to be emmited when some error occured when running thread.
Header file for Communication class.
Header file for FrameThread class.