-
Notifications
You must be signed in to change notification settings - Fork 0
/
PushbuttonScanTester.cpp
76 lines (66 loc) · 1.66 KB
/
PushbuttonScanTester.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* PushbuttonScanTester.cpp
*
* Created on: Feb 5, 2013
* Author: jpm8766
*/
#include "PushbuttonScanTester.h"
PushbuttonScanTester::PushbuttonScanTester() :
StateContext() {}
PushbuttonScanTester::~PushbuttonScanTester() {}
void* PushbuttonScanTester::run() {
printf("PBST Running\n");
// Continuously pop events off our queue and accept them.
while (!killThread) {
pthread_sleepon_lock();
// This thread should sleep until there is an event.
while (eventQueue.empty()) {
pthread_sleepon_wait(&eventQueue);
}
switch (eventQueue.front()) {
// Used in anonymous transitions.
case evNoEvent:
printf("SCANTESTER: evNoEvent\n");
break;
case evFullReset:
printf("SCANTESTER: evFullReset\n");
break;
case evSetDepressed:
printf("SCANTESTER: evSetDepressed\n");
break;
case evSetReleased:
printf("SCANTESTER: evSetReleased\n");
break;
case evModeDepressed:
printf("SCANTESTER: evModeDepressed\n");
break;
case evModeReleased:
printf("SCANTESTER: evModeReleased\n");
break;
case evStartStopDepressed:
printf("SCANTESTER: evStartStopDepressed\n");
break;
case evStartStopReleased:
printf("SCANTESTER: evStartStopReleased\n");
break;
case evModeStartStopDepressed:
printf("SCANTESTER: evModeStartStopDepressed\n");
break;
case evModeStartStopReleased:
printf("SCANTESTER: evModeStartStopReleased\n");
break;
case evAllDepressed:
printf("SCANTESTER: evAllDepressed\n");
break;
case evAllReleased:
printf("SCANTESTER: evAllReleased\n");
break;
default:
printf("SCANTESTER: default???\n");
break;
}
eventQueue.pop();
pthread_sleepon_unlock();
}
return NULL;
}