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
25MBASE_PUBLIC bool ping(const QString &host, std::chrono::milliseconds timeout);
26MBASE_PUBLIC bool telnet(const QString &host, int port);
27
28namespace MythFile
29{
30MBASE_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);
34MBASE_PUBLIC bool makeFileAccessible(const QString& filename);
35
36MBASE_PUBLIC QString getResponse(const QString &query, const QString &def);
37MBASE_PUBLIC int intResponse(const QString &query, int def);
38
39MBASE_PUBLIC QString getSymlinkTarget(const QString &start_file,
40 QStringList *intermediaries = nullptr,
41 unsigned maxLinks = 255);
42
43MBASE_PUBLIC bool IsMACAddress(const QString& MAC);
44MBASE_PUBLIC bool WakeOnLAN(const QString& MAC);
45MBASE_PUBLIC bool MythWakeup(const QString &wakeUpCommand,
46 uint flags = kMSNone, std::chrono::seconds timeout = 0s);
47
48MBASE_PUBLIC QString FileHash(const QString& filename);
49
52
53MBASE_PUBLIC bool myth_nice(int val);
54MBASE_PUBLIC void myth_yield(void);
56MBASE_PUBLIC bool myth_ioprio(int val);
57
58MBASE_PUBLIC bool MythRemoveDirectory(QDir &aDir);
59
60MBASE_PUBLIC void setHttpProxy(void);
61
62#endif // MYTHMISCUTIL_H_
unsigned int block_size
unsigned int uint
Definition: freesurround.h:24
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
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 ping(const QString &host, std::chrono::milliseconds timeout)
Can we ping host within timeout seconds?
MBASE_PUBLIC bool myth_nice(int val)
MBASE_PUBLIC loadArray getLoadAvgs(void)
Returns the system load averages.
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.