A WebEngine app is a web application that runs within the vehicle. This is made possible by an OEM hosted "app store" which distributes approved "app bundles." The HMI will decompress these app bundles and launch the entrypoint which will use the SDL JavaScript (JS) library to interact with SDL Core.
App bundles are zip compressed archives containing the following files:
manifest.js is a javascript file that exports the following application properties:
entrypoint
appIcon
appId
policyAppId
of this applicationappName
category
appHMIType
of the WebEngine applicationadditionalCategories
appHMIType
s of the WebEngine applicationlocales
appVersion
minRpcVersion
minProtocolVersion
sdl.js contains the SDL JS library used to interact with SDL Core.
All other HTML / JS files used to run the application.
To see an example WebEngine application, take a look at the example in the javascript suite on GitHub.
In order for a WebEngine application to appear on the SDL app list, the HMI must notify SDL Core about newly installed WebEngine applications by sending a BasicCommunication.SetAppProperties
. The properties sent in this request will be stored in Core's policy table and the information will stay persistent between ignition cycles.
Not all parameters in the AppProperties
struct apply to WebEngine Apps. WebEngine Apps should omit endpoint
and authToken
.
When the user activates a WebEngine application, the HMI will use information from the manifest.js to launch the entrypoint HTML (our development HMIs do this by creating an invisible iframe). Here, the app will begin execution on the head unit and eventually call RegisterAppInterface
. When the HMI receives an OnAppRegistered
notification signalling that the WebEngine app has successfully registered, the HMI should then send Core an ActivateApp
request.
In order to support the WebEngine feature, a WebSocket server transport was added to SDL Core. This contrasts to the WebSocket client transport in SDL Core that is used by Java Cloud applications. When the HMI launches a WebEngine application, it will provide Core's hostname and port as query parameters to the entrypoint of the WebEngine application. This transport supports both secure and non-secure WebSocket communication, which is also determined by a query parameter passed to the entrypoint HTML file of the WebEngine application.
These are the accepted values for the sdl-transport-role parameter:
Example URL with query parameters: file://somewhere/HelloSDL/index.html?sdl-host=localhost&sdl-port=12345&sdl-transport-role=wss-server
WebSocket server transport will only run if either all three of these are valid or if none are provided:
If all three are provided, SDL Core will use WebSocket Secure, otherwise, Core will use regular WebSocket communication. These values can be set in the smartDeviceLink.ini configuration file.
Please refer to the following diagram which describes the hierarchy of transport components for the WebSocket Server transport adapter.
Please refer to the following diagram that describes the initialization sequence when SDL Core is started.
View on GitHub.com