- cmake/FindRTI.cmake: Add INTERFACE placeholder targets when RTI not found - cmake/FindRTI.cmake: Force BUILD_RTI=OFF when RTI not installed - Lts/Common/LtsSession/CMakeLists.txt: Make LtsSessionDataDds conditional on BUILD_RTI - Lts/Viewer/CMakeLists.txt: Make LtsDataView conditional on BUILD_RTI - Lts/Plugins/*/CMakeLists.txt: 97 plugin files wrapped in BUILD_RTI conditionals - cmake/NGLMacros.cmake: Fix NGL_ADD_BIG_RESOURCES macro (removed premature return()) - Multiple Qt6 API fixes: QLinkedList→std::list, QStringRef→QStringView, etc. - BUILD_RTI_FIXES_SUMMARY.md: Comprehensive documentation of all fixes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
70 lines
1.4 KiB
C++
Executable File
70 lines
1.4 KiB
C++
Executable File
|
|
|
|
|
|
#include "ttci_channel.h"
|
|
|
|
#include "ttci_device.h"
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
|
|
namespace TrainingAreaBaseOC
|
|
{
|
|
|
|
Channel::Channel(QChar channel, bool bIsBinary, QObject *parent)
|
|
: QObject(parent)
|
|
, m_channel(channel)
|
|
, m_bIsBinary(bIsBinary)
|
|
, m_device(nullptr)
|
|
.getNGLLogger("SCTT.Channel"))
|
|
{}
|
|
|
|
void Channel::setDevice(Device *dev)
|
|
{
|
|
if (m_device)
|
|
disconnect(m_device);
|
|
m_device = dev;
|
|
connect(dev, &Device::destroyed,
|
|
this, &Channel::onDeviceDestroyed);
|
|
connect(dev, &Device::dataAvailable,
|
|
this, &Channel::onDataAvailable, Qt::QueuedConnection);
|
|
connect(dev, &Device::disconnectedFromEq,
|
|
this, &Channel::disconnectedFromEq);
|
|
}
|
|
|
|
bool Channel::writeData(const QByteArray &data)
|
|
{
|
|
if (!m_device || !m_device->isOpen())
|
|
{
|
|
WARNING_LOG() << "Error writing data - device is not open" ;
|
|
return false;
|
|
}
|
|
|
|
QByteArray payload;
|
|
if (m_bIsBinary)
|
|
payload = data;
|
|
else
|
|
{
|
|
payload.reserve(data.size());
|
|
for (const char c : data)
|
|
{
|
|
if (c == 0x0a)
|
|
continue;
|
|
payload += c;
|
|
}
|
|
}
|
|
return m_device->writeData(m_channel, payload);
|
|
}
|
|
|
|
void Channel::onDeviceDestroyed()
|
|
{
|
|
m_device = nullptr;
|
|
}
|
|
|
|
void Channel::onDataAvailable(const QByteArray &data)
|
|
{
|
|
TRACE_LOG() << "Data available from "
|
|
<< ", we are: " << m_channel
|
|
<< ", data: '" << data << "'" ;
|
|
emit dataAvailable(data);
|
|
}
|
|
}
|