BSB Developer Docs
Loading...
Searching...
No Matches
busy_i.h
1#pragma once
2
3#include <furi.h>
4#include <api_lock.h>
5
6#include <gui/gui.h>
11#include <audio/audio.h>
12#include <loader/loader.h>
13#include <front_display/front_display.h>
14#include <busy_timer/busy_timer.h>
16
17#include "busy.h"
18#include "busy_theme.h"
19#include "busy_presets.h"
20
21#include "storage_macros.h"
22
23#include "helpers/run_later.h"
24#include "scenes/busy_scenes.h"
25
26#include "widgets/timer_label.h"
28
29#define TAG "Busy"
30
31#define TOTAL_TIME_LOW_THR_MN (15)
32
33typedef enum {
34 BusyAppRunModeNormal,
35 BusyAppRunModeTimer,
36 BusyAppRunModeMax,
37} BusyAppRunMode;
38
39typedef enum {
40 BusyCustomEventIndexMax = 0x80,
41 BusyCustomEventTimerTick,
42 BusyCustomEventTimerModeChanged,
43 BusyCustomEventTimerStateChanged,
44 BusyCustomEventTimerIntervalEnded,
45 BusyCustomEventTimerPaused,
46 BusyCustomEventTimerSkip,
47 BusyCustomEventTimeIncrement,
48 BusyCustomEventTimeDecrement,
49 BusyCustomEventStartPressed,
50 BusyCustomEventStartReleased,
51 BusyCustomEventStartShortPressed,
52 BusyCustomEventOkShortPressed,
53 BusyCustomEventReturnToStart,
54 BusyCustomEventAnimationCompleted,
55 BusyCustomEventAppConfigChanged,
56 BusyCustomEventMax,
57} BusyCustomEvent;
58
59typedef enum {
60 BusyApiMessageTypeSetConfig,
61 BusyApiMessageTypeShowTimer,
62 BusyApiMessageTypeRequestExit,
63 BusyApiMessageTypeMax,
64} BusyApiMessageType;
65
66typedef struct {
67 const BusyAppConfig* config;
69
70typedef union {
71 BusyApiMessageSetConfig set_config;
73
74typedef struct {
75 BusyApiMessageType type;
77 BusyStatus* status;
78 FuriApiLock lock;
80
81struct BusyApp {
82 FuriEventLoop* event_loop;
83 FuriMessageQueue* input_queue;
84 FuriMessageQueue* event_queue;
85 FuriMessageQueue* api_queue;
86 SceneManager* scene_manager;
87 BusyTimer* busy_timer;
88 FrontDisplaySrv* front_display;
89 Audio* audio;
90 Gui* gui;
91 Updater* updater;
92 Loader* loader;
93 // Containers & application windows
94 Widget* front_window;
95 FlexLayout* back_container;
96 Widget* back_window;
97 // Persistent widgets
98 TransitionOverlay* transition_overlay;
99 MirrorCard* timer_card;
100 NavBar* nav_bar;
101 // Misc state
102 BusyTheme* theme;
103 BusyAppRunMode run_mode;
104 BusyAppConfig config;
105 BusyAppPresetId preset_id;
106 bool show_timer_requested;
107};
108
109// Guaranteed to deliver an event, but might deadlock.
110// Use for events that will break the logic if ignored.
111void busy_send_custom_event(BusyApp* instance, uint32_t custom_event);
112
113// Might drop and event, but will never deadlock.
114// Prefer for events that are safe to ignore (e.g. input or tick events).
115void busy_send_custom_event_nonblocking(BusyApp* instance, uint32_t custom_event);
116
117void busy_prepare_transition(BusyApp* instance, BusyTransitionType type);
118
119void busy_start_transition(BusyApp* instance);
120
139void busy_set_priority(BusyApp* instance, bool active);
140
141void busy_set_front_display_blanking(BusyApp* instance, bool is_blanked);
142
143void busy_push_location(BusyApp* instance, const char* location_name);
144
145void busy_pop_location(BusyApp* instance);
146
147bool busy_return_to_start_scene(BusyApp* instance);
148
149void busy_exit(BusyApp* instance);
150
151void busy_set_app_config(BusyApp* instance, const BusyAppConfig* app_config);
152
153void busy_get_timer_preset(BusyApp* instance, BusyTimerPreset* timer_preset);
154
155void busy_set_timer_preset(BusyApp* instance, BusyTimerPreset* timer_preset);
156
157const BusyAppGlobalPreset* busy_get_global_preset(const BusyApp* instance);
158
159BusyTimerProfileId busy_get_profile_id(const BusyApp* instance);
160
161void busy_api_unlock_message(BusyApiMessage* api_message, BusyStatus status);
162
163void busy_api_abort_pending_messages(BusyApp* instance);
APIs for playing audio (e.g.
BUSY application – frontend for the BusyTimer service.
BusyStatus
Enumeration of possible statuses returned by the BusyApp APIs.
Definition busy.h:51
A widget that arranges its elements in flexible rows or columns.
struct FlexLayout FlexLayout
FlexLayout opaque structure.
Definition flex_layout.h:16
GUI system APIs.
Loader service API.
A widget that shows the front display mirrored content.
Definition audio_i.h:85
Definition busy_i.h:74
Definition busy_i.h:66
BusyApp configuration structure.
Definition busy_common.h:22
Definition busy_presets.h:50
Definition busy_i.h:81
Definition busy_theme.c:14
Definition busy_timer_i.h:110
Definition busy_timer.h:86
Definition front_display.c:31
Definition gui_i.h:48
Definition loader_i.h:13
Definition mirror_card.c:9
Definition nav_bar.c:20
Definition scene_manager.c:13
Definition transition_overlay.c:16
Definition updater_i.h:68
Definition widget_i.h:35
A widget that shows the current timer status.
A widget that shows the remaining time.
Can be used only on the front display.
Definition busy_i.h:70
Firmware update system interface.