#include "sharedata.h" ShareData::ShareData(QObject *parent) : QObject(parent) { mSerialController = new SerialController(nullptr); mLua.DoFile("Test.lua"); } int ShareData::OpenUart(QString port, QString baudRate, QString dataBits, QString stopBits, QString flow) { qDebug()<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; } int ShareData::TestLua() { mLua.OnDataRecv(); } int ShareData::TestShowData() { if(nullptr != mProtoDebug){ QMetaObject::invokeMethod(mProtoDebug, "addString",Q_ARG(QVariant, QString("test\r\n"))); } return 0; } void ShareData::SetProtoDebug(QObject *obj) { this->mProtoDebug = obj; }