Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 353 → Rev 354

/Misc Projects/PcMarlinInterface/SerialHelper.cpp
30,7 → 30,7
QString stopBits, QString parity, QString flowControl)
{
if (!connected) {
emit UpdateStatus("Serial: Connecting to " + port);
emit UpdateStatus("Connecting to " + port);
serialPort = new QSerialPort();
connect(serialPort, SIGNAL(readyRead()), this, SLOT(Serial_ProcessIncomingData()));
connect(serialPort, SIGNAL(error(QSerialPort::SerialPortError)), this, SLOT(Serial_ProcessError(QSerialPort::SerialPortError)));
80,7 → 80,7
serialPort->setDataTerminalReady(1);
 
if (ok) {
QString status = "Serial: Connected (%1 @ %2 D: %3 S: %4 P: %5 FC: %6)";
QString status = "Connected (%1 @ %2 D: %3 S: %4 P: %5 FC: %6)";
emit UpdateStatus(status.arg(port).arg(speed).arg(dataBits).arg(stopBits).arg(parity).arg(flowControl));
emit Serial_Connected();
} else
96,7 → 96,7
delete serialPort;
connected = false;
if (!errored)
emit UpdateStatus("Serial: Disconnected");
emit UpdateStatus("Disconnected");
emit Serial_Disconnected();
}
 
106,9 → 106,9
serialPort->write(SERIAL_NEWLINE_CHAR);
}
 
void SerialHelper::Serial_TransmitByteArray(QByteArray buffer)
void SerialHelper::Serial_TransmitByteArray(QByteArray data)
{
serialPort->write(buffer);
serialPort->write(data);
}
 
void SerialHelper::Serial_ProcessIncomingData()
130,43 → 130,43
 
switch(error) {
case QSerialPort::DeviceNotFoundError:
emit UpdateStatus("Serial: (Error) Device not found");
emit UpdateStatus("(Error) Device not found");
return;
case QSerialPort::PermissionError:
emit UpdateStatus("Serial: (Error) Device already opened or lacking permission");
emit UpdateStatus("(Error) Device already opened or lacking permission");
return;
case QSerialPort::OpenError:
emit UpdateStatus("Serial: (Error) Device already opened");
emit UpdateStatus("(Error) Device already opened");
return;
case QSerialPort::NotOpenError:
emit UpdateStatus("Serial: (Error) Device not opened");
emit UpdateStatus("(Error) Device not opened");
return;
case QSerialPort::ParityError:
emit UpdateStatus("Serial: (Error) Parity error detected");
emit UpdateStatus("(Error) Parity error detected");
break;
case QSerialPort::FramingError:
emit UpdateStatus("Serial: (Error) Framing error detected");
emit UpdateStatus("(Error) Framing error detected");
break;
case QSerialPort::BreakConditionError:
emit UpdateStatus("Serial: (Error) Break condition detected");
emit UpdateStatus("(Error) Break condition detected");
break;
case QSerialPort::WriteError:
emit UpdateStatus("Serial: (Error) Unable to write to device");
emit UpdateStatus("(Error) Unable to write to device");
break;
case QSerialPort::ReadError:
emit UpdateStatus("Serial: (Error) Unable to read from device");
emit UpdateStatus("(Error) Unable to read from device");
break;
case QSerialPort::ResourceError:
emit UpdateStatus("Serial: (Error) Device missing or disconnected");
emit UpdateStatus("(Error) Device missing or disconnected");
break;
case QSerialPort::UnsupportedOperationError:
emit UpdateStatus("Serial: (Error) Operation not supported or prohibited");
emit UpdateStatus("(Error) Operation not supported or prohibited");
break;
case QSerialPort::TimeoutError:
emit UpdateStatus("Serial: (Error) Connection timeout");
emit UpdateStatus("(Error) Connection timeout");
break;
case QSerialPort::UnknownError:
emit UpdateStatus("Serial: (Error) Unknown error");
emit UpdateStatus("(Error) Unknown error");
break;
default:
break;