ApplicationIPCManager QML Type

The ApplicationIPCManager singleton. More...

Import Statement: import QtApplicationManager 1.0

Methods

Detailed Description

This singleton type is the central manager for app-to-System-UI IPC interfaces within the application-manager.

It only exports a single function towards the QML System-UI: registerInterface().

See ApplicationInterfaceExtension for information on how to access these registered IPC interfaces from the client (application) side.

Method Documentation

bool registerInterface(ApplicationIPCInterface interface, string name, var filter)

Registers an IPC interface object to extend the communication API between applications and the Application Manager itself. The interface object is an ApplicationIPCInterface item, that needs to stay valid during the whole lifetime of the System-UI. The name of the interface has to adhere to D-Bus standards, so it needs to contain at least one period ('.') character (for example, io.qt.test). The interface is available to all applications matching the filter criteria (see below) on the private Peer-To-Peer D-Bus as a standard, typed D-Bus interface.

Because there is no way to add type information to the parameters of JavaScript functions, the interface is scanned for special annotation properties that are only used to deduce type information, but are not exported to the applications:

readonly property var _decltype_<function-name>: { "<return type>": [ "<param 1 type>", "<param 2 type>", ...] }

The following types are supported:

TypeDBus TypeNote
void-Only valid as return type.
intINT32
string, urlSTRINGUrls are mapped to plain strings.
boolBOOLEAN
real, doubleDOUBLE
var, variantVARIANTCan also be used for lists and maps.

A simple example showing how to add these annotations to a function definition:

readonly property var _decltype_testFunction: { "var": [ "int", "string" ] }
function testFunction(ivar, strvar) {
    return { "strvar": strvar, "intvar": intvar }
}

You can restrict the availability of the interface in applications via the filter parameter: either pass an empty JavaScript object ({}) or use any combination of these available field names:

KeyValueDescription
applicationIdslist<string>A list of applications ids that are allowed to use this interface.
categorieslist<string>A list of category names (see info.yaml). Any application that is part of one of these categories is allowed to use this interface.
capabilitieslist<string>A list of applications capabilities (see info.yaml). Any application that has one of these capabilities is allowed to use this interface.

All of the filter fields have to match, but only fields that are actually set are taken into consideration.

import QtQuick 2.0
import QtApplicationManager 1.0

ApplicationIPCInterface {
    id: extension

    property bool pbool: true
    property double pdouble: 3.14

    signal testSignal(string str, variant list)

    readonly property var _decltype_testFunction: { "void": [ "int", "string" ] }
    function testFunction(foo, bar) {
        console.log("testFunction was called: " + foo + " " + bar)
    }

    Component.onCompleted: {
        ApplicationIPCManager.registerInterface(extension, "io.qt.test.interface",
                                                { "capabilities": [ "media", "camera" ] })
    }
}

Returns true if the registration was successful, false otherwise.


© 2018 Pelagicore AG. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.