UpdatePTUDevCtrl/serial.cpp

34 lines
838 B
C++
Raw Normal View History

2023-04-05 14:43:27 +02:00
#include "serial.h"
#include "plugins/interfaces.h"
#include <QDebug>
Serial::Serial(hwinf const *hwinf, uint32_t baudrate, QString baudrateStr,
QString comPort)
: m_hwinf(hwinf)
, m_baudrate(baudrate)
, m_baudrateStr(baudrateStr)
, m_comPort(comPort) {
}
bool Serial::testConnection() {
m_hwinf->dc_requTestResponse();
return true;
}
bool Serial::openSerial() { // 1: connect
// sollte einen bool zureuckgeben
m_baudrate = 5;
m_comPort = "ttyUSB0";
qDebug() << "winComPort opening serial with: " << m_baudrate << " " << m_baudrateStr << " " << m_comPort;
m_hwinf->dc_openSerial(5, m_baudrateStr, m_comPort, 1);
//m_hwinf->dc_openSerial(m_baudrate, m_baudrateStr, m_comPort, 1);
return true;
}
bool Serial::closeSerial() {
m_hwinf->dc_closeSerial();
return true;
}