53 lines
959 B
C++
Executable File
53 lines
959 B
C++
Executable File
|
|
|
|
|
|
#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;
|
|
}
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
DEBUG_LOG(m_logger) << "Sent " << tele.getSize() << " to Tetra";
|
|
return true;
|
|
}
|
|
}
|