2024-03-06 06:25:21 +00:00
|
|
|
/**
|
|
|
|
* @file plugin2.c
|
|
|
|
* @brief Plugin example 2.
|
|
|
|
*
|
2023-03-14 14:29:28 +00:00
|
|
|
* This plugin uses both firmware's API interface and private application headers.
|
|
|
|
* It can be loaded by a plugin manager that uses CompoundApiInterface,
|
|
|
|
* which combines both interfaces.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "app_api.h"
|
|
|
|
#include "plugin_interface.h"
|
|
|
|
|
|
|
|
#include <flipper_application/flipper_application.h>
|
|
|
|
#include <furi.h>
|
|
|
|
|
|
|
|
static void advanced_plugin2_method1(int arg1) {
|
|
|
|
/* This function is implemented inside host application */
|
|
|
|
app_api_accumulator_mul(arg1);
|
|
|
|
}
|
|
|
|
|
2024-03-19 14:43:52 +00:00
|
|
|
static void advanced_plugin2_method2(void) {
|
2023-03-14 14:29:28 +00:00
|
|
|
/* Accumulator value is stored inside host application */
|
|
|
|
FURI_LOG_I("TEST", "Plugin 2, accumulator: %lu", app_api_accumulator_get());
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Actual implementation of app<>plugin interface */
|
|
|
|
static const AdvancedPlugin advanced_plugin2 = {
|
|
|
|
.name = "Advanced Plugin 2",
|
|
|
|
.method1 = &advanced_plugin2_method1,
|
|
|
|
.method2 = &advanced_plugin2_method2,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Plugin descriptor to comply with basic plugin specification */
|
|
|
|
static const FlipperAppPluginDescriptor advanced_plugin2_descriptor = {
|
|
|
|
.appid = PLUGIN_APP_ID,
|
|
|
|
.ep_api_version = PLUGIN_API_VERSION,
|
|
|
|
.entry_point = &advanced_plugin2,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Plugin entry point - must return a pointer to const descriptor */
|
2024-03-19 14:43:52 +00:00
|
|
|
const FlipperAppPluginDescriptor* advanced_plugin2_ep(void) {
|
2023-03-14 14:29:28 +00:00
|
|
|
return &advanced_plugin2_descriptor;
|
|
|
|
}
|