BSB Developer Docs
Loading...
Searching...
No Matches
Loader service

Topics

 Loader application priority
 
 

Data Structures

struct  LoaderEvent
 

Macros

#define RECORD_LOADER   "loader"
 
#define LOADER_APPLICATIONS_NAME   "Apps"
 

Typedefs

typedef struct Loader Loader
 

Enumerations

enum  LoaderStatus {
  LoaderStatusOk , LoaderStatusErrorAppStarted , LoaderStatusErrorAppNotRunning , LoaderStatusErrorUnknownApp ,
  LoaderStatusErrorNoSignalHandler
}
 
enum  LoaderEventType { LoaderEventTypeApplicationBeforeLoad , LoaderEventTypeApplicationLoadFailed , LoaderEventTypeApplicationStopped , LoaderEventTypePriorityChanged }
 

Functions

LoaderStatus loader_start (Loader *instance, const char *name, const char *args, FuriString *error_message)
 Start application.
 
LoaderStatus loader_stop (Loader *instance)
 Stop the currently running application.
 
bool loader_lock (Loader *instance)
 Lock application start.
 
void loader_unlock (Loader *instance)
 Unlock application start.
 
bool loader_is_locked (Loader *instance)
 Check if loader is locked.
 
FuriPubSub * loader_get_pubsub (Loader *instance)
 Get loader pubsub.
 
bool loader_get_application_name (Loader *instance, FuriString *name)
 Get the name of the currently running application.
 
bool loader_send_signal (Loader *instance, uint32_t signal, void *arg)
 Send a signal to the currently running application.
 
bool loader_set_priority (Loader *instance, size_t priority)
 Set the priority level for the currently running app.
 
size_t loader_get_priority (Loader *instance)
 Get the priority level of the currently running app.
 

Detailed Description

Loader is a system service that loads and manages applications.

Function Documentation

◆ loader_get_application_name()

bool loader_get_application_name ( Loader * instance,
FuriString * name )

Get the name of the currently running application.

Parameters
[in]instancepointer to the loader instance
[in,out]namepointer to the string to contain the name (must be allocated)
Returns
true if it was possible to get an application name, false otherwise

◆ loader_get_priority()

size_t loader_get_priority ( Loader * instance)

Get the priority level of the currently running app.

The canvas service calls this on every draw request to compute the effective rejection threshold. Returns 0 if no application is currently running.

Parameters
[in]instanceloader instance
Returns
Current app priority, or 0 if no app is running.

◆ loader_get_pubsub()

FuriPubSub * loader_get_pubsub ( Loader * instance)

Get loader pubsub.

Parameters
[in]instanceloader instance
Returns
FuriPubSub*

◆ loader_is_locked()

bool loader_is_locked ( Loader * instance)

Check if loader is locked.

Parameters
[in]instanceloader instance
Returns
true if locked

◆ loader_lock()

bool loader_lock ( Loader * instance)

Lock application start.

Parameters
[in]instanceloader instance
Returns
true on success

◆ loader_send_signal()

bool loader_send_signal ( Loader * instance,
uint32_t signal,
void * arg )

Send a signal to the currently running application.

Parameters
[in]instancepointer to the loader instance
[in]signalsignal value
[in]argoptional argument to pass with the signal
Returns
true if signal was sent and consumed, false otherwise

◆ loader_set_priority()

bool loader_set_priority ( Loader * instance,
size_t priority )

Set the priority level for the currently running app.

The priority gates HTTP canvas draw requests: see the LoaderPriority group for the full scale and interaction rules.

The call is synchronous and is processed by the loader task. It succeeds only when an application is running and the calling thread belongs to that same application (verified by app-id comparison).

Parameters
[in]instanceloader instance
[in]prioritynew priority (0 … LOADER_BLOCKING_PRIORITY)
Returns
true priority was updated
false no app is running, or the caller is not the running app

◆ loader_start()

LoaderStatus loader_start ( Loader * instance,
const char * name,
const char * args,
FuriString * error_message )

Start application.

Parameters
[in]instanceloader instance
[in]nameapplication name or id
[in]argsapplication arguments
[out]error_messagedetailed error message, can be NULL
Returns
LoaderStatus

◆ loader_stop()

LoaderStatus loader_stop ( Loader * instance)

Stop the currently running application.

Parameters
[in]instanceloader instance
Returns
LoaderStatusOk on success, any other error code on failure

◆ loader_unlock()

void loader_unlock ( Loader * instance)

Unlock application start.

Parameters
[in]instanceloader instance