-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy paththread.cpp
More file actions
38 lines (33 loc) · 705 Bytes
/
Copy paththread.cpp
File metadata and controls
38 lines (33 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "thread.h"
Thread::Thread(QString com, QObject *parent)
:QThread(parent)
{
myCom = new Posix_QextSerialPort(com, QextSerialBase::Polling);
myCom->open(QIODevice::ReadWrite);
stopped = 1;
myCom->setBaudRate(BAUD9600);
myCom->setDataBits(DATA_8);
myCom->setParity(PAR_NONE);
myCom->setStopBits(STOP_1);
myCom->setFlowControl(FLOW_OFF);
myCom->setTimeout(100);
}
Thread::~Thread()
{
}
void Thread::run()
{
while(stopped)
{
//msleep(5000);
QByteArray temp = myCom->readAll();
//if(temp.size() == 8)
//{
emit this->serialFinished(temp);
// }
}
}
void Thread::stopThread()
{
stopped = 0;
}