Skip to content

Commit

Permalink
loads plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bettse committed Apr 14, 2024
1 parent 6bbd7d5 commit 0802b59
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions seader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
}

Expand Down
7 changes: 7 additions & 0 deletions seader_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -110,6 +115,8 @@ struct Seader {
PicopassPoller* picopass_poller;

NfcDevice* nfc_device;

PluginManager* plugin_manager;
};

struct SeaderPollerContainer {
Expand Down

0 comments on commit 0802b59

Please sign in to comment.