Loading...
Searching...
No Matches
power_i.h
1#pragma once
2
3#include "power.h"
4
5#include <gui/gui.h>
6#include <gui/view_holder.h>
7
8#include <toolbox/api_lock.h>
9#include <assets_icons.h>
10
11#include "views/power_off.h"
12#include "views/power_unplug_usb.h"
13
14typedef enum {
15 PowerStateNotCharging,
16 PowerStateCharging,
17 PowerStateCharged,
18} PowerState;
19
20struct Power {
21 ViewHolder* view_holder;
22 FuriPubSub* event_pubsub;
23 FuriEventLoop* event_loop;
24 FuriMessageQueue* message_queue;
25
26 ViewPort* battery_view_port;
27 PowerOff* view_power_off;
28 PowerUnplugUsb* view_power_unplug_usb;
29
30 PowerEvent event;
31 PowerState state;
32 PowerInfo info;
33
34 bool battery_low;
35 bool show_battery_low_warning;
36 uint8_t battery_level;
37 uint8_t power_off_timeout;
38};
39
40typedef enum {
41 PowerViewOff,
42 PowerViewUnplugUsb,
43} PowerView;
44
45typedef enum {
46 PowerMessageTypeShutdown,
47 PowerMessageTypeReboot,
48 PowerMessageTypeGetInfo,
49 PowerMessageTypeIsBatteryHealthy,
50 PowerMessageTypeShowBatteryLowWarning,
51} PowerMessageType;
52
53typedef struct {
54 PowerMessageType type;
55 union {
56 PowerBootMode boot_mode;
57 PowerInfo* power_info;
58 bool* bool_param;
59 };
60 FuriApiLock lock;
GUI: main API.
Definition event_flag.c:14
Definition event_loop_i.h:78
Definition message_queue.c:16
Definition pubsub.c:14
Definition power.h:33
Definition power_i.h:20
Definition power.h:38
Definition power_i.h:53
Definition power_off.c:6
Definition power_unplug_usb.c:6
Definition view_holder.c:6
Definition view_port_i.h:11
GUI: ViewHolder API.