66 lines
1.4 KiB
C++
Executable File
66 lines
1.4 KiB
C++
Executable File
/**
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#include "tetra_if_impl.h"
|
|
|
|
#include "mainthread.h"
|
|
|
|
#include <CoPrtCnv/CoPrtCnvRadioTelegram.hpp>
|
|
#include <QtNetwork/QTcpSocket>
|
|
#include <time.h>
|
|
|
|
namespace DifferentialGPS
|
|
{
|
|
TetraImpl::TetraImpl()
|
|
: TetraIF("TetraIF")
|
|
, m_main(nullptr)
|
|
{}
|
|
|
|
TetraImpl::~TetraImpl()
|
|
{}
|
|
|
|
void TetraImpl::startThread(int threadIndex, MainThread *main)
|
|
{
|
|
m_main = main;
|
|
startThreadInternal(threadIndex);
|
|
}
|
|
|
|
bool TetraImpl::onNewDataAvailableInternal()
|
|
{
|
|
QByteArray payload;
|
|
if (!m_main->getNewData(payload))
|
|
{
|
|
DEBUG_LOG(m_logger) << "No data to send";
|
|
return false;
|
|
}
|
|
|
|
// GEF_BESTAETIGUNG -> Dummy, gets overridden by setPayloadDataComplete()
|
|
N_CoPrtCnv::CoPrtCnvRadioTelegram tele(GEF_BESTAETIGUNG, payload.size(), m_broadcastIssi);
|
|
tele.setPayloadDataComplete(payload);
|
|
tele.setSrcISSI(m_srcIssi);
|
|
tele.setDestISSI(m_broadcastIssi);
|
|
tele.setZaehler(m_counter++);
|
|
m_socket->write(tele.data());
|
|
m_socket->flush();
|
|
|
|
/*
|
|
uint8_t* p = tele.getData();
|
|
QString outText("Data: \n ");
|
|
for (int i=0; i<tele.getSize(); ++i)
|
|
{
|
|
outText.append(QString::number(p[i], 16).rightJustified(2,QChar('0')));
|
|
outText.append(" ");
|
|
if(i%8 == 7 )
|
|
outText.append("\n");
|
|
}
|
|
DEBUG_LOG(m_logger) << outText;
|
|
*/
|
|
|
|
DEBUG_LOG(m_logger) << "Sent " << tele.getSize() << " to Tetra";
|
|
return true;
|
|
}
|
|
} // namespace DifferentialGPS
|