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 <cstdint>
7 #include <ctime>
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 
19 MBASE_PUBLIC bool getUptime(std::chrono::seconds &uptime);
21  int &totalMB, int &freeMB, int &totalVM, int &freeVM);
22 using loadArray = std::array<double,3>;
24 
25 MBASE_PUBLIC bool ping(const QString &host, std::chrono::milliseconds timeout);
26 MBASE_PUBLIC bool telnet(const QString &host, int port);
27 
28 namespace MythFile
29 {
30 MBASE_PUBLIC long long copy(QFile &dst, QFile &src, uint block_size = 0);
31 } // namespace MythFile
33  QString name_template = "/tmp/mythtv_XXXXXX", bool dir = false);
34 MBASE_PUBLIC bool makeFileAccessible(const QString& filename);
35 
36 MBASE_PUBLIC QString getResponse(const QString &query, const QString &def);
37 MBASE_PUBLIC int intResponse(const QString &query, int def);
38 
39 MBASE_PUBLIC QString getSymlinkTarget(const QString &start_file,
40  QStringList *intermediaries = nullptr,
41  unsigned maxLinks = 255);
42 
43 MBASE_PUBLIC bool IsMACAddress(const QString& MAC);
44 MBASE_PUBLIC bool WakeOnLAN(const QString& MAC);
45 MBASE_PUBLIC bool MythWakeup(const QString &wakeUpCommand,
46  uint flags = kMSNone, std::chrono::seconds timeout = 0s);
47 
48 MBASE_PUBLIC QString FileHash(const QString& filename);
49 
52 
53 MBASE_PUBLIC bool myth_nice(int val);
54 MBASE_PUBLIC void myth_yield(void);
56 MBASE_PUBLIC bool myth_ioprio(int val);
57 
58 MBASE_PUBLIC bool MythRemoveDirectory(QDir &aDir);
59 
60 MBASE_PUBLIC void setHttpProxy(void);
61 
62 #endif // MYTHMISCUTIL_H_
IsMACAddress
MBASE_PUBLIC bool IsMACAddress(const QString &MAC)
Definition: mythmiscutil.cpp:503
hardwareprofile.smolt.timeout
float timeout
Definition: smolt.py:102
getLoadAvgs
MBASE_PUBLIC loadArray getLoadAvgs(void)
Returns the system load averages.
Definition: mythmiscutil.cpp:175
mythbaseexp.h
myth_yield
MBASE_PUBLIC void myth_yield(void)
Definition: mythmiscutil.cpp:670
MythFile
Definition: mythmiscutil.h:28
IsPulseAudioRunning
MBASE_PUBLIC bool IsPulseAudioRunning(void)
Is A/V Sync destruction daemon is running on this host?
Definition: mythmiscutil.cpp:638
getSymlinkTarget
MBASE_PUBLIC QString getSymlinkTarget(const QString &start_file, QStringList *intermediaries=nullptr, unsigned maxLinks=255)
Definition: mythmiscutil.cpp:451
mythsystem.h
MBASE_PUBLIC
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
telnet
MBASE_PUBLIC bool telnet(const QString &host, int port)
Can we talk to port on host?
Definition: mythmiscutil.cpp:232
getResponse
MBASE_PUBLIC QString getResponse(const QString &query, const QString &def)
In an interactive shell, prompt the user to input a string.
Definition: mythmiscutil.cpp:410
MythFile::copy
MBASE_PUBLIC long long copy(QFile &dst, QFile &src, uint block_size=0)
Copies src file to dst file.
Definition: mythmiscutil.cpp:263
WakeOnLAN
MBASE_PUBLIC bool WakeOnLAN(const QString &MAC)
Definition: mythmiscutil.cpp:589
createTempFile
MBASE_PUBLIC QString createTempFile(QString name_template="/tmp/mythtv_XXXXXX", bool dir=false)
Definition: mythmiscutil.cpp:323
MythRemoveDirectory
MBASE_PUBLIC bool MythRemoveDirectory(QDir &aDir)
Definition: mythmiscutil.cpp:759
loadArray
std::array< double, 3 > loadArray
Definition: mythmiscutil.h:22
MythWakeup
MBASE_PUBLIC bool MythWakeup(const QString &wakeUpCommand, uint flags=kMSNone, std::chrono::seconds timeout=0s)
Definition: mythmiscutil.cpp:630
myth_ioprio
MBASE_PUBLIC bool myth_ioprio(int val)
range -1..8, smaller is higher priority
Definition: mythmiscutil.cpp:755
uint
unsigned int uint
Definition: compat.h:81
ping
MBASE_PUBLIC bool ping(const QString &host, std::chrono::milliseconds timeout)
Can we ping host within timeout seconds?
Definition: mythmiscutil.cpp:199
FileHash
MBASE_PUBLIC QString FileHash(const QString &filename)
Definition: mythmiscutil.cpp:548
block_size
unsigned int block_size
Definition: freesurround.cpp:49
intResponse
MBASE_PUBLIC int intResponse(const QString &query, int def)
In an interactive shell, prompt the user to input a number.
Definition: mythmiscutil.cpp:440
kMSNone
@ kMSNone
Definition: mythsystem.h:35
myth_nice
MBASE_PUBLIC bool myth_nice(int val)
Definition: mythmiscutil.cpp:656
getUptime
MBASE_PUBLIC bool getUptime(std::chrono::seconds &uptime)
Definition: mythmiscutil.cpp:66
setHttpProxy
MBASE_PUBLIC void setHttpProxy(void)
Get network proxy settings from OS, and use for [Q]Http[Comms].
Definition: mythmiscutil.cpp:803
build_compdb.filename
filename
Definition: build_compdb.py:21
getMemStats
MBASE_PUBLIC bool getMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM)
Returns memory statistics in megabytes.
makeFileAccessible
MBASE_PUBLIC bool makeFileAccessible(const QString &filename)
Definition: mythmiscutil.cpp:395