1
0
mirror of https://github.com/JvanKatwijk/qt-dab.git synced 2025-10-06 00:02:40 +02:00

first step in handling DL2

This commit is contained in:
Jan
2025-09-09 17:42:31 +02:00
parent c3294adbbc
commit d68e45f59a
13 changed files with 186 additions and 89 deletions

View File

@@ -4,4 +4,4 @@ HERE="$(dirname "$(readlink -f "${0}")")"
# Try to run using sudo, if this does not work ask the user for password # Try to run using sudo, if this does not work ask the user for password
#sudo -n -E -- "/tmp/udev-rules-helper" || pkexec "/tmp/udev-rules-helper" #sudo -n -E -- "/tmp/udev-rules-helper" || pkexec "/tmp/udev-rules-helper"
#rm "/tmp/udev-rules-helper" #rm "/tmp/udev-rules-helper"
exec "${HERE}/usr/bin/qt-dab-6.9.3" "$@" exec "${HERE}/usr/bin/qt-dab-6.9.4" "$@"

View File

@@ -1,6 +1,6 @@
[Desktop Entry] [Desktop Entry]
Name=Qt6_DAB-6.9.3 Name=Qt6_DAB-6.9.4
Exec=qt-dab-6.9.3 Exec=qt-dab-6.9.4
Icon=qt-dab-6.9 Icon=qt-dab-6.9
Type=Application Type=Application
Categories=AudioVideo; Categories=AudioVideo;

View File

@@ -11,7 +11,7 @@ mkdir -p ./appdir/usr/share/applications
mkdir -p ./appdir/usr/share/icons/hicolor/128x128/apps/ mkdir -p ./appdir/usr/share/icons/hicolor/128x128/apps/
mkdir -p ./appdir/usr/share/icons/hicolor/256x256/apps/ mkdir -p ./appdir/usr/share/icons/hicolor/256x256/apps/
cp linux-bin/qt-dab* appdir/usr/bin/qt-dab-6.9.3 cp linux-bin/qt-dab* appdir/usr/bin/qt-dab-6.9.4
cp app-files/qt-dab-6.9.desktop appdir/usr/share/applications cp app-files/qt-dab-6.9.desktop appdir/usr/share/applications
cp ../res/radio-pcitures/qt-dab-6.9-256x256.png appdir/qt-dab-RC.png cp ../res/radio-pcitures/qt-dab-6.9-256x256.png appdir/qt-dab-RC.png
cp ../res/radio-pictures/qt-dab-6.9-128x128.png appdir/usr/share/icons/hicolor/128x128/apps/ cp ../res/radio-pictures/qt-dab-6.9-128x128.png appdir/usr/share/icons/hicolor/128x128/apps/

View File

