mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +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()
|
||||
{
|
||||
emit aboutToClose();
|
||||
|
||||
if (timer.isActive())
|
||||
timer.stop();
|
||||
file.close();
|
||||
@ -127,11 +129,12 @@ bool LogFile::startReplay() {
|
||||
file.read((char *) &lastTimeStamp,sizeof(lastTimeStamp));
|
||||
timer.setInterval(10);
|
||||
timer.start();
|
||||
emit replayStarted();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LogFile::stopReplay() {
|
||||
timer.stop();
|
||||
close();
|
||||
emit replayFinished();
|
||||
return true;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ protected slots:
|
||||
|
||||
signals:
|
||||
void readReady();
|
||||
void replayStarted();
|
||||
void replayFinished();
|
||||
|
||||
protected:
|
||||
|
@ -299,7 +299,6 @@ void LoggingThread::transactionCompleted(UAVObject* obj, bool success)
|
||||
|
||||
LoggingPlugin::LoggingPlugin() : state(IDLE)
|
||||
{
|
||||
// Do nothing
|
||||
logConnection = new LoggingConnection();
|
||||
}
|
||||
|
||||
@ -347,6 +346,7 @@ bool LoggingPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
|
||||
// Map signal from end of replay to replay stopped
|
||||
connect(getLogfile(),SIGNAL(replayFinished()), this, SLOT(replayStopped()));
|
||||
connect(getLogfile(),SIGNAL(replayStarted()), this, SLOT(replayStarted()));
|
||||
|
||||
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()
|
||||
{
|
||||
Q_ASSERT(state == REPLAY);
|
||||
|
||||
if(uavTalk)
|
||||
delete(uavTalk);
|
||||
|
||||
getLogfile()->close();
|
||||
|
||||
uavTalk = 0;
|
||||
state = 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;
|
||||
|
||||
// These are used for replay, logging in its own thread
|
||||
UAVTalk * uavTalk;
|
||||
LoggingConnection* logConnection;
|
||||
LoggingConnection* logConnection;
|
||||
|
||||
private slots:
|
||||
void toggleLogging();
|
||||
void startLogging(QString file);
|
||||
void stopLogging();
|
||||
void loggingStopped();
|
||||
void replayStarted();
|
||||
void replayStopped();
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user