installationservices/swi/inc/sislauncherclient.h
branchRCL_3
changeset 25 7333d7932ef7
parent 0 ba25891c3a9e
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
     1 /*
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    27 #define __SISLAUNCHERCLIENT_H__
    27 #define __SISLAUNCHERCLIENT_H__
    28 
    28 
    29 #include <e32base.h>
    29 #include <e32base.h>
    30 #include <f32file.h>
    30 #include <f32file.h>
    31 #include "sislauncherdefs.h"
    31 #include "sislauncherdefs.h"
    32 
    32 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK  
       
    33 #include <usif/scr/appregentries.h>
       
    34 #include <usif/scr/screntries_platform.h>
       
    35 #endif
    33 const TInt KDefaultShutdownTimeout = 10000000;
    36 const TInt KDefaultShutdownTimeout = 10000000;
    34 
    37 
    35 namespace Swi
    38 namespace Swi
    36 {
    39 {
    37 class CSisRegistryFileDescription;
    40 class CSisRegistryFileDescription;
    38 class CSoftwareTypeRegInfo;
    41 class CSoftwareTypeRegInfo;
       
    42 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 
       
    43 class TAppUpdateInfo;
       
    44 #endif
    39 
    45 
    40 class RSisLauncherSession : public RSessionBase
    46 class RSisLauncherSession : public RSessionBase
    41 	{
    47     {
    42 public:
    48 public:
       
    49     /**
       
    50      * Connects to the SIS launcher server.
       
    51      */
       
    52     IMPORT_C TInt Connect();
       
    53     
       
    54 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
    55     /**
       
    56      * Closes to the SIS launcher session.
       
    57      */
       
    58     IMPORT_C void Close();
       
    59 #endif
       
    60     
       
    61     /**
       
    62      * Launches an executable.
       
    63      *
       
    64      * @param aFileName The file name of the executable.
       
    65      * @param aWait     If true, then this call waits for the executable to terminate.
       
    66      */
       
    67     IMPORT_C void RunExecutableL(const TDesC& aFileName, TBool aWait);
       
    68     
       
    69     /**
       
    70      * Opens a document.
       
    71      * @param aFileName The file name of the document to open.
       
    72      * @param aWait     If true, then this call waits for the document to close.
       
    73      */
       
    74     IMPORT_C void StartDocumentL(const TDesC& aFileName, TBool aWait);
       
    75     
       
    76     /**
       
    77      * Opens a document using the mime-type to determine the helper application.
       
    78      * @param aFileName The file name of the document to open.
       
    79      * @param aMimeType The mime type of the document.
       
    80      * @param aWait     If true, then this call waits for the document to close.
       
    81      */
       
    82     IMPORT_C void StartByMimeL(const TDesC& aFileName, const TDesC8& aMimeType, TBool aWait);
       
    83     
       
    84 
       
    85     /**
       
    86      * Opens a document.
       
    87      * @param aFile The file handle of the document to open.
       
    88      * @param aWait     If true, then this call waits for the document to close.
       
    89      */
       
    90     IMPORT_C void StartDocumentL(RFile& aFile, TBool aWait);
       
    91     
       
    92     /**
       
    93      * Opens a document using the mime-type to determine the helper application.
       
    94      * @param aFile The file handle of the document to open.
       
    95      * @param aMimeType The mime type of the document.
       
    96      * @param aWait     If true, then this call waits for the document to close.
       
    97      */
       
    98     IMPORT_C void StartByMimeL(RFile& aFile, const TDesC8& aMimeType, TBool aWait);
       
    99     
       
   100     IMPORT_C void ShutdownAllL();
       
   101     
       
   102     /**
       
   103      * Checks if the application is running. This function will leave with error KErrInUse if an 
       
   104      * application is busy. Else it will leave with error KErrNone
       
   105      *
       
   106      * @param aUid The UID of the application to check.
       
   107      */
       
   108     
       
   109     IMPORT_C void CheckApplicationInUseL(RArray<TAppInUse>& aUidList);
       
   110 
       
   111     /**
       
   112      * Shuts down an application. If the aUid parameter is null then all non system/hidden
       
   113      * applications are closed. This function will leave with error KErrInUse if an 
       
   114      * application is busy.
       
   115      *
       
   116      * @param aUid The UID of the application to close.
       
   117      * @param aTimeout Timeout value in microseconds used when shutting down individual exe.
       
   118      */
       
   119     IMPORT_C void ShutdownL(const RArray<TUid>& aUidList, TInt aTimeout);
       
   120 
       
   121     /**
       
   122      * Notifies APPARC of new registration files. Causes APPARC to rescan its
       
   123      * import/apps directory, so avoid calling unnecessarily. This call
       
   124      * supports DEF084847 by telling APPARC which apps to treat as registered
       
   125      * even though installation is not quite complete.
       
   126      *
       
   127      * @param aFiles The array of filenames that have appeared during this installation.
       
   128      */
       
   129     IMPORT_C void NotifyNewAppsL(const RPointerArray<TDesC>& aFiles);
       
   130 
       
   131     /**
       
   132      * Waits for ECOM to notify of changes before attempting to launch the files.
       
   133      * Files are opened client side before sending them to the server to avoid capability issues. 
       
   134      *  
       
   135      * As SWI may shutdown before ECOM will process delivered plug-ins 
       
   136      * the launcher will not terminate the usual 2secs after the last client. Instead a 
       
   137      * longer running timeout is used for two reasons.
       
   138      * a) to allow ECOM a 'reasonable' amount of time to do its work - we don't want to 
       
   139      *    kill the launcher while ECOM is still busy.
       
   140      * b) to shutdown correctly where SWI has incorrectly identified a plug-in resource file -
       
   141      *    we don't want to hang around forever waiting for an event that will never come.  
       
   142      * */
       
   143     IMPORT_C void RunAfterEcomNotificationL(const RPointerArray<CSisRegistryFileDescription>& aFileList);
       
   144 
       
   145 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   146     IMPORT_C void ParseSwTypeRegFileL(RFile& aFile, RPointerArray<Usif::CSoftwareTypeRegInfo>& aSwTypeRegInfoArray);
       
   147 
       
   148     IMPORT_C void RegisterSifLauncherMimeTypesL(const RPointerArray<HBufC8>& aMimeTypes);
       
   149 
       
   150     IMPORT_C void UnregisterSifLauncherMimeTypesL(const RPointerArray<HBufC8>& aMimeTypes);
       
   151             
       
   152     /**
       
   153     * Populate CApplicationRegistrationData from the specified resource file, for the given languages and pass the data size back to the caller in TRequestStatus
       
   154     *
       
   155     * @param An already opened file handle.
       
   156     * @param aAppLanguages List of the languages
       
   157     * @return Return size of buffer needed in TRequestStatus
       
   158     */
       
   159     IMPORT_C void AsyncParseResourceFileSizeL(const RFile& aRegistrationFile, const RArray<TLanguage>& aAppLanguages, TRequestStatus& aStatus);
       
   160     
    43 	/**
   161 	/**
    44 	 * Connects to the SIS launcher server.
   162     * Return populate CApplicationRegistrationData 
    45 	 */
   163     *
    46 	IMPORT_C TInt Connect();
   164     * @param aDataSize Size of buffer needed for CApplicationRegistrationData.
    47 	
   165     * @return Pointer to a CApplicationRegistrationData (caller owns it)
       
   166     */
       
   167     IMPORT_C Usif::CApplicationRegistrationData*  AsyncParseResourceFileDataL(TInt aDataSize);
       
   168     
    48 	/**
   169 	/**
    49 	 * Launches an executable.
   170     * @param aRegistrationFileName registration file name to be parsed
    50 	 *
   171     * @return Pointer to a CApplicationRegistrationData (caller owns it)
    51 	 * @param aFileName The file name of the executable.
   172     */    
    52 	 * @param aWait     If true, then this call waits for the executable to terminate.
   173     IMPORT_C Usif::CApplicationRegistrationData* SyncParseResourceFileL(const RFile& aRegistrationFile, const RArray<TLanguage>& aAppLanguages); 
    53 	 */
   174        
    54 	IMPORT_C void RunExecutableL(const TDesC& aFileName, TBool aWait);
       
    55 	
       
    56 	/**
   175 	/**
    57 	 * Opens a document.
   176      * Notifies APPARC of new applications. This call  
    58 	 * @param aFileName The file name of the document to open.
   177      * informs APPARC which apps to treat as registered
    59 	 * @param aWait     If true, then this call waits for the document to close.
   178      * even though installation is not quite complete.
    60 	 */
   179      *
    61 	IMPORT_C void StartDocumentL(const TDesC& aFileName, TBool aWait);
   180      * @param aFiles The array of application information to be treated as registered before this current installation completes.
    62 	
   181      */
    63 	/**
   182     IMPORT_C void NotifyNewAppsL(const RPointerArray<Usif::CApplicationRegistrationData>& aAppRegData);
    64 	 * Opens a document using the mime-type to determine the helper application.
   183     
    65 	 * @param aFileName The file name of the document to open.
   184     /**
    66 	 * @param aMimeType The mime type of the document.
   185      * Notifies APPARC of applications which are removed/upgraded during installation       
    67 	 * @param aWait     If true, then this call waits for the document to close.
   186      * @param aAppUpdateInfo , array of app uids along with the action(remove/upgrade)
    68 	 */
   187      */
    69 	IMPORT_C void StartByMimeL(const TDesC& aFileName, const TDesC8& aMimeType, TBool aWait);
   188     IMPORT_C void NotifyNewAppsL(const RArray<TAppUpdateInfo>& aAppUpdateInfo);
    70 	
   189     
    71 
       
    72 	/**
       
    73 	 * Opens a document.
       
    74 	 * @param aFile The file handle of the document to open.
       
    75 	 * @param aWait     If true, then this call waits for the document to close.
       
    76 	 */
       
    77 	IMPORT_C void StartDocumentL(RFile& aFile, TBool aWait);
       
    78 	
       
    79 	/**
       
    80 	 * Opens a document using the mime-type to determine the helper application.
       
    81 	 * @param aFile The file handle of the document to open.
       
    82 	 * @param aMimeType The mime type of the document.
       
    83 	 * @param aWait     If true, then this call waits for the document to close.
       
    84 	 */
       
    85 	IMPORT_C void StartByMimeL(RFile& aFile, const TDesC8& aMimeType, TBool aWait);
       
    86 	
       
    87 	IMPORT_C void ShutdownAllL();
       
    88 	
       
    89 	/**
       
    90  	 * Checks if the application is running. This function will leave with error KErrInUse if an 
       
    91  	 * application is busy. Else it will leave with error KErrNone
       
    92  	 *
       
    93  	 * @param aUid The UID of the application to check.
       
    94 	 */
       
    95 	
       
    96 	IMPORT_C void CheckApplicationInUseL(RArray<TAppInUse>& aUidList);
       
    97 
       
    98 	/**
       
    99  	 * Shuts down an application. If the aUid parameter is null then all non system/hidden
       
   100  	 * applications are closed. This function will leave with error KErrInUse if an 
       
   101  	 * application is busy.
       
   102  	 *
       
   103  	 * @param aUid The UID of the application to close.
       
   104  	 * @param aTimeout Timeout value in microseconds used when shutting down individual exe.
       
   105 	 */
       
   106 	IMPORT_C void ShutdownL(const RArray<TUid>& aUidList, TInt aTimeout);
       
   107 
       
   108 	/**
       
   109 	 * Notifies APPARC of new registration files. Causes APPARC to rescan its
       
   110 	 * import/apps directory, so avoid calling unnecessarily. This call
       
   111 	 * supports DEF084847 by telling APPARC which apps to treat as registered
       
   112 	 * even though installation is not quite complete.
       
   113 	 *
       
   114 	 * @param aFiles The array of filenames that have appeared during this installation.
       
   115 	 */
       
   116 	IMPORT_C void NotifyNewAppsL(const RPointerArray<TDesC>& aFiles);
       
   117 
       
   118 	/**
       
   119 	 * Waits for ECOM to notify of changes before attempting to launch the files.
       
   120 	 * Files are opened client side before sending them to the server to avoid capability issues. 
       
   121 	 *  
       
   122 	 * As SWI may shutdown before ECOM will process delivered plug-ins 
       
   123 	 * the launcher will not terminate the usual 2secs after the last client. Instead a 
       
   124 	 * longer running timeout is used for two reasons.
       
   125 	 * a) to allow ECOM a 'reasonable' amount of time to do its work - we don't want to 
       
   126 	 *    kill the launcher while ECOM is still busy.
       
   127 	 * b) to shutdown correctly where SWI has incorrectly identified a plug-in resource file -
       
   128 	 *    we don't want to hang around forever waiting for an event that will never come.  
       
   129 	 * */
       
   130 	IMPORT_C void RunAfterEcomNotificationL(const RPointerArray<CSisRegistryFileDescription>& aFileList);
       
   131 
       
   132 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   133 	IMPORT_C void ParseSwTypeRegFileL(RFile& aFile, RPointerArray<CSoftwareTypeRegInfo>& aSwTypeRegInfoArray);
       
   134 
       
   135 	IMPORT_C void RegisterSifLauncherMimeTypesL(const RPointerArray<HBufC8>& aMimeTypes);
       
   136 
       
   137 	IMPORT_C void UnregisterSifLauncherMimeTypesL(const RPointerArray<HBufC8>& aMimeTypes);
       
   138 
       
   139 private:
   190 private:
   140 	void RegisterSifLauncherMimeTypesImplL(const RPointerArray<HBufC8>& aMimeTypes, TBool aRegister);
   191     void RegisterSifLauncherMimeTypesImplL(const RPointerArray<HBufC8>& aMimeTypes, TBool aRegister);
       
   192     HBufC8* iBuffForLanguages;        
   141 #endif
   193 #endif
   142     };
   194     };
       
   195 
       
   196 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 	
       
   197 enum InstallActions
       
   198        {
       
   199        EAppInstalled = 0,
       
   200        EAppUninstalled
       
   201        };
       
   202 
       
   203 class TAppUpdateInfo
       
   204     {
       
   205 public:    
       
   206     IMPORT_C void InternalizeL(RReadStream& aReadStream);
       
   207     IMPORT_C void ExternalizeL(RWriteStream& aWriteStream) const; 
       
   208     IMPORT_C TAppUpdateInfo(TUid aAppUid, InstallActions aAction);
       
   209     IMPORT_C TAppUpdateInfo();    
       
   210 public:
       
   211     TUid iAppUid;
       
   212     InstallActions iAction;
       
   213     };
       
   214 #endif
       
   215 
   143 } //namespace
   216 } //namespace
   144 
   217 
   145 #endif
   218 #endif
       
   219