mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-19 19:49:42 +08:00
hebing
This commit is contained in:
@ -31,7 +31,17 @@ CZZ_SeiralPort_QT::~CZZ_SeiralPort_QT()
|
||||
// {
|
||||
// bRes = false;
|
||||
// }
|
||||
QString qstrPortName = QString("COM%1").arg(m_piSettings.iPortNumber);
|
||||
QString qstrPortName;
|
||||
if (m_piSettings.qstrFullPortName != "")
|
||||
{
|
||||
qstrPortName = m_piSettings.qstrFullPortName;
|
||||
qDebug() << m_piSettings.qstrFullPortName;
|
||||
}
|
||||
else
|
||||
{
|
||||
qstrPortName = QString("COM%1").arg(m_piSettings.iPortNumber);
|
||||
}
|
||||
//QString qstrPortName = QString("COM%1").arg(m_piSettings.iPortNumber);
|
||||
m_pSerialPort->setPortName(qstrPortName);
|
||||
m_pSerialPort->setReadBufferSize(512);
|
||||
bRes = m_pSerialPort->setBaudRate(m_piSettings.iBaudRate);
|
||||
@ -63,7 +73,7 @@ void CZZ_SeiralPort_QT::Close()
|
||||
|
||||
std::string CZZ_SeiralPort_QT::ReadAll()
|
||||
{
|
||||
m_pSerialPort->waitForReadyRead(5000);
|
||||
m_pSerialPort->waitForReadyRead();
|
||||
qbaRecv.clear();
|
||||
qbaRecv = m_pSerialPort->readAll();
|
||||
std::string strRet(qbaRecv.constData(), qbaRecv.length());
|
||||
@ -95,6 +105,15 @@ std::string CZZ_SeiralPort_QT::ReadAll()
|
||||
// return strRet;
|
||||
}
|
||||
|
||||
std::string CZZ_SeiralPort_QT::ReadAll(int iWait)
|
||||
{
|
||||
m_pSerialPort->waitForReadyRead(iWait);
|
||||
qbaRecv.clear();
|
||||
qbaRecv = m_pSerialPort->readAll();
|
||||
std::string strRet(qbaRecv.constData(), qbaRecv.length());
|
||||
return strRet;
|
||||
}
|
||||
|
||||
int CZZ_SeiralPort_QT::Write(const std::string strSend)
|
||||
{
|
||||
QByteArray qbaTest(strSend.c_str(),(int)strSend.length());
|
||||
|
Reference in New Issue
Block a user