46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#include "telemetryclass.h"
|
|
#include <QDebug>
|
|
|
|
double sin_Param(double step, double min, double dim)
|
|
{
|
|
return sin(step)*dim+min;
|
|
}
|
|
|
|
telemetryClass::telemetryClass()
|
|
{
|
|
QDateTime dateTime;
|
|
dateTime = QDateTime::currentDateTime();
|
|
QString namefile = QString("%1_%2").arg(dateTime.toString("yyyyMMddhhmmss")).arg("telemetry.log");
|
|
filePath = QString("%1//%2").arg(QFileInfo(".").absolutePath()).arg(namefile);
|
|
|
|
file.setFileName(filePath);
|
|
if ( !file.open(QFile::WriteOnly | QFile::Text | QIODevice::Append) )
|
|
{
|
|
qDebug() << "File not exists";
|
|
}
|
|
}
|
|
|
|
telemetryClass::~telemetryClass()
|
|
{
|
|
file.close();
|
|
}
|
|
|
|
|
|
void telemetryClass::start(QString _operation)
|
|
{
|
|
StartOper = QDateTime::currentDateTime();
|
|
operation = _operation;
|
|
}
|
|
|
|
void telemetryClass::stop()
|
|
{
|
|
StopOper = QDateTime::currentDateTime();
|
|
|
|
qint64 millisecondsDiff = StartOper.time().msecsTo(StopOper.time());
|
|
|
|
QString _value = QString("%1 - %2 - %3 - %4").arg(StartOper.toString("yyyyMMddhhmmss")).arg(StopOper.toString("yyyyMMddhhmmss")).arg(millisecondsDiff).arg(operation);
|
|
|
|
QTextStream out(&file);
|
|
out << _value << "\n";
|
|
}
|