Ticket #11386: services-api.v1.patch
| File services-api.v1.patch, 13.4 KB (added by , 13 years ago) |
|---|
-
new file mythtv/libs/libmythservicecontracts/datacontracts/buildInfo.h
diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/buildInfo.h b/mythtv/libs/libmythservicecontracts/datacontracts/buildInfo.h new file mode 100644 index 0000000..c359d71
- + 1 ////////////////////////////////////////////////////////////////////////////// 2 // Program Name: buildInfo.h 3 // Created : Jan. 16, 2013 4 // 5 // Copyright (c) 2013 David Blain <dblain@mythtv.org> 6 // 7 // Licensed under the GPL v2 or later, see COPYING for details 8 // 9 ////////////////////////////////////////////////////////////////////////////// 10 11 #ifndef BUILDINFO_H_ 12 #define BUILDINFO_H_ 13 14 #include <QString> 15 16 #include "serviceexp.h" 17 #include "datacontracthelper.h" 18 19 namespace DTC 20 { 21 22 class SERVICE_PUBLIC BuildInfo : public QObject 23 { 24 Q_OBJECT 25 26 Q_CLASSINFO( "version" , "1.0" ); 27 28 Q_PROPERTY( bool LibX264 READ LibX264 WRITE setLibX264 ) 29 Q_PROPERTY( bool LibDNS_SD READ LibX264 WRITE setLibDNS_SD ) 30 31 PROPERTYIMP( bool , LibX264 ) 32 PROPERTYIMP( bool , LibDNS_SD ) 33 34 public: 35 36 static void InitializeCustomTypes() 37 { 38 qRegisterMetaType< BuildInfo >(); 39 qRegisterMetaType< BuildInfo* >(); 40 } 41 42 public: 43 44 BuildInfo(QObject *parent = 0) 45 : QObject ( parent ), 46 m_LibX264 ( false ), 47 m_LibDNS_SD( false ) 48 { 49 } 50 51 BuildInfo( const BuildInfo &src ) 52 { 53 Copy( src ); 54 } 55 56 void Copy( const BuildInfo &src ) 57 { 58 m_LibX264 = src.m_LibX264 ; 59 m_LibDNS_SD = src.m_LibDNS_SD; 60 } 61 }; 62 63 typedef BuildInfo* BuildInfoPtr; 64 65 } // namespace DTC 66 67 Q_DECLARE_METATYPE( DTC::BuildInfo ) 68 Q_DECLARE_METATYPE( DTC::BuildInfo* ) 69 70 71 #endif -
new file mythtv/libs/libmythservicecontracts/datacontracts/configurationInfo.h
diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/configurationInfo.h b/mythtv/libs/libmythservicecontracts/datacontracts/configurationInfo.h new file mode 100644 index 0000000..41a7f5d
- + 1 ////////////////////////////////////////////////////////////////////////////// 2 // Program Name: configurationInfo.h 3 // Created : Jan. 16, 2013 4 // 5 // Copyright (c) 2010 David Blain <dblain@mythtv.org> 6 // 7 // Licensed under the GPL v2 or later, see COPYING for details 8 // 9 ////////////////////////////////////////////////////////////////////////////// 10 11 #ifndef CONFIGURATIONINFO_H_ 12 #define CONFIGURATIONINFO_H_ 13 14 #include "serviceexp.h" 15 #include "datacontracthelper.h" 16 17 #include "buildInfo.h" 18 #include "logInfo.h" 19 20 namespace DTC 21 { 22 23 class SERVICE_PUBLIC ConfigurationInfo : public QObject 24 { 25 Q_OBJECT 26 27 Q_CLASSINFO( "version" , "1.0" ); 28 29 Q_PROPERTY( QObject* Build READ Build ) 30 Q_PROPERTY( QObject* Log READ Log ) 31 32 PROPERTYIMP_PTR( BuildInfo, Build ) 33 PROPERTYIMP_PTR( LogInfo, Log ) 34 35 public: 36 37 static void InitializeCustomTypes() 38 { 39 qRegisterMetaType< ConfigurationInfo >(); 40 qRegisterMetaType< ConfigurationInfo* >(); 41 42 BuildInfo::InitializeCustomTypes(); 43 LogInfo ::InitializeCustomTypes(); 44 } 45 46 public: 47 48 ConfigurationInfo(QObject *parent = 0) 49 : QObject ( parent ), 50 m_Build ( NULL ), 51 m_Log ( NULL ) 52 { 53 } 54 55 ConfigurationInfo( const ConfigurationInfo &src ) 56 : m_Build ( NULL ), 57 m_Log ( NULL ) 58 { 59 Copy( src ); 60 } 61 62 void Copy( const ConfigurationInfo &src ) 63 { 64 // We always need to make sure the child object is 65 // created with the correct parent * 66 67 if (src.m_Build) 68 Build()->Copy( src.m_Build ); 69 70 if (src.m_Log) 71 Log()->Copy( src.m_Log ); 72 73 } 74 }; 75 76 typedef ConfigurationInfo* ConfigurationInfoPtr; 77 78 } // namespace DTC 79 80 Q_DECLARE_METATYPE( DTC::ConfigurationInfo ) 81 Q_DECLARE_METATYPE( DTC::ConfigurationInfo* ) 82 83 #endif -
new file mythtv/libs/libmythservicecontracts/datacontracts/logInfo.h
diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/logInfo.h b/mythtv/libs/libmythservicecontracts/datacontracts/logInfo.h new file mode 100644 index 0000000..1569d58
- + 1 ////////////////////////////////////////////////////////////////////////////// 2 // Program Name: logInfo.h 3 // Created : Jan. 16, 2013 4 // 5 // Copyright (c) 2013 David Blain <dblain@mythtv.org> 6 // 7 // Licensed under the GPL v2 or later, see COPYING for details 8 // 9 ////////////////////////////////////////////////////////////////////////////// 10 11 #ifndef LOGINFO_H_ 12 #define LOGINFO_H_ 13 14 #include <QString> 15 16 #include "serviceexp.h" 17 #include "datacontracthelper.h" 18 19 namespace DTC 20 { 21 22 class SERVICE_PUBLIC LogInfo : public QObject 23 { 24 Q_OBJECT 25 26 Q_CLASSINFO( "version" , "1.0" ); 27 Q_CLASSINFO( "defaultProp", "LogArgs" ); 28 29 Q_PROPERTY( QString LogArgs READ LogArgs WRITE setLogArgs ) 30 31 PROPERTYIMP( QString, LogArgs ) 32 33 public: 34 35 static void InitializeCustomTypes() 36 { 37 qRegisterMetaType< LogInfo >(); 38 qRegisterMetaType< LogInfo* >(); 39 } 40 41 public: 42 43 LogInfo(QObject *parent = 0) 44 : QObject ( parent ), 45 m_LogArgs ( "" ) 46 { 47 } 48 49 LogInfo( const LogInfo &src ) 50 { 51 Copy( src ); 52 } 53 54 void Copy( const LogInfo &src ) 55 { 56 m_LogArgs = src.m_LogArgs ; 57 } 58 }; 59 60 typedef LogInfo* LogInfoPtr; 61 62 } // namespace DTC 63 64 Q_DECLARE_METATYPE( DTC::LogInfo ) 65 Q_DECLARE_METATYPE( DTC::LogInfo* ) 66 67 68 #endif -
mythtv/libs/libmythservicecontracts/datacontracts/storageGroupDir.h
diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/storageGroupDir.h b/mythtv/libs/libmythservicecontracts/datacontracts/storageGroupDir.h index 6693551..fd88653 100644
a b namespace DTC 14 14 class SERVICE_PUBLIC StorageGroupDir : public QObject 15 15 { 16 16 Q_OBJECT 17 Q_CLASSINFO( "version" , "1. 0" );17 Q_CLASSINFO( "version" , "1.1" ); 18 18 19 19 Q_PROPERTY( int Id READ Id WRITE setId ) 20 20 Q_PROPERTY( QString GroupName READ GroupName WRITE setGroupName ) 21 21 Q_PROPERTY( QString HostName READ HostName WRITE setHostName ) 22 22 Q_PROPERTY( QString DirName READ DirName WRITE setDirName ) 23 Q_PROPERTY( bool DirPerms READ DirPerms WRITE setDirPerms ) 23 24 24 25 PROPERTYIMP ( int , Id ) 25 26 PROPERTYIMP ( QString , GroupName ) 26 27 PROPERTYIMP ( QString , HostName ) 27 28 PROPERTYIMP ( QString , DirName ) 29 PROPERTYIMP ( bool , DirPerms ) 28 30 29 31 public: 30 32 … … class SERVICE_PUBLIC StorageGroupDir : public QObject 53 55 m_GroupName = src.m_GroupName ; 54 56 m_HostName = src.m_HostName ; 55 57 m_DirName = src.m_DirName ; 58 m_DirPerms = src.m_DirPerms ; 56 59 } 57 60 }; 58 61 -
mythtv/libs/libmythservicecontracts/libmythservicecontracts.pro
diff --git a/mythtv/libs/libmythservicecontracts/libmythservicecontracts.pro b/mythtv/libs/libmythservicecontracts/libmythservicecontracts.pro index 638aa94..9bf3564 100644
a b HEADERS += datacontracts/frontendActionList.h 40 40 HEADERS += datacontracts/liveStreamInfo.h datacontracts/liveStreamInfoList.h 41 41 HEADERS += datacontracts/labelValue.h 42 42 HEADERS += datacontracts/logMessage.h datacontracts/logMessageList.h 43 HEADERS += datacontracts/buildInfo.h datacontracts/logInfo.h 44 HEADERS += datacontracts/configurationInfo.h 43 45 44 46 SOURCES += service.cpp 45 47 … … incDatacontracts.files += datacontracts/frontendStatus.h datacontracts/fron 80 82 incDatacontracts.files += datacontracts/liveStreamInfo.h datacontracts/liveStreamInfoList.h 81 83 incDatacontracts.files += datacontracts/labelValue.h 82 84 incDatacontracts.files += datacontracts/logMessage.h datacontracts/logMessageList.h 85 incDatacontracts.files += datacontracts/buildInfo.h datacontracts/logInfo.h 86 incDatacontracts.files += datacontracts/configurationInfo.h 83 87 84 88 INSTALLS += inc incServices incDatacontracts 85 89 -
mythtv/libs/libmythservicecontracts/services/mythServices.h
diff --git a/mythtv/libs/libmythservicecontracts/services/mythServices.h b/mythtv/libs/libmythservicecontracts/services/mythServices.h index c2450ef..1d21dce 100644
a b 22 22 #include "datacontracts/timeZoneInfo.h" 23 23 #include "datacontracts/logMessage.h" 24 24 #include "datacontracts/logMessageList.h" 25 #include "datacontracts/configurationInfo.h" 25 26 26 27 ///////////////////////////////////////////////////////////////////////////// 27 28 ///////////////////////////////////////////////////////////////////////////// … … 42 43 class SERVICE_PUBLIC MythServices : public Service //, public QScriptable ??? 43 44 { 44 45 Q_OBJECT 45 Q_CLASSINFO( "version" , "2. 0" );46 Q_CLASSINFO( "version" , "2.1" ); 46 47 Q_CLASSINFO( "PutSetting_Method", "POST" ) 47 48 Q_CLASSINFO( "AddStorageGroupDir_Method", "POST" ) 48 49 Q_CLASSINFO( "RemoveStorageGroupDir_Method", "POST" ) … … class SERVICE_PUBLIC MythServices : public Service //, public QScriptable ??? 66 67 DTC::TimeZoneInfo ::InitializeCustomTypes(); 67 68 DTC::LogMessage ::InitializeCustomTypes(); 68 69 DTC::LogMessageList ::InitializeCustomTypes(); 70 DTC::ConfigurationInfo ::InitializeCustomTypes(); 69 71 } 70 72 71 73 public slots: … … class SERVICE_PUBLIC MythServices : public Service //, public QScriptable ??? 138 140 virtual QString ProfileUpdated ( void ) = 0; 139 141 140 142 virtual QString ProfileText ( void ) = 0; 143 144 virtual DTC::ConfigurationInfo* GetConfigurationInfo ( void ) = 0; 141 145 }; 142 146 143 147 #endif -
mythtv/programs/mythbackend/services/myth.cpp
diff --git a/mythtv/programs/mythbackend/services/myth.cpp b/mythtv/programs/mythbackend/services/myth.cpp index a0f449f..2175ee5 100644
a b 26 26 #include "myth.h" 27 27 28 28 #include <QDir> 29 #include <QFileInfo> 29 30 #include <QCryptographicHash> 30 31 #include <QHostAddress> 31 32 #include <QUdpSocket> 32 33 34 #include "config.h" 33 35 #include "version.h" 34 36 #include "mythversion.h" 35 37 #include "mythcorecontext.h" … … DTC::StorageGroupDirList *Myth::GetStorageGroupDirs( const QString &sGroupName, 249 251 while (query.next()) 250 252 { 251 253 DTC::StorageGroupDir *pStorageGroupDir = pList->AddNewStorageGroupDir(); 254 QFileInfo fi(query.value(3).toString()); 252 255 253 256 pStorageGroupDir->setId ( query.value(0).toInt() ); 254 257 pStorageGroupDir->setGroupName ( query.value(1).toString() ); 255 258 pStorageGroupDir->setHostName ( query.value(2).toString() ); 256 259 pStorageGroupDir->setDirName ( query.value(3).toString() ); 260 pStorageGroupDir->setDirPerms ( fi.isReadable() && fi.isWritable() ); 257 261 } 258 262 259 263 return pList; … … QString Myth::ProfileText() 928 932 return sProfileText; 929 933 } 930 934 935 ///////////////////////////////////////////////////////////////////////////// 936 // 937 ///////////////////////////////////////////////////////////////////////////// 938 939 DTC::ConfigurationInfo* Myth::GetConfigurationInfo( void ) 940 { 941 942 // ---------------------------------------------------------------------- 943 // Create and populate a Configuration object 944 // ---------------------------------------------------------------------- 945 946 DTC::ConfigurationInfo *pInfo = new DTC::ConfigurationInfo(); 947 DTC::BuildInfo *pBuild = pInfo->Build(); 948 DTC::LogInfo *pLog = pInfo->Log(); 949 950 pBuild->setLibX264 ( CONFIG_LIBX264 ); 951 pBuild->setLibDNS_SD ( CONFIG_LIBDNS_SD ); 952 pLog->setLogArgs ( logPropagateArgs ); 953 954 // ---------------------------------------------------------------------- 955 // Return the pointer... caller is responsible to delete it!!! 956 // ---------------------------------------------------------------------- 957 958 return pInfo; 959 960 } -
mythtv/programs/mythbackend/services/myth.h
diff --git a/mythtv/programs/mythbackend/services/myth.h b/mythtv/programs/mythbackend/services/myth.h index f6b99a2..d112259 100644
a b class Myth : public MythServices 109 109 QString ProfileUpdated ( void ); 110 110 111 111 QString ProfileText ( void ); 112 113 DTC::ConfigurationInfo* GetConfigurationInfo ( void ); 112 114 }; 113 115 114 116 // -------------------------------------------------------------------------- … … class ScriptableMyth : public QObject 255 257 { 256 258 return m_obj.ProfileText(); 257 259 } 260 261 QObject* GetConfigurationInfo ( void ) 262 { 263 return m_obj.GetConfigurationInfo(); 264 } 258 265 }; 259 266 260 267
