Skip to content

Commit

Permalink
REmove QIoDevice sinks
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy committed Jan 7, 2025
1 parent b3fdaaa commit b01c94e
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 91 deletions.
68 changes: 2 additions & 66 deletions decode/aerol.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "aerol.h"
#include <QtEndian>
#include <iostream>

// R channel

Expand Down Expand Up @@ -876,7 +877,7 @@ void OQPSKPreambleDetectorAndAmbiguityCorrection::setTollerence(
tollerence = _tollerence;
}

AeroL::AeroL(QObject *parent) : QIODevice(parent) {
AeroL::AeroL(QObject *parent) : QObject(parent) {

cntr = 1000000000;
formatid = 0;
Expand Down Expand Up @@ -1043,34 +1044,6 @@ void AeroL::setSettings(double fb, bool _burstmode) {

AeroL::~AeroL() {}

bool AeroL::Start() {
if (psinkdevice.isNull())
return false;
QIODevice *out = psinkdevice.data();
out->open(QIODevice::WriteOnly);
return true;
}

void AeroL::Stop() {
if (!psinkdevice.isNull()) {
QIODevice *out = psinkdevice.data();
out->close();
}
}

void AeroL::ConnectSinkDevice(QIODevice *device) {
if (!device)
return;
psinkdevice = device;
Start();
}

void AeroL::DisconnectSinkDevice() {
Stop();
if (!psinkdevice.isNull())
psinkdevice.clear();
}

void AeroL::updateDCD() {
// qDebug()<<datacdcountdown;

Expand Down Expand Up @@ -2064,37 +2037,6 @@ QByteArray &AeroL::Decode(QVector<short> &bits,
return decodedbytes;
}

qint64 AeroL::readData(char *data, qint64 maxlen) {
Q_UNUSED(data);
Q_UNUSED(maxlen);
return 0;
}

qint64 AeroL::writeData(const char *data, qint64 len) {
sbits.clear();
uchar *udata = (uchar *)data;
uchar auchar;
for (int i = 0; i < len; i++) {
auchar = udata[i];
if (preambledetectorburst.Update(auchar)) {
sbits.push_back(-1);
} else
for (int j = 0; j < 8; j++) {
sbits.push_back(auchar & 1);
auchar = auchar >> 1;
}
}
Decode(sbits);

if (!psinkdevice.isNull()) {
QIODevice *out = psinkdevice.data();
if (out->isOpen())
out->write(decodedbytes);
}

return len;
}

void AeroL::processDemodulatedSoftBits(const QVector<short> &soft_bits) {

sbits.clear();
Expand All @@ -2106,12 +2048,6 @@ void AeroL::processDemodulatedSoftBits(const QVector<short> &soft_bits) {
} else {
Decode(sbits, true);
}

if (!psinkdevice.isNull()) {
QIODevice *out = psinkdevice.data();
if (out->isOpen())
out->write(decodedbytes);
}
}

CChannelAssignmentItem AeroL::CreateCAssignmentItem(QByteArray su) {
Expand Down
10 changes: 1 addition & 9 deletions decode/aerol.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef AEROL_H
#define AEROL_H

#include "iostream"
#include "jconvolutionalcodec.h"
#include <QDateTime>
#include <QDebug>
Expand Down Expand Up @@ -846,17 +845,13 @@ class RTChannelDeleaveFECScram {
int numberofsus;
};

class AeroL : public QIODevice {
class AeroL : public QObject {
Q_OBJECT
public:
enum ChannelType { PChannel, RChannel, TChannel };

explicit AeroL(QObject *parent = 0);
~AeroL();
void ConnectSinkDevice(QIODevice *device);
void DisconnectSinkDevice();
qint64 readData(char *data, qint64 maxlen);
qint64 writeData(const char *data, qint64 len);
signals:
void DataCarrierDetect(bool status);
void ACARSsignal(ACARSItem &acarsitem);
Expand Down Expand Up @@ -884,16 +879,13 @@ public slots:
void processDemodulatedSoftBits(const QVector<short> &soft_bits);

private:
bool Start();
void Stop();
void SendCAssignment(int k, QString decline);
void SendLogOnOff(int k, QString text);

CChannelAssignmentItem CreateCAssignmentItem(QByteArray su);
QByteArray &Decode(QVector<short> &bits, bool soft = false);
QByteArray &DecodeC(QVector<short> &bits);

QPointer<QIODevice> psinkdevice;
QVector<short> sbits;
QByteArray decodedbytes;
PreambleDetector preambledetector;
Expand Down
2 changes: 0 additions & 2 deletions decode/mskdemodulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ class MskDemodulator : public QObject {

BaceConverter bc;

QPointer<QIODevice> pdatasinkdevice;

QElapsedTimer timer;

double ee;
Expand Down
13 changes: 0 additions & 13 deletions decode/oqpskdemodulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,19 +559,6 @@ qint64 OqpskDemodulator::writeData(const char *data, qint64 len) {
// someone uses C band with lots of drift. untested on C-band.
mixer_fir_pre.SetFreq(mixer2_freq_sum / ((double)i));

// return the demodulated data (packed in bytes)
// using bytes and the qiodevice class
if (!RxDataBytes.isEmpty()) {
if (mse < signalthreshold || lastmse < signalthreshold) {
if (!pdatasinkdevice.isNull()) {
QIODevice *io = pdatasinkdevice.data();
if (io->isOpen())
io->write(RxDataBytes);
}
}
RxDataBytes.clear();
}

return len;
}

Expand Down
1 change: 0 additions & 1 deletion decode/oqpskdemodulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class OqpskDemodulator : public QObject {
void processDemodulatedSoftBits(const QVector<short> &soft_bits);

private:
QPointer<QIODevice> pdatasinkdevice;
bool afc;

QVector<double> spectrumcycbuff;
Expand Down

0 comments on commit b01c94e

Please sign in to comment.