plugin2.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * This plugin uses both firmware's API interface and private application headers.
  3. * It can be loaded by a plugin manager that uses CompoundApiInterface,
  4. * which combines both interfaces.
  5. */
  6. #include "app_api.h"
  7. #include "plugin_interface.h"
  8. #include <flipper_application/flipper_application.h>
  9. #include <furi.h>
  10. static void advanced_plugin2_method1(int arg1) {
  11. /* This function is implemented inside host application */
  12. app_api_accumulator_mul(arg1);
  13. }
  14. static void advanced_plugin2_method2() {
  15. /* Accumulator value is stored inside host application */
  16. FURI_LOG_I("TEST", "Plugin 2, accumulator: %lu", app_api_accumulator_get());
  17. }
  18. /* Actual implementation of app<>plugin interface */
  19. static const AdvancedPlugin advanced_plugin2 = {
  20. .name = "Advanced Plugin 2",
  21. .method1 = &advanced_plugin2_method1,
  22. .method2 = &advanced_plugin2_method2,
  23. };
  24. /* Plugin descriptor to comply with basic plugin specification */
  25. static const FlipperAppPluginDescriptor advanced_plugin2_descriptor = {
  26. .appid = PLUGIN_APP_ID,
  27. .ep_api_version = PLUGIN_API_VERSION,
  28. .entry_point = &advanced_plugin2,
  29. };
  30. /* Plugin entry point - must return a pointer to const descriptor */
  31. const FlipperAppPluginDescriptor* advanced_plugin2_ep() {
  32. return &advanced_plugin2_descriptor;
  33. }