mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-22 20:43:07 +00:00
890c9e87ce
* examples: plugins: utilize fal_embedded * libs: removed fnv1a_hash * furi: added FURI_PACKED; apps, libs: changed to use FURI_PACKED * lib: mbedtls: using custom config * lib: toolbox: removed md5, switched to mbedtls * targets: f18: link fix * lib: added mbedtls_cfg.h * apps: nfc: explicit dependency on libmbedtls * u2f: reworking to mbedtls * u2f: replaced sha256 & hmac with mbedtls * u2f: functional rework using mbedtls * libs: dropped micro-ecc * u2f: dropped old implementation * toolbox: removed sha256 impl * mcheck() for mbedtls * libs: removed libmisc; split into smaller libs * apps: debug: fixed display_test * apps: include cleanups * fbt: fixed VERSIONCOMSTR * furi: added FURI_CHECK_RETURN * lib: removed qrcode * cleanup * fbt: lint_py+format_py: fixed excessive command length * api: Removed bzero from f7 * api: Removed bzero from f18 * Bump API Symbols Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
51 lines
1.7 KiB
C
51 lines
1.7 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 "ExampleAdvancedPlugins"
|
|
|
|
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 {
|
|
// For built-in .fals (fal_embedded==True), use APP_ASSETS_PATH
|
|
// Otherwise, use APP_DATA_PATH
|
|
if(plugin_manager_load_all(manager, APP_ASSETS_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;
|
|
}
|