Reinserts original comments
This commit is contained in:
112 files changed
+7113
-5131
No files matched your search
@@ -1,17 +1,17 @@
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// manual class headers
|
||||
#include "PrtCnvTelegramLogThread.hpp"
|
||||
#include <CoPrtCnv/CoPrtCnvCentralTelegram.hpp>
|
||||
#include <CoPrtCnv/CoPrtCnvLogHeader.hpp>
|
||||
@@ -28,7 +28,7 @@
|
||||
static int gettimeofday(struct timeval *__p, void *__t)
|
||||
{
|
||||
union {
|
||||
unsigned long long ns100;
|
||||
unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */
|
||||
FILETIME ft;
|
||||
} now;
|
||||
|
||||
@@ -48,7 +48,7 @@ static int gettimeofday(struct timeval *__p, void *__t)
|
||||
namespace PrtCnv
|
||||
{
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
PrtCnvTelegramLogThread::PrtCnvTelegramLogThread(PrtCnvThreadStarter* a_parent)
|
||||
: PrtCnvThread(a_parent, "PrtCnvTelegramLogThread")
|
||||
, m_DoLogCentralTelegram(true)
|
||||
@@ -58,7 +58,7 @@ PrtCnvTelegramLogThread::PrtCnvTelegramLogThread(PrtCnvThreadStarter* a_parent)
|
||||
m_Name = QStringLiteral("TelegramLog");
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
int32_t PrtCnvTelegramLogThread::create(NGL::Settings *settings)
|
||||
{
|
||||
PrtCnvThread::create(settings);
|
||||
@@ -71,7 +71,7 @@ int32_t PrtCnvTelegramLogThread::create(NGL::Settings *settings)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
int32_t PrtCnvTelegramLogThread::init()
|
||||
{
|
||||
PrtCnvThread::init();
|
||||
@@ -86,7 +86,7 @@ int32_t PrtCnvTelegramLogThread::init()
|
||||
if (!m_LogTelegramPathWithPrefix.endsWith(QLatin1Char('_')))
|
||||
m_LogTelegramPathWithPrefix += QLatin1Char('_');
|
||||
|
||||
|
||||
// create the telegram-log-path when it not yet exists
|
||||
QFileInfo fileInfo(m_LogTelegramPathWithPrefix);
|
||||
QDir dir;
|
||||
dir.mkpath(fileInfo.absolutePath());
|
||||
@@ -101,9 +101,9 @@ static inline int setSend(int protocol, bool bIsSend)
|
||||
return (protocol | (bIsSend ? N_CoPrtCnv::CoPrtCnvLogHeader::e_DestSend : N_CoPrtCnv::CoPrtCnvLogHeader::e_DestReceive));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Writes a received or sent central-telegram into log-file
|
||||
// ---------------------------------------------------------------
|
||||
void PrtCnvTelegramLogThread::writeCentralTelegramLog(N_CoPrtCnv::CoPrtCnvCentralTelegram *a_centralTelegram, bool a_isSend, int a_priority)
|
||||
{
|
||||
if (!m_DoLogCentralTelegram)
|
||||
@@ -115,9 +115,9 @@ void PrtCnvTelegramLogThread::writeCentralTelegramLog(N_CoPrtCnv::CoPrtCnvCentra
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Writes a received or sent wls-telegram into log-file
|
||||
// ---------------------------------------------------------------
|
||||
void PrtCnvTelegramLogThread::writeWlsTelegramLog(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *tele, bool a_isSend, int a_priority)
|
||||
{
|
||||
if (!m_DoLogWlsTelegram)
|
||||
@@ -130,9 +130,9 @@ void PrtCnvTelegramLogThread::writeWlsTelegramLog(const TrainingAreaBase::TetraI
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Writes a received or sent radio-telegram into log-file
|
||||
// ---------------------------------------------------------------
|
||||
void PrtCnvTelegramLogThread::writeRadioTelegramLog(const QByteArray &tele, bool a_isSend, int a_priority)
|
||||
{
|
||||
if (!m_DoLogRadioTelegram)
|
||||
@@ -144,27 +144,27 @@ void PrtCnvTelegramLogThread::writeRadioTelegramLog(const QByteArray &tele, bool
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Writes the telegram to the file
|
||||
// ---------------------------------------------------------------
|
||||
void PrtCnvTelegramLogThread::writeTelegramLog(const QByteArray &a_data, int a_protocolType, int a_priority)
|
||||
{
|
||||
|
||||
// get time with microseconds
|
||||
timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
uint64_t exactTime = tv.tv_sec;
|
||||
exactTime = exactTime << 32;
|
||||
exactTime += tv.tv_usec;
|
||||
|
||||
|
||||
// generate the filename of the telegram-file: "PrefixYYMMDD_HH.krlog"
|
||||
QString fileName = QStringLiteral("%1%2.krlog")
|
||||
.arg(m_LogTelegramPathWithPrefix, QDateTime::fromSecsSinceEpoch(tv.tv_sec).toString(QStringLiteral("yyMMdd_hh")));
|
||||
|
||||
|
||||
// open the log-file
|
||||
QFile telegramFile(fileName);
|
||||
(void)telegramFile.open(QIODevice::WriteOnly | QIODevice::Append);
|
||||
|
||||
|
||||
// write header
|
||||
N_CoPrtCnv::CoPrtCnvLogHeader lh;
|
||||
lh.m_Length = a_data.size() + sizeof(N_CoPrtCnv::CoPrtCnvLogHeader);
|
||||
lh.m_Version = 3;
|
||||
@@ -174,9 +174,9 @@ void PrtCnvTelegramLogThread::writeTelegramLog(const QByteArray &a_data, int a_p
|
||||
lh.m_Reserved = 0;
|
||||
telegramFile.write(reinterpret_cast<const char*>(&lh), sizeof(N_CoPrtCnv::CoPrtCnvLogHeader));
|
||||
|
||||
|
||||
// write telegram-data
|
||||
telegramFile.write(a_data);
|
||||
telegramFile.close();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace PrtCnv
|
||||
Reference in new issue
Block a user