inital commit

This commit is contained in:
2023-01-29 18:45:42 +01:00
commit f91c9f1a6f
19 changed files with 3763 additions and 0 deletions

53
vhfmillthread.cpp Normal file
View File

@ -0,0 +1,53 @@
#include "vhfmillthread.h"
VhfMillThread::VhfMillThread(bool tcpI, int portI, const QString& hostI, const QString& serialPortI, QObject *parent):
tcp(tcpI),
port(portI),
serialPort(serialPortI),
host(hostI),
QThread(parent)
{
}
void VhfMillThread::run()
{
if(tcp)
{
QTcpSocket* microSocket = new QTcpSocket;
microSocket->connectToHost(host, port, QIODevice::ReadWrite);
if(!microSocket->waitForConnected(1000))
{
ret = -2;
ready();
return;
}
masterIODevice = microSocket;
}
else
{
QSerialPort* microPort = new QSerialPort;
microPort->setPortName(serialPort);
microPort->setBaudRate(115200);
if(!microPort->open(QIODevice::ReadWrite))
{
qDebug()<<"could not open serial port "<<serialPort;
ret = -3;
ready();
return;
}
masterIODevice = microPort;
}
mill = new VhfMill(masterIODevice);
ret = 0;
ready();
exec();
delete mill;
delete masterIODevice;
}
VhfMillThread::~VhfMillThread()
{
}