Firebolt™ Application Platform 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, 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"}' http://127.0.0.1:9998/jsonrpc

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

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"}' http://127.0.0.1:9998/jsonrpc

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

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"}}' http://127.0.0.1:9998/jsonrpc

{"jsonrpc":"2.0","id":3,"result":{"success":true}}

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"}' http://127.0.0.1:9998/jsonrpc

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

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": "client.events.1"}}' http://127.0.0.1:9998/jsonrpc;

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

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

{"jsonrpc":"2.0","method":"client.events.1.activeInputChanged","params":{"tvinput":false}}

Go To Top