iaupdate/IAD/engine/inc/iaupdateutils.h
changeset 0 ba25891c3a9e
child 18 3ba40be8e484
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef IAUPDATEUTILS_H
       
    21 #define IAUPDATEUTILS_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <driveinfo.h>
       
    25 
       
    26 // For silent installation
       
    27 #include <SWInstDefs.h>
       
    28 
       
    29 class TIAUpdateVersion;
       
    30 class MIAUpdateNode;
       
    31 
       
    32 namespace IAUpdateUtils
       
    33 {
       
    34 
       
    35 /**
       
    36  * Converts descriptor containing hexadecimal number to an integer.
       
    37  * Accepts "ABCD" and "0xABCD" format numbers.
       
    38  * Leaves if corrupt parameter.
       
    39  * @param aDes Descriptor representation of a hexadecimal.
       
    40  * @return TInt Converted integer.
       
    41  */
       
    42 IMPORT_C TInt DesHexToIntL( const TDesC& aDes );
       
    43 
       
    44 /**
       
    45  * Converts a version string of format <major>.<minor>.<build> to version components.
       
    46  * 
       
    47  * @note If part of the version information is not included in the aVersion,
       
    48  * then missing version parts are not set and those version part references will 
       
    49  * contain their original values. So, caller needs to initialize them correctly before
       
    50  * calling this function.
       
    51  *
       
    52  * @param aStr Version string
       
    53  * @param aMajor On return contains the major version.
       
    54  * @param aMinor On return contains the minor version.
       
    55  * @param aBuild On return contains the build number.
       
    56 */
       
    57 IMPORT_C void DesToVersionL( const TDesC& aVersion, 
       
    58                              TInt8& aMajor, TInt8& aMinor, TInt16& aBuild );
       
    59 
       
    60 /**
       
    61  * Checks if application is installed.
       
    62  * Function is able to check if the given UID is SID or pUID. If SID is given then
       
    63  * the package where it is included is returned. If pUID is given, then the pUID is
       
    64  * returned.
       
    65  * @param aUid SID or pUID of the application
       
    66  * @return TUid pUID of the application. If app not found TUid::Null() returned.
       
    67  **/
       
    68 IMPORT_C TUid AppPackageUidL( const TUid& aUid );
       
    69 
       
    70 /**
       
    71  * Checks if application is installed, and if so, returns its version and the pUid.
       
    72  * Function is able to check if the given UID is SID or pUID. If SID is given then
       
    73  * the package where it is included is returned. If pUID is given, then the pUID is
       
    74  * returned.
       
    75  * @param aUid SID or pUID of the application
       
    76  * @param aVersion Returned version if app is found. If app not found, unchanged
       
    77  * @return TUid pUID of the application. If app not found TUid::Null() returned.
       
    78  **/
       
    79 IMPORT_C TUid AppPackageUidL( const TUid& aUid, TIAUpdateVersion &aVersion );
       
    80 
       
    81 
       
    82 /**
       
    83  * Checks if application is installed.
       
    84  * Function is able to check if the given UID is SID or pUID.
       
    85  * @param aUid SID or pUID of the application
       
    86  * @return ETrue if application is installed on the device
       
    87  **/
       
    88 IMPORT_C TBool IsAppInstalledL( const TUid& aUid );    
       
    89 
       
    90 /**
       
    91  * Checks if application is installed, and if so, returns its version.
       
    92  * Function is able to check if the given UID is SID or pUID.
       
    93  * @param aUid SID or pUID of the application
       
    94  * @param aVersion Returned version if app is found. If app not found, unchanged
       
    95  * @return ETrue if application is installed on the device
       
    96  **/
       
    97 IMPORT_C TBool IsAppInstalledL( const TUid& aUid, TIAUpdateVersion &aVersion );
       
    98 
       
    99 
       
   100 IMPORT_C TBool SpaceAvailableInInternalDrivesL( 
       
   101                                          RPointerArray<MIAUpdateNode>& aNodes );
       
   102 
       
   103 /**
       
   104  * 
       
   105  * Reads from sis registry existence of exe in installation
       
   106  * 
       
   107  * @param aPUid Package UID of installation
       
   108  * @param aExecutable Exe file name 
       
   109  *
       
   110  * @return ETrue if exe is found in gvben installation
       
   111  **/
       
   112 IMPORT_C TBool IsInstalledL( const TUid& aPUid, const TDesC& aExecutable );  
       
   113 
       
   114 /**
       
   115  * Creates options for silent install.
       
   116  * Uses DriveToInstallL to etermine target drive to install.
       
   117  * 
       
   118  * @param aUid PUID of the application
       
   119  * @param aSize Estimated size of installation
       
   120  */
       
   121 IMPORT_C SwiUI::TInstallOptions SilentInstallOptionsL( const TUid& aUid,
       
   122                                                        TInt aSize );
       
   123 
       
   124 
       
   125 
       
   126 /**
       
   127  * Finds drive where a package is currently installed
       
   128  * 
       
   129  * @param aLocationDrive Drive where a package is currently installed
       
   130  * @return ETrue if a package previously installed to an available drive
       
   131  **/
       
   132 TBool InstalledDriveL( const TUid& aUid, TDriveUnit& aLocationDrive );
       
   133 
       
   134 TBool NextInternalDriveL( RFs& aFs, 
       
   135                           TDriveUnit aCurrentDrive, 
       
   136                           TDriveUnit& aNextDrive );
       
   137 
       
   138 /**
       
   139  * Determines target drive to install
       
   140  * 
       
   141  * @param aUid PUID of the application
       
   142  * @param aSize Estimated size of installation
       
   143  * @return Drive to install
       
   144  **/
       
   145 TDriveUnit DriveToInstallL( const TUid& aUid, TInt aSize );
       
   146 
       
   147 TDriveUnit BiggestInternalDriveL();
       
   148 
       
   149 TBool InternalDriveWithSpaceL( TInt aSize, 
       
   150                                TDriveUnit aPreferredDriveUnit, 
       
   151                                TDriveUnit& aTargetDriveUnit );
       
   152 
       
   153 void SaveCurrentFwVersionIfNeededL();
       
   154 
       
   155 TBool IsFirmwareChangedL(); 
       
   156 
       
   157 TInt64 FreeDiskSpace( RFs& aFs, TInt aDriveNumber );
       
   158 
       
   159 }
       
   160 
       
   161 
       
   162 #endif  //  IAUPDATEUTILS_H