2020-09-11 12:06:06 +01:00
|
|
|
/*
|
2024-12-31 10:51:06 +00:00
|
|
|
* Copyright (C) 2020-2025 Gavin MacGregor
|
2020-09-11 12:06:06 +01:00
|
|
|
*
|
|
|
|
|
* This file is part of QTeletextMaker.
|
|
|
|
|
*
|
|
|
|
|
* QTeletextMaker 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 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* QTeletextMaker 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 QTeletextMaker. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef PAGEBASE_H
|
|
|
|
|
#define PAGEBASE_H
|
|
|
|
|
|
|
|
|
|
#include <QByteArray>
|
|
|
|
|
|
|
|
|
|
// If we inherit from QObject then we can't copy construct, so "make a new subpage that's a copy of this one" wouldn't work
|
|
|
|
|
class PageBase //: public QObject
|
|
|
|
|
{
|
|
|
|
|
//Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2020-11-24 19:01:25 +00:00
|
|
|
enum ControlBitsEnum { C4ErasePage, C5Newsflash, C6Subtitle, C7SuppressHeader, C8Update, C9InterruptedSequence, C10InhibitDisplay, C11SerialMagazine, C12NOS, C13NOS, C14NOS };
|
2025-05-25 14:42:03 +01:00
|
|
|
// Available Page Functions according to 9.4.2.1 of the spec
|
|
|
|
|
enum PageFunctionEnum { PFUnknown = -1, PFLevelOnePage, PFDataBroadcasting, PFGlobalPOP, PFNormalPOP, PFGlobalDRCS, PFNormalDRCS, PFMOT, PFMIP, PFBasicTOPTable, PFAdditionalInformationTable, PFMultiPageTable, PFMultiPageExtensionTable, PFTriggerMessages };
|
|
|
|
|
// Available Page Codings of X/1 to X/25 according to 9.4.2.1 of the spec
|
|
|
|
|
enum PacketCodingEnum { CodingUnknown = -1, Coding7bit, Coding8bit, Coding18bit, Coding4bit, Coding4bitThen7bit, CodingPerPacket };
|
2020-11-22 12:19:48 +00:00
|
|
|
|
2020-09-11 12:06:06 +01:00
|
|
|
PageBase();
|
2020-09-16 20:49:52 +01:00
|
|
|
|
2025-05-25 14:42:03 +01:00
|
|
|
virtual PageFunctionEnum pageFunction() const { return PFUnknown; }
|
|
|
|
|
virtual PacketCodingEnum packetCoding() const { return CodingUnknown; }
|
|
|
|
|
|
2020-12-06 17:57:05 +00:00
|
|
|
virtual bool isEmpty() const;
|
|
|
|
|
|
2025-02-12 19:03:48 +00:00
|
|
|
virtual QByteArray packet(int y) const { return m_displayPackets[y]; }
|
|
|
|
|
virtual QByteArray packet(int y, int d) const { return m_designationPackets[y-26][d]; }
|
|
|
|
|
virtual bool setPacket(int y, QByteArray pkt);
|
2025-02-11 18:46:01 +00:00
|
|
|
virtual bool setPacket(int y, int d, QByteArray pkt);
|
2025-02-12 19:03:48 +00:00
|
|
|
virtual bool packetExists(int y) const { return !m_displayPackets[y].isEmpty(); }
|
|
|
|
|
virtual bool packetExists(int y, int d) const { return !m_designationPackets[y-26][d].isEmpty(); }
|
2025-05-25 14:42:03 +01:00
|
|
|
virtual bool clearPacket(int y);
|
|
|
|
|
virtual bool clearPacket(int y, int d);
|
|
|
|
|
virtual void clearAllPackets();
|
2025-02-11 18:46:01 +00:00
|
|
|
|
|
|
|
|
virtual bool controlBit(int b) const { return m_controlBits[b]; }
|
|
|
|
|
virtual bool setControlBit(int b, bool active);
|
2020-09-15 22:37:50 +01:00
|
|
|
|
2020-09-11 12:06:06 +01:00
|
|
|
private:
|
2020-11-24 19:01:25 +00:00
|
|
|
bool m_controlBits[11];
|
2025-02-12 19:03:48 +00:00
|
|
|
QByteArray m_displayPackets[26], m_designationPackets[3][16];
|
2020-09-11 12:06:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|