MythTV  master
hardwareprofile.h
Go to the documentation of this file.
1 #ifndef HARDWAREPROFILE_H_
2 #define HARDWAREPROFILE_H_
3 
4 // QT headers
5 #include <QObject>
6 #include <QString>
7 #include <QDateTime>
8 
9 // MythDB headers
10 #include "mythbaseexp.h"
11 #include "housekeeper.h"
12 
13 extern const QString SMOLT_SERVER_LOCATION;
14 extern const QString SMOLT_TOKEN;
15 
16 class MBASE_PUBLIC HardwareProfile : public QObject
17 {
18  Q_OBJECT
19 
20  public:
22  ~HardwareProfile(void) override = default;
23 
24  void Enable(void);
25  static void Disable(void);
26 
27  void GenerateUUIDs(void);
28 
29  static QString GetPrivateUUIDFromFile(void) ;
30  static bool WritePrivateUUIDToFile(const QString &uuid);
31  QString GetPublicUUIDFromFile(void) const;
32  static QString GetAdminPasswordFromFile(void) ;
33 
34  bool NeedsUpdate(void) const;
35  bool SubmitProfile(bool updateTime=true);
36  bool DeleteProfile(void);
37 
38  QString GetPublicUUID(void) const { return m_publicuuid; };
39  QString GetPrivateUUID(void) const { return m_uuid; };
40  QDateTime GetLastUpdate(void) const { return m_lastUpdate; };
41  QString GetProfileURL(void) const;
42  static QString GetHardwareProfile(void) ;
43 
44  private:
45  bool m_enabled {false};
46  QString m_uuid;
47  QString m_publicuuid;
48  QDateTime m_lastUpdate;
50 };
51 
53 {
54  public:
55  HardwareProfileTask(void) : PeriodicHouseKeeperTask("HardwareProfiler",
56  30 * 24h, // 30 days in seconds
57  0.96667F, // up to one day early
58  1.03333F, // up to one day late
59  24h, // retry daily on error
61  bool DoCheckRun(const QDateTime& now) override; // HouseKeeperTask
62  bool DoRun(void) override; // HouseKeeperTask
63  private:
64 
65 };
66 
67 #endif
HardwareProfile::m_publicuuid
QString m_publicuuid
Definition: hardwareprofile.h:47
HardwareProfile::m_hardwareProfile
QString m_hardwareProfile
Definition: hardwareprofile.h:49
housekeeper.h
mythbaseexp.h
HardwareProfile::m_lastUpdate
QDateTime m_lastUpdate
Definition: hardwareprofile.h:48
HardwareProfile::GetLastUpdate
QDateTime GetLastUpdate(void) const
Definition: hardwareprofile.h:40
kHKRunOnStartup
@ kHKRunOnStartup
task is queued when HouseKeeper is started
Definition: housekeeper.h:36
PeriodicHouseKeeperTask::DoCheckRun
bool DoCheckRun(const QDateTime &now) override
Definition: housekeeper.cpp:380
HardwareProfileTask::HardwareProfileTask
HardwareProfileTask(void)
Definition: hardwareprofile.h:55
kHKLocal
@ kHKLocal
task should only run once per machine e.g.
Definition: housekeeper.h:28
MBASE_PUBLIC
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
HardwareProfile
Definition: hardwareprofile.h:16
PeriodicHouseKeeperTask
Modified HouseKeeperTask for tasks to be run at a regular interval.
Definition: housekeeper.h:85
HardwareProfileTask
Definition: hardwareprofile.h:52
HardwareProfile::GetPublicUUID
QString GetPublicUUID(void) const
Definition: hardwareprofile.h:38
HardwareProfile::GetPrivateUUID
QString GetPrivateUUID(void) const
Definition: hardwareprofile.h:39
HardwareProfile::m_uuid
QString m_uuid
Definition: hardwareprofile.h:46
SMOLT_TOKEN
const QString SMOLT_TOKEN
Definition: hardwareprofile.cpp:18
HouseKeeperTask::DoRun
virtual bool DoRun(void)
Definition: housekeeper.h:67
SMOLT_SERVER_LOCATION
const QString SMOLT_SERVER_LOCATION
Definition: hardwareprofile.cpp:16