Files
Upsilon/apps/hardware_test/led_test_controller.h
Émilie Feral 6afa7cd3fd [apps/hardware_test] Redesign hardware test
Change-Id: Id2c55fe66ca68ce617ea131f5cfb77d78557860b
2017-06-01 09:43:22 +02:00

49 lines
1.5 KiB
C++

#ifndef HARDWARE_TEST_LED_TEST_CONTROLLER_H
#define HARDWARE_TEST_LED_TEST_CONTROLLER_H
#include <escher.h>
#include "battery_test_controller.h"
namespace HardwareTest {
class LEDTestController : public ViewController {
public:
LEDTestController(Responder * parentResponder);
View * view() override;
bool handleEvent(Ion::Events::Event event) override;
void viewWillAppear() override;
private:
class ContentView : public View {
public:
ContentView();
SolidColorView * LEDColorIndicatorView();
void drawRect(KDContext * ctx, KDRect rect) const override;
private:
void layoutSubviews() override;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
SolidColorView m_ledColorIndicatorView;
SolidColorView m_ledColorOutlineView;
BufferTextView m_ledView;
};
void setLEDColor(KDColor color);
constexpr static KDCoordinate k_arrowThickness = 3;
constexpr static KDCoordinate k_arrowLength = 100;
constexpr static KDCoordinate k_arrowMargin = 20;
constexpr static KDCoordinate k_indicatorSize = 20;
constexpr static KDCoordinate k_indicatorMargin = 8;
constexpr static KDCoordinate k_arrowHeight = 10;
constexpr static KDCoordinate k_arrowWidth = 9;
constexpr static int k_numberOfColors = 5;
constexpr static KDColor k_LEDColors[k_numberOfColors] = {KDColorWhite, KDColorRed, KDColorBlue, KDColorGreen, KDColorBlack};
static KDColor LEDColorAtIndex(int i);
ContentView m_view;
int m_LEDColorIndex;
BatteryTestController m_batteryTestController;
};
}
#endif