Numworks Epsilon  1.4.1
Graphing Calculator Operating System
battery_test_controller.h
Go to the documentation of this file.
1 #ifndef HARDWARE_TEST_BATTERY_TEST_CONTROLLER_H
2 #define HARDWARE_TEST_BATTERY_TEST_CONTROLLER_H
3 
4 #include <escher.h>
5 
6 namespace HardwareTest {
7 
9 public:
11  View * view() override;
12  bool handleEvent(Ion::Events::Event event) override;
13  void viewWillAppear() override;
14 private:
15  class ContentView : public SolidColorView {
16  public:
17  ContentView();
18  BufferTextView * batteryStateTextView();
19  BufferTextView * batteryLevelTextView();
20  BufferTextView * batteryChargingTextView();
21  constexpr static int k_maxNumberOfCharacters = 20;
22  void setColor(KDColor color) override;
23  private:
24  void layoutSubviews() override;
25  int numberOfSubviews() const override;
26  View * subviewAtIndex(int index) override;
27  constexpr static int k_margin = 4;
28  BufferTextView m_batteryStateView;
29  BufferTextView m_batteryLevelView;
30  BufferTextView m_batteryChargingView;
31  };
32  constexpr static float k_batteryThreshold = 3.7f;
33  constexpr static const char * k_batteryOKText = "BATTERY: OK";
34  constexpr static const char * k_batteryNeedChargingText = "BATTERY: NEED RECHARGE";
35  void updateBatteryState(float batteryLevel, bool batteryCharging);
36  ContentView m_view;
37 };
38 
39 }
40 
41 #endif
42 
Responder * parentResponder() const
Definition: responder.cpp:12
bool handleEvent(Ion::Events::Event event) override
void setColor(KDColor c)
Definition: led.cpp:8
Definition: color.h:6
Definition: view.h:23
BatteryTestController(Responder *parentResponder)