mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-23 04:53:08 +00:00
ecab4d53d2
* Add doxygen and doxygen-awesome css, cleanup docs files * Ignore more libraries and remove leftover local variables * Create an actual intro page * .md files linting * Add doxygen action * Fix Doxygen path * Fix doxyfile path * Try to upload * Change docs branch * Add submudules checkout * Disable doxygen on PR * Mention the firmware docs in the readme * More dev docs mentions in the readme * Fix runner group, add tags * Test dev in PR * Disable running on PR * Fix a typo in the doxyfile * Try upload to S3 * Fix local path * Fix S3 ACL * Add delete flag, unifying dev and tags * Update ignored directories * More ignored directories * Even more ignored directories * Fix submodule * Change S3 uploader * Change S3 uploader version * Fix aws sync flags * Fix ACL * Disable ACL * Improve ignores, add WiFi devboard docs * TEMP: generate dev docs * TEMP: generate 0.89.0 docs * Disabling PR trigger * Enable submodules and test build * Enable test build * Disable test build * Change docs directory structure * Fix accidentally committed submodule * Fix submodules * Update links to the developer documentation * Markdown linting * Update workflow, enable test build * Fix doxygen dir path * Update Doxyfile-awesome.cfg * Change paths * Fix upload docs path * Disable pull_request debug trigger * Disable tags building * Remove autolinks and namespaces * Establish basic documentation structure * Add missing changes * Improve stylesheet, move some files * Improve examples * Improve the main page * Improve application dev docs * Improve system programming docs * Improve development tools docs * Improve other docs * Improve application examples * Fix formatting * Fix PVS-studio warnings * Improve visuals * Fix doxygen syntax warnings * Fix broken links * Update doxygen action Co-authored-by: DrunkBatya <drunkbatya.js@gmail.com> Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com> Co-authored-by: Georgii Surkov <37121527+gsurkov@users.noreply.github.com>
72 lines
2.2 KiB
C
72 lines
2.2 KiB
C
/**
|
|
* @file example_plugins.c
|
|
* @brief Plugin host application example.
|
|
*
|
|
* Loads a single plugin and calls its methods.
|
|
*/
|
|
|
|
#include "plugin_interface.h"
|
|
|
|
#include <furi.h>
|
|
|
|
#include <flipper_application/flipper_application.h>
|
|
#include <loader/firmware_api/firmware_api.h>
|
|
#include <storage/storage.h>
|
|
|
|
#define TAG "ExamplePlugins"
|
|
|
|
int32_t example_plugins_app(void* p) {
|
|
UNUSED(p);
|
|
|
|
FURI_LOG_I(TAG, "Starting");
|
|
|
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
|
|
|
FlipperApplication* app = flipper_application_alloc(storage, firmware_api_interface);
|
|
|
|
do {
|
|
FlipperApplicationPreloadStatus preload_res =
|
|
flipper_application_preload(app, APP_DATA_PATH("plugins/example_plugin1.fal"));
|
|
|
|
if(preload_res != FlipperApplicationPreloadStatusSuccess) {
|
|
FURI_LOG_E(TAG, "Failed to preload plugin");
|
|
break;
|
|
}
|
|
|
|
if(!flipper_application_is_plugin(app)) {
|
|
FURI_LOG_E(TAG, "Plugin file is not a library");
|
|
break;
|
|
}
|
|
|
|
FlipperApplicationLoadStatus load_status = flipper_application_map_to_memory(app);
|
|
if(load_status != FlipperApplicationLoadStatusSuccess) {
|
|
FURI_LOG_E(TAG, "Failed to load plugin file");
|
|
break;
|
|
}
|
|
|
|
const FlipperAppPluginDescriptor* app_descriptor =
|
|
flipper_application_plugin_get_descriptor(app);
|
|
|
|
FURI_LOG_I(
|
|
TAG,
|
|
"Loaded plugin for appid '%s', API %lu",
|
|
app_descriptor->appid,
|
|
app_descriptor->ep_api_version);
|
|
|
|
furi_check(app_descriptor->ep_api_version == PLUGIN_API_VERSION);
|
|
furi_check(strcmp(app_descriptor->appid, PLUGIN_APP_ID) == 0);
|
|
|
|
const ExamplePlugin* plugin = app_descriptor->entry_point;
|
|
|
|
FURI_LOG_I(TAG, "Plugin name: %s", plugin->name);
|
|
FURI_LOG_I(TAG, "Plugin method1: %d", plugin->method1());
|
|
FURI_LOG_I(TAG, "Plugin method2(7,8): %d", plugin->method2(7, 8));
|
|
FURI_LOG_I(TAG, "Plugin method2(1337,228): %d", plugin->method2(1337, 228));
|
|
} while(false);
|
|
flipper_application_free(app);
|
|
|
|
furi_record_close(RECORD_STORAGE);
|
|
FURI_LOG_I(TAG, "Goodbye!");
|
|
|
|
return 0;
|
|
}
|