The mlink-daemon service—discoverer, launcher, and audiorouter

Overview

The mlink-daemon service uses the RealVNC Discovery SDK to detect new MirrorLink devices.



When a new device is detected, the device's MirrorLink applications are published to a PPS object (/pps/system/navigator/applications/applications). The service also creates a shortcut for the application (in the /apps/ directory). Note that there's a limit of 10 MirrorLink applications.

The mlink-daemon service also negotiates RTP audio connections with the device and notifies mlink-rtp of these connections. Note that the mlink-daemon service doesn't need a RealVNC license file for discovering devices, but it uses the license for audio connections.

The service also has a native message-passing interface, which is used by mlink-viewer for requesting a MirrorLink application to be launched.

Command line

mlink-daemon [-A path_to_applications_object] [-a path_to_shortcut] [-D] [-I lo0;en0...] [-i path_to_icon.png] [-L path_to_vnclicense] [-P pps_dir] [-S]

Options

-A path_to_applications_object
Override location of the /pps/system/navigator/applications/applications PPS object.
-a path_to_shortcut
Override installation path for shortcuts for MirrorLink apps (default: /apps/).
-D
Don't run in the background after successful initialization.
-I
Semicolon-separated list of interfaces to ignore (default: lo0).
-i path_to_icon.png
Set default icon for MirrorLink apps. If multiple -i options are used, the service will use the last icon that was successfully loaded.
-L path_to_vnclicense
Specify location of VNC license file (default: /etc/vnclicense).
-P pps_dir
Base directory for PPS objects (default: /pps/mirrorlink/).
-S
Strictly enforce sandboxing, i.e., don't start with the default network stack. To set the network sandbox, use the SOCK environment variable. If the -S option is used, the service won't start if this environment variable isn't set. A network sandbox is highly recommended!

USB device enumeration

When mlink-daemon starts up, the RealVNC Discovery SDK listens for new devices. The SDK relies on PPS objects (under /pps/services/vnc/discovery/usb/) to detect new USB devices. The SDK also sends the MirrorLink NCM USB command to the device to start the MirrorLink server.

The following scripts are used for enumeration:
Script Description
/etc/usblauncher/rules.lua Rules for USB enumeration with whitelist for known devices.
/scripts/vncdiscovery/usb-device-attached.sh This script is used by usblancher to create the PPS object (under /pps/services/vnc/discovery/usb/) for the USB device and to request an IP address from the NCM device. When the device is disconnected, the PPS object is removed. The script also contains the blacklist for known incompatible devices.
Note: Using the whitelist isn't future proof—you'll need to manually add new MirrorLink devices to the whitelist. Remember to disable the whitelist and improve the blacklist for deployment.

Using SLM to start the service

To use SLM to start mlink-daemon, add this component section to the SLM configuration file:
<SLM:component name="mlink-daemon">
     <SLM:command>mlink-daemon</SLM:command>
     <SLM:args>-S -i /usr/mlink/default.png -L /usr/mlink/vnclicense</SLM:args>
     <SLM:envar>SOCK=/mirrorlink_sandbox/</SLM:envar>
     <SLM:stop stop="signal">SIGTERM</SLM:stop>
     <SLM:depend>mirrorlink-sandbox</SLM:depend>
</SLM:component>