X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=sample%2Fapp%2Feventhandler.cpp;fp=sample%2Fapp%2Feventhandler.cpp;h=58f99fccf4baa9a69be9c92c40e4384ef5de40e0;hb=cd39ff2c9987904617c53685a75f5fe89513ce81;hp=388291fc54fd9bd8bb2077eb77437bdde7f03d28;hpb=85a1f5f0305fda98d7077bab78070456bcd680ac;p=apps%2Fonscreenapp.git diff --git a/sample/app/eventhandler.cpp b/sample/app/eventhandler.cpp index 388291f..58f99fc 100644 --- a/sample/app/eventhandler.cpp +++ b/sample/app/eventhandler.cpp @@ -137,6 +137,11 @@ void EventHandler::init(int port, const char *token) if (shell_desktop) agl_shell_desktop_add_listener(shell_desktop, &agl_shell_desk_listener, this); + + m_launcher = new Launcher(DEFAULT_AFM_UNIX_SOCK, nullptr); + if (m_launcher->setup_pws_connection() != 0) + HMI_DEBUG("onscreen", "EventHandler::init failed to set-up connection to afm-system-daemon"); + #if 0 myThis = this; mp_wm = new QLibWindowmanager(); @@ -217,3 +222,23 @@ void EventHandler::hideWindow(QString id) mp_hs->hideWindow(id.toStdString().c_str()); #endif } + +int +EventHandler::start(const QString &app_id) +{ + int pid = -1; + + if (m_launcher && m_launcher->connection_is_set()) + pid = m_launcher->start(app_id); + + return pid; +} + +bool +EventHandler::is_running(const QString &app_id) +{ + if (m_launcher && m_launcher->connection_is_set()) + return m_launcher->is_running(app_id); + + return false; +}