Commit 96522cf7 authored by pixhawk's avatar pixhawk

Working on real log replay in simulation link

parent d3b45c52
......@@ -69,7 +69,7 @@ public:
/** @brief Get logging state */
bool loggingEnabled(void);
/** @brief Get the name of the packet log file */
QString getLogfileName();
static QString getLogfileName();
public slots:
/** @brief Receive bytes from a communication interface */
......
......@@ -38,6 +38,7 @@ This file is part of the PIXHAWK project
#include <QDebug>
#include "MG.h"
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
#include "MAVLinkSimulationLink.h"
// MAVLINK includes
#include <mavlink.h>
......@@ -92,6 +93,10 @@ MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile
maxTimeNoise = 0;
this->id = getNextLinkId();
LinkManager::instance()->add(this);
// Open packet log
mavlinkLogFile = new QFile(MAVLinkProtocol::getLogfileName());
mavlinkLogFile->open(QIODevice::ReadOnly);
}
MAVLinkSimulationLink::~MAVLinkSimulationLink()
......@@ -121,6 +126,21 @@ void MAVLinkSimulationLink::run()
if (_isConnected)
{
mainloop();
// FIXME Hacky code to read from packet log file
// readyBufferMutex.lock();
// for (int i = 0; i < streampointer; i++)
// {
// readyBuffer.enqueue(*(stream + i));
// }
// readyBufferMutex.unlock();
emit bytesReady(this);
}
last = MG::TIME::getGroundTimeNow();
......
......@@ -98,6 +98,7 @@ protected:
QTimer* timer;
/** File which contains the input data (simulated robot messages) **/
QFile* simulationFile;
QFile* mavlinkLogFile;
QString simulationHeader;
/** File where the commands sent by the groundstation are stored **/
QFile* receiveFile;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment