-
Notifications
You must be signed in to change notification settings - Fork 0
/
control.cpp
61 lines (60 loc) · 1.26 KB
/
control.cpp
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
#include "control.h"
control::control() {
this->A = this->A = false;
this->B = true;
}
void control::plasticReady(bool ready) {
if (ready) {
event1();
}
else {
qDebug() << "Error";
}
}
void control::event1() {
setA(true);
qDebug() << "New Bottle";
qDebug() << "Bottling Started";
QTimer::singleShot(5000, this, SLOT(event2()));
}
void control::event2() {
setA(false);
setC(true);
qDebug() << "Plastic Bottling Size Reached";
qDebug() << "Molding Bottle";
QTimer::singleShot(500, this, SLOT(event3()));
}
void control::event3() {
setB(false);
QTimer::singleShot(4000, this, SLOT(event1()));
setB(true);
setC(false);
qDebug() << "Bottle Ready";
}
void control::setA(bool change) {
if (getA() != change) {
this->A = change;
emit this->AChanged(change);
}
}
void control::setB(bool change) {
if (getB() != change) {
this->B = change;
emit this->BChanged(change);
}
}
void control::setC(bool change) {
if (getC() != change) {
this->A = change;
emit this->CChanged(change);
}
}
bool control::getA() const {
return this->A;
}
bool control::getB() const {
return this->B;
}
bool control::getC() const {
return this->A;
}