mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-30 16:56:41 +03:00
53435579b3
* fbt, faploader: minimal app module implementation * faploader, libs: moved API hashtable core to flipper_application * example: compound api * lib: flipper_application: naming fixes, doxygen comments * fbt: changed `requires` manifest field behavior for app extensions * examples: refactored plugin apps; faploader: changed new API naming; fbt: changed PLUGIN app type meaning * loader: dropped support for debug apps & plugin menus * moved applications/plugins -> applications/external * Restored x bit on chiplist_convert.py * git: fixed free-dap submodule path * pvs: updated submodule paths * examples: example_advanced_plugins.c: removed potential memory leak on errors * examples: example_plugins: refined requires * fbt: not deploying app modules for debug/sample apps; extra validation for .PLUGIN-type apps * apps: removed cdefines for external apps * fbt: moved ext app path definition * fbt: reworked fap_dist handling; f18: synced api_symbols.csv * fbt: removed resources_paths for extapps * scripts: reworked storage * scripts: reworked runfap.py & selfupdate.py to use new api * wip: fal runner * fbt: moved file packaging into separate module * scripts: storage: fixes * scripts: storage: minor fixes for new api * fbt: changed internal artifact storage details for external apps * scripts: storage: additional fixes and better error reporting; examples: using APP_DATA_PATH() * fbt, scripts: reworked launch_app to deploy plugins; moved old runfap.py to distfap.py * fbt: extra check for plugins descriptors * fbt: additional checks in emitter * fbt: better info message on SDK rebuild * scripts: removed requirements.txt * loader: removed remnants of plugins & debug menus * post-review fixes
83 lines
2.3 KiB
C
83 lines
2.3 KiB
C
#pragma once
|
|
|
|
#include <flipper_application/flipper_application.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief Object that manages plugins for an application
|
|
* Implements mass loading of plugins and provides access to their descriptors
|
|
*/
|
|
typedef struct PluginManager PluginManager;
|
|
|
|
typedef enum {
|
|
PluginManagerErrorNone = 0,
|
|
PluginManagerErrorLoaderError,
|
|
PluginManagerErrorApplicationIdMismatch,
|
|
PluginManagerErrorAPIVersionMismatch,
|
|
} PluginManagerError;
|
|
|
|
/**
|
|
* @brief Allocates new PluginManager
|
|
* @param application_id Application ID filter - only plugins with matching ID will be loaded
|
|
* @param api_version Application API version filter - only plugins with matching API version
|
|
* @param api_interface Application API interface - used to resolve plugins' API imports
|
|
* If plugin uses private application's API, use CompoundApiInterface
|
|
* @return new PluginManager instance
|
|
*/
|
|
PluginManager* plugin_manager_alloc(
|
|
const char* application_id,
|
|
uint32_t api_version,
|
|
const ElfApiInterface* api_interface);
|
|
|
|
/**
|
|
* @brief Frees PluginManager
|
|
* @param manager PluginManager instance
|
|
*/
|
|
void plugin_manager_free(PluginManager* manager);
|
|
|
|
/**
|
|
* @brief Loads single plugin by full path
|
|
* @param manager PluginManager instance
|
|
* @param path Path to plugin
|
|
* @return Error code
|
|
*/
|
|
PluginManagerError plugin_manager_load_single(PluginManager* manager, const char* path);
|
|
|
|
/**
|
|
* @brief Loads all plugins from specified directory
|
|
* @param manager PluginManager instance
|
|
* @param path Path to directory
|
|
* @return Error code
|
|
*/
|
|
PluginManagerError plugin_manager_load_all(PluginManager* manager, const char* path);
|
|
|
|
/**
|
|
* @brief Returns number of loaded plugins
|
|
* @param manager PluginManager instance
|
|
* @return Number of loaded plugins
|
|
*/
|
|
uint32_t plugin_manager_get_count(PluginManager* manager);
|
|
|
|
/**
|
|
* @brief Returns plugin descriptor by index
|
|
* @param manager PluginManager instance
|
|
* @param index Plugin index
|
|
* @return Plugin descriptor
|
|
*/
|
|
const FlipperAppPluginDescriptor* plugin_manager_get(PluginManager* manager, uint32_t index);
|
|
|
|
/**
|
|
* @brief Returns plugin entry point by index
|
|
* @param manager PluginManager instance
|
|
* @param index Plugin index
|
|
* @return Plugin entry point
|
|
*/
|
|
const void* plugin_manager_get_ep(PluginManager* manager, uint32_t index);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|