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 <QString>
10#include <QDir>
11
12#ifdef _WIN32
13 #undef mkdir
14#endif
15
16#include "mythbaseexp.h"
17#include "mythsystem.h"
18
19MBASE_PUBLIC bool getUptime(std::chrono::seconds &uptime);
21 int &totalMB, int &freeMB, int &totalVM, int &freeVM);
22using loadArray = std::array<double,3>;
24
26MBASE_PUBLIC bool RemoteGetUptime(std::chrono::seconds &uptime);
28bool RemoteGetMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM);
29
30MBASE_PUBLIC bool ping(const QString &host, std::chrono::milliseconds timeout);
31MBASE_PUBLIC bool telnet(const QString &host, int port);
32
33namespace MythFile
34{
35MBASE_PUBLIC long long copy(QFile &dst, QFile &src, uint block_size = 0);
36} // namespace MythFile
38 QString name_template = "/tmp/mythtv_XXXXXX", bool dir = false);
39MBASE_PUBLIC bool makeFileAccessible(const QString& filename);
40
41MBASE_PUBLIC QString getResponse(const QString &query, const QString &def);
42MBASE_PUBLIC int intResponse(const QString &query, int def);
43
44MBASE_PUBLIC QString getSymlinkTarget(const QString &start_file,
45 QStringList *intermediaries = nullptr,
46 unsigned maxLinks = 255);
47
48MBASE_PUBLIC bool IsMACAddress(const QString& MAC);
49MBASE_PUBLIC bool WakeOnLAN(const QString& MAC);
50MBASE_PUBLIC bool MythWakeup(const QString &wakeUpCommand,
51 uint flags = kMSNone, std::chrono::seconds timeout = 0s);
52
53MBASE_PUBLIC QString FileHash(const QString& filename);
54
57
58MBASE_PUBLIC bool myth_nice(int val);
59MBASE_PUBLIC void myth_yield(void);
61MBASE_PUBLIC bool myth_ioprio(int val);
62
63MBASE_PUBLIC bool MythRemoveDirectory(QDir &aDir);
64
65MBASE_PUBLIC void setHttpProxy(void);
66
67#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:22
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.