Files
GoldenCheetah/src/ANTLogger.cpp
Jon Escombe 695cf78659 Fix QIODevice errors in ANTLogger
Darren Hagues logging code causes issues since the state
of the logger is not reset on close.
2013-04-29 19:18:20 +01:00

33 lines
668 B
C++

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