1.Repos:


Repo Name

URL

Comment

WPEFrameworkhttps://github.com/WebPlatformForEmbedded/WPEFrameworkMain repo for Thunder/WPEFramework
WPEFrameworkPluginshttps://github.com/WebPlatformForEmbedded/WPEFrameworkPluginsVarious WPEFramework plugins
Lightning SDKhttps://github.com/WebPlatformForEmbedded/Lightning

WPE UI Framework (JS & WebGL library for developing web apps)

WPEReferenceUXhttps://github.com/WebPlatformForEmbedded/WPEReferenceUXSample UI/Demo app which demonstrates WPEFramework and Lightning use
WPEPluginLauncherhttps://github.com/WebPlatformForEmbedded/WPEPluginLauncherPlugin to "Launch" linux applications and scripts

2. WPEFramework

WPEFramework provides a unified web-based interface with a consistent navigation model. In this model, plugins (custom or generic) are controlled and queried, through the WPEFramework application.

The main responsibilities of WPEFramework application are:

  • Modular loading and unloading of plugins.
  • Plugin process localization. In or out-of-process communicating with the framework over a lightweight RPC communication channel.
  • Runtime enabling/disabling of tracing information within the plugins and the WPEFramework application.
  • Light-weight implementation of the HTTP [RFC2616] specification.
  • Light-weight implementation of the WebSocket [RFC6455] specification.

Each instance of a plugin in the WPE id identified by a name. This name is referred to as Callsign of the plugin. The callsign must be unique in the context of all configured plugins.


3. HTTP Restful API

All request and response bodies should use the JSON format for data.

3.1 Methods

Method

Function

GETRetrieve information from WPEFramework or a plugin
POSTUpdate new information or new objects at WPEFramework or a plugin
PUTUpdate new information or new objects at WPEFramework or a plugin
DELETEDelete information at WPEFramework or a plugin

3.2 Web API Path

All WPEFramework commands start with the “Service” prefix followed by the Plugin name:

   (GET|POST|PUT|DELETE) /Service/<PluginName>[/OptionalPaths] HTTP/1.1

3.3 Examples

Retrieve the list of all active plugins:

    curl -X GET http://192.168.1.122:9998/Service/Controller

Deactivate OCDM plugin:

   curl -X PUT http://192.168.1.122:9998/Service/Controller/Deactivate/OCDM

Send a Scan command to the WIFI controller plugin:

   curl -X PUT http://192.168.1.122:9998/Service/WifiControl/Scan

Update the WebktiBrowser config:

curl -X POST http://192.168.1.122:9998/Service/WebKitBrowser/Config --data "config.json"

4. WebSockets for events & notifications

The architecture of the WPEFramework offers event based feedback to clients. This functionality is realized using web socket connections to a plugin. Over these web socket connections, the plugin will notify the client on the other side of the web socket of events specific to the plugin.

The syntax for opening a web socket to the plugin is equal to the syntax of the RESTfull API:

   Request: ws://<IP Address and port of WPEFramework>/Service/<Callsign>
protocol: notification
In Javascript, the socket would be opened like:
socket = new WebSocket("ws://192.168.1.122:9998/Service/Controller", "notification");

using wscat tool: (shows notification for OCDM plugin being deacticated)

   09:23 $ wscat -c ws://192.168.1.122:9998/Service/Controller -s notification --no-color
connected (press CTRL+C to quit)
< {"callsign":"OCDM","state":"deactivated","reason":"Requested"}
< {"subsystems":{"Decryption":false}}
>

Using the Controller callsign, one can listen to all the notifications. If a specific plugin callsign is used when opening the websocket connection, only events from that plugin will be received.

5. Filesystem installation (config files & shared libs)

5.1 Config files

Config files are stored under /etc/WPEFramework:

   root@pacexi5:/etc/WPEFramework# find .
.
./config.json
./plugins
./plugins/OCDM.json
./plugins/DeviceInfo.json
./plugins/Tracing.json
./plugins/Monitor.json

 config.json is the main configuration file for the WPEframework and port number and network interface for the main HTTP API are set here:

    "version":"1.0.0000000",
"port":9998,
"binding":"0.0.0.0",
"ipv6":false,
"idletime":180,
"persistentpath":"/opt",
"datapath":"/usr/share/WPEFramework",
"systempath":"/usr/lib/wpeframework/plugins",
"proxystubpath":"/usr/lib/wpeframework/proxystubs",
"redirect":"/Service/Controller/UI",

