# QML declarative plugin layer

[kde-telephony-plugin-declarative](https://invent.kde.org/plasma-mobile/plasma-dialer/-/tree/master/kde-telephony-plugin-declarative) — `org.kde.telephony` QML plugin to work with the telephony daemon D-Bus interfaces.

The plugin provides QML interfaces to all the session-level D-BUS telephony daemon interfaces (See also: [D-Bus APIs of the session-side daemons](https://github.com/Neshama1/develop-kde-org/blob/master/content/docs/packaging/plasma-mobile/telephony/session-daemon-userland-dbus-ipc-level/README.md#daemons))

There's no need to split it into several parts like Modem Daemon and KDE Telephony Daemon, since the plugin is not KDE-specific and could use any implementation that follows the appropriate XML D-Bus API description.

Work-in-Progress.

#### Getting started

Minimal iteration could contain these packages:

* **kde-telephony-meta** (D-Bus API descriptions)
* **modem-daemon** (calls and history) — provides d-bus adaptor according to *kde-telephony-meta*
* **kde-telephony-plugin-declarative** (QML plugin) — provides d-bus interface to *kde-telephony-meta*

After building these packages and running `/usr/lib/libexec/modem-daemon` via `/etc/xdg/autostart/org.kde.modem.daemon.desktop` you should be able to play with USSD via QML interfaces like this:

```sh
qml draft.qml
```

```qml
// ...
import QtQuick 2.15
import org.kde.telephony 1.0

Item {

    // ...

    Component.onCompleted: {
        const deviceUni =  DeviceUtils.deviceUniList()[0]
        const number = "*100#"
        UssdUtils.initiate(deviceUni, number)
    }

    Connections {
        target: UssdUtils

        function onNotificationReceived(deviceUni, message) {
            console.log(message)
        }

        function onRequestReceived(deviceUni, message) {
            console.log(message)
        }

        function onInitiated(deviceUni, command) {
            console.log("initiated")
        }
    }
}

```

The USSD is probably the simplest part of the API to start with. The same logic could also be found in the *plasma-dialer* project. Feel free to provide feedback via the issues list of the appropriate repositories.

#### Future Work

In theory, it could be added to the Plasma Phone Components repo, since the current ModeManagerQt QML plugin is there right now.

After that, the next things could be ported to these plugins:

* The part of the Plasma Phone Components called [mmplugin](https://invent.kde.org/plasma/plasma-phone-components/-/tree/master/mmplugin) could be ported to Modem Daemon (after it will be ready; when `SignalIndicator` API will be ported here).
* The part of the [SpaceBar](https://invent.kde.org/plasma-mobile/spacebar) (SMS/MMS Application for Plasma Mobile):
  * Not related to KDE (MMQt-only) could be ported to Modem Daemon
  * Related to KDE (contacts and avatars) could be ported to KDE Telephony Daemon

As a result, any [KDE telephony-related application](https://github.com/Neshama1/develop-kde-org/blob/master/content/docs/packaging/plasma-mobile/telephony/kde-application-layer/README.md) should be able to reuse the introduced Qt/QML declarative library.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.novaflowos.com/start/kde-developer-platform/readme/packaging/plasma-mobile/telephony/_index-3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
