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