Files
Upsilon/apps/hardware_test/battery_test_controller.h
Émilie Feral 434d9f1107 [apps/hardware_test] Add USB-plugging test
Change-Id: Ief50c7618e4f4083566a6b32b07d23b64bb4fbf2
2017-06-12 10:25:10 +02:00

45 lines
1.3 KiB
C++

#ifndef HARDWARE_TEST_BATTERY_TEST_CONTROLLER_H
#define HARDWARE_TEST_BATTERY_TEST_CONTROLLER_H
#include <escher.h>
#include "usb_test_controller.h"
namespace HardwareTest {
class BatteryTestController : public ViewController {
public:
BatteryTestController(Responder * parentResponder);
View * view() override;
bool handleEvent(Ion::Events::Event event) override;
void viewWillAppear() override;
private:
class ContentView : public SolidColorView {
public:
ContentView();
BufferTextView * batteryStateTextView();
BufferTextView * batteryLevelTextView();
BufferTextView * batteryChargingTextView();
constexpr static int k_maxNumberOfCharacters = 20;
void setColor(KDColor color) override;
private:
void layoutSubviews() override;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
constexpr static int k_margin = 4;
BufferTextView m_batteryStateView;
BufferTextView m_batteryLevelView;
BufferTextView m_batteryChargingView;
};
constexpr static float k_batteryThreshold = 3.7f;
constexpr static const char * k_batteryOKText = "BATTERY: OK";
constexpr static const char * k_batteryNeedChargingText = "BATTERY: NEED RECHARGE";
void updateBatteryState(float batteryLevel, bool batteryCharging);
ContentView m_view;
USBTestController m_usbTestController;
};
}
#endif