Newer
Older
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#ifndef BUTTON_BEHAVIOUR_h
#define BUTTON_BEHAVIOUR_h
#include "Arduino.h"
#include "Behaviours.h"
#include <WallVis.h>
class ButtonPressed : public Behaviour {
/*
* Class that defines a behaviour that publishes a
* ButtonPressed message to the input topic of the
* MQQT broker
*/
WallVis* _node;
public:
ButtonPressed(WallVis* node, String name = "ButtonPressed") :
Behaviour(name), _node(node){ }
char* args() {return "<String buttonId>"; };
String start(String args) {
//This is where you do your stuff for a simple behaviour
_node->input_publish("ButtonPressed " + args);
return "ButtonPressed behaviour " + _name + " with (" + args + ")";
}
};
class ButtonReleased : public Behaviour {
/*
* Class that defines a behaviour that publishes a
* ButtonReleased message to the input topic of the
* MQQT broker
*/
WallVis* _node;
public:
ButtonReleased(WallVis* node, String name = "ButtonReleased") :
Behaviour(name), _node(node){ }
char* args() {return "<String buttonId>"; };
String start(String args) {
//This is where you do your stuff for a simple behaviour
_node->input_publish("ButtonReleased " + args);
return "ButtonReleased behaviour " + _name + " with (" + args + ")";
}
};
class ButtonClicked : public Behaviour {
/*
* Class that defines a behaviour that publishes a
* ButtonClicked message to the input topic of the
* MQQT broker
*/
WallVis* _node;
public:
ButtonClicked(WallVis* node, String name = "ButtonClicked") :
Behaviour(name), _node(node){ }
char* args() {return "<String buttonId>"; };
String start(String args) {
//This is where you do your stuff for a simple behaviour
_node->input_publish("ButtonClicked " + args);
return "ButtonClicked behaviour " + _name + " with (" + args + ")";
}
};
class ButtonDoubleClicked : public Behaviour {
/*
* Class that defines a behaviour that publishes a
* ButtonDoubleClicked message to the input topic of the
* MQQT broker
*/
WallVis* _node;
public:
ButtonDoubleClicked(WallVis* node, String name = "ButtonDoubleClicked") :
Behaviour(name), _node(node){ }
char* args() {return "<String buttonId>"; };
String start(String args) {
//This is where you do your stuff for a simple behaviour
_node->input_publish("ButtonDoubleClicked " + args);
return "ButtonDoubleClicked behaviour " + _name + " with (" + args + ")";
}
};
class ButtonLongPressed : public Behaviour {
/*
* Class that defines a behaviour that publishes a
* ButtonLongPressed message to the input topic of the
* MQQT broker
*/
WallVis* _node;
public:
ButtonLongPressed(WallVis* node, String name = "ButtonLongPressed") :
Behaviour(name), _node(node){ }
char* args() {return "<String buttonId>"; };
String start(String args) {
//This is where you do your stuff for a simple behaviour
_node->input_publish("ButtonLongPressed " + args);
return "ButtonLongPressed behaviour " + _name + " with (" + args + ")";
}
};
class ButtonRepeatPressed : public Behaviour {
/*
* Class that defines a behaviour that publishes a
* ButtonRepeatPressed message to the input topic of the
* MQQT broker
*/
WallVis* _node;
public:
ButtonRepeatPressed(WallVis* node, String name = "ButtonRepeatPressed") :
Behaviour(name), _node(node){ }
char* args() {return "<String buttonId>"; };
String start(String args) {
//This is where you do your stuff for a simple behaviour
_node->input_publish("ButtonRepeatPressed " + args);
return "ButtonRepeatPressed behaviour " + _name + " with (" + args + ")";
}
};
#endif