Files
GoldenCheetah/src/ANTLogger.cpp
Mark Liversedge 3043e356d5 ANTLogger farce continues
Fixups after testing this evening - the meta object types
are now registered and the file open/close is called as
needed.
2013-05-14 21:57:52 +01:00

37 lines
670 B
C++

#include "ANTLogger.h"
ANTLogger::ANTLogger(QObject *parent) : QObject(parent)
{
isLogging=false;
}
void
ANTLogger::open()
{
if (isLogging) return;
antlog.setFileName("antlog.bin");
antlog.open(QIODevice::WriteOnly | QIODevice::Truncate);
isLogging=true;
}
void
ANTLogger::close()
{
if (!isLogging) return;
antlog.close();
isLogging=false;
}
void ANTLogger::logRawAntMessage(const ANTMessage message, const struct timeval timestamp)
{
Q_UNUSED(timestamp); // not used at present
if (isLogging) {
QDataStream out(&antlog);
for (int i=0; i<ANT_MAX_MESSAGE_SIZE; i++)
out<<message.data[i];
}
}