i want make samsung flasher simillar to odin flasher for flash rom (package of system data) with qt widget.
i need c++ command on port for flashing data to device and how to connect program to device for this operation.
i want make samsung flasher simillar to odin flasher for flash rom (package of system data) with qt widget.
i need c++ command on port for flashing data to device and how to connect program to device for this operation.
You can use library at qtserial library. Here is the sample snippet to get uart working.
QextSerialPort port;
port.setPortName("portName");
port.setBaudRate(BAUD115200);
port.setFlowControl(FLOW_OFF);
port.setParity(PAR_NONE);
port.setDataBits(DATA_8);
port.setStopBits(STOP_1);
port.open(QIODevice::ReadWrite);
For reading data from UART.
char ch;
port.getChar(&ch))
Here you have an almost complete code, to connect and send data, with a serial connection:
.h file:
private slots:
void connectSerial();
void sendData();
void closeSerial();
...
.cpp file:
#include <QSerialPort>
#include <QSerialPortInfo>
static QSerialPort * serialPort;
...
Connect to Serial:
void MainWindow::connectSerial()
{
serialPort = new QSerialPort;
serialPort->setPortName("com1");
serialPort->open(QIODevice::ReadWrite);
serialPort->setBaudRate(QSerialPort::Baud9600);
serialPort->setDataBits(QSerialPort::Data8);
serialPort->setParity(QSerialPort::NoParity);
serialPort->setStopBits(QSerialPort::OneStop);
serialPort->setFlowControl(QSerialPort::NoFlowControl);
QObject::connect(serialPort, SIGNAL(readyRead()), this, SLOT(readSerial()));
}
...
Read data send from the device:
void MainWindow::readSerial()
{
....
}
Send QString data (12345), to Serial:
void MainWindow::sendData()
{
QByteArray payload_buffer;
QString Data = "12345";
payload_buffer = payload_buffer.append(Data.toLatin1());
if(serialPort->isWritable()){
serialPort->write(payload_buffer,(payload_buffer.size()));
}
}
...
Remember to close the connecting!:
void MainWindow::closeSerial()
{
serialPort->close();
}
...