BSB Developer Docs
Loading...
Searching...
No Matches
busy_timer.h
1#pragma once
2
3#include <core/pubsub.h>
4
5#include <busy/busy_common.h>
6
7#include "busy_timer_common.h"
10
11#define RECORD_BUSY_TIMER "busy_timer"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17typedef struct BusyTimer BusyTimer;
18
19typedef enum {
20 BusyTimerStateIdle,
21 BusyTimerStateWork,
22 BusyTimerStateRest,
23 BusyTimerStateMax,
24} BusyTimerState;
25
26typedef enum {
27 BusyTimerEventTypeTick,
28 BusyTimerEventTypeModeChanged,
29 BusyTimerEventTypeStateChanged,
30 BusyTimerEventTypeIntervalEnded,
31 BusyTimerEventTypePaused,
32 BusyTimerEventTypeProfileChanged,
33 BusyTimerEventTypeSnapshotCreated,
34 BusyTimerEventTypeMax,
35} BusyTimerEventType;
36
37typedef struct {
38 uint32_t time_elapsed_s;
39 uint32_t time_remaining_s;
41
42typedef struct {
43 BusyTimerMode mode;
45
46typedef struct {
47 BusyTimerState state;
49
50typedef struct {
51 bool is_forced;
53
54typedef struct {
55 bool is_paused;
57
58typedef struct {
59 BusyTimerProfileId profile_id;
60 BusyTimerProfile profile;
62
63typedef struct {
64 BusyTimerSnapshot snapshot;
66
67typedef struct {
68 BusyTimerEventType type;
69 union {
71 BusyTimerEventModeChanged mode_changed;
72 BusyTimerEventStateChanged state_changed;
73 BusyTimerEventIntervalEnded interval_ended;
75 BusyTimerEventProfileChanged profile_changed;
76 BusyTimerEventSnapshotCreated snapshot_created;
77 };
79
80typedef struct {
81 BusyTimerState state;
82 BusyTimerConfig config;
83 uint32_t current_interval_idx;
85
86typedef struct {
87 BusyAppConfig app_config;
88 BusyTimerConfig timer_config;
89 bool is_demo_mode_enabled;
91
92FuriPubSub* busy_timer_get_pubsub(const BusyTimer* instance);
93
94void busy_timer_start(BusyTimer* instance, BusyTimerProfileId profile_id);
95
96void busy_timer_stop(BusyTimer* instance);
97
98void busy_timer_toggle(BusyTimer* instance);
99
100void busy_timer_skip(BusyTimer* instance);
101
102void busy_timer_finalize(BusyTimer* instance);
103
104void busy_timer_add_time(BusyTimer* instance, int32_t time_minutes);
105
106void busy_timer_get_run_info(const BusyTimer* instance, BusyTimerRunInfo* run_info);
107
108void busy_timer_get_snapshot(BusyTimer* instance, BusyTimerSnapshot* snapshot);
109
110void busy_timer_set_snapshot(BusyTimer* instance, const BusyTimerSnapshot* snapshot);
111
112const char* busy_timer_get_profile_name(BusyTimerProfileId profile_id);
113
114void busy_timer_get_profile(
115 BusyTimer* instance,
116 BusyTimerProfileId profile_id,
117 BusyTimerProfile* profile);
118
119void busy_timer_set_profile(
120 BusyTimer* instance,
121 BusyTimerProfileId profile_id,
122 const BusyTimerProfile* profile);
123
124void busy_timer_get_preset(
125 BusyTimer* instance,
126 BusyTimerProfileId profile_id,
127 BusyTimerPreset* preset);
128
129void busy_timer_set_preset(
130 BusyTimer* instance,
131 BusyTimerProfileId profile_id,
132 const BusyTimerPreset* preset);
133
134const char** busy_timer_get_mode_names(void);
135
136#ifdef __cplusplus
137}
138#endif
Common BUSY application defines and variables.
Common BusyTimer types & macros.
Data types and functions for BusyTimer snapshot handling.
BusyApp configuration structure.
Definition busy_common.h:22
Definition busy_timer_common.h:72
Definition busy_timer.h:67
Definition busy_timer.h:50
Definition busy_timer.h:42
Definition busy_timer.h:54
Definition busy_timer.h:58
Definition busy_timer.h:63
Definition busy_timer.h:46
Definition busy_timer.h:37
Definition busy_timer_i.h:110
Definition busy_timer.h:86
Definition busy_timer_profile.h:20
Definition busy_timer.h:80
Definition busy_timer_snapshot.h:42