Versions Compared

Key

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

...

Most of the up-to-data examples , definitely with the new JSONRPC , can be found here : https://github.com/WebPlatformForEmbedded/ThunderNanoServices/tree/master/examples

...

This directory also contains an example on how to communicate from outside of the Thunder framework, to the ThunderFramework (bidirectional). It is not the recommended way forward to develop services "out-side" of the Thunder framework but for legacy it is shown here how that could work by the JSONRPCClient. The JSONRPC Client is a stand-alone application that connect to the JSONRPCPlugin.

...

Plugins can be developed in a large variety, in process, out-of-process, out-of host, and each plugin can exploit a large scale over communication protocols, JSONRPC/COMRPC, MessagePackRPC.

Steps involved in implementing new Thunder Plug-In

Interface Specification in wpeframework 

  1. <PluginName>.json

       Add <PluginName>.json in wpeframework module so as to define the interfaces.

          https://github.com/WebPlatformForEmbedded/Thunder/tree/master/Source/interfaces/json

          Refer eg: DeviceInfo.json

          After adding the json file and compilation of wpeframework, it will autogenerate header file JsonData_PluginName.h 

...

          This header will be used from wpeframework-plugins module. 

Plugin Development in wpeframework-plugins

21. In wpeframework-plugins repo:

...

Create PluginName folder


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

This will handle all the dependencies as well


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

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


25. 4) <PluginName>Plugin.json:

This file contains the plugin's information like schema, information and interface json file etc.,

...

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#"
  }
}


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

...

Used to make the Plug-in to start automatically aling along with wpeframework daemon

We can set some other parameters based on our need


27. 6) <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;


 2 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
	}
}


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

...