1
0
mirror of https://github.com/JvanKatwijk/qt-dab.git synced 2025-10-06 00:02:40 +02:00
Files
SDR-DAB_Qt-DAB/sources/backend/data/pad-handler.h

117 lines
3.2 KiB
C
Raw Normal View History

2017-02-06 14:09:08 +01:00
#
/*
2025-03-29 10:51:10 +01:00
* Copyright (C) 2015 .. 2025
2017-02-06 14:09:08 +01:00
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
2017-03-27 16:32:49 +02:00
* This file is part of the Qt-DAB program
2023-03-04 11:53:24 +01:00
*
2017-03-27 16:32:49 +02:00
* Qt-DAB is free software; you can redistribute it and/or modify
2017-02-06 14:09:08 +01:00
* 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.
*
2017-03-27 16:32:49 +02:00
* Qt-DAB is distributed in the hope that it will be useful,
2017-02-06 14:09:08 +01:00
* 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
2017-03-27 16:32:49 +02:00
* along with Qt-DAB; if not, write to the Free Software
2017-02-06 14:09:08 +01:00
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
2023-09-20 21:17:22 +02:00
#pragma once
2017-02-06 14:09:08 +01:00
#include <QObject>
#include <cstring>
2019-07-08 23:43:00 +02:00
#include <cstdint>
2018-01-06 19:37:34 +01:00
#include <vector>
2025-05-27 18:50:45 +02:00
#include "mot-object.h"
#include <QScopedPointer>
2017-02-06 14:09:08 +01:00
class RadioInterface;
2025-06-07 18:45:00 +02:00
struct DL2_object {
uint8_t ct;
uint8_t base;
uint8_t len;
2025-06-09 15:04:46 +02:00
QString str;
2025-06-07 18:45:00 +02:00
};
struct DL2_base {
bool valid;
uint8_t IT;
uint8_t IR;
QString dlsText;
struct DL2_object entity [4];
};
2017-02-06 14:09:08 +01:00
class padHandler: public QObject {
Q_OBJECT
public:
2023-09-23 11:50:09 +02:00
padHandler (RadioInterface *,
bool);
2023-03-04 11:53:24 +01:00
~padHandler ();
2025-06-09 15:04:46 +02:00
void processPAD (const uint8_t *,
2023-03-04 11:53:24 +01:00
int16_t, uint8_t, uint8_t);
2017-02-06 14:09:08 +01:00
private:
2023-03-04 11:53:24 +01:00
RadioInterface *myRadioInterface;
2023-09-23 11:50:09 +02:00
bool backgroundFlag;
2025-06-09 15:04:46 +02:00
void handle_variablePAD (const uint8_t *,
int16_t, uint8_t);
void handle_shortPAD (const uint8_t *,
int16_t, uint8_t);
void dynamicLabel (const uint8_t *,
int16_t, uint8_t);
void new_MSC_element (const std::vector<uint8_t> &);
void add_MSC_element (const std::vector<uint8_t> &);
void build_MSC_segment (const std::vector<uint8_t> &);
2023-03-04 11:53:24 +01:00
bool pad_crc (uint8_t *, int16_t);
2024-04-14 12:47:14 +02:00
QByteArray dynamicLabelText;
2023-03-04 11:53:24 +01:00
int16_t charSet;
2025-05-27 18:50:45 +02:00
QScopedPointer<motObject> currentSlide;
2023-03-04 11:53:24 +01:00
uint8_t last_appType;
bool mscGroupElement;
int xpadLength;
int16_t still_to_go;
2018-02-12 16:55:26 +01:00
std::vector<uint8_t> shortpadData;
2023-03-04 11:53:24 +01:00
bool lastSegment;
bool firstSegment;
int16_t segmentNumber;
2017-12-27 19:11:36 +01:00
// dataGroupLength is set when having processed an appType 1
2023-03-04 11:53:24 +01:00
int dataGroupLength;
2025-05-27 18:50:45 +02:00
int16_t segmentno;
int16_t remainDataLength;
bool isLastSegment;
bool moreXPad;
2017-12-27 19:11:36 +01:00
//
// The msc_dataGroupBuffer is - as the name suggests - used for
// assembling the msc_data group.
2018-01-06 19:37:34 +01:00
std::vector<uint8_t> msc_dataGroupBuffer;
2017-12-27 19:11:36 +01:00
2025-06-07 18:45:00 +02:00
// Experimental
2025-09-09 17:42:31 +02:00
struct {
QString theText;
bool valid;
QString title;
QString composer;
QString stationname;
QString currentProgram;
} DL2_record;
2025-06-07 18:45:00 +02:00
DL2_base the_DL2;
2025-09-09 17:42:31 +02:00
QString extractText (uint16_t, uint16_t);
2025-06-07 18:45:00 +02:00
void add_toDL2 (const QString &);
2025-09-08 13:38:08 +02:00
void add_toDL2 (const uint8_t *,
uint8_t, uint8_t);
2017-02-06 14:09:08 +01:00
signals:
2025-08-14 22:00:06 +02:00
void showLabel (const QString &, int);
2025-06-07 18:45:00 +02:00
void show_mothandling (bool);
2025-09-09 17:42:31 +02:00
void show_dl2 (uint8_t, uint8_t,
2025-06-09 15:04:46 +02:00
const QString &);
2017-02-06 14:09:08 +01:00
};