mirror of
https://github.com/JvanKatwijk/qt-dab.git
synced 2025-10-06 00:02:40 +02:00
changed control journaline
This commit is contained in:
@@ -288,6 +288,7 @@ add_definitions (-D__THREADED_BACKEND__) # uncomment for use for an RPI
|
||||
./sources/backend/data/adv-datahandler.h
|
||||
./sources/backend/data/data-processor.h
|
||||
./sources/backend/data/ip-datahandler.h
|
||||
./sources/backend/data/journaline-controller.h
|
||||
./sources/backend/data/journaline-datahandler.h
|
||||
./sources/backend/data/journaline-screen.h
|
||||
./sources/backend/data/pad-handler.h
|
||||
@@ -417,6 +418,7 @@ add_definitions (-D__THREADED_BACKEND__) # uncomment for use for an RPI
|
||||
./sources/backend/data/adv-datahandler.cpp
|
||||
./sources/backend/data/data-processor.cpp
|
||||
./sources/backend/data/ip-datahandler.cpp
|
||||
./sources/backend/data/journaline-controller.cpp
|
||||
./sources/backend/data/journaline-datahandler.cpp
|
||||
./sources/backend/data/journaline-screen.cpp
|
||||
./sources/backend/data/pad-handler.cpp
|
||||
|
@@ -165,6 +165,7 @@ HEADERS += ./sources/main/radio.h \
|
||||
./sources/backend/data/mot/mot-handler.h \
|
||||
./sources/backend/data/mot/mot-object.h \
|
||||
./sources/backend/data/mot/mot-dir.h \
|
||||
./sources/backend/data/journaline-controller.h \
|
||||
./sources/backend/data/journaline-datahandler.h \
|
||||
./sources/backend/data/journaline-screen.h \
|
||||
./sources/backend/data/journaline/dabdatagroupdecoder.h \
|
||||
@@ -315,6 +316,7 @@ SOURCES += ./sources/main/main.cpp \
|
||||
./sources/backend/data/mot/mot-handler.cpp \
|
||||
./sources/backend/data/mot/mot-object.cpp \
|
||||
./sources/backend/data/mot/mot-dir.cpp \
|
||||
./sources/backend/data/journaline-controller.cpp \
|
||||
./sources/backend/data/journaline-datahandler.cpp \
|
||||
./sources/backend/data/journaline-screen.cpp \
|
||||
./sources/backend/data/journaline/crc_8_16.c \
|
||||
|
@@ -4,5 +4,9 @@ The directory "backend" contains - as the name suggests - functions to map the
|
||||
|
||||
The input here is processed by the file "msc-handler.cpp", that file
|
||||
extracts the data for the selected service(s) and initiates required backends.
|
||||
The file backend takes care of the de-interleaving, the file "backend-deconvolver" takes care of the deconvolution and data from a packet service is
|
||||
then further processed by files in the "data" directory, and audio data in the
|
||||
directory "audio".
|
||||
|
||||
|
||||
|
||||
|
@@ -29,6 +29,8 @@
|
||||
// Driver program for the selected backend. Embodying that in a
|
||||
// separate class makes the "Backend" class simpler.
|
||||
|
||||
static bool running = false;
|
||||
|
||||
backendDriver::backendDriver (RadioInterface *mr,
|
||||
logger *theLogger,
|
||||
descriptorType *d,
|
||||
@@ -71,15 +73,25 @@
|
||||
}
|
||||
else
|
||||
theProcessor. reset (new frameProcessor ()); // should not happen
|
||||
running = true;
|
||||
}
|
||||
|
||||
|
||||
backendDriver::~backendDriver() {
|
||||
// delete theProcessor;
|
||||
running = false;
|
||||
theProcessor. reset ();
|
||||
}
|
||||
|
||||
//
|
||||
void backendDriver::addtoFrame (const std::vector<uint8_t> &theData) {
|
||||
theProcessor -> addtoFrame (theData);
|
||||
if (running)
|
||||
theProcessor -> addtoFrame (theData);
|
||||
}
|
||||
|
||||
void backendDriver::stop () {
|
||||
running = false;
|
||||
theProcessor -> stop ();
|
||||
theProcessor. reset ();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -44,6 +44,7 @@ public:
|
||||
FILE *);
|
||||
~backendDriver ();
|
||||
void addtoFrame (const std::vector<uint8_t> &outData);
|
||||
void stop ();
|
||||
private:
|
||||
logger *theLogger;
|
||||
QScopedPointer<frameProcessor> theProcessor;
|
||||
|
@@ -112,7 +112,7 @@ int32_t Backend::process (int16_t *softBits, int16_t cnt) {
|
||||
(void)cnt;
|
||||
#ifdef __THREADED_BACKEND__
|
||||
while (!freeSlots. tryAcquire (1, 200))
|
||||
if (!running)
|
||||
if (!running. load ())
|
||||
return 0;
|
||||
memcpy (theData [nextIn]. data (), softBits,
|
||||
fragmentSize * sizeof (int16_t));
|
||||
@@ -158,8 +158,9 @@ void Backend::run() {
|
||||
|
||||
while (running. load()) {
|
||||
while (!usedSlots. tryAcquire (1, 200))
|
||||
if (!running)
|
||||
if (!running. load ()) {
|
||||
return;
|
||||
}
|
||||
processSegment (theData [nextOut]. data());
|
||||
}
|
||||
}
|
||||
@@ -168,7 +169,8 @@ void Backend::run() {
|
||||
// It might take a msec for the task to stop
|
||||
void Backend::stopRunning() {
|
||||
#ifdef __THREADED_BACKEND__
|
||||
running = false;
|
||||
driver. stop ();
|
||||
running. store (false);
|
||||
while (this -> isRunning())
|
||||
usleep (1);
|
||||
// myAudioSink -> stop();
|
||||
|
@@ -28,7 +28,8 @@
|
||||
#include "virtual-datahandler.h"
|
||||
#include "ip-datahandler.h"
|
||||
#include "mot-handler.h"
|
||||
#include "journaline-datahandler.h"
|
||||
#include "journaline-controller.h"
|
||||
//#include "journaline-datahandler.h"
|
||||
#include "tdc-datahandler.h"
|
||||
#include "adv-datahandler.h"
|
||||
|
||||
@@ -67,7 +68,8 @@
|
||||
|
||||
case 5:
|
||||
if (appType == 0x44a)
|
||||
my_dataHandler. reset (new journaline_dataHandler ());
|
||||
// my_dataHandler. reset (new journaline_dataHandler ());
|
||||
my_dataHandler. reset (new journalineController (mr));
|
||||
else
|
||||
if (appType == 1500)
|
||||
my_dataHandler. reset (new adv_dataHandler (mr, dataBuffer, appType));
|
||||
@@ -82,7 +84,8 @@
|
||||
break;
|
||||
|
||||
case 44:
|
||||
my_dataHandler. reset (new journaline_dataHandler ());
|
||||
my_dataHandler. reset (new journalineController (mr));
|
||||
// my_dataHandler. reset (new journaline_dataHandler ());
|
||||
break;
|
||||
|
||||
case 59:
|
||||
@@ -233,13 +236,17 @@ uint16_t address = getBits (vec, 6, 10);
|
||||
// with data, bext 9 * 22 bytes RS data
|
||||
if ((pLength == 24) && (address == 1022)) { // RS packet
|
||||
uint8_t counter = getBits (vec, 2, 4);
|
||||
registerFEC (vec, counter);
|
||||
if (FEC_complete ()) {
|
||||
processRS (AppVector, FECVector);
|
||||
handle_RSpackets (AppVector);
|
||||
clear_FECtable ();
|
||||
fillPointer = 0;
|
||||
if (counter < 9) { // zo hoort het
|
||||
registerFEC (vec, counter);
|
||||
if (FEC_complete ()) {
|
||||
processRS (AppVector, FECVector);
|
||||
handle_RSpackets (AppVector);
|
||||
clear_FECtable ();
|
||||
fillPointer = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
fprintf (stderr, "Foute counter: %d\n", counter);
|
||||
}
|
||||
else {
|
||||
// addPacket checks the size and sets fillPointer to 0 id erroneous
|
||||
|
58
sources/backend/data/journaline-controller.cpp
Normal file
58
sources/backend/data/journaline-controller.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#
|
||||
/*
|
||||
* Copyright (C) 2015 .. 2025
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of Qt-DAB
|
||||
*
|
||||
* Qt-DAB is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Qt-DAB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Qt-DAB; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//
|
||||
// Since handling journaline implies showing an interactive screen
|
||||
// it was found to be "better" to handle the journaline data
|
||||
// in the main thread.
|
||||
// A small controller is added, interfacing between
|
||||
// the backend processes and the actual handler
|
||||
#include "journaline-controller.h"
|
||||
#include "radio.h"
|
||||
//
|
||||
static int key = 0;
|
||||
|
||||
journalineController::journalineController (RadioInterface *mr) {
|
||||
connect (this, &journalineController::startJournaline,
|
||||
mr, &RadioInterface::startJournaline);
|
||||
connect (this, &journalineController::stopJournaline,
|
||||
mr, &RadioInterface::stopJournaline);
|
||||
connect (this, &journalineController::send_mscDatagroup,
|
||||
mr, &RadioInterface::journalineData);
|
||||
currentKey = key;
|
||||
key ++;
|
||||
emit startJournaline (currentKey);
|
||||
}
|
||||
|
||||
journalineController::~journalineController () {
|
||||
emit stopJournaline (currentKey);
|
||||
}
|
||||
|
||||
void journalineController::
|
||||
add_mscDatagroup (const std::vector<uint8_t> &msc) {
|
||||
QByteArray v;
|
||||
for (int i = 0; i < msc. size (); i ++)
|
||||
v. push_back (msc [i]);
|
||||
emit send_mscDatagroup (v, currentKey);
|
||||
}
|
||||
|
45
sources/backend/data/journaline-controller.h
Normal file
45
sources/backend/data/journaline-controller.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
/*
|
||||
* Copyright (C) 2015 .. 2025
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of Qt-DAB
|
||||
*
|
||||
* Qt-DAB is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Qt-DAB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Qt-DAB; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
#include "virtual-datahandler.h"
|
||||
class RadioInterface;
|
||||
|
||||
class journalineController: public virtual_dataHandler {
|
||||
Q_OBJECT
|
||||
public:
|
||||
journalineController (RadioInterface*);
|
||||
~journalineController ();
|
||||
void add_mscDatagroup (const std::vector<uint8_t> &);
|
||||
private:
|
||||
int currentKey;
|
||||
signals:
|
||||
void startJournaline (int);
|
||||
void stopJournaline (int);
|
||||
void send_mscDatagroup (QByteArray, int);
|
||||
};
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "newsobject.h"
|
||||
#include "NML.h"
|
||||
|
||||
static bool running = false;
|
||||
static
|
||||
void my_callBack (const DAB_DATAGROUP_DECODER_msc_datagroup_header_t *header,
|
||||
const unsigned long len, const unsigned char *buf,
|
||||
@@ -58,12 +59,16 @@ void my_callBack (const DAB_DATAGROUP_DECODER_msc_datagroup_header_t *header,
|
||||
init_dataBase ();
|
||||
connect (this, &journaline_dataHandler::start,
|
||||
&theScreen, &journalineScreen::start);
|
||||
running = true;
|
||||
}
|
||||
|
||||
journaline_dataHandler::~journaline_dataHandler() {
|
||||
theScreen. hide ();
|
||||
if (!running)
|
||||
return;
|
||||
DAB_DATAGROUP_DECODER_deleteDec (theDecoder);
|
||||
destroy_dataBase ();
|
||||
running = false;
|
||||
}
|
||||
|
||||
//void journaline_dataHandler::add_mscDatagroup (QByteArray &msc) {
|
||||
@@ -80,6 +85,15 @@ int32_t res;
|
||||
return;
|
||||
}
|
||||
|
||||
void journaline_dataHandler::stop () {
|
||||
theScreen. hide ();
|
||||
if (!running)
|
||||
return;
|
||||
DAB_DATAGROUP_DECODER_deleteDec (theDecoder);
|
||||
destroy_dataBase ();
|
||||
running = false;
|
||||
}
|
||||
|
||||
void journaline_dataHandler::init_dataBase () {
|
||||
destroy_dataBase ();
|
||||
table. resize (0);
|
||||
|
@@ -38,6 +38,7 @@ public:
|
||||
~journaline_dataHandler ();
|
||||
void add_mscDatagroup (const std::vector<uint8_t> &);
|
||||
void add_to_dataBase (NML *);
|
||||
void stop ();
|
||||
private:
|
||||
std::vector<tableElement> table;
|
||||
journalineScreen theScreen;
|
||||
|
@@ -364,6 +364,8 @@ int16_t dataLength = 0;
|
||||
// for the time being
|
||||
if (Cflag) { // special dynamic label command
|
||||
uint16_t Command = (prefix >> 8) & 0x0f;
|
||||
uint8_t field_2 = (prefix >> 4) & 0x0f;
|
||||
uint8_t field_3 = prefix & 0x0f;
|
||||
switch (Command) {
|
||||
case 1:
|
||||
#ifdef _PAD_TRACE_
|
||||
@@ -378,7 +380,7 @@ int16_t dataLength = 0;
|
||||
#endif
|
||||
if (!backgroundFlag) {
|
||||
if (dataLength > 2)
|
||||
add_toDL2 (&data [2]);
|
||||
add_toDL2 (&data [2], field_2, field_3);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -631,28 +633,25 @@ void padHandler::add_toDL2 (const QString &text) {
|
||||
}
|
||||
}
|
||||
|
||||
void padHandler::add_toDL2 (const uint8_t *data) {
|
||||
int IT = (data [0] & 0x08) >> 3;
|
||||
int IR = (data [2] & 0x04) >> 2;
|
||||
//int NT = data [2] & 0x03;
|
||||
void padHandler::add_toDL2 (const uint8_t *data,
|
||||
uint8_t field_2, uint8_t field_3) {
|
||||
return;
|
||||
fprintf (stderr, "Field 2 %d %d\n", field_2 & 0x04, field_2 & 0x03);
|
||||
fprintf (stderr, "Field 3 -> nr bytes (-1) = %d\n", field_3);
|
||||
uint8_t CId = (data [0] >> 4) & 0x0f;
|
||||
uint8_t CB = data [0] & 0x0f;
|
||||
fprintf (stderr, "CId = %d, CB = %d\n", CId, CB);
|
||||
|
||||
if ((the_DL2. IT == IT) && (the_DL2. IR == IR))
|
||||
return;
|
||||
|
||||
if (the_DL2. IT != IT) { // toggle bit changed
|
||||
the_DL2. IT = IT;
|
||||
// if (IR != 0)
|
||||
// fprintf (stderr, "Show a message\n");
|
||||
// else
|
||||
// fprintf (stderr, "hide a message\n");
|
||||
}
|
||||
else
|
||||
if (the_DL2. IR != IR) {
|
||||
// if (IR == 0)
|
||||
// fprintf (stderr, "Stop met de message\n");
|
||||
// else
|
||||
// fprintf (stderr, "Restart de message\n");
|
||||
the_DL2. IR = IR;
|
||||
fprintf (stderr, "IT = %d, IR = %d, NT = %d\n",
|
||||
(CB >> 3), (CB >> 2) & 0x01, CB & 0x03);
|
||||
fprintf (stderr, "size command body %d\n", field_3);
|
||||
fprintf (stderr, "The DL plus tags\n");
|
||||
for (int i = 0; i < field_3; i += 3) {
|
||||
uint8_t contentType = data [1 + i + 0] & 0x7F;
|
||||
uint8_t startMarker = data [1 + i + 1] & 0x7F;
|
||||
uint8_t lengthMarker = data [1 + i + 2] & 0x7F;
|
||||
fprintf (stderr, "%d -> ct = %d, start %d, length %d\n",
|
||||
i, contentType, startMarker, lengthMarker);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -96,7 +96,8 @@ private:
|
||||
// Experimental
|
||||
DL2_base the_DL2;
|
||||
void add_toDL2 (const QString &);
|
||||
void add_toDL2 (const uint8_t *);
|
||||
void add_toDL2 (const uint8_t *,
|
||||
uint8_t, uint8_t);
|
||||
signals:
|
||||
void showLabel (const QString &, int);
|
||||
void show_mothandling (bool);
|
||||
|
@@ -38,4 +38,7 @@ virtual ~frameProcessor () {}
|
||||
virtual void addtoFrame (const std::vector<uint8_t> &) {
|
||||
fprintf (stderr, "in frameprocessor\n");
|
||||
}
|
||||
virtual void stop () {
|
||||
}
|
||||
|
||||
};
|
||||
|
@@ -212,12 +212,13 @@ void mscHandler::resetChannel () {
|
||||
nrServices ((int)(theBackends. size ()));
|
||||
}
|
||||
|
||||
void mscHandler::stopBackend (int subchId, int flag) {
|
||||
void mscHandler::stopBackend (const QString &serviceName,
|
||||
int subchId, int flag) {
|
||||
locker. lock ();
|
||||
for (int i = 0; i < (int)(theBackends. size ()); i ++) {
|
||||
Backend *b = theBackends. at (i);
|
||||
if ((b -> subChId == subchId) && (b -> borf == flag)) {
|
||||
// fprintf (stderr, "stopping subchannel %d\n", subchId);
|
||||
if ((b -> serviceName == serviceName) &&
|
||||
(b -> subChId == subchId) && (b -> borf == flag)) {
|
||||
b -> stopRunning ();
|
||||
delete b;
|
||||
theBackends. erase (theBackends. begin () + i);
|
||||
|
@@ -70,7 +70,7 @@ public:
|
||||
RingBuffer<std::complex<int16_t>> *,
|
||||
RingBuffer<uint8_t> *,
|
||||
FILE *, int);
|
||||
void stopBackend (int, int);
|
||||
void stopBackend (const QString &, int, int);
|
||||
void resetChannel ();
|
||||
void resetBuffers ();
|
||||
bool serviceRuns (uint32_t SId, uint16_t subChId);
|
||||
|
@@ -140,13 +140,13 @@ char manufac [256], product [256], serial [256];
|
||||
|
||||
if (rtlsdr_set_tuner_bandwidth != nullptr) {
|
||||
r = rtlsdr_set_tuner_bandwidth (theDevice, KHz (1575));
|
||||
if (r != 0)
|
||||
if (r != 0) {
|
||||
QString t = QString ("cannot set frequency to 1575 KHz");
|
||||
theErrorLogger -> add ("RTLSDR", t);
|
||||
}
|
||||
}
|
||||
r = rtlsdr_set_tuner_gain_mode (theDevice, 1);
|
||||
if (r != 0)
|
||||
if (r != 0) {
|
||||
QString t = QString ("cannot set gainmode to 1");
|
||||
theErrorLogger -> add ("RTLSDR", t);
|
||||
}
|
||||
|
@@ -104,7 +104,7 @@ int fibConfig::findIndex_subChannel_table (uint8_t subChId) {
|
||||
}
|
||||
|
||||
//
|
||||
// For the following few functions, it holds that thet all
|
||||
// For the following few functions, it holds that they all
|
||||
// fetch attributes from the subChannel,
|
||||
//int fibConfig::startAddressOf (int index) {
|
||||
//int subChId = subChannelOf (index);
|
||||
|
@@ -258,7 +258,7 @@ float sum = 0;
|
||||
// working best
|
||||
if (this -> decoder == DECODER_1) {
|
||||
DABFLOAT corrector =
|
||||
meanLevelVector [index] / sigmaSQ_Vector [index];
|
||||
1.5 * meanLevelVector [index] / sigmaSQ_Vector [index];
|
||||
corrector /= (1 / snr + 2);
|
||||
Complex R1 = corrector * normalize (fftBin) *
|
||||
(DABFLOAT)(sqrt (jan_abs (fftBin) *
|
||||
|
@@ -618,9 +618,11 @@ int ofdmHandler::freeSpace () {
|
||||
}
|
||||
|
||||
//
|
||||
void ofdmHandler::stopService (int subChId, int flag) {
|
||||
void ofdmHandler::stopService (const QString &serviceName,
|
||||
int subChId, int flag) {
|
||||
if (!scanMode)
|
||||
theMscHandler. stopBackend (subChId, flag);
|
||||
theMscHandler. stopBackend (serviceName,
|
||||
subChId, flag);
|
||||
}
|
||||
|
||||
bool ofdmHandler::setAudioChannel (audiodata &d,
|
||||
|
@@ -105,7 +105,8 @@ public:
|
||||
// for the mscHandler
|
||||
// void resetServices ();
|
||||
// void stopService (descriptorType *, int);
|
||||
void stopService (int, int);
|
||||
void stopService (const QString &,
|
||||
int, int);
|
||||
bool setAudioChannel (audiodata &,
|
||||
RingBuffer<std::complex<int16_t>> *,
|
||||
FILE *, int);
|
||||
|
@@ -151,21 +151,20 @@ auto *buffer = dynVec (std::complex<float>, nrSamples);
|
||||
std::complex<float> v = buffer [i];
|
||||
if (dcRemoval) {
|
||||
dcReal = compute_avg (dcReal, real (v), Alpha);
|
||||
dcImag = compute_avg (dcReal, imag (v), Alpha);
|
||||
dcImag = compute_avg (dcImag, imag (v), Alpha);
|
||||
v = std::complex<float> (real (v) - dcReal, imag (v) - dcImag);
|
||||
v = theEqualizer. equalize (v);
|
||||
DABFLOAT real_V = abs (real (v));
|
||||
DABFLOAT imag_V = abs (imag (v));
|
||||
IQ_Real = compute_avg (IQ_Real, real_V, Alpha);
|
||||
IQ_Imag = compute_avg (IQ_Imag, imag_V, Alpha);
|
||||
static int teller = 0;
|
||||
if (++teller >= SAMPLERATE) {
|
||||
show_dcOffset (10 * (IQ_Real - IQ_Imag) /
|
||||
((IQ_Real + IQ_Imag) / 2));
|
||||
teller = 0;
|
||||
DABFLOAT real_V = abs (real (v));
|
||||
DABFLOAT imag_V = abs (imag (v));
|
||||
IQ_Real = compute_avg (IQ_Real, real_V, Alpha);
|
||||
IQ_Imag = compute_avg (IQ_Imag, imag_V, Alpha);
|
||||
static int teller = 0;
|
||||
if (++teller >= SAMPLERATE) {
|
||||
show_dcOffset (10 * (IQ_Real - IQ_Imag) /
|
||||
((IQ_Real + IQ_Imag) / 2));
|
||||
teller = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// first: adjust frequency. We need Hz accuracy
|
||||
// Note that "phase" itself might be negative
|
||||
|
@@ -399,7 +399,7 @@ int length = Values. size () < NR_TAPS ? Values. size () : NR_TAPS;
|
||||
|
||||
for (int i = 0; i < NR_TAPS; i ++) {
|
||||
// waterfall_X [i] = i;
|
||||
waterfall_Y [i] = 0.1 * abs (Values [i]);
|
||||
// waterfall_Y [i] = 0.1 * abs (Values [i]);
|
||||
}
|
||||
|
||||
waterfallScope_p -> display (X_axis, waterfall_Y,
|
||||
|
@@ -565,6 +565,7 @@ QString h;
|
||||
leftAudio -> setAlarmEnabled (true);
|
||||
rightAudio -> setAlarmEnabled(true);
|
||||
|
||||
journalineKey = -1;
|
||||
// do we show controls?
|
||||
bool visible =
|
||||
value_i (dabSettings_p, DAB_GENERAL,
|
||||
@@ -2097,36 +2098,38 @@ void RadioInterface::stopService (dabService &s) {
|
||||
announcement_stop ();
|
||||
if (s. isAudio) {
|
||||
soundOut_p -> suspend ();
|
||||
stopAudioDumping ();
|
||||
stopFrameDumping ();
|
||||
myTimeTable. clear ();
|
||||
stopAudioDumping ();
|
||||
stopFrameDumping ();
|
||||
myTimeTable. clear ();
|
||||
|
||||
// and clean up the technical widget
|
||||
techWindow_p -> cleanUp ();
|
||||
techWindow_p -> cleanUp ();
|
||||
// and stop the service and erase it from the task list
|
||||
theOFDMHandler -> stopService (s. subChId, FORE_GROUND);
|
||||
for (int i = 0; i < (int)channel. runningTasks. size (); i ++) {
|
||||
if (channel. runningTasks [i]. serviceName == s. serviceName)
|
||||
if (channel. runningTasks [i]. runsBackground == false) {
|
||||
channel. runningTasks. erase
|
||||
theOFDMHandler -> stopService (s. serviceName,
|
||||
s. subChId, FORE_GROUND);
|
||||
for (int i = 0; i < (int)channel. runningTasks. size (); i ++) {
|
||||
if (channel. runningTasks [i]. serviceName == s. serviceName)
|
||||
if (channel. runningTasks [i]. runsBackground == false) {
|
||||
channel. runningTasks. erase
|
||||
(channel. runningTasks. begin () + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// stop "secondary services" - if any - as well
|
||||
// Note: they are not recorded on the tasklist
|
||||
int nrComps =
|
||||
theOFDMHandler -> getNrComps (s. SId);
|
||||
for (int i = 1; i < nrComps; i ++) {
|
||||
int index =
|
||||
theOFDMHandler -> getServiceComp (s. SId, i);
|
||||
if ((index < 0) ||
|
||||
(theOFDMHandler -> serviceType (index) != PACKET_SERVICE))
|
||||
int nrComps =
|
||||
theOFDMHandler -> getNrComps (s. SId);
|
||||
for (int i = 1; i < nrComps; i ++) {
|
||||
int index =
|
||||
theOFDMHandler -> getServiceComp (s. SId, i);
|
||||
if ((index < 0) ||
|
||||
(theOFDMHandler -> serviceType (index) != PACKET_SERVICE))
|
||||
continue;
|
||||
packetdata pd;
|
||||
theOFDMHandler -> packetData (index, pd);
|
||||
if (pd. defined) {
|
||||
theOFDMHandler -> stopService (pd. subchId, BACK_GROUND);
|
||||
theOFDMHandler -> stopService (pd. serviceName,
|
||||
pd. subchId, BACK_GROUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2493,9 +2496,11 @@ void RadioInterface::stopChannel () {
|
||||
//
|
||||
for (auto &serv : channel. runningTasks) {
|
||||
if (!serv. runsBackground)
|
||||
theOFDMHandler -> stopService (serv. subChId, FORE_GROUND);
|
||||
theOFDMHandler -> stopService (serv. serviceName,
|
||||
serv. subChId, FORE_GROUND);
|
||||
else
|
||||
theOFDMHandler -> stopService (serv. subChId, BACK_GROUND);
|
||||
theOFDMHandler -> stopService (serv. serviceName,
|
||||
serv. subChId, BACK_GROUND);
|
||||
|
||||
if (serv. fd != nullptr)
|
||||
fclose (serv. fd);
|
||||
@@ -4185,7 +4190,7 @@ audiodata ad;
|
||||
int teller = 0;
|
||||
for (auto &task: channel. runningTasks) {
|
||||
if (task. serviceName == service) {
|
||||
theOFDMHandler -> stopService (ad. subchId, BACK_GROUND);
|
||||
theOFDMHandler -> stopService (service, ad. subchId, BACK_GROUND);
|
||||
if (task. fd != nullptr)
|
||||
fclose (task. fd);
|
||||
channel. runningTasks. erase
|
||||
@@ -4642,4 +4647,36 @@ bool serviceAvailable = false;
|
||||
(void)serviceAvailable;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// handling journaline //
|
||||
|
||||
void RadioInterface::startJournaline (int currentKey) {
|
||||
if (!journalineHandler. isNull ())
|
||||
return;
|
||||
journalineHandler. reset (new journaline_dataHandler ());
|
||||
journalineKey = currentKey;
|
||||
}
|
||||
|
||||
void RadioInterface::stopJournaline (int currentKey) {
|
||||
if (journalineHandler. isNull ())
|
||||
return;
|
||||
if (journalineKey != currentKey)
|
||||
fprintf (stderr, "What is happenng here %d %d\n",
|
||||
journalineKey, currentKey);
|
||||
journalineHandler. reset ();
|
||||
journalineKey = -1;
|
||||
}
|
||||
|
||||
void RadioInterface::journalineData (QByteArray data,
|
||||
int currentKey) {
|
||||
if (journalineHandler. isNull ())
|
||||
return;
|
||||
if (currentKey != journalineKey)
|
||||
return;
|
||||
std::vector<uint8_t> theMscdata (data. size());
|
||||
for (int i = 0; i < data. size (); i ++)
|
||||
theMscdata [i] = data [i];
|
||||
journalineHandler -> add_mscDatagroup (theMscdata);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -75,6 +75,8 @@
|
||||
#include "ofdm-handler.h"
|
||||
|
||||
#include <QScopedPointer>
|
||||
#include "journaline-datahandler.h"
|
||||
|
||||
class QSettings;
|
||||
class ofdmHandler;
|
||||
class deviceHandler;
|
||||
@@ -273,7 +275,6 @@ private:
|
||||
timeTableHandler myTimeTable;
|
||||
xmlExtractor xmlHandler;
|
||||
epgCompiler epgVertaler;
|
||||
|
||||
// end of variables that are initalized
|
||||
|
||||
QScopedPointer<configHandler> configHandler_p;
|
||||
@@ -282,6 +283,8 @@ private:
|
||||
QScopedPointer<deviceHandler> inputDevice_p;
|
||||
bool autoStart_http ();
|
||||
bool dxMode;
|
||||
QScopedPointer<journaline_dataHandler> journalineHandler;
|
||||
int journalineKey;
|
||||
//
|
||||
// Since the local position does not depend on the channel selected
|
||||
// the local position is not stored in the channel data
|
||||
@@ -618,4 +621,10 @@ public slots:
|
||||
const QString &);
|
||||
void nrActiveServices (int);
|
||||
void handle_activeServices ();
|
||||
|
||||
|
||||
void startJournaline (int);
|
||||
void stopJournaline (int);
|
||||
void journalineData (QByteArray,
|
||||
int);
|
||||
};
|
||||
|
@@ -54,11 +54,11 @@ DABFLOAT Q_out;
|
||||
DABFLOAT Alpha_;
|
||||
public:
|
||||
equalizer () {
|
||||
I_avg = 0.0f;
|
||||
Q_avg = 0.0f;
|
||||
IQ_avg = 0.0f;
|
||||
Q_out = 0.0f;
|
||||
Alpha_ = 0.0001f;
|
||||
I_avg = 1.0f; // meanII
|
||||
Q_avg = 1.0;
|
||||
IQ_avg = 0.0f; // meanIQ
|
||||
Q_out = 0.1f; // meanQQ
|
||||
Alpha_ = 1.0 / 2048000.0;
|
||||
}
|
||||
~equalizer () {}
|
||||
|
||||
@@ -71,7 +71,7 @@ Complex equalize (Complex v) {
|
||||
DABFLOAT Beta = IQ_avg / (sqrt (I_avg) * sqrt (Q_avg));
|
||||
DABFLOAT K = v_q - Beta * v_i;
|
||||
Q_out = compute_avg (Q_out, square (K), Alpha_);
|
||||
DABFLOAT Q_gain = std::sqrt (I_avg / Q_avg);
|
||||
DABFLOAT Q_gain = std::sqrt (I_avg / Q_out);
|
||||
return Complex (v_i, K * Q_gain);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user