proto-debuger/protoDebuger/sharedata.cpp

29 lines
693 B
C++

#include "sharedata.h"
ShareData::ShareData(QObject *parent) : QObject(parent)
{
mSerialController = new SerialController(nullptr);
}
int ShareData::OpenUart(QString port, QString baudRate, QString dataBits, QString stopBits, QString flow)
{
qDebug()<<port<<baudRate<<dataBits<<stopBits<<flow;
if(mSerialController->OpenSerial(port,baudRate,dataBits,stopBits,flow) == 0){
qDebug()<<"openserial ok";
return 0;
}
qDebug()<<"openserial failed";
return -1;
}
int ShareData::CloseSerial()
{
if(mSerialController->CloseSerial() == 0){
qDebug()<<"close serial ok";
return 0;
}
qDebug()<<"cloase serial failed";
return -1;
}