Each plugin has a json config file under /etc/WPEFramework/plugins. For example, OCDM plugin config file OCDM.json:

   root@pacexi5:/etc/WPEFramework# cat plugins/OCDM.json
{
"locator":"libWPEFrameworkOCDM.so",
"classname":"OCDM",
"precondition":[
"Provisioning"
],
"autostart":true,
"configuration":{
"outofprocess":true,
"mapping":[
{
"key":"com.youtube.playready",
"system":"PlayReady"
},
{
"key":"com.microsoft.playready",
"system":"PlayReady"
},
{
"key":"com.widevine.alpha",
"system":"WideVine"
}
]

Generic plugin properties like preconditions, autostart and outofprocess are set here as well as plugin specific ones. In this case, supported KeySystems (DRMs) are listed in the config file.

5.2 Executables

Two executables are installed in /usr/bin:

   /usr/bin/WPEFramework-1.0.0000000
/usr/bin/WPEProcess -> WPEProcess-1.0.0000000 (each out-of-process plugin will run in a seperate WPEProcess)
/usr/bin/WPEProcess-1.0.0000000
/usr/bin/WPEFramework -> WPEFramework-1.0.0000000 (main WPEFramework process, started with systemd, Controller and in-process plugins run in this process)

5.3 Shared libs

wpeframework core libraries are in /usr/lib:

   root@pacexi5:/usr/lib# ls -l libWPEFramework*
libWPEFrameworkCore.so -> libWPEFrameworkCore.so.1
libWPEFrameworkCore.so.1 -> libWPEFrameworkCore.so.1.0.0000000
libWPEFrameworkCore.so.1.0.0000000
libWPEFrameworkCryptalgo.so -> libWPEFrameworkCryptalgo.so.1
libWPEFrameworkCryptalgo.so.1 -> libWPEFrameworkCryptalgo.so.1.0.0000000
libWPEFrameworkCryptalgo.so.1.0.0000000
libWPEFrameworkPlugins.so -> libWPEFrameworkPlugins.so.1
libWPEFrameworkPlugins.so.1 -> libWPEFrameworkPlugins.so.1.0.0000000
libWPEFrameworkPlugins.so.1.0.0000000
libWPEFrameworkProtocols.so -> libWPEFrameworkProtocols.so.1
libWPEFrameworkProtocols.so.1 -> libWPEFrameworkProtocols.so.1.0.0000000
libWPEFrameworkProtocols.so.1.0.0000000
libWPEFrameworkTracing.so -> libWPEFrameworkTracing.so.1
libWPEFrameworkTracing.so.1 -> libWPEFrameworkTracing.so.1.0.0000000
libWPEFrameworkTracing.so.1.0.0000000
OCDM library is also part of WPEFramework:
   root@pacexi5:/usr/lib# ls -l libocdm.so*
libocdm.so -> libocdm.so.1
libocdm.so.1 -> libocdm.so.1.0.0000000
libocdm.so.1.0.0000000

Plugin shared libs are located in /usr/lib/wpeframework:

   root@pacexi5:/usr/lib/wpeframework# find .
./plugins/libWPEFrameworkMonitor.so
./plugins/libWPEFrameworkOCDM.so
./plugins/libWPEFrameworkWebKitBrowser.so
./plugins/libWPEFrameworkTraceControl.so
./plugins/libWPEFrameworkDeviceInfo.so
./proxystubs
./proxystubs/libWPEFrameworkInterfaces.so.1.0.0000000
./proxystubs/libWPEFrameworkInterfaces.so
./proxystubs/libWPEFrameworkProxyStubs.so.1
./proxystubs/libWPEFrameworkProxyStubs.so.1.0.0000000
./proxystubs/libWPEFrameworkInterfaces.so.1
./proxystubs/libWPEFrameworkProxyStubs.so

6. Memory Usage

WPEFramework runs as a systemd service. The main process is named WPEFramework and runs the main controller plugin as well as the other in-process plugins (such as monitor, tracing etc). 

The out-of-process plugins such as OCDM plugin run in seperate "WPEProcess" processes. For example, in a configuration with Trace, Monitor and DeviceInfo in-process plugins and OCDM out-of-process plugin, the following processes are present:

   root@pacexi5:/etc/WPEFramework# ps ax | grep -i wpe
   11317 ? Ssl 0:00 /usr/bin/WPEFramework -b
11340 ? Sl 0:00 WPEProcess -a /usr/bin/ -c OCDMImplementation -d /usr/share/WPEFramework/OCDM/ -i 85 -l libWPEFrameworkOCDM.so -m /usr/lib/wpeframework/proxystubs/ -p /opt/OCDM/ -r /tmp/communicator -s /usr/lib/wpeframework/plugins/

Top command output:

   PID   USER PR NI  VIRT  RES  SHR S %CPU %MEM   TIME+  COMMAND
25712 root 20 0 105156 3040 2432 S 0.3 0.5 0:00.08 WPEFramework
25737 root 20 0 322284 6120 5064 S 0.0 1.1 0:00.19 WPEProcess

The main WPEFramework process "WPEFramework" uses ~3MB RES memory with monitor, trace and deviceinfo plugins enabled. WPEProcess (OCDM) plugin is using 6MB (in idle state, it uses more when there are active DRM sessions).

7. Disk space usage

Plugins: (Monitor, OCDM,TraceControl,DeviceInfo, WebkitBrowser) use about 409KB of file space:

   root@pacexi5:/usr/lib/wpeframework# du -ah
75.0K ./plugins/libWPEFrameworkMonitor.so
103.0K ./plugins/libWPEFrameworkOCDM.so
104.0K ./plugins/libWPEFrameworkWebKitBrowser.so
67.0K ./plugins/libWPEFrameworkTraceControl.so
59.0K ./plugins/libWPEFrameworkDeviceInfo.so
409.0K ./plugins

Core shared libraries use about 600KB of file space:

   root@pacexi5:/usr/lib# du -ah libWPEFramework*.so.1.0.0000000
146.0K libWPEFrameworkCore.so.1.0.0000000
34.0K libWPEFrameworkCryptalgo.so.1.0.0000000
152.0K libWPEFrameworkPlugins.so.1.0.0000000
162.0K libWPEFrameworkProtocols.so.1.0.0000000
39.0K libWPEFrameworkTracing.so.1.0.0000000
   67.0K libocdm.so.1.0.0000000

ProxyStubs use an additional of 207KB:

   root@pacexi5:/usr/lib/wpeframework/proxystubs# du -ah
143.0K ./libWPEFrameworkInterfaces.so.1.0.0000000
63.0K ./libWPEFrameworkProxyStubs.so.1.0.0000000

Executables use 367KB:

   root@pacexi5:/usr/bin# du -ah WPE*
276.0K WPEFramework-1.0.0000000
91.0K WPEProcess-1.0.0000000

8. WebKitBrowser plugin & rdkbrowser2

WebKitBrowserPlugin allows WPEFramework clients to launch WPE instances, set the URL, suspend&resume browser processes. It works similar to rdkbrowser2 but instead of the rtRemote interface, HTTP API is used.

Further Reading:


  • No labels

23 Comments

  1. There now appears to be two WPE plugin repositories offering mostly different services, but some that overlap.

    https://github.com/rdkcentral/rdkservices

    And

    https://github.com/rdkcentral/ThunderNanoServices

    While most of the services don't overlap, some do.

    For example, SecurityAgent, OpenCDMi, TraceControl

    Worse, it would seem that these components differ depending on the repo.

    Can you tell us which repo to use, and why this has come about?

    Thanks,

    Howard

    1. Discussions are in progress on thunder plugins alignment between these 2 repos.

      Currently, the official version is https://github.com/rdkcentral/rdkservices

      This is what we are building for the Accelerator migration to rdk-next.


  2. Hi,

    We are trying to implement a diagnostic test application and we wanted to subscribe for the notification from Nano Service. we are getting following error when we send curl command 

    Jan 11 13:37:01 vip78x2w WPEFramework[3094]: PlayAssure:Process:89
    Jan 11 13:37:01 vip78x2w WPEFramework[3094]: PlayAssure:Pa_connect:452
    Jan 11 13:37:01 vip78x2w WPEFramework[3094]: PlayAssure:event_devicestatechange:314
    Jan 11 13:37:01 vip78x2w WPEFramework[3094]: PlayAssure:event_devicestatechange:320
    Jan 11 13:37:01 vip78x2w WPEFramework[3094]: /usr/bin/WPEFramework: symbol lookup error: /usr/lib/wpeframework/plugins/libWPEFrameworkPlayAssure.so: undefined symbol: _ZN12WPEFramework4Core13EnumerateTypeINS_8JsonData10PlayAssure30Pa_devicestatechangeParamsData18Pa_devicestateTypeEE5TableEt

    can you please help us to understand the issue?

    Also can you please share one example which we can refer to for notification from JS APP to Nano service?


  3. Hi Team,

    We are looking for an example of sending and receiving of structure in WPEFramework-Plugin using JSON. Could you point me to one such example?

    1. Raghavendra Narayana

      Can you please provide more details on what structure you meant.? There are lot of get/set properties there, but all these will be predefined structures

      Some example in jsonrpcplugin :
      https://github.com/rdkcentral/ThunderNanoServices/blob/master/examples/JSONRPCPlugin/JSONRPCPlugin.cpp#L76-L78

      1. thank you this example was use full. 

  4. Deepthi Suseelan with the yocto framework, dunfell build would the port to which i make the thunder connection in the lightning app change from 80 to anything diff ? I get a connection refused when try this 

    const thunderJS = ThunderJS({ host: '127.0.0.1' }); 

    1. Z-Keerthi 

      With rdkservices, Thunder framework is now running on port 9998. You can specify the port as well.

      1. I realized that the plugin I am looking to use isnt present within the plugins folders in the image , how to do I add the plugins during the build process for yocto 3.1(dunfell). Any instructions or documentation for the same would be great.

        I have looked into how to make a Thunder Nano service but I wasn't able to add it to the build. 

        Thank you 


        1. RDKServices Plugin Template#ToaddPluginintherecipefile - This might be useful for you.  The document is a work-in-progress and under review.

  5. Hi Deepthi Suseelan I tried what is given in that doc but I am still having troubles. Would there be a point of contact for the RemoteControl plugin specifically. This is to include it in the build. This has been a blocker for a while now, would really appreciate any leads.


    1. Z-Keerthi 

      Please create a ticket in https://jira.rdkcentral.com/ with exact details and issue faced.

  6. Hi,

    We are trying to implement the event call backs based on registration from platform via ThunderJS, but we are not getting to receive the callbacks once the event is invoked.

    Is there any documentation for registered event callbacks for thunder js or any sample implementation where we can look.

    1. This is a good example to understand event notification from Thunder plugins:

      https://github.com/rdkcentral/rdkservices/blob/main/WifiManager/test/thunder-wifimanager-test.js

      If you are looking specifically for ThunderJS, Lightning UI code will be a good reference. (RDK UI Options)

  7. Hi Deepthi Suseelan  I have opened a ticket for the issue I have faced and haven't had any inputs. I know that the official repo for the plugins is rdkservices but the RemoteControl plugin is in the ThundernanoServices repo and I have added it but isnt working the way it is supposed to. I have opened a ticket here REFPLTV-865 - Getting issue details... STATUS . Just updated it to reflect the issue.

  8. Z-Keerthi 

    Can you provide details on what is the issue and till what level it is working? Have you used any utilities like evtest to monitor if key presses are getting detected from kernel level.

  9. Hi Deepthi Suseelan


    Is there any HTTP API  Or Websocket event that provides browser consuming memory, CPU and GPU info ? 

  10. Hi Deepthi Suseelan ,

    Is there a way to find the number of active plugins?

  11. Hi Deepthi Suseelan Do you have a Thunder deb package created that I could use?

  12. Hi Deepthi Suseelan 

     For RDK-Broadband, trying to bring up TDK framework on Raspberrypi(3b) board. 

    Raspberrypi board is built and loaded with tdk enabled image, configured the test manager(x86) referring the steps in RDK central. Currently we are seeing communication issue between Raspberrypi(DUT) and test manager.

    At tdk test manager we observed that device is not showing in green instead showing in grey.

    Displaying below message:

    Rasberrypi : Device is not free to execute scripts.


    1) For Test Manager to communicate with device, WPE framework (Thunder) is mandatory ?
    If yes, please point the link to follow instructions

    2) Without WPE framework, is it possible to establish communication with Device


    Please help on this regard


    Thanks & Regards,

    Mahalaxmi.