NUGU SDK Linux  1.7.6
Plugin

Plugin management. More...

+ Collaboration diagram for Plugin:

Classes

struct  nugu_plugin_desc
 Plugin description. More...
 

Macros

#define NUGU_PLUGIN_DEFINE(p_name, p_prio, p_ver, p_load, p_unload, p_init)
 Macros to easily define plugins. More...
 
#define NUGU_PLUGIN_PRIORITY_DEFAULT   100
 A value representing default priority.
 
#define NUGU_PLUGIN_PRIORITY_HIGH   10
 A value representing high priority.
 
#define NUGU_PLUGIN_PRIORITY_LOW   900
 A value representing low priority.
 
#define NUGU_PLUGIN_SYMBOL   "nugu_plugin_define_desc"
 Default symbol name for dlsym()
 

Typedefs

typedef struct _plugin NuguPlugin
 Plugin object.
 

Functions

NUGU_API int nugu_plugin_add (NuguPlugin *p)
 Add the plugin to managed list. More...
 
NUGU_API void nugu_plugin_deinitialize (void)
 De-initialize plugin.
 
NUGU_API NuguPluginnugu_plugin_find (const char *name)
 Find a plugin by name in the managed list. More...
 
NUGU_API void nugu_plugin_free (NuguPlugin *p)
 Destroy the plugin. More...
 
NUGU_API void * nugu_plugin_get_data (NuguPlugin *p)
 Get private data from plugin. More...
 
NUGU_API const struct nugu_plugin_descnugu_plugin_get_description (NuguPlugin *p)
 Get the plugin description. More...
 
NUGU_API void * nugu_plugin_get_symbol (NuguPlugin *p, const char *symbol_name)
 Get dlsym result from plugin. More...
 
NUGU_API int nugu_plugin_initialize (void)
 Initialize plugin. More...
 
NUGU_API int nugu_plugin_load_builtin (void)
 Load all built-in plugins. More...
 
NUGU_API int nugu_plugin_load_directory (const char *dirpath)
 Load all plugin files from directory. More...
 
NUGU_API NuguPluginnugu_plugin_new (struct nugu_plugin_desc *desc)
 Create new plugin object. More...
 
NUGU_API NuguPluginnugu_plugin_new_from_file (const char *filepath)
 Create new plugin object from file. More...
 
NUGU_API int nugu_plugin_remove (NuguPlugin *p)
 Remove the plugin to managed list. More...
 
NUGU_API int nugu_plugin_set_data (NuguPlugin *p, void *data)
 Set private data to plugin. More...
 

Detailed Description

Plugin management.

The plugin is a feature provided to extend the functionality of sdk. The plugin must have a shared library type that contains the 'nugu_plugin_define_desc' symbol. And there should be no 'lib' prefix in file name.

Macro Definition Documentation

◆ NUGU_PLUGIN_DEFINE

#define NUGU_PLUGIN_DEFINE (   p_name,
  p_prio,
  p_ver,
  p_load,
  p_unload,
  p_init 
)
Value:
NUGU_API_EXPORT struct nugu_plugin_desc nugu_plugin_define_desc = { \
.name = #p_name, \
.priority = p_prio, \
.version = p_ver, \
.load = p_load, \
.unload = p_unload, \
.init = p_init \
}
Plugin description.
Definition: nugu_plugin.h:93
const char * name
Name of plugin.
Definition: nugu_plugin.h:97

Macros to easily define plugins.

Function Documentation

◆ nugu_plugin_new()

NUGU_API NuguPlugin* nugu_plugin_new ( struct nugu_plugin_desc desc)

Create new plugin object.

Parameters
[in]descplugin description
Returns
plugin object
See also
nugu_plugin_new_from_file()
nugu_plugin_free()

◆ nugu_plugin_new_from_file()

NUGU_API NuguPlugin* nugu_plugin_new_from_file ( const char *  filepath)

Create new plugin object from file.

Parameters
[in]filepathplugin file path
Returns
plugin object
See also
nugu_plugin_new()
nugu_plugin_free()

◆ nugu_plugin_free()

NUGU_API void nugu_plugin_free ( NuguPlugin p)

Destroy the plugin.

Parameters
[in]pplugin object

◆ nugu_plugin_add()

NUGU_API int nugu_plugin_add ( NuguPlugin p)

Add the plugin to managed list.

Parameters
[in]pplugin object
Returns
result
Return values
0success
1success (plugin is already registered)
-1failure (another plugin using the same file is already registered)
See also
nugu_plugin_find()
nugu_plugin_remove()

◆ nugu_plugin_remove()

NUGU_API int nugu_plugin_remove ( NuguPlugin p)

Remove the plugin to managed list.

Parameters
[in]pplugin object
Returns
result
Return values
0success
-1failure
See also
nugu_plugin_add()
nugu_plugin_find()

◆ nugu_plugin_find()

NUGU_API NuguPlugin* nugu_plugin_find ( const char *  name)

Find a plugin by name in the managed list.

Parameters
[in]namename of plugin
Returns
plugin object
See also
nugu_plugin_add()
nugu_plugin_remove()

◆ nugu_plugin_set_data()

NUGU_API int nugu_plugin_set_data ( NuguPlugin p,
void *  data 
)

Set private data to plugin.

Parameters
[in]pplugin object
[in]dataplugin specific data
Returns
result
Return values
0success
-1failure
See also
nugu_plugin_get_data()

◆ nugu_plugin_get_data()

NUGU_API void* nugu_plugin_get_data ( NuguPlugin p)

Get private data from plugin.

Parameters
[in]pplugin object
Returns
data
See also
nugu_plugin_set_data()

◆ nugu_plugin_get_symbol()

NUGU_API void* nugu_plugin_get_symbol ( NuguPlugin p,
const char *  symbol_name 
)

Get dlsym result from plugin.

Parameters
[in]pplugin object
[in]symbol_namesymbol name to find
Returns
symbol address

◆ nugu_plugin_get_description()

NUGU_API const struct nugu_plugin_desc* nugu_plugin_get_description ( NuguPlugin p)

Get the plugin description.

Parameters
[in]pplugin object
Returns
plugin description

◆ nugu_plugin_load_directory()

NUGU_API int nugu_plugin_load_directory ( const char *  dirpath)

Load all plugin files from directory.

Parameters
[in]dirpathdirectory path
Returns
Number of plugins loaded
Return values
-1failure

◆ nugu_plugin_load_builtin()

NUGU_API int nugu_plugin_load_builtin ( void  )

Load all built-in plugins.

Returns
Number of plugins loaded
Return values
-1failure

◆ nugu_plugin_initialize()

NUGU_API int nugu_plugin_initialize ( void  )

Initialize plugin.

Returns
Number of plugins initialized