summaryrefslogtreecommitdiff
path: root/app/gdp-hmi-launcher2/gdp-hmi-launcher2.h
blob: d13e91b04df51c4b1e92626fae13ca08f2c4f0b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
 * SPDX license identifier: MPL-2.0
 *
 * Copyright (C) 2015, GENIVI Alliance
 *
 * This file is part of GENIVI Demo Platform HMI.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License (MPL), v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * For further information see http://www.genivi.org/.
 *
 * List of changes:
 * 16.Mar.2015, Sebastien Baudouin, written
 * 16.Mar.2015, Sebastien Baudouin, added supprot for dbus
 */

#ifndef GDP_HMI_LAUNCHER2_H
#define GDP_HMI_LAUNCHER2_H

#include <QDebug>
#include <QObject>
#include <QString>
#include <QtDBus>

#include <signal.h>
#include <sys/types.h>
#include <systemd/sd-journal.h>

#include "gdp-hmi-introspect_interface.h"

class GDPLauncherClass : public QObject
{
    Q_OBJECT

public:
    GDPLauncherClass();
    ~GDPLauncherClass();

public slots:
    void hmiRequestOffSlot() {
        QString unit = QStringLiteral("poweroff.target");
        QString status = m_controller->Show(unit);
        sd_journal_print(LOG_DEBUG,
            "DEBUG: controller->Show(\"%s\") -> %s\n",
            unit.toLatin1().data(), status.toLatin1().data());
    }
    void hmiAppLaunchSlot(const QString &unit) {
        QString status = m_controller->Show(unit);
        sd_journal_print(LOG_DEBUG,
            "DEBUG: controller->Show(\"%s\") -> %s\n",
            unit.toLatin1().data(), status.toLatin1().data());
    }

protected:
    void timerEvent(QTimerEvent *event);

private:
	pid_t m_hmiControllerPid;
    int m_timerId;
    org::genivi::gdp::HMI_Controller *m_controller;
};

#endif // GDP_HMI_LAUNCHER2_H