Eric Betts 1 год назад
Родитель
Сommit
0802b594ce
2 измененных файлов с 20 добавлено и 0 удалено
  1. 13 0
      seader.c
  2. 7 0
      seader_i.h

+ 13 - 0
seader.c

@@ -85,6 +85,17 @@ Seader* seader_alloc() {
     view_dispatcher_add_view(
         seader->view_dispatcher, SeaderViewWidget, widget_get_view(seader->widget));
 
+    seader->plugin_manager =
+        plugin_manager_alloc(PLUGIN_APP_ID, PLUGIN_API_VERSION, firmware_api_interface);
+
+    if(plugin_manager_load_all(seader->plugin_manager, APP_DATA_PATH("plugins")) !=
+       PluginManagerErrorNone) {
+        FURI_LOG_E(TAG, "Failed to load all libs");
+    } else {
+        uint32_t plugin_count = plugin_manager_get_count(seader->plugin_manager);
+        FURI_LOG_I(TAG, "Loaded %lu plugin(s)", plugin_count);
+    }
+
     return seader;
 }
 
@@ -144,6 +155,8 @@ void seader_free(Seader* seader) {
     furi_record_close(RECORD_NOTIFICATION);
     seader->notifications = NULL;
 
+    plugin_manager_free(seader->plugin_manager);
+
     free(seader);
 }
 

+ 7 - 0
seader_i.h

@@ -40,6 +40,11 @@
 #include <Payload.h>
 #include <FrameProtocol.h>
 
+#include "plugin_interface.h"
+#include <flipper_application/flipper_application.h>
+#include <flipper_application/plugins/plugin_manager.h>
+#include <loader/firmware_api/firmware_api.h>
+
 #include "protocol/picopass_poller.h"
 #include "scenes/seader_scene.h"
 
@@ -110,6 +115,8 @@ struct Seader {
     PicopassPoller* picopass_poller;
 
     NfcDevice* nfc_device;
+
+    PluginManager* plugin_manager;
 };
 
 struct SeaderPollerContainer {