2021-09-24 16:28:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "power.h"
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <gui/view_dispatcher.h>
|
|
|
|
#include <gui/gui.h>
|
2021-10-06 15:41:22 +00:00
|
|
|
|
|
|
|
#include <gui/modules/popup.h>
|
2021-09-24 16:28:02 +00:00
|
|
|
#include "views/power_off.h"
|
|
|
|
|
|
|
|
#include <notification/notification-messages.h>
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
PowerStateNotCharging,
|
|
|
|
PowerStateCharging,
|
|
|
|
PowerStateCharged,
|
|
|
|
} PowerState;
|
|
|
|
|
|
|
|
struct Power {
|
|
|
|
ViewDispatcher* view_dispatcher;
|
2021-10-06 15:41:22 +00:00
|
|
|
Popup* popup;
|
2021-09-24 16:28:02 +00:00
|
|
|
PowerOff* power_off;
|
|
|
|
|
|
|
|
ViewPort* battery_view_port;
|
|
|
|
Gui* gui;
|
|
|
|
NotificationApp* notification;
|
|
|
|
PubSub event_pubsub;
|
|
|
|
PowerEvent event;
|
|
|
|
|
|
|
|
PowerState state;
|
|
|
|
PowerInfo info;
|
|
|
|
osMutexId_t info_mtx;
|
|
|
|
|
|
|
|
bool battery_low;
|
|
|
|
uint8_t battery_level;
|
|
|
|
uint8_t power_off_timeout;
|
|
|
|
};
|
|
|
|
|
2021-10-06 15:41:22 +00:00
|
|
|
typedef enum {
|
|
|
|
PowerViewPopup,
|
|
|
|
PowerViewOff,
|
|
|
|
} PowerView;
|