Getting to Know the Thunder Plugins

Joseph Ruzzi

In my previous blog, Thunder: A Services-Based Framework for the RDK, I introduced the Thunder framework, described the Thunder plugin architecture, and demonstrated how to access Thunder plugins using their JSON-RPC services-based interface. In this blog, I’ll describe how you can discover and activate the rich set of plugins (services) that are available on RDK set-top devices.

If you want to follow along and do not have access to an RDK-based device, you can use the RDK reference implementation for the Raspberry Pi. Download the reference implementation using the Startup Guide instructions, which also includes setup instructions.

Prerequisites

To complete the examples, you will need:

  • Raspberry Pi 3 Model B+ running the RDK reference implementation for the Raspberry Pi or a similar RDK-based device running RDK Version 4 or higher
  • cURL

Discovering Plugins/Services

Many of the traditional services available on an RDK set-top device are implemented as Thunder plugins. These plugins are commonly referred to as RDK services because of their JSON-RPC services-based interface. I’ll continue to use RDK services from here out to avoid any confusion; however, the terms are synonymous.

RDK services are uniquely identified using a callsign, which takes the form org.rdk.service_name. There is also a core Thunder service (the Controller service) that manages services in the Thunder framework. The following example sends a request to the Controller service and uses the status method to return information about all registered services including their service callsign. Replace host_address with the IP address of your device.

curl --header "Content-Type: application/json" --request POST --data '{"jsonrpc":"2.0","id":"3","method": "Controller.1.status"}' http://host_address:9998/jsonrpc

Note: You can access the Controller service directly from a browser using the same URL with the /Service/Controller/ context (http://host_address:9998/Service/Controller). There is also a Controller UI available at http://host_address:9998/.

Once you discover the service callsigns, you can request the status of individual services. The following example uses the Controller service to requests the status of the DisplaySettings service using the org.rdk.DisplaySettings callsign:

Request

curl --header "Content-Type: application/json" --request POST --data '{"jsonrpc":"2.0","id":"3","method":"Controller.1.status@org.rdk.DisplaySettings"}' http://host_address:9998/jsonrpc

Response

{
   "jsonrpc":"2.0",
   "id":3,
   "result":[{
      "callsign":"org.rdk.DisplaySettings",
      "locator":"libWPEFrameworkDisplaySettings.so",
      "classname":"DisplaySettings",
      "autostart":false,
      "precondition":["Platform"],
      "state":"deactivated",
      "processedrequests":0,
      "processedobjects":0,
      "observers":0,
      "module":"DisplaySettings",
      "hash":"engineering_build_for_debug_purpose_only"
   }]
}

Starting a Service

Some RDK services are configured to start automatically, while other services must be explicitly started. You may have noticed in the example that the DisplaySettings service is deactivated. Many of the services on the Raspberry Pi reference implementation are deactivated by default. The Controller service can be used to activate (as well as deactivate) services. The following example starts the DisplaySettings service using the activate method. The service callsign is included as a parameter:

Request

curl --header "Content-Type: application/json" --request POST --data '{"jsonrpc":"2.0","id":"3","method": "Controller.1.activate", "params": {"callsign":"org.rdk.DisplaySettings"}}' http://host_address:9998/jsonrpc

Response

{
   "jsonrpc":"2.0",
   "id":3,"result":null
}

You can now invoke methods on the DisplaySettings service. The following example demonstrates using the getConnectedVideoDisplays method to check if a display is connected to a video port on the device.

Request

curl --header "Content-Type: application/json" --request POST --data '{"jsonrpc":"2.0","id":"3","method": "org.rdk.DisplaySettings.1.getConnectedVideoDisplays"}' http://host_address:9998/jsonrpc

Response

{
   "jsonrpc":"2.0",
   "id":3,
   "result":{
      "connectedVideoDisplays":["HDMI0"],
      "success":true}
   }
}

Learning More about RDK Services

There are many RDK services available, and more services are always being added. Be sure to check out RDK Services API Reference for a complete list and documentation. If you want to dive deeper into a service implementation, then take a look at the rdkservices repository. Here is a short list of some standard open source RDK services that are available on an RDK device.

  • org.rdk.ActivityMonitor: monitor memory and CPU usage by application
  • org.rdk.Bluetooth: interact with the Bluetooth stack and manage Bluetooth devices
  • org.rdk.ControlService: manage remote controls
  • org.rdk.dataCapture: capture an audio clip from an audio source and send it to a URL
  • DeviceInfo: retrieve device-related information
  • org.rdk.DisplaySettings: retrieve display-related information
  • org.rdk.HdcpProfile: monitor HDCP support
  • org.rdk.HdmiCec: configure HDMI Consumer Electronics Control (CEC)
  • org.rdk.HdmiCecSink: manage HDMI CEC sink
  • org.rdk.HdmiInput: control HDMI Input
  • org.rdk.LoggingPreferences: control key press logging
  • org.rdk.MotionDetection: control motion sensors
  • org.rdk.Network: manage network interfaces
  • org.rdk.RDKShell: controls the management of composition, layout, Z order, and key handling.
  • org.rdk.RemoteActionMapping: control and map remote controllers
  • org.rdk.ScreenCapture: upload screen captures
  • org.rdk.Timer: start, suspend, resume timers and receive timer notifications
  • org.rdk.System: manage various system-level features
  • org.rdk.Warehouse: perform various types of resets
  • org.rdk.Wifi: manage Wifi network connections
  • org.rdk.Xcast: launch applications from an external source

Conclusion

RDK Services offer application developers a standard way to use the components and features that are available on RDK set-top devices. The services are easy to access using their JSON-RPC services-based interface and the Thunder Controller service provides a simplified way to manage these services.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Go To Top