diff options
author | Scott Murray <scott.murray@konsulko.com> | 2022-09-10 12:31:13 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2022-09-10 12:42:02 -0400 |
commit | 560d902f4d2bf4ba3bb2edba6436080ee7d5a5ac (patch) | |
tree | 026c81383374b0b7ffbb867ab392ec7789f8ff45 /applauncher/AppLauncherClient.cpp | |
parent | a2d991a54f77017ced1558d289bcb83d73fe2a35 (diff) |
Add applaunchd gRPC API wrapper
Changes:
- Add applaunchd gRPC API wrapper in applauncher directory, clients
can include AppLauncherClient.h to use it.
- To facilitate generating protobuf and gRPC code with protoc,
switch from CMake to meson for building. While the code
generation can be done in CMake, it is a lot more straightforward
with meson, and if use of this library continues meson will be
easier to maintain.
Known issues:
- The behavior of the client implementation here with respect to the
server side (i.e. applaunchd) going away is currently robust, but
could stand improvement with some further investigation. As the
code stands, starting applications works when applaunchd becomes
available again, but the streaming status RPC that is tied to
window activation in the homescreen does not reconnect, and there
seem to be some things that need to be resolved with respect to
Qt object connection expiry to do so. If the Qt demos continue to
be used in a significant fashion, this may be worth picking up.
Bug-AGL: SPEC-4559
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I5cb480d4ce4d1cb944ebfd4114fb305f09f28ea3
Diffstat (limited to 'applauncher/AppLauncherClient.cpp')
-rw-r--r-- | applauncher/AppLauncherClient.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/applauncher/AppLauncherClient.cpp b/applauncher/AppLauncherClient.cpp new file mode 100644 index 0000000..bbbcef3 --- /dev/null +++ b/applauncher/AppLauncherClient.cpp @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (C) 2022 Konsulko Group + */ + +#include <QDebug> + +#include "AppLauncherClient.h" +#include "AppLauncherGrpcClient.h" + +AppLauncherClient::AppLauncherClient(QObject *parent) : QObject(parent) +{ + m_launcher = new AppLauncherGrpcClient(this); +} + +AppLauncherClient::~AppLauncherClient() +{ + delete m_launcher; +} + +bool AppLauncherClient::startApplication(const QString &id) +{ + if (m_launcher) + return m_launcher->StartApplication(id); + + return false; +} + +bool AppLauncherClient::listApplications(QList<QMap<QString, QString>> &list) +{ + if (!m_launcher) { + return false; + } + + return m_launcher->ListApplications(list); +} + +void AppLauncherClient::sendStatusEvent(const QString &id, const QString &status) +{ + emit appStatusEvent(id, status); +} |