17 #ifndef __NUGU_PLUGIN_H__
18 #define __NUGU_PLUGIN_H__
43 #define NUGU_PLUGIN_PRIORITY_HIGH 10
48 #define NUGU_PLUGIN_PRIORITY_DEFAULT 100
53 #define NUGU_PLUGIN_PRIORITY_LOW 900
58 #define NUGU_PLUGIN_SYMBOL "nugu_plugin_define_desc"
63 #ifdef NUGU_PLUGIN_BUILTIN
64 #define NUGU_PLUGIN_DEFINE(p_name, p_prio, p_ver, p_load, p_unload, p_init) \
65 NUGU_API_EXPORT struct nugu_plugin_desc _builtin_plugin_##p_name = { \
74 #define NUGU_PLUGIN_DEFINE(p_name, p_prio, p_ver, p_load, p_unload, p_init) \
75 NUGU_API_EXPORT struct nugu_plugin_desc nugu_plugin_define_desc = { \
NUGU_API const struct nugu_plugin_desc * nugu_plugin_get_description(NuguPlugin *p)
Get the plugin description.
NUGU_API int nugu_plugin_initialize(void)
Initialize plugin.
NUGU_API void nugu_plugin_deinitialize(void)
De-initialize plugin.
NUGU_API int nugu_plugin_load_builtin(void)
Load all built-in plugins.
NUGU_API void * nugu_plugin_get_data(NuguPlugin *p)
Get private data from plugin.
NUGU_API int nugu_plugin_add(NuguPlugin *p)
Add the plugin to managed list.
NUGU_API void * nugu_plugin_get_symbol(NuguPlugin *p, const char *symbol_name)
Get dlsym result from plugin.
struct _plugin NuguPlugin
Plugin object.
Definition: nugu_plugin.h:88
NUGU_API NuguPlugin * nugu_plugin_find(const char *name)
Find a plugin by name in the managed list.
NUGU_API NuguPlugin * nugu_plugin_new_from_file(const char *filepath)
Create new plugin object from file.
NUGU_API NuguPlugin * nugu_plugin_new(struct nugu_plugin_desc *desc)
Create new plugin object.
NUGU_API int nugu_plugin_set_data(NuguPlugin *p, void *data)
Set private data to plugin.
NUGU_API int nugu_plugin_load_directory(const char *dirpath)
Load all plugin files from directory.
NUGU_API int nugu_plugin_remove(NuguPlugin *p)
Remove the plugin to managed list.
NUGU_API void nugu_plugin_free(NuguPlugin *p)
Destroy the plugin.
Plugin description.
Definition: nugu_plugin.h:93
const char * name
Name of plugin.
Definition: nugu_plugin.h:97
int(* init)(NuguPlugin *p)
Function called by priority after all plugins have finished loading.
Definition: nugu_plugin.h:123
unsigned int priority
Priority used in the init call order.
Definition: nugu_plugin.h:102
const char * version
Version of plugin.
Definition: nugu_plugin.h:107
void(* unload)(NuguPlugin *p)
Function to be called after unloading.
Definition: nugu_plugin.h:117
int(* load)(void)
Function to be called after loading.
Definition: nugu_plugin.h:112