diff options
author | Matt Porter <mporter@konsulko.com> | 2017-05-16 15:59:58 -0400 |
---|---|---|
committer | Matt Porter <mporter@konsulko.com> | 2017-05-19 10:01:02 -0400 |
commit | 676ce330cfa62121c9cd68b29fec5dd2458b9eee (patch) | |
tree | 84a099267d0144fb2534cc2c9b3a4cb08d0b1caf /app/main.cpp | |
parent | 27dbd46c4c73964a0fe61cddf30470b4587e17f2 (diff) |
Add basic telephony binding
Adds a basic telephony binding which supports dial and hangup
operations via ofono. Bluetooth HFP is the only modem type supported
now, with SIM support expected in the future.
AGL-Bug: SPEC-597
Change-Id: Icb302533c368fe37a181601c30f49294ad292a6b
Signed-off-by: Matt Porter <mporter@konsulko.com>
Diffstat (limited to 'app/main.cpp')
-rw-r--r-- | app/main.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/main.cpp b/app/main.cpp index 952d222..0fe4bf1 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -15,8 +15,11 @@ */ #include <QtCore/QDebug> +#include <QtCore/QCommandLineParser> +#include <QtCore/QUrlQuery> #include <QtGui/QGuiApplication> #include <QtQml/QQmlApplicationEngine> +#include <QtQml/QQmlContext> #include <QtQuickControls2/QQuickStyle> #ifdef HAVE_LIBHOMESCREEN @@ -39,6 +42,29 @@ int main(int argc, char *argv[]) QQuickStyle::setStyle("AGL"); QQmlApplicationEngine engine; + + QCommandLineParser parser; + parser.addPositionalArgument("port", app.translate("main", "port for binding")); + parser.addPositionalArgument("secret", app.translate("main", "secret for binding")); + parser.addHelpOption(); + parser.addVersionOption(); + parser.process(app); + QStringList positionalArguments = parser.positionalArguments(); + if (positionalArguments.length() == 2) { + int port = positionalArguments.takeFirst().toInt(); + QString secret = positionalArguments.takeFirst(); + QUrl bindingAddress; + bindingAddress.setScheme(QStringLiteral("ws")); + bindingAddress.setHost(QStringLiteral("localhost")); + bindingAddress.setPort(port); + bindingAddress.setPath(QStringLiteral("/api")); + QUrlQuery query; + query.addQueryItem(QStringLiteral("token"), secret); + bindingAddress.setQuery(query); + QQmlContext *context = engine.rootContext(); + context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress); + } + engine.load(QUrl(QStringLiteral("qrc:/Phone.qml"))); return app.exec(); |