forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @file plugin_interface.h | ||
* @brief Example plugin interface. | ||
* | ||
* Common interface between a plugin and host application | ||
*/ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
#include <stddef.h> | ||
|
||
#define PLUGIN_APP_ID "plugin_wiegand" | ||
#define PLUGIN_API_VERSION 1 | ||
|
||
typedef struct { | ||
const char* name; | ||
int (*count)(uint8_t, uint64_t); | ||
int (*description)(uint8_t, uint64_t, size_t); | ||
} PluginWiegand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
#include "plugin_interface.h" | ||
|
||
#include <flipper_application/flipper_application.h> | ||
|
||
static int wiegand_format_count(uint8_t bit_length, uint64_t bits) { | ||
UNUSED(bit_length); | ||
UNUSED(bits); | ||
return 1337; | ||
} | ||
|
||
static int wiegand_format_description(uint8_t bit_length, uint64_t bits, size_t index) { | ||
UNUSED(bit_length); | ||
UNUSED(bits); | ||
UNUSED(index); | ||
|
||
return 0; | ||
} | ||
|
||
/* Actual implementation of app<>plugin interface */ | ||
static const PluginWiegand plugin_wiegand = { | ||
.name = "Plugin Wiegand", | ||
.count = &wiegand_format_count, | ||
.description = &wiegand_format_description, | ||
}; | ||
|
||
/* Plugin descriptor to comply with basic plugin specification */ | ||
static const FlipperAppPluginDescriptor plugin_wiegand_descriptor = { | ||
.appid = PLUGIN_APP_ID, | ||
.ep_api_version = PLUGIN_API_VERSION, | ||
.entry_point = &plugin_wiegand, | ||
}; | ||
|
||
/* Plugin entry point - must return a pointer to const descriptor */ | ||
const FlipperAppPluginDescriptor* plugin_wiegand_ep(void) { | ||
return &plugin_wiegand_descriptor; | ||
} |