Debian Codegraph @

src/helper/helpercontrol.h

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #pragma once
5
6 #include "ihelpercontrol.h"
7 #include <QByteArray>
8 #include <QObject>
9 #include <QTimer>
10 #include <memory>
11 #include <optional>
12 #include <units.h>
13
14 class ICryptoLayer;
15 class QDBusInterface;
16
17 class HelperControl final
18 : public QObject
19 , public IHelperControl
20 {
21 Q_OBJECT
22
23 public:
24 HelperControl(std::shared_ptr<ICryptoLayer> cryptoLayer,
25 QObject *parent = nullptr) noexcept;
26
27 void init(units::time::millisecond_t autoExitTimeout) override;
28 void stop() override;
29
30 private slots:
31 void helperHealthCheckTimeout();
32 void helperExitDeferrerTimeout();
33
34 private:
35 bool helperHasBeenStarted() const;
36 void createHelperInterface();
37 std::optional<QByteArray> startHelper();
38 void stopHelper();
39 void killOtherHelperInstance();
40 bool startHelperKiller();
41
42 std::shared_ptr<ICryptoLayer> cryptoLayer_;
43 QTimer deferHelperHealthCheckTimer_;
44 QTimer deferHelperAutoExitSignalTimer_;
45 std::unique_ptr<QDBusInterface> helperInterface_;
46
47 units::time::millisecond_t autoExitTimeout_;
48 units::time::millisecond_t deferAutoExitSignalInterval_;
49 };