Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Getting Started for App Developers

Reference Image

A reference image for the Raspberry Pi 3B is available for app developers that containers all the tooling necessary to install and run DAC applications. The image contains the Lightning-based RefApp, RDKServices, AAMP as well as the DAC STB components such as RDKShell, Packager, Dobby and crun.

The image uses the meta-cmf-video-reference-next layer (https://code.rdkcentral.com/r/plugins/gitiles/components/generic/rdk-oe/meta-cmf-video-reference-next), which is contains all the necessary recipes for building DAC on the Raspberry Pi.

Download/Build Instructions

Full documentation and instructions to build the reference image yourself can be found here: RDK reference image.

To quickly get started:

  • Download the latest pre-built image from the RDK reference image page
  • Flash this to an SD card with Etcher: https://www.balena.io/etcher/
  • Resize the second partition afterwards to at least 2GB or else there is not enough space to download the DAC apps on the rootfs. This can be done with fdisk or gparted.
  • By default the image will start up with refapp2. You can stop refapp2 by browsing to http://$BOXIP:9998 on your workstation and de-activate the webkitbrowser plugin there

Installing and Running DAC Applications

Once the reference image has been flashed to the Raspberry Pi, follow the below instructions to install and run a sample DAC application onto the RPi.

Two sample DAC applications are available here: https://github.com/stagingrdkm/lntpub/tree/master/bundle/rpi. These applications are in the OCI bundle format and have already been prepared for the Raspberry Pi. This example will use the Wayland EGL test application.

For instructions on how to create your own application, see the SDK section. You may need to install wscat first on your workstation to follow these instructions. $BOX refers to the IP of the raspberry pi and Thunder port: e.g. 192.169.1.10:9998.

1. Download the rpi-wayland-egl-test.tar.gz file from GitHub to your workstation

2. Create a simple web server on your workstation that is accessible from the Raspberry Pi, and use it to serve the downloaded tar.gz file. https://www.npmjs.com/package/http-server is a good, simple HTTP server that could be used for this purpose

3. Install the application on the Pi using Packager. Replace the IP address with the IP of your web server:

Code Block
wscat -c ws://$BOX/jsonrpc -s notification -x '{"jsonrpc":"2.0","id":1,"method":"Packager.1.install", "params":{ "pkgId": "mypkgid", "type": "DAC", "url": "http://192.168.1.147:8080/7218c-wayland-egl-test.tar.gz" } }'

4. Launch the application with RDKShell:

Code Block
wscat -c ws://$BOX/jsonrpc -s notification -x '{"jsonrpc":"2.0","id":1,"method":"org.rdk.RDKShell.1.launchApplication", "params":{ "client": "test", "mimeType": "application/dac.native", "uri": "mypkgid" } }'

5. You should see a flashing green square in the corner of the display. This is the sample application.

6. Suspend and resume the application by running the following:

Code Block
wscat -c ws://$BOX/jsonrpc -s notification -x '{"jsonrpc":"2.0","id":1,"method":"org.rdk.RDKShell.1.suspendApplication", "params":{ "client": "test" } }'
wscat -c ws://$BOX/jsonrpc -s notification -x '{"jsonrpc":"2.0","id":1,"method":"org.rdk.RDKShell.1.resumeApplication", "params":{ "client": "test" } }'

7. Kill the application:

Code Block
wscat -c ws://$BOX/jsonrpc -s notification -x '{"jsonrpc":"2.0","id":1,"method":"org.rdk.RDKShell.1.kill", "params":{ "client": "test" } }'

8. Get a list of installed applications and uninstall the sample app:

Code Block
wscat -c ws://$BOX/jsonrpc -s notification -x '{"jsonrpc":"2.0","id":1,"method":"Packager.1.getInstalled" }'
wscat -c ws://$BOX/jsonrpc -s notification -x '{"jsonrpc":"2.0","id":1,"method":"Packager.1.remove", "params":{ "pkgId": "mypkgid" } }'

The full list of RDKShell and Packager APIs can be found in the full documentation.

Demo Web App

The reference image also contains a sample web app that performs the above steps. To start the test page, you can run the following command on your development PC

Code Block
wscat -c ws://$BOX/jsonrpc -s notification -x '{"jsonrpc":"2.0","id":1,"method":"org.rdk.RDKShell.1.launch", "params":{ "callsign": "WebApp", "uri": "http://127.0.0.1:50050/test/index.html", "type": "WebKitBrowser"} }'

Use "TAB" to navigate the buttons and enter to click. By default it will download DAC bundles for RPI. Bundles are currently downloaded from here: https://github.com/stagingrdkm/lntpub/tree/master/bundle This test app is based on the browser example which comes with ThunderJS. The sources of the test app can be found here: https://github.com/stagingrdkm/lgpub/tree/master/dac/rdkshelldactester 

Note when a DAC app is started via the test page, the underlying test page will also still receive the keys

App Development and Publishing

The above example used a pre-created OCI bundle. Using the SDK it is possible to build your own applications that can be run in a container. Further documentation will be available once the SDK is more stable. For now, initial documentation for SDK usage can be found here: SDK DocumentationRefer to the quickstart documentation here: Quickstart: Building, Installing and Running DAC apps for instructions on how to create, build and run DAC applications on the Raspberry Pi reference platform