2010-08-31 11:09:16 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file logging.cpp
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @see The GNU Public License (GPL) Version 3
|
|
|
|
* @brief Import/Export Plugin
|
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
|
|
|
* @{
|
|
|
|
* @addtogroup Logging
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "loggingplugin.h"
|
2010-09-21 23:43:23 +02:00
|
|
|
#include "logginggadgetfactory.h"
|
2010-08-31 11:09:16 +02:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QtPlugin>
|
|
|
|
#include <QThread>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QDir>
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QList>
|
|
|
|
#include <QErrorMessage>
|
|
|
|
#include <QWriteLocker>
|
|
|
|
|
|
|
|
#include <extensionsystem/pluginmanager.h>
|
|
|
|
#include <QKeySequence>
|
2011-01-22 18:38:22 +01:00
|
|
|
#include "uavobjectmanager.h"
|
2010-08-31 11:09:16 +02:00
|
|
|
|
2011-01-20 23:28:38 +01:00
|
|
|
|
|
|
|
LoggingConnection::LoggingConnection()
|
2013-05-19 16:37:30 +02:00
|
|
|
{}
|
2011-01-20 23:28:38 +01:00
|
|
|
|
|
|
|
LoggingConnection::~LoggingConnection()
|
2013-05-19 16:37:30 +02:00
|
|
|
{}
|
2011-01-20 23:28:38 +01:00
|
|
|
|
|
|
|
void LoggingConnection::onEnumerationChanged()
|
|
|
|
{
|
2013-05-19 16:37:30 +02:00
|
|
|
emit availableDevChanged(this);
|
2011-01-20 23:28:38 +01:00
|
|
|
}
|
|
|
|
|
2011-03-29 20:25:24 +02:00
|
|
|
QList <Core::IConnection::device> LoggingConnection::availableDevices()
|
2011-01-20 23:28:38 +01:00
|
|
|
{
|
2011-03-29 20:25:24 +02:00
|
|
|
QList <device> list;
|
|
|
|
device d;
|
2013-05-19 16:37:30 +02:00
|
|
|
d.displayName = "Logfile replay...";
|
|
|
|
d.name = "Logfile replay...";
|
|
|
|
list << d;
|
2011-01-20 23:28:38 +01:00
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
QIODevice *LoggingConnection::openDevice(const QString &deviceName)
|
2011-01-20 23:28:38 +01:00
|
|
|
{
|
2011-03-13 22:23:26 +01:00
|
|
|
Q_UNUSED(deviceName)
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
if (logFile.isOpen()) {
|
2011-01-20 23:28:38 +01:00
|
|
|
logFile.close();
|
|
|
|
}
|
2011-08-05 12:22:08 +02:00
|
|
|
QString fileName = QFileDialog::getOpenFileName(NULL, tr("Open file"), QString(""), tr("OpenPilot Log (*.opl)"));
|
|
|
|
if (!fileName.isNull()) {
|
|
|
|
startReplay(fileName);
|
|
|
|
}
|
2011-01-20 23:28:38 +01:00
|
|
|
return &logFile;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LoggingConnection::startReplay(QString file)
|
|
|
|
{
|
|
|
|
logFile.setFileName(file);
|
2013-05-19 16:37:30 +02:00
|
|
|
if (logFile.open(QIODevice::ReadOnly)) {
|
2011-01-20 23:28:38 +01:00
|
|
|
qDebug() << "Replaying " << file;
|
|
|
|
// state = REPLAY;
|
|
|
|
logFile.startReplay();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LoggingConnection::closeDevice(const QString &deviceName)
|
|
|
|
{
|
|
|
|
Q_UNUSED(deviceName);
|
2013-05-19 16:37:30 +02:00
|
|
|
// we have to delete the serial connection we created
|
|
|
|
if (logFile.isOpen()) {
|
2011-01-20 23:28:38 +01:00
|
|
|
logFile.close();
|
|
|
|
m_deviceOpened = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString LoggingConnection::connectionName()
|
|
|
|
{
|
|
|
|
return QString("Logfile replay");
|
|
|
|
}
|
|
|
|
|
|
|
|
QString LoggingConnection::shortName()
|
|
|
|
{
|
|
|
|
return QString("Logfile");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-31 11:09:16 +02:00
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* Sets the file to use for logging and takes the parent plugin
|
|
|
|
* to connect to stop logging signal
|
|
|
|
* @param[in] file File name to write to
|
|
|
|
* @param[in] parent plugin
|
|
|
|
*/
|
|
|
|
bool LoggingThread::openFile(QString file, LoggingPlugin *parent)
|
2010-08-31 11:09:16 +02:00
|
|
|
{
|
|
|
|
logFile.setFileName(file);
|
2010-09-21 09:07:39 +02:00
|
|
|
logFile.open(QIODevice::WriteOnly);
|
|
|
|
|
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
|
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
2010-08-31 11:09:16 +02:00
|
|
|
|
2010-09-21 09:07:39 +02:00
|
|
|
uavTalk = new UAVTalk(&logFile, objManager);
|
2013-05-19 16:37:30 +02:00
|
|
|
connect(parent, SIGNAL(stopLoggingSignal()), this, SLOT(stopLogging()));
|
2010-08-31 11:09:16 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* Logs an object update to the file. Data format is the
|
|
|
|
* timestamp as a 32 bit uint counting ms from start of
|
|
|
|
* file writing (flight time will be embedded in stream),
|
|
|
|
* then object packet size, then the packed UAVObject.
|
|
|
|
*/
|
|
|
|
void LoggingThread::objectUpdated(UAVObject *obj)
|
2010-08-31 11:09:16 +02:00
|
|
|
{
|
|
|
|
QWriteLocker locker(&lock);
|
2013-05-19 16:37:30 +02:00
|
|
|
|
|
|
|
if (!uavTalk->sendObject(obj, false, false)) {
|
2010-09-21 09:07:39 +02:00
|
|
|
qDebug() << "Error logging " << obj->getName();
|
2013-05-19 16:37:30 +02:00
|
|
|
}
|
2010-08-31 11:09:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* Connect signals from all the objects updates to the write routine then
|
|
|
|
* run event loop
|
|
|
|
*/
|
2010-08-31 11:09:16 +02:00
|
|
|
void LoggingThread::run()
|
|
|
|
{
|
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
|
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
QList< QList<UAVObject *> > list;
|
2010-08-31 11:09:16 +02:00
|
|
|
list = objManager->getObjects();
|
2013-05-19 16:37:30 +02:00
|
|
|
QList< QList<UAVObject *> >::const_iterator i;
|
|
|
|
QList<UAVObject *>::const_iterator j;
|
2010-08-31 11:09:16 +02:00
|
|
|
int objects = 0;
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
for (i = list.constBegin(); i != list.constEnd(); ++i) {
|
|
|
|
for (j = (*i).constBegin(); j != (*i).constEnd(); ++j) {
|
|
|
|
connect(*j, SIGNAL(objectUpdated(UAVObject *)), (LoggingThread *)this, SLOT(objectUpdated(UAVObject *)));
|
2010-08-31 11:09:16 +02:00
|
|
|
objects++;
|
2013-05-19 16:37:30 +02:00
|
|
|
// qDebug() << "Detected " << j[0];
|
2010-08-31 11:09:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
GCSTelemetryStats *gcsStatsObj = GCSTelemetryStats::GetInstance(objManager);
|
2010-12-04 17:47:55 +01:00
|
|
|
GCSTelemetryStats::DataFields gcsStats = gcsStatsObj->getData();
|
2013-05-19 16:37:30 +02:00
|
|
|
if (gcsStats.Status == GCSTelemetryStats::STATUS_CONNECTED) {
|
2010-12-04 17:47:55 +01:00
|
|
|
qDebug() << "Logging: connected already, ask for all settings";
|
|
|
|
retrieveSettings();
|
|
|
|
} else {
|
|
|
|
qDebug() << "Logging: not connected, do no ask for settings";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-31 11:09:16 +02:00
|
|
|
exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* Pass this command to the correct thread then close the file
|
|
|
|
*/
|
2010-08-31 11:09:16 +02:00
|
|
|
void LoggingThread::stopLogging()
|
|
|
|
{
|
|
|
|
QWriteLocker locker(&lock);
|
2010-12-04 18:39:32 +01:00
|
|
|
|
|
|
|
// Disconnect all objects we registered with:
|
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
|
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
QList< QList<UAVObject *> > list;
|
2010-12-04 18:39:32 +01:00
|
|
|
list = objManager->getObjects();
|
2013-05-19 16:37:30 +02:00
|
|
|
QList< QList<UAVObject *> >::const_iterator i;
|
|
|
|
QList<UAVObject *>::const_iterator j;
|
|
|
|
|
|
|
|
for (i = list.constBegin(); i != list.constEnd(); ++i) {
|
|
|
|
for (j = (*i).constBegin(); j != (*i).constEnd(); ++j) {
|
|
|
|
disconnect(*j, SIGNAL(objectUpdated(UAVObject *)), (LoggingThread *)this, SLOT(objectUpdated(UAVObject *)));
|
2010-12-04 18:39:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-31 11:09:16 +02:00
|
|
|
logFile.close();
|
2010-09-21 09:07:39 +02:00
|
|
|
qDebug() << "File closed";
|
2010-08-31 11:09:16 +02:00
|
|
|
quit();
|
|
|
|
}
|
|
|
|
|
2010-12-04 17:47:55 +01:00
|
|
|
/**
|
|
|
|
* Initialize queue with settings objects to be retrieved.
|
|
|
|
*/
|
|
|
|
void LoggingThread::retrieveSettings()
|
|
|
|
{
|
|
|
|
// Clear object queue
|
|
|
|
queue.clear();
|
|
|
|
// Get all objects, add metaobjects, settings and data objects with OnChange update mode to the queue
|
|
|
|
// Get UAVObjectManager instance
|
2013-05-19 16:37:30 +02:00
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
2010-12-04 17:47:55 +01:00
|
|
|
UAVObjectManager *objMngr = pm->getObject<UAVObjectManager>();
|
2013-05-19 16:37:30 +02:00
|
|
|
QList< QList<UAVDataObject *> > objs = objMngr->getDataObjects();
|
|
|
|
for (int n = 0; n < objs.length(); ++n) {
|
|
|
|
UAVDataObject *obj = objs[n][0];
|
|
|
|
if (obj->isSettings()) {
|
|
|
|
queue.enqueue(obj);
|
2010-12-04 17:47:55 +01:00
|
|
|
}
|
2013-05-19 16:37:30 +02:00
|
|
|
}
|
2010-12-04 17:47:55 +01:00
|
|
|
// Start retrieving
|
|
|
|
qDebug() << tr("Logging: retrieve settings objects from the autopilot (%1 objects)")
|
2013-05-19 16:37:30 +02:00
|
|
|
.arg(queue.length());
|
2010-12-04 17:47:55 +01:00
|
|
|
retrieveNextObject();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the next object in the queue
|
|
|
|
*/
|
|
|
|
void LoggingThread::retrieveNextObject()
|
|
|
|
{
|
|
|
|
// If queue is empty return
|
2013-05-19 16:37:30 +02:00
|
|
|
if (queue.isEmpty()) {
|
2010-12-04 17:47:55 +01:00
|
|
|
qDebug() << "Logging: Object retrieval completed";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Get next object from the queue
|
2013-05-19 16:37:30 +02:00
|
|
|
UAVObject *obj = queue.dequeue();
|
2010-12-04 17:47:55 +01:00
|
|
|
// Connect to object
|
2013-05-19 16:37:30 +02:00
|
|
|
connect(obj, SIGNAL(transactionCompleted(UAVObject *, bool)), this, SLOT(transactionCompleted(UAVObject *, bool)));
|
2010-12-04 17:47:55 +01:00
|
|
|
// Request update
|
|
|
|
obj->requestUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called by the retrieved object when a transaction is completed.
|
|
|
|
*/
|
2013-05-19 16:37:30 +02:00
|
|
|
void LoggingThread::transactionCompleted(UAVObject *obj, bool success)
|
2010-12-04 17:47:55 +01:00
|
|
|
{
|
|
|
|
Q_UNUSED(success);
|
|
|
|
// Disconnect from sending object
|
|
|
|
obj->disconnect(this);
|
|
|
|
// Process next object if telemetry is still available
|
|
|
|
// Get stats objects
|
2013-05-19 16:37:30 +02:00
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
2010-12-04 17:47:55 +01:00
|
|
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
2013-05-19 16:37:30 +02:00
|
|
|
GCSTelemetryStats *gcsStatsObj = GCSTelemetryStats::GetInstance(objManager);
|
2010-12-04 17:47:55 +01:00
|
|
|
GCSTelemetryStats::DataFields gcsStats = gcsStatsObj->getData();
|
2013-05-19 16:37:30 +02:00
|
|
|
if (gcsStats.Status == GCSTelemetryStats::STATUS_CONNECTED) {
|
2010-12-04 17:47:55 +01:00
|
|
|
retrieveNextObject();
|
2013-05-19 16:37:30 +02:00
|
|
|
} else {
|
2010-12-04 17:47:55 +01:00
|
|
|
qDebug() << "Logging: Object retrieval has been cancelled";
|
|
|
|
queue.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
Logging plugin
|
|
|
|
********************************/
|
|
|
|
|
|
|
|
|
2010-08-31 11:09:16 +02:00
|
|
|
LoggingPlugin::LoggingPlugin() : state(IDLE)
|
|
|
|
{
|
2011-01-22 09:37:25 +01:00
|
|
|
logConnection = new LoggingConnection();
|
2010-08-31 11:09:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
LoggingPlugin::~LoggingPlugin()
|
|
|
|
{
|
2013-05-19 16:37:30 +02:00
|
|
|
if (loggingThread) {
|
2010-12-04 18:39:32 +01:00
|
|
|
delete loggingThread;
|
2013-05-19 16:37:30 +02:00
|
|
|
}
|
2011-01-22 09:37:25 +01:00
|
|
|
|
|
|
|
// Don't delete it, the plugin manager will do it:
|
2013-05-19 16:37:30 +02:00
|
|
|
// delete logConnection;
|
2010-08-31 11:09:16 +02:00
|
|
|
}
|
|
|
|
|
2010-08-31 19:22:46 +02:00
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* Add Logging plugin to File menu
|
|
|
|
*/
|
|
|
|
bool LoggingPlugin::initialize(const QStringList & args, QString *errMsg)
|
2010-08-31 11:09:16 +02:00
|
|
|
{
|
|
|
|
Q_UNUSED(args);
|
|
|
|
Q_UNUSED(errMsg);
|
|
|
|
|
2010-12-04 18:39:32 +01:00
|
|
|
loggingThread = NULL;
|
|
|
|
|
|
|
|
|
2010-08-31 11:09:16 +02:00
|
|
|
// Add Menu entry
|
2013-05-19 16:37:30 +02:00
|
|
|
Core::ActionManager *am = Core::ICore::instance()->actionManager();
|
|
|
|
Core::ActionContainer *ac = am->actionContainer(Core::Constants::M_TOOLS);
|
2010-08-31 11:09:16 +02:00
|
|
|
|
2010-09-21 21:28:01 +02:00
|
|
|
// Command to start logging
|
2011-03-13 22:23:26 +01:00
|
|
|
cmd = am->registerAction(new QAction(this),
|
2013-05-19 16:37:30 +02:00
|
|
|
"LoggingPlugin.Logging",
|
|
|
|
QList<int>() <<
|
|
|
|
Core::Constants::C_GLOBAL_ID);
|
2010-08-31 11:09:16 +02:00
|
|
|
cmd->setDefaultKeySequence(QKeySequence("Ctrl+L"));
|
2011-01-20 23:28:38 +01:00
|
|
|
cmd->action()->setText("Start logging...");
|
2010-08-31 11:09:16 +02:00
|
|
|
|
|
|
|
ac->menu()->addSeparator();
|
|
|
|
ac->appendGroup("Logging");
|
|
|
|
ac->addAction(cmd, "Logging");
|
|
|
|
|
|
|
|
connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(toggleLogging()));
|
|
|
|
|
2010-09-21 21:28:01 +02:00
|
|
|
|
2010-09-21 23:43:23 +02:00
|
|
|
mf = new LoggingGadgetFactory(this);
|
|
|
|
addAutoReleasedObject(mf);
|
|
|
|
|
2010-09-22 03:04:24 +02:00
|
|
|
// Map signal from end of replay to replay stopped
|
2013-05-19 16:37:30 +02:00
|
|
|
connect(getLogfile(), SIGNAL(replayFinished()), this, SLOT(replayStopped()));
|
|
|
|
connect(getLogfile(), SIGNAL(replayStarted()), this, SLOT(replayStarted()));
|
2010-09-22 03:04:24 +02:00
|
|
|
|
2010-08-31 11:09:16 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* The action that is triggered by the menu item which opens the
|
|
|
|
* file and begins logging if successful
|
|
|
|
*/
|
2010-08-31 11:09:16 +02:00
|
|
|
void LoggingPlugin::toggleLogging()
|
|
|
|
{
|
2013-05-19 16:37:30 +02:00
|
|
|
if (state == IDLE) {
|
2011-01-21 19:20:18 +01:00
|
|
|
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Start Log"),
|
2013-05-19 16:37:30 +02:00
|
|
|
tr("OP-%0.opl").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")),
|
|
|
|
tr("OpenPilot Log (*.opl)"));
|
|
|
|
if (fileName.isEmpty()) {
|
2011-03-13 22:23:26 +01:00
|
|
|
return;
|
2013-05-19 16:37:30 +02:00
|
|
|
}
|
2011-03-13 22:23:26 +01:00
|
|
|
|
|
|
|
startLogging(fileName);
|
|
|
|
cmd->action()->setText(tr("Stop logging"));
|
2013-05-19 16:37:30 +02:00
|
|
|
} else if (state == LOGGING) {
|
2010-08-31 11:09:16 +02:00
|
|
|
stopLogging();
|
2011-03-13 22:23:26 +01:00
|
|
|
cmd->action()->setText(tr("Start logging..."));
|
2010-08-31 11:09:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-21 21:28:01 +02:00
|
|
|
|
2010-08-31 11:09:16 +02:00
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* Starts the logging thread to a certain file
|
|
|
|
*/
|
2010-08-31 11:09:16 +02:00
|
|
|
void LoggingPlugin::startLogging(QString file)
|
|
|
|
{
|
|
|
|
qDebug() << "Logging to " << file;
|
2010-12-04 18:39:32 +01:00
|
|
|
// We have to delete the previous logging thread if is was still there!
|
2013-05-19 16:37:30 +02:00
|
|
|
if (loggingThread) {
|
2010-12-04 18:39:32 +01:00
|
|
|
delete loggingThread;
|
2013-05-19 16:37:30 +02:00
|
|
|
}
|
2010-09-21 21:28:01 +02:00
|
|
|
loggingThread = new LoggingThread();
|
2013-05-19 16:37:30 +02:00
|
|
|
if (loggingThread->openFile(file, this)) {
|
|
|
|
connect(loggingThread, SIGNAL(finished()), this, SLOT(loggingStopped()));
|
2010-08-31 11:09:16 +02:00
|
|
|
state = LOGGING;
|
|
|
|
loggingThread->start();
|
2010-09-21 23:43:23 +02:00
|
|
|
emit stateChanged("LOGGING");
|
2010-08-31 11:09:16 +02:00
|
|
|
} else {
|
|
|
|
QErrorMessage err;
|
|
|
|
err.showMessage("Unable to open file for logging");
|
|
|
|
err.exec();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-31 19:22:46 +02:00
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* Send the stop logging signal to the LoggingThread
|
|
|
|
*/
|
2010-08-31 11:09:16 +02:00
|
|
|
void LoggingPlugin::stopLogging()
|
|
|
|
{
|
|
|
|
emit stopLoggingSignal();
|
2010-12-04 18:39:32 +01:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
disconnect(this, SIGNAL(stopLoggingSignal()), 0, 0);
|
2010-08-31 11:09:16 +02:00
|
|
|
}
|
|
|
|
|
2010-09-21 21:28:01 +02:00
|
|
|
|
2010-08-31 19:22:46 +02:00
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* Receive the logging stopped signal from the LoggingThread
|
|
|
|
* and change status to not logging
|
|
|
|
*/
|
2010-08-31 11:09:16 +02:00
|
|
|
void LoggingPlugin::loggingStopped()
|
|
|
|
{
|
2013-05-19 16:37:30 +02:00
|
|
|
if (state == LOGGING) {
|
2010-09-21 21:28:01 +02:00
|
|
|
state = IDLE;
|
2013-05-19 16:37:30 +02:00
|
|
|
}
|
2010-09-21 23:43:23 +02:00
|
|
|
|
|
|
|
emit stateChanged("IDLE");
|
|
|
|
|
2010-09-21 21:28:01 +02:00
|
|
|
free(loggingThread);
|
|
|
|
loggingThread = NULL;
|
2010-08-31 11:09:16 +02:00
|
|
|
}
|
2010-09-21 21:28:01 +02:00
|
|
|
|
2010-09-22 03:04:24 +02:00
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* Received the replay stopped signal from the LogFile
|
|
|
|
*/
|
2010-09-22 03:04:24 +02:00
|
|
|
void LoggingPlugin::replayStopped()
|
|
|
|
{
|
|
|
|
state = IDLE;
|
|
|
|
emit stateChanged("IDLE");
|
|
|
|
}
|
|
|
|
|
2011-03-13 23:27:26 +01:00
|
|
|
/**
|
2013-05-19 16:37:30 +02:00
|
|
|
* Received the replay started signal from the LogFile
|
|
|
|
*/
|
2011-03-13 23:27:26 +01:00
|
|
|
void LoggingPlugin::replayStarted()
|
|
|
|
{
|
|
|
|
state = REPLAY;
|
|
|
|
emit stateChanged("REPLAY");
|
|
|
|
}
|
2010-09-22 03:04:24 +02:00
|
|
|
|
2010-12-04 17:47:55 +01:00
|
|
|
|
2010-08-31 11:09:16 +02:00
|
|
|
void LoggingPlugin::extensionsInitialized()
|
|
|
|
{
|
2011-01-22 09:37:25 +01:00
|
|
|
addAutoReleasedObject(logConnection);
|
2010-08-31 11:09:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void LoggingPlugin::shutdown()
|
|
|
|
{
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
Q_EXPORT_PLUGIN(LoggingPlugin)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
* @}
|
|
|
|
*/
|