unleashed-firmware/applications/services/loader/loader_i.h
Georgii Surkov 4cf98867a0
[FL-3847, FL-3513] Thread Signals (#3730)
* Add signal API
* Add signal support to loader
* Add signal support to ViewDispatcher
* Remove extra signal definitions
* Fix typos
  Co-authored-by: Silent <CookiePLMonster@users.noreply.github.com>
* scripts: runfap: close current app pre-launch
* loader: enable backlight when starting an app
* scripts: removed distfap.py
* Do not expose signal API via ViewDispatcher
* scripts: runfap: iterative retry to launch
* Add a loader signal subcommand
* Furi, Gui: move signal handling from View Dispatcher to Event Loop

Co-authored-by: Silent <CookiePLMonster@users.noreply.github.com>
Co-authored-by: hedger <hedger@nanode.su>
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2024-06-21 21:44:36 +01:00

84 lines
1.9 KiB
C

#pragma once
#include <furi.h>
#include <toolbox/api_lock.h>
#include <flipper_application/flipper_application.h>
#include "loader.h"
#include "loader_menu.h"
#include "loader_applications.h"
typedef struct {
char* args;
FuriThread* thread;
bool insomniac;
FlipperApplication* fap;
} LoaderAppData;
struct Loader {
FuriPubSub* pubsub;
FuriMessageQueue* queue;
LoaderMenu* loader_menu;
LoaderApplications* loader_applications;
LoaderAppData app;
};
typedef enum {
LoaderMessageTypeStartByName,
LoaderMessageTypeAppClosed,
LoaderMessageTypeShowMenu,
LoaderMessageTypeMenuClosed,
LoaderMessageTypeApplicationsClosed,
LoaderMessageTypeLock,
LoaderMessageTypeUnlock,
LoaderMessageTypeIsLocked,
LoaderMessageTypeStartByNameDetachedWithGuiError,
LoaderMessageTypeSignal,
LoaderMessageTypeGetApplicationName,
} LoaderMessageType;
typedef struct {
const char* name;
const char* args;
FuriString* error_message;
} LoaderMessageStartByName;
typedef struct {
uint32_t signal;
void* arg;
} LoaderMessageSignal;
typedef enum {
LoaderStatusErrorUnknown,
LoaderStatusErrorInvalidFile,
LoaderStatusErrorInvalidManifest,
LoaderStatusErrorMissingImports,
LoaderStatusErrorHWMismatch,
LoaderStatusErrorOutdatedApp,
LoaderStatusErrorOutOfMemory,
LoaderStatusErrorOutdatedFirmware,
} LoaderStatusError;
typedef struct {
LoaderStatus value;
LoaderStatusError error;
} LoaderMessageLoaderStatusResult;
typedef struct {
bool value;
} LoaderMessageBoolResult;
typedef struct {
FuriApiLock api_lock;
LoaderMessageType type;
union {
LoaderMessageStartByName start;
LoaderMessageSignal signal;
FuriString* application_name;
};
union {
LoaderMessageLoaderStatusResult* status_value;
LoaderMessageBoolResult* bool_value;
};
} LoaderMessage;