BSB Developer Docs
Loading...
Searching...
No Matches
loader.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <furi.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
24#define RECORD_LOADER "loader"
25#define LOADER_APPLICATIONS_NAME "Apps"
26
48#define LOADER_MAX_PRIORITY 100
49#define LOADER_DEFAULT_APP_PRIORITY 10
50#define LOADER_MAX_APP_PRIORITY 90
51#define LOADER_STUB_APP_PRIORITY 0
52#define LOADER_PASSTHROUGH_PRIORITY (LOADER_DEFAULT_APP_PRIORITY - 1)
53#define LOADER_BLOCKING_PRIORITY (LOADER_MAX_PRIORITY + 1)
54
57typedef struct Loader Loader;
58
59typedef enum {
60 LoaderStatusOk,
61 LoaderStatusErrorAppStarted,
62 LoaderStatusErrorAppNotRunning,
63 LoaderStatusErrorUnknownApp,
64 LoaderStatusErrorNoSignalHandler,
65} LoaderStatus;
66
67typedef enum {
68 LoaderEventTypeApplicationBeforeLoad,
69 LoaderEventTypeApplicationLoadFailed,
70 LoaderEventTypeApplicationStopped,
71 LoaderEventTypePriorityChanged,
72} LoaderEventType;
73
74typedef struct {
75 LoaderEventType type;
76 size_t priority;
78
87LoaderStatus
88 loader_start(Loader* instance, const char* name, const char* args, FuriString* error_message);
89
96LoaderStatus loader_stop(Loader* instance);
97
103bool loader_lock(Loader* instance);
104
109void loader_unlock(Loader* instance);
110
116bool loader_is_locked(Loader* instance);
117
123FuriPubSub* loader_get_pubsub(Loader* instance);
124
132bool loader_get_application_name(Loader* instance, FuriString* name);
133
141bool loader_send_signal(Loader* instance, uint32_t signal, void* arg);
142
158bool loader_set_priority(Loader* instance, size_t priority);
159
169size_t loader_get_priority(Loader* instance);
170
173#ifdef __cplusplus
174}
175#endif
bool loader_lock(Loader *instance)
Lock application start.
Definition loader.c:62
void loader_unlock(Loader *instance)
Unlock application start.
Definition loader.c:76
FuriPubSub * loader_get_pubsub(Loader *instance)
Get loader pubsub.
Definition loader.c:100
size_t loader_get_priority(Loader *instance)
Get the priority level of the currently running app.
Definition loader.c:154
bool loader_is_locked(Loader *instance)
Check if loader is locked.
Definition loader.c:86
bool loader_send_signal(Loader *instance, uint32_t signal, void *arg)
Send a signal to the currently running application.
Definition loader.c:124
LoaderStatus loader_start(Loader *instance, const char *name, const char *args, FuriString *error_message)
Start application.
Definition loader.c:30
bool loader_set_priority(Loader *instance, size_t priority)
Set the priority level for the currently running app.
Definition loader.c:139
bool loader_get_application_name(Loader *instance, FuriString *name)
Get the name of the currently running application.
Definition loader.c:108
LoaderStatus loader_stop(Loader *instance)
Stop the currently running application.
Definition loader.c:48
Definition loader.h:74
Definition loader_i.h:13