Thunder: A Services-Based Framework for the RDK

Published: September 20, 2019
Edited: September 30, 2019

Thunder is the next generation framework for accessing the components and functionality available on set-top devices. Thunder is included with the RDK and used by the Firebolt® Application Platform. Like any good framework, you won't need to understand all the low-level details of Thunder, but you do need to have a basic understanding of the framework to use the services it exposes. If you are interested in low-level details, then check out the Thunder project on GitHub.

In this blog, I'll describe the Thunder framework, discuss some of its key features, and provide a quick demonstration of accessing the Thunder framework.

Interface Abstraction Layer

Thunder provides a common plugin interface for integrating different components on set-top boxes. The interface is modular and provides plugin implementations with some key functionality:

  • Plugins can be replaced or exchanged without breaking the system.
  • Plugins can be activated or deactivated as required.
  • Plugins can take advantage of common security, management, logging, and tracing.

Similar to the hardware abstraction layers in the RDK, the Thunder interface abstraction layer allows RDK components to change while decoupling and shielding applications from low-level implementation details.

The following diagram show a simplified view of the Thunder framework as an abstraction layer for integrating plugins.

Shows plugins in the Thunder framework accessing RDK core components.

Lightweight Service Access

Applications that run on RDK devices require access to the rich set of features that the Thunder plugins provide. This is where Thunder really excels: it exposes plugins as JSON-RPC services and makes them accessible to your apps over both HTTP and WebSockets. A services-based approach facilitates integration between web-based applications and native, embedded functionality available on the device.

JSON-RPC allows the use of any JSON-capable client (standalone or browser-based). However, Thunder does not constrain you to an out-of-process model. Native applications that require optimal performance can choose to use the services in-process by directly accessing the service interface using C/C++ native code.

The following diagram show a simplified view of applications using Thunder plugins through their service interface.

Shows applications accessing plugins through service interface

Thunder Demo

The Thunder framework is pre-integrated with the RDK and does not require a separate installation. For this quick demonstration, I’ll be using the RDK reference implementation for the Raspberry Pi. The reference implementation is perfect for testing and development if you do not have access to an RDK-based device. You can download the reference implementation using the Startup Guide instructions, which also includes setup instructions.

Prerequisites

This demo requires:

  • Raspberry Pi 3 Model B+ reference implementation or similar RDK-based device running RDK version 4 or higher
  • cURL

Making a Thunder Call

Thunder includes several plugins that are activated by default. The following example uses the cURL command-line tool to send a JSON request to the Thunder HTTP server. The request invokes the DeviceInfo plugin and uses the systeminfo method which returns basic device information.

Request

curl -H "Content-Type: application/json" -X POST -d '{"jsonrpc":"2.0","id":"3","method": "DeviceInfo.1.systeminfo"}' http://127.0.0.1:9998/jsonrpc

Response

{"jsonrpc":"2.0","id":3,"result": {
    "version":"1.0.#0105e8f8ed2716fa2bff6f897e3538d922455ed0",
    "uptime":80454,
    "totalram":639639552,
    "freeram":434946048,
    "devicename":"raspberrypi-rdk-mc",
    "cpuload":"2",
    "serialnumber":"OEuCfXXXXX",
    "time":"Thu, 08 Oct 2020 16:55:58"
    }
}

Conclusion

Thunder is a next generation, services-based framework for integrating RDK components and features. The services expose Thunder plugins to applications using standard technologies such as JSON and HTTP. The plugins implement common interfaces to ensure the system remains modular and loosely coupled.

PHP Code Snippets Powered By : XYZScripts.com