• Quick Start
  • Booting
  • Platform
  • Portals
  • References
    • API Reference TOI3
    • IIP Reference
  • Resources
ARRIS Enterprises, Inc. Confidential Information

Example loader portal

The SDK contains an example loader portal. It is intended to be installed into the boot image as a local portal. The example loader portal will run automatically when the STB boots. It performs some network checks, and if all went well, it loads the main portal over the network.

Begin by uncommenting the loader portal lines in the <sdk_root>/build_scripts/example.config boot image configuration file, so it looks like this:

<sdk_root>/build_scripts/example.config

# Add the loader portal example
kreatv-option-local-portal::file=../examples/loader-portal.tgz

# Set the loader portal as the default URL
kreatv-app-webkit-portal::url=file:///usr/local/portal/loader-portal/index.html

Note that since kreatv-app-webkit-portal already has a url argument specified earlier in the config file, you will need to comment out or remove that earlier definition. The url can only appear once.

The url argument tells the portal application on the STB to run the specified url as the startup page. Instead of an http:// address, a file:// URL is used and the path to the portal is provided. It always begins with /usr/local/portal/, which is where the IIP installs local portals, followed by the dir structure used in the tarball, shown below:

.
└── loader-portal
    ├── darktheme.css
    ├── framework
    │   ├── framework.css
    │   ├── framework-enable.css
    │   └── framework.js
    ├── index.html
    ├── loader.js
    └── main.css

Setting the main URL

For convenience, URLs used by the loader portal are stored in configuration objects. This makes it easy to alter them in the boot image configuration, rather than requiring the tarball to be repacked. The loader portal uses two urls, apps.portal.url.test, to which it sends an XHR request to test the availability of the server, and apps.portal.url.main, which is the URL to the main portal.


# Set main portal URL
kreatv-option-is-default::apps.portal.url.main=http://main.portal.server.address/portal/index.html
# Set connectivity test URL
kreatv-option-is-default::apps.portal.url.start=http://server.ip/connection.html

When the example loader portal has completed its startup checks, it uses the TOI API to fetch the values of the apps.portal.url.main and apps.portal.url.test configuration objects. It sends an XHR GET request to the test URL, to verify that the server is available and responding, and then changes the window.location.href to load the main URL:

<sdk_root>/examples/loader-portal/loader.js

function getPortalUrls() {
  var object = toi.informationService.get(["apps.portal.url.main",
                                           "apps.portal.url.test"]);
  if (object[0].status != toi.informationService.STATUS_NO_OBJECT) {
    portalUrl = object[0].objectItem.value;
  }
  if (object[1].status != toi.informationService.STATUS_NO_OBJECT) {
    testUrl = object[1].objectItem.value;
  }
}

Once the network checks have been successfully carried out, the portal loads the main URL:

<sdk_root>/examples/loader-portal/loader.js

function loadPortal() {
  // Load the main portal
  window.location.href = portalUrl;
}

Network checks

The loader portal performs the following network tests:

  • Waiting for network link
  • Fetching an IP address
  • Checking Internet connectivity
  • Checking DNS lookup
  • Checking the STB time is valid

Several other tests could be added, such as testing to see if the connection to the home gateway or router is working, even if the Internet is not. These tests can be used to prompt the user to check their cabling between the STB and the router, or the router and the modem, or to contact their service provider, etc.

For details on how these tests are performed, please see the Network Service page, and the TOI Network Service interface.

Booting without network

To ensure that the STB boots the loader portal, even if no network is available, the boot loader configuration parameter BootWithoutNet needs to be set to "Yes". You do this by setting the factory defaults when building the boot image.

5.1.1.p8

Copyright (c) 2018 ARRIS Enterprises, LLC. All Rights Reserved. ARRIS Enterprises, LLC. Confidential Information.