Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Plugin Development in wpeframework-plugins

...

In wpeframework-plugins workspace :

(cloned from https://github.com/WebPlatformForEmbedded/ThunderNanoServices/)

Create PluginName folderfolder 


Inside PluginName directory:

12. Create “CmakeLists.txt” to compile the Plug-in code and to generate the shared library (“.so”)

This will handle all the dependencies as well


32. Module.h: This header file includes the support for JSON request, response, logging etc.,

43. Module.cpp: This file is used to declare the module name for the Plug-in


54. <PluginName>Plugin.json:

...

Code Block
themeEclipse
{
  "$schema": "plugin.schema.json",
  "info": {
    "title": "Plugin Name Plugin",
    "callsign": "PluginName",
    "locator": "libWPEFrameworkPluginName.so",
    "status": "production",
    "description": "The PluginName plugin allows retrieving of various plugin-related information.",
    "version": "1.0"
  },
  "interface": {
    "$ref": "{interfacedir}/PluginName.json#"
  }
}


65.  <PluginName>.config: This file is used to set configurations of the Plug-in 

...

We can set some other parameters based on our need


76. <PluginName>.h

Declare the plugin class in this which should contains all the structures, variables and methods which are needed for plugin implementation. The interface header auto-generated earlier will be used here,

...

Code Block
virtual Core::ProxyType<Web::Response> Process(const Web::Request& request) override;


 8 7. <PluginName>.cpp: This class does contains all the definitions for the methods declared in the Plugin.h and those definitions should be defined inside the below namespace. 

...

Code Block
namespace WPEFramework {
	namespace Plugin {  
		SERVICE_REGISTRATION(Plugin, 1, 0);
		//All the methods declared in Plugin.h should be defined here
	}
}


 9 8.  <PluginName>JsonRpc.cpp: This class is used to register the methods with JSON RPC interface as below

...

Code Block
themeEclipse
uint32_t Plugin::get_method(ClassName& response) const
{
	//body of the method
}

uint32_t Plugin::set_method(ClassName& response) const
{
	//body of the method
}       


109.  <PluginName>HAL.cpp: Used to communicate to driver layer in order to get some information or to set some properties.

...

for further clarifications

Compilation and Install

Enable the plugin in the main CMakeLists.txt of wpeframework-plugins


bitbake wpeframework-plugins

...