forked from peterkvt80/vbit2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packetmag.h
77 lines (61 loc) · 2.42 KB
/
packetmag.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef PACKETMAG_H
#define PACKETMAG_H
#include <list>
#include <packetsource.h>
#include "ttxpagestream.h"
#include "carousel.h"
#include "specialpages.h"
#include "normalpages.h"
#include "configure.h"
#define MAXPACKET29TYPES 3
namespace vbit
{
enum PacketState {PACKETSTATE_HEADER, PACKETSTATE_FASTEXT, PACKETSTATE_PACKET26, PACKETSTATE_PACKET27, PACKETSTATE_PACKET28, PACKETSTATE_TEXTROW};
class PacketMag : public PacketSource
{
public:
/** Default constructor */
PacketMag(uint8_t mag, std::list<TTXPageStream>* pageSet, ttx::Configure *configure, uint8_t priority);
/** Default destructor */
virtual ~PacketMag();
/** Access _pageSet
* \return The current value of _pageSet
*/
std::list<TTXPageStream>* Get_pageSet() { return _pageSet; }
SpecialPages* GetSpecialPages() { return _specialPages; }
NormalPages* GetNormalPages() { return _normalPages; }
Carousel* GetCarousel() { return _carousel; }
/** Get the next packet
* @return The next packet OR if IsReady() would return false then a filler packet
*/
Packet* GetPacket(Packet* p) override;
void SetPriority(uint8_t priority) { _priority = priority; }
bool IsReady(bool force=false);
void SetPacket29(TTXLine *lines[MAXPACKET29TYPES]);
protected:
private:
std::list<TTXPageStream>* _pageSet; //!< Member variable "_pageSet"
ttx::Configure* _configure;
TTXPageStream* _page; //!< The current page being output
int _magNumber; //!< The number of this magazine. (where 0 is mag 8)
uint8_t _priority; //!< Priority of transmission where 1 is highest
std::list<TTXPageStream>::iterator _it;
Carousel* _carousel;
SpecialPages* _specialPages;
NormalPages* _normalPages;
uint8_t _priorityCount; /// Controls transmission priority
PacketState _state; /// State machine to sequence packet types
uint8_t _thisRow; // The current line that we are outputting
TTXLine* _lastTxt; // The text of the last row that we fetched. Used for enhanced packets
TTXLine* _packet29[MAXPACKET29TYPES]; // space to store magazine related enhancement packets
TTXLine* _nextPacket29;
int _nextPacket29DC;
int _magRegion;
int _status;
int _region;
bool _hasX28Region;
bool _specialPagesFlipFlop; // toggle to alternate between special pages and normal pages
int _waitingForField;
};
}
#endif // PACKETMAG_H