-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMessages.h
More file actions
74 lines (54 loc) · 1.41 KB
/
Messages.h
File metadata and controls
74 lines (54 loc) · 1.41 KB
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
#pragma once
#include "arduino.h"
#include "Print.h"
#include "DEF_Message.h"
#define AND &&
#define OR ||
#define NOT !
//using PEventFunc = void(*)(int, int);
struct TMessage;
using PMessage = TMessage *;
struct TMessage
{
public:
byte Message;
word LoParam;
word HiParam;
TMessage();
TMessage(byte msg, word loparam, word hiparam = 0);
TMessage(byte msg);
bool operator ==(TMessage msg);
bool operator ==(PMessage msg);
bool operator ==(byte msg);
#ifdef DDEBUG
void PrintTo(Print &Stream);
#endif // DDEBUG
};
class TMessageList
{
private:
PMessage *Items;
byte flength;
byte fcount;
void DeleteFirst(void);
bool FindMessage(PMessage msg); //есть ли такое сообщение в очереди
public:
TMessageList();
TMessageList(byte length);
~TMessageList();
bool Availiable(); // проверка, что очередь сообщений не пуста
TMessage GetMessage();
bool Add(PMessage msg);
bool Add(byte msg, word lo, word high);
bool Add(byte msg);
bool AddEmpty(void);
bool Paint(void);
bool Paint(int objptr, int param) { return Add(msg_Paint, objptr, param); }
bool Error(int errornum);
bool Error() { return Add(msg_Error); }
byte Count();
#ifdef DDEBUG
void PrintOut(Print &stream);
#endif // DDEBUG
};
extern TMessageList *MessageList;