MythTV master
mythmiscutil.h
Go to the documentation of this file.
1#ifndef MYTHMISCUTIL_H_
2#define MYTHMISCUTIL_H_
3
4#include <algorithm>
5#include <array>
6#include <chrono>
7#include <cstdint>
8
9#include <QtGlobal>
10#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
11#include <QtSystemDetection>
12#endif
13#include <QString>
14#include <QDir>
15
16#ifdef Q_OS_WINDOWS
17 #undef mkdir
18#endif
19
20#include "mythbaseexp.h"
21#include "mythsystem.h"
22
23MBASE_PUBLIC bool getUptime(std::chrono::seconds &uptime);
25 int &totalMB, int &freeMB, int &totalVM, int &freeVM);
26using loadArray = std::array<double,3>;
28
30MBASE_PUBLIC bool RemoteGetUptime(std::chrono::seconds &uptime);
32bool RemoteGetMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM);
33
34MBASE_PUBLIC bool ping(const QString &host, std::chrono::milliseconds timeout);
35MBASE_PUBLIC bool telnet(const QString &host, int port);
36
37namespace MythFile
38{
39MBASE_PUBLIC long long copy(QFile &dst, QFile &src, uint block_size = 0);
40} // namespace MythFile
42 QString name_template = "/tmp/mythtv_XXXXXX", bool dir = false);
43MBASE_PUBLIC bool makeFileAccessible(const QString& filename);
44
45MBASE_PUBLIC QString getResponse(const QString &query, const QString &def);
46MBASE_PUBLIC int intResponse(const QString &query, int def);
47
48MBASE_PUBLIC QString getSymlinkTarget(const QString &start_file,
49 QStringList *intermediaries = nullptr,
50 unsigned maxLinks = 255);
51
52MBASE_PUBLIC bool IsMACAddress(const QString& MAC);
53MBASE_PUBLIC bool WakeOnLAN(const QString& MAC);
54MBASE_PUBLIC bool MythWakeup(const QString &wakeUpCommand,
55 uint flags = kMSNone, std::chrono::seconds timeout = 0s);
56
57MBASE_PUBLIC QString FileHash(const QString& filename);
58
61
62MBASE_PUBLIC bool myth_nice(int val);
63MBASE_PUBLIC void myth_yield(void);
65MBASE_PUBLIC bool myth_ioprio(int val);
66
67MBASE_PUBLIC bool MythRemoveDirectory(QDir &aDir);
68
69MBASE_PUBLIC void setHttpProxy(void);
70
71#endif // MYTHMISCUTIL_H_
unsigned int uint
Definition: compat.h:68
unsigned int block_size
#define MBASE_PUBLIC
Definition: mythbaseexp.h:8
MBASE_PUBLIC bool myth_ioprio(int val)
range -1..8, smaller is higher priority
MBASE_PUBLIC QString getResponse(const QString &query, const QString &def)
In an interactive shell, prompt the user to input a string.
MBASE_PUBLIC bool makeFileAccessible(const QString &filename)
MBASE_PUBLIC bool WakeOnLAN(const QString &MAC)
std::array< double, 3 > loadArray
Definition: mythmiscutil.h:26
MBASE_PUBLIC void setHttpProxy(void)
Get network proxy settings from OS, and use for [Q]Http[Comms].
MBASE_PUBLIC void myth_yield(void)
MBASE_PUBLIC bool RemoteGetUptime(std::chrono::seconds &uptime)
MBASE_PUBLIC bool ping(const QString &host, std::chrono::milliseconds timeout)
Can we ping host within timeout seconds?
MBASE_PUBLIC bool RemoteGetMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM)
MBASE_PUBLIC bool myth_nice(int val)
MBASE_PUBLIC loadArray getLoadAvgs(void)
Returns the system load averages.
MBASE_PUBLIC bool RemoteGetLoad(loadArray &load)
MBASE_PUBLIC QString createTempFile(QString name_template="/tmp/mythtv_XXXXXX", bool dir=false)
MBASE_PUBLIC int intResponse(const QString &query, int def)
In an interactive shell, prompt the user to input a number.
MBASE_PUBLIC bool telnet(const QString &host, int port)
Can we talk to port on host?
MBASE_PUBLIC QString FileHash(const QString &filename)
MBASE_PUBLIC QString getSymlinkTarget(const QString &start_file, QStringList *intermediaries=nullptr, unsigned maxLinks=255)
MBASE_PUBLIC bool getUptime(std::chrono::seconds &uptime)
Returns uptime statistics.
MBASE_PUBLIC bool MythWakeup(const QString &wakeUpCommand, uint flags=kMSNone, std::chrono::seconds timeout=0s)
MBASE_PUBLIC bool IsPulseAudioRunning(void)
Is A/V Sync destruction daemon is running on this host?
MBASE_PUBLIC bool MythRemoveDirectory(QDir &aDir)
MBASE_PUBLIC bool getMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM)
Returns memory statistics in megabytes.
MBASE_PUBLIC bool IsMACAddress(const QString &MAC)
@ kMSNone
Definition: mythsystem.h:35
MBASE_PUBLIC long long copy(QFile &dst, QFile &src, uint block_size=0)
Copies src file to dst file.