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.1" );
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( "ProfileSubmit_Method", "POST" )
58  Q_CLASSINFO( "ProfileDelete_Method", "POST" )
59  Q_CLASSINFO( "ManageDigestUser_Method", "POST" )
60  Q_CLASSINFO( "ManageUrlProtection_Method", "POST" )
61 
62  public:
63 
64  // Must call InitializeCustomTypes for each unique Custom Type used
65  // in public slots below.
66 
67  MythServices( QObject *parent = nullptr ) : Service( parent )
68  {
77  }
78 
79  public slots:
80 
81  virtual DTC::ConnectionInfo* GetConnectionInfo ( const QString &Pin ) = 0;
82 
83  virtual QString GetHostName ( ) = 0;
84  virtual QStringList GetHosts ( ) = 0;
85  virtual QStringList GetKeys ( ) = 0;
86 
87  virtual DTC::StorageGroupDirList* GetStorageGroupDirs ( const QString &GroupName,
88  const QString &HostName ) = 0;
89 
90  virtual bool AddStorageGroupDir ( const QString &GroupName,
91  const QString &DirName,
92  const QString &HostName ) = 0;
93 
94  virtual bool RemoveStorageGroupDir( const QString &GroupName,
95  const QString &DirName,
96  const QString &HostName ) = 0;
97 
98  virtual DTC::TimeZoneInfo* GetTimeZone ( ) = 0;
99 
100  virtual QString GetFormatDate ( const QDateTime Date,
101  bool ShortDate ) = 0;
102  virtual QString GetFormatDateTime ( const QDateTime DateTime,
103  bool ShortDate ) = 0;
104  virtual QString GetFormatTime ( const QDateTime Time ) = 0;
105  virtual QDateTime ParseISODateString ( const QString &DateTime ) = 0;
106 
107  virtual DTC::LogMessageList* GetLogs ( const QString &HostName,
108  const QString &Application,
109  int PID,
110  int TID,
111  const QString &Thread,
112  const QString &Filename,
113  int Line,
114  const QString &Function,
115  const QDateTime &FromTime,
116  const QDateTime &ToTime,
117  const QString &Level,
118  const QString &MsgContains ) = 0;
119 
120  virtual DTC::FrontendList* GetFrontends ( bool OnLine ) = 0;
121 
122  virtual QString GetSetting ( const QString &HostName,
123  const QString &Key,
124  const QString &Default ) = 0;
125 
126  virtual DTC::SettingList* GetSettingList ( const QString &HostName ) = 0;
127 
128  virtual bool PutSetting ( const QString &HostName,
129  const QString &Key,
130  const QString &Value ) = 0;
131 
132  virtual bool ChangePassword ( const QString &UserName,
133  const QString &OldPassword,
134  const QString &NewPassword ) = 0;
135 
136  virtual bool TestDBSettings ( const QString &HostName,
137  const QString &UserName,
138  const QString &Password,
139  const QString &DBName,
140  int dbPort) = 0;
141 
142  virtual bool SendMessage ( const QString &Message,
143  const QString &Address,
144  int udpPort,
145  int Timeout ) = 0;
146 
147  virtual bool SendNotification ( bool Error,
148  const QString &Type,
149  const QString &Message,
150  const QString &Origin,
151  const QString &Description,
152  const QString &Image,
153  const QString &Extra,
154  const QString &ProgressText,
155  float Progress,
156  int Timeout,
157  bool Fullscreen,
158  uint Visibility,
159  uint Priority,
160  const QString &Address,
161  int udpPort ) = 0;
162 
163  virtual bool BackupDatabase ( void ) = 0;
164 
165  virtual bool CheckDatabase ( bool Repair ) = 0;
166 
167  virtual bool ProfileSubmit ( void ) = 0;
168 
169  virtual bool ProfileDelete ( void ) = 0;
170 
171  virtual QString ProfileURL ( void ) = 0;
172 
173  virtual QString ProfileUpdated ( void ) = 0;
174 
175  virtual QString ProfileText ( void ) = 0;
176 
177  virtual DTC::BackendInfo* GetBackendInfo ( void ) = 0;
178 
179  virtual bool ManageDigestUser ( const QString &Action,
180  const QString &UserName,
181  const QString &Password,
182  const QString &NewPassword,
183  const QString &AdminPassword ) = 0;
184 
185  virtual bool ManageUrlProtection ( const QString &Services,
186  const QString &AdminPassword) = 0;
187 };
188 
189 #endif
unsigned int slots[4]
Definition: element.c:38
static void InitializeCustomTypes()
Definition: timeZoneInfo.h:59
static int SendMessage(const MythUtilCommandLineParser &cmdline)
unsigned int uint
Definition: compat.h:140
An action (for this plugin) consists of a description, and a set of key sequences.
Definition: action.h:38
static void InitializeCustomTypes()
Definition: logMessage.h:99
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
static void InitializeCustomTypes()
Definition: backendInfo.h:72
static void InitializeCustomTypes()
static StandardSetting * Password(bool enabled)
Setting for changing password.
MythServices(QObject *parent=nullptr)
Definition: mythServices.h:67
static void InitializeCustomTypes()
Definition: frontendList.h:67
static void InitializeCustomTypes()
Definition: image.h:30
static void InitializeCustomTypes()
Definition: settingList.h:58