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 ( const QDateTime Date,
102  bool ShortDate ) = 0;
103  virtual QString GetFormatDateTime ( const QDateTime DateTime,
104  bool ShortDate ) = 0;
105  virtual QString GetFormatTime ( const 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
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:68
static void InitializeCustomTypes()
Definition: frontendList.h:67
static void InitializeCustomTypes()
Definition: image.h:30
static void InitializeCustomTypes()
Definition: settingList.h:58