Published: May 20, 2020
Edited: November 17, 2020

RDK Video Application Platform (VAP) includes many RDK services that allow you to access device-specific functionality. RDK services use underlying RDK-V components and are implemented as plugins for the Thunder framework. The Thunder framework is responsible for, among other things, managing plugins and handling client requests.

RDK services are invoked using their JSON-RPC service interface over HTTP or Web Sockets. This makes RDK services accessible to any client (standalone or browser-based) that can process JSON. For native applications, you can also invoke RDK services directly using C/C++ native code.

For a list of RDK services available with RDK VAP, see RDK Service APIs. For a complete list of RDK services in RDK, see RDK Services (Thunder) at RDK Central.

Invoking a Service

A service method is invoked using the service name, the service version, and the method name together with any required parameters.

The following example uses the cURL command-line tool to demonstrate making a call to the DeviceInfo service and uses the systeminfo method which returns basic device information. The call is made to the default HTTP server running on the device.

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

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

Starting a Service

Some RDK services are configured to start automatically while other services must be explicitly activated. A special core service called the Controller service is always available and includes an activate method that starts a service. To start a service, you must use the service callsign, which uniquely identifies the service and takes the form org.rdk.service_name. Before activating a service, you can check the status of a service using the status property.

Note: For convenience, you can also activate and deactivate services using the Controller UI. To access the application, open a browser and navigate to http://host_address:9998. Replace host_address with the IP address of the device where RDK VAP is running.

The following example demonstrates starting the org.rdk.DisplaySettings service. Start by checking the status of the DisplaySettings service using the status property and passing in the service callsign:

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


Next, activate the service using the activate method and use the callsign parameter to enter the service name:

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


Lastly, invoke a method on the service to verify that it is active. The following example demonstrates using the getConnectedVideoDisplays method to check if a display is connected to a video port on the device.

curl -H "Content-Type: application/json" -X POST -d '{"jsonrpc":"2.0","id":"3","method": "org.rdk.DisplaySettings.1.getConnectedVideoDisplays"}'


Using Events

Many RDK services can emit events. Clients must register for events to receive event notifications. Event registration is performed using the register method. Event de-registration is performed using the unregister method. Both methods are available on all services that support events.

The following example demonstrates registering for the activeInputChanged event that is available on the DisplaySettings service.

curl -H "Content-Type: application/json" -X POST -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.DisplaySettings.1.register", "params": {"event":"activeInputChanged", "id": ""}}';


Clients receive events over web sockets. The following example demonstrates an event.


PHP Code Snippets Powered By :