screen_test_controller.cpp
923 Bytes
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
#include "screen_test_controller.h"
extern "C" {
#include <assert.h>
}
namespace HardwareTest {
ScreenTestController::ScreenTestController(Responder * parentResponder) :
ViewController(parentResponder),
m_patternIndex(0),
m_view(),
m_ledTestController(this)
{
}
View * ScreenTestController::view() {
return &m_view;
}
bool ScreenTestController::handleEvent(Ion::Events::Event event) {
if (event != Ion::Events::OK) {
return true;
}
if (m_patternIndex == Pattern::numberOfPatterns()) {
ModalViewController * modal = (ModalViewController *)parentResponder();
modal->displayModalViewController(&m_ledTestController, 0.0f, 0.0f);
} else {
showNextPattern();
}
return true;
}
void ScreenTestController::viewWillAppear() {
m_patternIndex = 0;
showNextPattern();
}
void ScreenTestController::showNextPattern() {
m_view.setPattern(Pattern::patternAtIndex(m_patternIndex++));
}
}