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
49 lines
1.6 KiB
C
49 lines
1.6 KiB
C
#include "app_api.h"
|
|
#include "plugin_interface.h"
|
|
#include "app_api_interface.h"
|
|
|
|
#include <flipper_application/flipper_application.h>
|
|
#include <flipper_application/plugins/plugin_manager.h>
|
|
#include <flipper_application/plugins/composite_resolver.h>
|
|
|
|
#include <loader/firmware_api/firmware_api.h>
|
|
|
|
#define TAG "example_advanced_plugins"
|
|
|
|
int32_t example_advanced_plugins_app(void* p) {
|
|
UNUSED(p);
|
|
|
|
FURI_LOG_I(TAG, "Starting");
|
|
|
|
CompositeApiResolver* resolver = composite_api_resolver_alloc();
|
|
composite_api_resolver_add(resolver, firmware_api_interface);
|
|
composite_api_resolver_add(resolver, application_api_interface);
|
|
|
|
PluginManager* manager = plugin_manager_alloc(
|
|
PLUGIN_APP_ID, PLUGIN_API_VERSION, composite_api_resolver_get(resolver));
|
|
|
|
do {
|
|
if(plugin_manager_load_all(manager, APP_DATA_PATH("plugins")) != PluginManagerErrorNone) {
|
|
FURI_LOG_E(TAG, "Failed to load all libs");
|
|
break;
|
|
}
|
|
|
|
uint32_t plugin_count = plugin_manager_get_count(manager);
|
|
FURI_LOG_I(TAG, "Loaded libs: %lu", plugin_count);
|
|
|
|
for(uint32_t i = 0; i < plugin_count; i++) {
|
|
const AdvancedPlugin* plugin = plugin_manager_get_ep(manager, i);
|
|
FURI_LOG_I(TAG, "plugin name: %s. Calling methods", plugin->name);
|
|
plugin->method1(228);
|
|
plugin->method2();
|
|
FURI_LOG_I(TAG, "Accumulator: %lu", app_api_accumulator_get());
|
|
}
|
|
} while(0);
|
|
|
|
plugin_manager_free(manager);
|
|
composite_api_resolver_free(resolver);
|
|
FURI_LOG_I(TAG, "Goodbye!");
|
|
|
|
return 0;
|
|
}
|