mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-05 21:52:10 +01:00
OP-330 Log replay does not crash at the end anymore.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@3039 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
c355dfff44
commit
823f814d85
@ -44,6 +44,8 @@ bool LogFile::open(OpenMode mode) {
|
|||||||
|
|
||||||
void LogFile::close()
|
void LogFile::close()
|
||||||
{
|
{
|
||||||
|
emit aboutToClose();
|
||||||
|
|
||||||
if (timer.isActive())
|
if (timer.isActive())
|
||||||
timer.stop();
|
timer.stop();
|
||||||
file.close();
|
file.close();
|
||||||
@ -127,11 +129,12 @@ bool LogFile::startReplay() {
|
|||||||
file.read((char *) &lastTimeStamp,sizeof(lastTimeStamp));
|
file.read((char *) &lastTimeStamp,sizeof(lastTimeStamp));
|
||||||
timer.setInterval(10);
|
timer.setInterval(10);
|
||||||
timer.start();
|
timer.start();
|
||||||
|
emit replayStarted();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LogFile::stopReplay() {
|
bool LogFile::stopReplay() {
|
||||||
timer.stop();
|
close();
|
||||||
emit replayFinished();
|
emit replayFinished();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ protected slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void readReady();
|
void readReady();
|
||||||
|
void replayStarted();
|
||||||
void replayFinished();
|
void replayFinished();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -299,7 +299,6 @@ void LoggingThread::transactionCompleted(UAVObject* obj, bool success)
|
|||||||
|
|
||||||
LoggingPlugin::LoggingPlugin() : state(IDLE)
|
LoggingPlugin::LoggingPlugin() : state(IDLE)
|
||||||
{
|
{
|
||||||
// Do nothing
|
|
||||||
logConnection = new LoggingConnection();
|
logConnection = new LoggingConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,6 +346,7 @@ bool LoggingPlugin::initialize(const QStringList& args, QString *errMsg)
|
|||||||
|
|
||||||
// Map signal from end of replay to replay stopped
|
// Map signal from end of replay to replay stopped
|
||||||
connect(getLogfile(),SIGNAL(replayFinished()), this, SLOT(replayStopped()));
|
connect(getLogfile(),SIGNAL(replayFinished()), this, SLOT(replayStopped()));
|
||||||
|
connect(getLogfile(),SIGNAL(replayStarted()), this, SLOT(replayStarted()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -428,23 +428,22 @@ void LoggingPlugin::loggingStopped()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Received the replay stoppedsignal from the LogFile
|
* Received the replay stopped signal from the LogFile
|
||||||
*/
|
*/
|
||||||
void LoggingPlugin::replayStopped()
|
void LoggingPlugin::replayStopped()
|
||||||
{
|
{
|
||||||
Q_ASSERT(state == REPLAY);
|
|
||||||
|
|
||||||
if(uavTalk)
|
|
||||||
delete(uavTalk);
|
|
||||||
|
|
||||||
getLogfile()->close();
|
|
||||||
|
|
||||||
uavTalk = 0;
|
|
||||||
state = IDLE;
|
state = IDLE;
|
||||||
|
|
||||||
emit stateChanged("IDLE");
|
emit stateChanged("IDLE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Received the replay started signal from the LogFile
|
||||||
|
*/
|
||||||
|
void LoggingPlugin::replayStarted()
|
||||||
|
{
|
||||||
|
state = REPLAY;
|
||||||
|
emit stateChanged("REPLAY");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,14 +137,14 @@ protected:
|
|||||||
LoggingThread * loggingThread;
|
LoggingThread * loggingThread;
|
||||||
|
|
||||||
// These are used for replay, logging in its own thread
|
// These are used for replay, logging in its own thread
|
||||||
UAVTalk * uavTalk;
|
LoggingConnection* logConnection;
|
||||||
LoggingConnection* logConnection;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toggleLogging();
|
void toggleLogging();
|
||||||
void startLogging(QString file);
|
void startLogging(QString file);
|
||||||
void stopLogging();
|
void stopLogging();
|
||||||
void loggingStopped();
|
void loggingStopped();
|
||||||
|
void replayStarted();
|
||||||
void replayStopped();
|
void replayStopped();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user