proto-debuger/protoDebuger/sharedata.cpp

35 lines
775 B
C++
Raw Normal View History

2021-04-11 03:28:04 +00:00
#include "sharedata.h"
ShareData::ShareData(QObject *parent) : QObject(parent)
2021-04-12 15:39:06 +00:00
{
mSerialController = new SerialController(nullptr);
2021-04-14 16:52:05 +00:00
mLua.DoFile("Test.lua");
2021-04-12 15:39:06 +00:00
}
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()
2021-04-11 03:28:04 +00:00
{
2021-04-13 17:28:19 +00:00
if(mSerialController->CloseSerial() == 0){
qDebug()<<"close serial ok";
return 0;
}
qDebug()<<"cloase serial failed";
return -1;
2021-04-11 03:28:04 +00:00
}
2021-04-14 16:52:05 +00:00
int ShareData::TestLua()
{
mLua.OnDataRecv();
}