@@ -392,10 +392,10 @@ SOURCES += ./sources/main/main.cpp \
unix { unix {
DESTDIR = ./linux-bin DESTDIR = ./linux-bin
equals (QT_MAJOR_VERSION, 5) { equals (QT_MAJOR_VERSION, 5) {
TARGET = qt-dab-qt5-6.9.3 TARGET = qt-dab-qt5-6.9.4
} }
else { else {
TARGET = qt-dab-qt6-6.9.3 TARGET = qt-dab-qt6-6.9.4
} }
exists ("../.git") { exists ("../.git") {
GITHASHSTRING = $$system(git rev-parse --short HEAD) GITHASHSTRING = $$system(git rev-parse --short HEAD)
@@ -521,17 +521,17 @@ isEmpty(GITHASHSTRING) {
# #
#for win32, comment out the lines above #for win32, comment out the lines above
equals (QT_MAJOR_VERSION, 5) { equals (QT_MAJOR_VERSION, 5) {
TARGET = qt-dab32-qt5-6.9V3.3 TARGET = qt-dab32-qt5-6.9V3.4
} }
else { else {
TARGET = qt-dab32-qt6-6.9V3.3 TARGET = qt-dab32-qt6-6.9V3.4
} }
CONFIG += dabstick-win-v3 CONFIG += dabstick-win-v3
# equals (QT_MAJOR_VERSION, 5) { # equals (QT_MAJOR_VERSION, 5) {
# TARGET = qt-dab32-qt5-6.9.3 # TARGET = qt-dab32-qt5-6.9.4
# } # }
# else { # else {
# TARGET = qt-dab32-qt6-6.9.3 # TARGET = qt-dab32-qt6-6.9.4
# } # }
# CONFIG += dabstick-win-v4 # CONFIG += dabstick-win-v4
CONFIG += airspy-2 CONFIG += airspy-2

View File

@@ -40,8 +40,8 @@
mr, &RadioInterface::showLabel); mr, &RadioInterface::showLabel);
connect (this, &padHandler::show_mothandling, connect (this, &padHandler::show_mothandling,
mr, &RadioInterface::show_mothandling); mr, &RadioInterface::show_mothandling);
connect (this, &padHandler::show_title, connect (this, &padHandler::show_dl2,
mr, &RadioInterface::show_title); mr, &RadioInterface::show_dl2);
// //
// mscGroupElement indicates whether we are handling an // mscGroupElement indicates whether we are handling an
// msc datagroup or not. // msc datagroup or not.
@@ -69,6 +69,12 @@
the_DL2. IR = 10; the_DL2. IR = 10;
for (int i = 0; i < 4; i ++) for (int i = 0; i < 4; i ++)
the_DL2. entity [i]. ct = 65; the_DL2. entity [i]. ct = 65;
DL2_record. theText = "";
DL2_record. title = "";
DL2_record. composer = "";
DL2_record. stationname = "";
DL2_record. currentProgram = "";
} }
padHandler::~padHandler() { padHandler::~padHandler() {
@@ -624,87 +630,81 @@ uint16_t index;
// //
// Experimental code // Experimental code
void padHandler::add_toDL2 (const QString &text) { void padHandler::add_toDL2 (const QString &text) {
if (the_DL2. dlsText != text) { if (DL2_record. theText != text) {
the_DL2. dlsText = text; DL2_record. theText = text;
// fprintf (stderr, "dl2 fragment %s\n", text. toLatin1 (). data ()); DL2_record. valid = true;
the_DL2. valid = true; // non existent key
for (int i = 0; i < 4; i ++)
the_DL2. entity [i]. ct = 65;
} }
} }
static uint8_t oldIT = 0; QString padHandler::extractText (uint16_t start, uint16_t length) {
QString res;
for (int i = start; i <= start + length; i ++)
res = res + QChar (DL2_record. theText. at (i));
return res;
}
void padHandler::add_toDL2 (const uint8_t *data, void padHandler::add_toDL2 (const uint8_t *data,
uint8_t field_2, uint8_t field_3) { uint8_t field_2, uint8_t field_3) {
// if (!the_DL2. valid) if (DL2_record. theText. size () == 0)
return; return;
uint8_t CId = (data [0] >> 4) & 0x0f; uint8_t CId = (data [0] >> 4) & 0x0f;
uint8_t CB = data [0] & 0x0f; uint8_t CB = data [0] & 0x0f;
// fprintf (stderr, "IT = %d, IR = %d, NT = %d\n", if ((CB & 04) == 0) // IR should be "running"
// (CB >> 3), (CB >> 2) & 0x01, CB & 0x03);
if ((CB & 04) == 0)
return; return;
if (oldIT != (CB & 0x08)) { uint8_t IT = CB & 0x08;
oldIT = (CB & 0x08);
fprintf (stderr, "switch\n");
}
for (int i = 0; i < field_3; i += 3) { for (int i = 0; i < field_3; i += 3) {
uint8_t contentType = data [1 + i + 0] & 0x3F; uint8_t contentType = data [1 + i + 0] & 0x3F;
uint8_t startMarker = data [1 + i + 1] & 0x7F; uint8_t startMarker = data [1 + i + 1] & 0x7F;
uint8_t lengthMarker = data [1 + i + 2] & 0x7F; uint8_t lengthMarker = data [1 + i + 2] & 0x7F;
switch (contentType) { switch (contentType) {
case 1 : { // the title case 1 : { // the title
QString ss; QString ss = extractText (startMarker, lengthMarker);
for (int i = startMarker; if (ss. size () > 0) {
i <= startMarker + lengthMarker; i ++) if (ss != DL2_record. title) {
ss = ss + QChar (the_DL2. dlsText. at (i)); DL2_record. title = ss;
if (ss. size () > 0) show_dl2 (contentType, IT, ss);
fprintf (stderr, "Title -> %s\n", }
ss. toLatin1 (). data ()); }
break; break;
} }
case 4: // the artist case 4: // the artist
case 8: { // the composer case 8: // the composer
QString ss; case 9: { // the band
for (int i = startMarker; QString ss = extractText (startMarker, lengthMarker);
i <= startMarker + lengthMarker; i ++) if (ss. size () > 0) {
ss = ss + QChar (the_DL2. dlsText. at (i)); if (ss != DL2_record. composer) {
if (ss. size () > 0) DL2_record. composer = ss;
fprintf (stderr, "Composer -> %s\n", show_dl2 (contentType, IT, ss);
ss. toLatin1 (). data ()); }
}
break; break;
} }
case 32: // stationname long case 32: // stationname long
case 31: { // stationname short case 31: { // stationname short
QString ss; QString ss = extractText (startMarker, lengthMarker);
for (int i = startMarker; if (ss. size () > 0) {
i <= startMarker + lengthMarker; i ++) if (DL2_record. stationname != ss) {
ss = ss + QChar (the_DL2. dlsText. at (i)); DL2_record. stationname = ss;
if (ss. size () > 0) show_dl2 (contentType, IT, ss);
fprintf (stderr, "stationname -> %s\n", }
ss. toLatin1 (). data ()); }
break; break;
} }
case 33: { // program now case 33: { // program now
QString ss; QString ss = extractText (startMarker, lengthMarker);
for (int i = startMarker; if (ss. size () > 0) {
i <= startMarker + lengthMarker; i ++) if (DL2_record. currentProgram != ss) {
ss = ss + QChar (the_DL2. dlsText. at (i)); DL2_record. currentProgram = ss;
if (ss. size () > 0) show_dl2 (contentType, IT, ss);
fprintf (stderr, "current program -> %s\n", }
ss. toLatin1 (). data ()); }
break; break;
} }
default: { default: {
QString ss; // QString ss = extractText (startMarker, lengthMarker);
for (int i = startMarker; // if (ss. size () > 0)
i <= startMarker + lengthMarker; i ++) // fprintf (stderr, "%d -> %s\n", contentType,
ss = ss + QChar (the_DL2. dlsText. at (i)); // ss. toLatin1 (). data ());
if (ss. size () > 0)
fprintf (stderr, "%d -> %s\n", contentType,
ss. toLatin1 (). data ());
break; break;
} }
} }

View File

@@ -94,14 +94,23 @@ private:
std::vector<uint8_t> msc_dataGroupBuffer; std::vector<uint8_t> msc_dataGroupBuffer;
// Experimental // Experimental
struct {
QString theText;
bool valid;
QString title;
QString composer;
QString stationname;
QString currentProgram;
} DL2_record;
DL2_base the_DL2; DL2_base the_DL2;
QString extractText (uint16_t, uint16_t);
void add_toDL2 (const QString &); void add_toDL2 (const QString &);
void add_toDL2 (const uint8_t *, void add_toDL2 (const uint8_t *,
uint8_t, uint8_t); uint8_t, uint8_t);
signals: signals:
void showLabel (const QString &, int); void showLabel (const QString &, int);
void show_mothandling (bool); void show_mothandling (bool);
void show_title (uint8_t, uint8_t, void show_dl2 (uint8_t, uint8_t,
const QString &); const QString &);
}; };

View File

@@ -277,7 +277,7 @@ float sum = 0;
else else
if (this -> decoder == DECODER_2) { // decoder 2 if (this -> decoder == DECODER_2) { // decoder 2
DABFLOAT corrector = DABFLOAT corrector =
meanLevelVector [index] / sigmaSQ_Vector [index]; 1.5 * meanLevelVector [index] / sigmaSQ_Vector [index];
corrector /= (1 / snr + 3); corrector /= (1 / snr + 3);
Complex R1 = corrector * normalize (fftBin) * Complex R1 = corrector * normalize (fftBin) *
(DABFLOAT)(sqrt (jan_abs (fftBin) * (DABFLOAT)(sqrt (jan_abs (fftBin) *

View File

@@ -78,7 +78,7 @@ QString aacComment;
ui -> appName -> setText ("<b>Qt-DAB</b>"); ui -> appName -> setText ("<b>Qt-DAB</b>");
ui -> author -> setText(tr("Developed by")+" Jan van Katwijk (<a href=\"mailto:J.vanKatwijk@gmail.com\">J.vanKatwijk@gmail.com</a>)"); ui -> author -> setText(tr("Developed by")+" Jan van Katwijk (<a href=\"mailto:J.vanKatwijk@gmail.com\">J.vanKatwijk@gmail.com</a>)");
ui -> author -> setTextInteractionFlags (Qt::TextBrowserInteraction); ui -> author -> setTextInteractionFlags (Qt::TextBrowserInteraction);
ui -> version -> setText (QString("Version-6.%1").arg ("9.3")); ui -> version -> setText (QString("Version-6.%1").arg ("9.4"));
QString theDate = QString (__DATE__) + " " + QString (__TIME__); QString theDate = QString (__DATE__) + " " + QString (__TIME__);
ui -> buildInfo -> setText (QString ("Built on ") + theDate + QString (", Commit ") + QString (GITHASH) + " with " + support); ui -> buildInfo -> setText (QString ("Built on ") + theDate + QString (", Commit ") + QString (GITHASH) + " with " + support);
ui -> sourceLocation -> setText ("Sources are at <a href=\"https://github.com/JvanKatwijk/qt-dab\">github> </a>"); ui -> sourceLocation -> setText ("Sources are at <a href=\"https://github.com/JvanKatwijk/qt-dab\">github> </a>");

View File

@@ -489,6 +489,13 @@ void configHandler::set_connections () {
connect (dcRemoval, &QCheckBox::stateChanged, connect (dcRemoval, &QCheckBox::stateChanged,
#endif #endif
this, &configHandler::handle_dcRemoval); this, &configHandler::handle_dcRemoval);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect (saveTitlesSelector, &QCheckBox::checkStateChanged,
#else
connect (saveTitlesSelector, &QCheckBox::stateChanged,
#endif
this, &configHandler::handle_saveTitles);
// //
// botton row // botton row
connect (decoderSelector, connect (decoderSelector,
@@ -1066,3 +1073,11 @@ bool configHandler::get_dcRemoval () {
return dcRemoval -> isChecked (); return dcRemoval -> isChecked ();
} }
void configHandler::handle_saveTitles (int h) {
(void)h;
}
bool configHandler::get_saveTitles () {
return saveTitlesSelector -> isChecked ();
}

View File

@@ -90,6 +90,7 @@ public:
bool get_allTIISelector (); bool get_allTIISelector ();
bool get_dcRemoval (); bool get_dcRemoval ();
bool get_saveTitles ();
private: private:
RadioInterface *myRadioInterface; RadioInterface *myRadioInterface;
QSettings *dabSettings; QSettings *dabSettings;
@@ -141,6 +142,7 @@ private slots:
void handle_auto_http (int); void handle_auto_http (int);
void handle_dcRemoval (int); void handle_dcRemoval (int);
void handle_saveTitles (int);
void handle_tiiCollisions (int); void handle_tiiCollisions (int);
void handle_tiiFilter (int); void handle_tiiFilter (int);

View File

@@ -598,9 +598,9 @@
</widget> </widget>
</item> </item>
<item row="4" column="2"> <item row="4" column="2">
<widget class="QCheckBox" name="checkBox_2"> <widget class="QCheckBox" name="saveTitlesSelector">
<property name="text"> <property name="text">
<string/> <string>save titles</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -301,11 +301,11 @@ QString h;
this, &RadioInterface::handle_newDisplayFrame_closed); this, &RadioInterface::handle_newDisplayFrame_closed);
#ifdef HAVE_RTLSDR_V3 #ifdef HAVE_RTLSDR_V3
SystemVersion = QString ("9.3") + " with RTLSDR-V3"; SystemVersion = QString ("9.4") + " with RTLSDR-V3";
#elif HAVE_RTLSDR_V4 #elif HAVE_RTLSDR_V4
SystemVersion = QString ("9.3") + " with RTLSDR-V4"; SystemVersion = QString ("9.4") + " with RTLSDR-V4";
#else #else
SystemVersion = QString ("9.3"); SystemVersion = QString ("9.4");
#endif #endif
#if QT_VERSION > QT_VERSION_CHECK (6, 0, 0) #if QT_VERSION > QT_VERSION_CHECK (6, 0, 0)
version = "Qt6-DAB-6." + SystemVersion ; version = "Qt6-DAB-6." + SystemVersion ;
@@ -4612,18 +4612,90 @@ void RadioInterface::handle_dcRemoval (bool b) {
theNewDisplay. set_dcRemoval (b); theNewDisplay. set_dcRemoval (b);
} }
void RadioInterface::show_title (uint8_t IR, uint8_t ct, static QString previousComposer;
static uint8_t old_IT = 0;
void RadioInterface::show_dl2 (uint8_t ct, uint8_t IT,
const QString &s) { const QString &s) {
(void)IR; static QString title = "";
return; static QString composer = "";
if (s == "") static QString stationName = "";
fprintf (stderr, "einde fragment\n"); static QString programNow = "";
else
if (ct == 1) if (!configHandler_p -> get_saveTitles ())
fprintf (stderr, "Ttitle: %s\n", s. toUtf8 (). data ()); return;
else
if (ct == 4) QString fileName = theFilenameFinder. basicPath ();
fprintf (stderr, "Artist: %s\n", s. toUtf8 (). data ()); if (!fileName. endsWith ("/"))
fileName += "/";
fileName += "DL2_titles.csv";
QDateTime theTime = QDateTime::currentDateTime ();
QString currentService = channel. currentService. serviceName;
QString res = "";
if (IT != old_IT)
fprintf (stderr, "Switch\n");
old_IT = IT;
switch (ct) {
case 1: // the title
title = s;
if (composer != "") {
res = theTime. toString () + ";" +
currentService + ";" +
title + ";" + composer + ";";
title = "";
composer = "";
}
break;
case 4: // the artist
case 8: // the composer
case 9: // the band
if (previousComposer == "")
previousComposer = s;
else
if (previousComposer. startsWith (s) ||
s. startsWith (previousComposer) ||
s == previousComposer)
break;
previousComposer = s;
composer = s;
if (title != "") {
res = theTime. toString () + ";" +
currentService + ";" +
title + ";" + composer + ";";
title = "";
composer = "";
}
break;
case 31: // stationname short
case 32: // stationname long
stationName = s;
if (programNow != "") {
res = theTime. toString () + ";" +
currentService + ";" + stationName + ";" +
programNow + ";";
stationName = "";
programNow = "";
}
break;
case 33: // program now
programNow = s;
if (stationName != "") {
res = theTime. toString () + ";" +
currentService + ";" + stationName + ";" +
programNow + ";";
stationName = "";
programNow = "";
}
break;
default:
break;
}
if (res != "") {
FILE *dlTextFile = fopen (fileName. toUtf8 (). data (), "a+");
if (dlTextFile != nullptr) {
fprintf (dlTextFile, "%s\n", res. toLatin1 (). data ());
fclose (dlTextFile);
}
}
} }
void RadioInterface::nrActiveServices (int n) { void RadioInterface::nrActiveServices (int n) {

View File

@@ -548,6 +548,10 @@ public slots:
void handleFramedumpButton (); void handleFramedumpButton ();
void handleAudiodumpButton (); void handleAudiodumpButton ();
void startJournaline (int);
void stopJournaline (int);
void journalineData (QByteArray,
int);
// Somehow, these must be connected to the GUI // Somehow, these must be connected to the GUI
private slots: private slots:
void handle_aboutLabel (); void handle_aboutLabel ();
@@ -616,15 +620,10 @@ public slots:
void handle_tiiFilter (bool); void handle_tiiFilter (bool);
void deviceListChanged (); void deviceListChanged ();
void show_title (uint8_t, void show_dl2 (uint8_t,
uint8_t, uint8_t,
const QString &); const QString &);
void nrActiveServices (int); void nrActiveServices (int);
void handle_activeServices (); void handle_activeServices ();
void startJournaline (int);
void stopJournaline (int);
void journalineData (QByteArray,
int);
}; };