Hi,
I want to send a file via serial port (rs232) on a device to another device. Any idea for doing this by Qt?
Hi,
I want to send a file via serial port (rs232) on a device to another device. Any idea for doing this by Qt?
I think after setting some thing like baud rate, bit data, stop bits, parity and etc then i can use this code for sending file:
Qt Code:
{ qDebug() << "Open file fault"; start(false); port->close(); return; } quint64 r = port->write(data); port->waitForBytesWritten(responseTimeout); port->waitForReadyRead(responseTimeout); cout<<r<<endl; if (r == quint64(data.size())) qDebug() << "Writed text file."; else qDebug() << "Bytes writed small: " << r; }To copy to clipboard, switch view to plain text mode
how much mega bytes cab sent by serial port? and could i consider a checksum for sending and recieving all right?
Serial port can transfer any number of bytes - it is only a pipe. That you have to define a protocol and transmit the data in an orderly manner so that the recipient can interpret them correctly.
PS
An example protocol for file transfer is xmodem or zmodem.
Last edited by Lesiok; 22nd November 2016 at 11:58.
Bookmarks