MythTV  master
mythServices.h
Go to the documentation of this file.
1 // Program Name: mythservices.h
3 // Created : Jan. 19, 2010
4 //
5 // Purpose - Myth Services API Interface definition
6 //
7 // Copyright (c) 2010 David Blain <dblain@mythtv.org>
8 //
9 // Licensed under the GPL v2 or later, see COPYING for details
10 //
12 
13 #ifndef MYTHSERVICES_H_
14 #define MYTHSERVICES_H_
15 
16 #include <QFileInfo>
17 
18 #include "service.h"
27 
30 //
31 // Notes -
32 //
33 // * This implementation can't handle declared default parameters
34 //
35 // * When called, any missing params are sent default values for its datatype
36 //
37 // * Q_CLASSINFO( "<methodName>_Method", ...) is used to determine HTTP method
38 // type. Defaults to "BOTH", available values:
39 // "GET", "POST" or "BOTH"
40 //
43 
44 class SERVICE_PUBLIC MythServices : public Service //, public QScriptable ???
45 {
46  Q_OBJECT
47  Q_CLASSINFO( "version" , "5.2" );
48  Q_CLASSINFO( "AddStorageGroupDir_Method", "POST" )
49  Q_CLASSINFO( "RemoveStorageGroupDir_Method", "POST" )
50  Q_CLASSINFO( "PutSetting_Method", "POST" )
51  Q_CLASSINFO( "ChangePassword_Method", "POST" )
52  Q_CLASSINFO( "TestDBSettings_Method", "POST" )
53  Q_CLASSINFO( "SendMessage_Method", "POST" )
54  Q_CLASSINFO( "SendNotification_Method", "POST" )
55  Q_CLASSINFO( "BackupDatabase_Method", "POST" )
56  Q_CLASSINFO( "CheckDatabase_Method", "POST" )
57  Q_CLASSINFO( "DelayShutdown_Method", "POST" )
58  Q_CLASSINFO( "ProfileSubmit_Method", "POST" )
59  Q_CLASSINFO( "ProfileDelete_Method", "POST" )
60  Q_CLASSINFO( "ManageDigestUser_Method", "POST" )
61  Q_CLASSINFO( "ManageUrlProtection_Method", "POST" )
62 
63  public:
64 
65  // Must call InitializeCustomTypes for each unique Custom Type used
66  // in public slots below.
67 
68  MythServices( QObject *parent = nullptr ) : Service( parent )
69  {
78  }
79 
80  public slots:
81 
82  virtual DTC::ConnectionInfo* GetConnectionInfo ( const QString &Pin ) = 0;
83 
84  virtual QString GetHostName ( ) = 0;
85  virtual QStringList GetHosts ( ) = 0;
86  virtual QStringList GetKeys ( ) = 0;
87 
88  virtual DTC::StorageGroupDirList* GetStorageGroupDirs ( const QString &GroupName,
89  const QString &HostName ) = 0;
90 
91  virtual bool AddStorageGroupDir ( const QString &GroupName,
92  const QString &DirName,
93  const QString &HostName ) = 0;
94 
95  virtual bool RemoveStorageGroupDir( const QString &GroupName,
96  const QString &DirName,
97  const QString &HostName ) = 0;
98 
99  virtual DTC::TimeZoneInfo* GetTimeZone ( ) = 0;
100 
101  virtual QString GetFormatDate ( QDateTime Date,
102  bool ShortDate ) = 0;
103  virtual QString GetFormatDateTime ( QDateTime DateTime,
104  bool ShortDate ) = 0;
105  virtual QString GetFormatTime ( QDateTime Time ) = 0;
106  virtual QDateTime ParseISODateString ( const QString &DateTime ) = 0;
107 
108  virtual DTC::LogMessageList* GetLogs ( const QString &HostName,
109  const QString &Application,
110  int PID,
111  int TID,
112  const QString &Thread,
113  const QString &Filename,
114  int Line,
115  const QString &Function,
116  const QDateTime &FromTime,
117  const QDateTime &ToTime,
118  const QString &Level,
119  const QString &MsgContains ) = 0;
120 
121  virtual DTC::FrontendList* GetFrontends ( bool OnLine ) = 0;
122 
123  virtual QString GetSetting ( const QString &HostName,
124  const QString &Key,
125  const QString &Default ) = 0;
126 
127  virtual DTC::SettingList* GetSettingList ( const QString &HostName ) = 0;
128 
129  virtual bool PutSetting ( const QString &HostName,
130  const QString &Key,
131  const QString &Value ) = 0;
132 
133  virtual bool ChangePassword ( const QString &UserName,
134  const QString &OldPassword,
135  const QString &NewPassword ) = 0;
136 
137  virtual bool TestDBSettings ( const QString &HostName,
138  const QString &UserName,
139  const QString &Password,
140  const QString &DBName,
141  int dbPort) = 0;
142 
143  virtual bool SendMessage ( const QString &Message,
144  const QString &Address,
145  int udpPort,
146  int Timeout ) = 0;
147 
148  virtual bool SendNotification ( bool Error,
149  const QString &Type,
150  const QString &Message,
151  const QString &Origin,
152  const QString &Description,
153  const QString &Image,
154  const QString &Extra,
155  const QString &ProgressText,
156  float Progress,
157  int Timeout,
158  bool Fullscreen,
159  uint Visibility,
160  uint Priority,
161  const QString &Address,
162  int udpPort ) = 0;
163 
164  virtual bool BackupDatabase ( void ) = 0;
165 
166  virtual bool CheckDatabase ( bool Repair ) = 0;
167 
168  virtual bool DelayShutdown ( void ) = 0;
169 
170  virtual bool ProfileSubmit ( void ) = 0;
171 
172  virtual bool ProfileDelete ( void ) = 0;
173 
174  virtual QString ProfileURL ( void ) = 0;
175 
176  virtual QString ProfileUpdated ( void ) = 0;
177 
178  virtual QString ProfileText ( void ) = 0;
179 
180  virtual DTC::BackendInfo* GetBackendInfo ( void ) = 0;
181 
182  virtual bool ManageDigestUser ( const QString &Action,
183  const QString &UserName,
184  const QString &Password,
185  const QString &NewPassword,
186  const QString &AdminPassword ) = 0;
187 
188  virtual bool ManageUrlProtection ( const QString &Services,
189  const QString &AdminPassword) = 0;
190 };
191 
192 #endif
Password
static StandardSetting * Password(bool enabled)
Setting for changing password.
Definition: galleryconfig.cpp:217
DTC::LogMessageList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: logMessageList.h:91
DTC::SettingList
Definition: settingList.h:24
DTC::FrontendList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: frontendList.h:67
DTC::FrontendList
Definition: frontendList.h:25
backendInfo.h
DTC::TimeZoneInfo
Definition: timeZoneInfo.h:21
MythServices::GetFormatDateTime
virtual QString GetFormatDateTime(QDateTime DateTime, bool ShortDate)=0
service.h
MythServices::GetConnectionInfo
virtual DTC::ConnectionInfo * GetConnectionInfo(const QString &Pin)=0
DTC::ConnectionInfo
Definition: connectionInfo.h:25
MythServices::GetBackendInfo
virtual DTC::BackendInfo * GetBackendInfo(void)=0
MythServices::GetFormatTime
virtual QString GetFormatTime(QDateTime Time)=0
MythServices
Definition: mythServices.h:45
MythServices::ChangePassword
virtual bool ChangePassword(const QString &UserName, const QString &OldPassword, const QString &NewPassword)=0
MythServices::DelayShutdown
virtual bool DelayShutdown(void)=0
MythServices::PutSetting
virtual bool PutSetting(const QString &HostName, const QString &Key, const QString &Value)=0
MythServices::ParseISODateString
virtual QDateTime ParseISODateString(const QString &DateTime)=0
MythServices::ProfileSubmit
virtual bool ProfileSubmit(void)=0
Image
Definition: image.h:31
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
MythServices::ProfileUpdated
virtual QString ProfileUpdated(void)=0
MythServices::SendNotification
virtual bool SendNotification(bool Error, const QString &Type, const QString &Message, const QString &Origin, const QString &Description, const QString &Image, const QString &Extra, const QString &ProgressText, float Progress, int Timeout, bool Fullscreen, uint Visibility, uint Priority, const QString &Address, int udpPort)=0
Action
An action (for this plugin) consists of a description, and a set of key sequences.
Definition: action.h:41
MythServices::GetLogs
virtual DTC::LogMessageList * GetLogs(const QString &HostName, const QString &Application, int PID, int TID, const QString &Thread, const QString &Filename, int Line, const QString &Function, const QDateTime &FromTime, const QDateTime &ToTime, const QString &Level, const QString &MsgContains)=0
MythServices::CheckDatabase
virtual bool CheckDatabase(bool Repair)=0
DTC::StorageGroupDirList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: storageGroupDirList.h:57
DTC::LogMessageList
Definition: logMessageList.h:16
storageGroupDirList.h
timeZoneInfo.h
MythServices::GetFormatDate
virtual QString GetFormatDate(QDateTime Date, bool ShortDate)=0
DTC::StorageGroupDirList
Definition: storageGroupDirList.h:15
DTC::BackendInfo::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: backendInfo.h:72
Service
Definition: service.h:43
logMessage.h
MythServices::ProfileURL
virtual QString ProfileURL(void)=0
MythServices::GetFrontends
virtual DTC::FrontendList * GetFrontends(bool OnLine)=0
DTC::LogMessage::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: logMessage.h:98
DTC::SettingList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: settingList.h:58
MythServices::GetHosts
virtual QStringList GetHosts()=0
MythServices::GetStorageGroupDirs
virtual DTC::StorageGroupDirList * GetStorageGroupDirs(const QString &GroupName, const QString &HostName)=0
MythServices::BackupDatabase
virtual bool BackupDatabase(void)=0
MythServices::GetKeys
virtual QStringList GetKeys()=0
uint
unsigned int uint
Definition: compat.h:140
MythServices::RemoveStorageGroupDir
virtual bool RemoveStorageGroupDir(const QString &GroupName, const QString &DirName, const QString &HostName)=0
DTC::TimeZoneInfo::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: timeZoneInfo.h:58
MythServices::ProfileText
virtual QString ProfileText(void)=0
MythServices::TestDBSettings
virtual bool TestDBSettings(const QString &HostName, const QString &UserName, const QString &Password, const QString &DBName, int dbPort)=0
settingList.h
connectionInfo.h
DTC::BackendInfo
Definition: backendInfo.h:25
MythServices::ManageDigestUser
virtual bool ManageDigestUser(const QString &Action, const QString &UserName, const QString &Password, const QString &NewPassword, const QString &AdminPassword)=0
frontendList.h
MythServices::GetSetting
virtual QString GetSetting(const QString &HostName, const QString &Key, const QString &Default)=0
MythServices::ManageUrlProtection
virtual bool ManageUrlProtection(const QString &Services, const QString &AdminPassword)=0
logMessageList.h
MythServices::GetTimeZone
virtual DTC::TimeZoneInfo * GetTimeZone()=0
MythServices::SendMessage
virtual bool SendMessage(const QString &Message, const QString &Address, int udpPort, int Timeout)=0
MythServices::GetHostName
virtual QString GetHostName()=0
MythServices::ProfileDelete
virtual bool ProfileDelete(void)=0
DTC::ConnectionInfo::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: connectionInfo.h:71
MythServices::GetSettingList
virtual DTC::SettingList * GetSettingList(const QString &HostName)=0
Priority
Definition: channelsettings.cpp:192
MythServices::Q_CLASSINFO
Q_CLASSINFO("version", "5.2")
MythServices::AddStorageGroupDir
virtual bool AddStorageGroupDir(const QString &GroupName, const QString &DirName, const QString &HostName)=0