Hm okay I will try
TimerForReadingFromPort
= new QTimer();
TimerForReadingFromPort->setSingleShot(true);
TimerForReadingFromPort->setInterval(100);
TimerForReadingFromPort = new QTimer();
TimerForReadingFromPort->setSingleShot(true);
TimerForReadingFromPort->setInterval(100);
To copy to clipboard, switch view to plain text mode
got Response is emitted when validatioFlag turns 1, means when I build a valid answer from what i read from the port.
handleTimeOut opens a MessageBox that says "No Connection" (which appears when i click on the ui).
Slot getDevicetype() analyses the data read from port. if this was successfull i disconnect gotResponse from the slot and call the next function for reading from the port.
...
connect(TimerForReadingFromPort,SIGNAL(timeout()),this,SLOT(handleTimeOut()));
connect(this,SIGNAL(gotResponse()),this,SLOT(getDevicetype()));
...
serialPort.write(dataToSend);
TimerForReadingFromPort->start();
...
connect(TimerForReadingFromPort,SIGNAL(timeout()),this,SLOT(handleTimeOut()));
connect(this,SIGNAL(gotResponse()),this,SLOT(getDevicetype()));
...
serialPort.write(dataToSend);
TimerForReadingFromPort->start();
To copy to clipboard, switch view to plain text mode
void Proccess::getDevicetype(){
... //analysig response
disconnect(this,SIGNAL(gotResponse()),0,0);
jumpToBootloader();
}
void Proccess::getDevicetype(){
... //analysig response
disconnect(this,SIGNAL(gotResponse()),0,0);
jumpToBootloader();
}
To copy to clipboard, switch view to plain text mode
void Proccess::jumpToBootloader(){
connect(this,SIGNAL(gotResponse()),this,SLOT(clearResponse()));
...
serialPort.write(dataToSend);
TimerForReadingFromPort->start();
}
void Proccess::jumpToBootloader(){
connect(this,SIGNAL(gotResponse()),this,SLOT(clearResponse()));
...
serialPort.write(dataToSend);
TimerForReadingFromPort->start();
}
To copy to clipboard, switch view to plain text mode
and so on.
Bookmarks