javamanager/javabackup/midp2backup_usif/src.s60/javascrbackuputil.h
changeset 48 e0d6e9bd3ca7
equal deleted inserted replaced
47:f40128debb5d 48:e0d6e9bd3ca7
       
     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:  Header file for CScrBackupUtil class
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef JAVASCRBACKUPUTIL_H_
       
    19 #define JAVASCRBACKUPUTIL_H_
       
    20 
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <s32strm.h>
       
    24 #include <f32file.h> 
       
    25 #include <e32cmn.h>
       
    26 #include <s32mem.h>
       
    27 #include <S32BUF.H>  
       
    28 
       
    29 #include <mw/usif/usifcommon.h>
       
    30 #include <mw/usif/scr/scr.h>
       
    31 #include <mw/usif/scr/screntries.h>
       
    32 #include <mw/usif/scr/appreginfo.h> //for TAppCaption
       
    33 #include <e32lang.h>
       
    34 
       
    35 #include <string>
       
    36 #include <vector>
       
    37 
       
    38 namespace java
       
    39     {
       
    40 namespace  backup
       
    41     {
       
    42 
       
    43 class CScrBackupUtil : public CBase
       
    44     {
       
    45 public:
       
    46     static CScrBackupUtil* NewL();
       
    47 
       
    48     ~CScrBackupUtil();
       
    49     
       
    50     static CScrBackupUtil* NewLC();
       
    51     
       
    52     /*
       
    53      * filling the data with the SCR value one by one 
       
    54      */
       
    55     void BackupScrDataL(RDesWriteStream& aStream, TBool& aBackupNotFinished, TInt& aBufferSpaceLeft);
       
    56     
       
    57     void GetComponentInfoL(Usif::TComponentId aComponentId,RDesWriteStream& aStream);
       
    58     void WriteToActualStream(RDesWriteStream& aStream);
       
    59     
       
    60     void RestoreScrDataL(RDesReadStream& aStream, TInt& aRestoreState, TInt& aBufferSpaceLeft);
       
    61     void SetDataInScrL(TUid aUid ,RDesReadStream& aStream);
       
    62     
       
    63 private: //fun
       
    64     void ConstructL();
       
    65     void ConnectScrL();
       
    66     void writeRemainingData();
       
    67     void RegisterApplicationL(TInt aComponentId, TUid aAppUid,
       
    68             Usif::TAppCaption aAppName, TDesC aIconFilename, TInt aNumberOfIcons,
       
    69             TLanguage aLanguages);
       
    70     
       
    71     template <typename T>
       
    72     TInt ComputeSizeL(const T &aObject);
       
    73     void ExtractUidAndComponentIdL(RArray<Usif::TComponentId>& componentIds,RArray<TInt>& uids,TInt& ComponentsCount);   
       
    74     Usif::TComponentId RegisterComponentL(Usif::CComponentEntry& aEntry ,TUid aUid,TPtr aMidletInfoUrl, TPtr aMidletDescription, TPtr8 aMidletDeletionConformation,TPtr aDownloadUrl,TInt64 aMediaId,TPtr aDomainCatogary , TPtr aSettingValue,RPointerArray<HBufC>& aComponentFilesArray, TBool aIsComponentPresent,RPointerArray<Usif::CLocalizableComponentInfo>& aLocalizableComponentInfoArray);
       
    75     CScrBackupUtil();
       
    76 private://members
       
    77       
       
    78      enum TState
       
    79          {
       
    80          EIsFetchCompleteInfo,
       
    81          EIsWriteCompleteInfo
       
    82          };
       
    83      TState iState;
       
    84      HBufC8* iRemainingInfo;
       
    85      // to check if the previous attribte claims that he cant 
       
    86      //write in stream because of space so all other attribute 
       
    87      //down the lane should be in the remaining info buffer to maintain the sequence
       
    88      TBool iIsToWriteInStream;
       
    89      TBool iBufferToWriteNextTime;
       
    90      TBool iWriteToStream;
       
    91     TInt i ;
       
    92     TInt iLengthOfString;
       
    93     Usif::RSoftwareComponentRegistry* iScr;
       
    94     RArray<Usif::TComponentId> iComponentIds;
       
    95     RArray<TInt> iUids;
       
    96     RArray<TInt> iPresentUids;
       
    97     
       
    98     TInt iNumberOfComponents;
       
    99     TInt iBufferSpaceLeft;
       
   100     
       
   101     TInt iRemainingBuffer;
       
   102     TPtr8 iPtrToWriteBuffer;
       
   103     
       
   104     TBool iIsFristCall;
       
   105   
       
   106     };
       
   107 
       
   108 // Helper class pass the info of midlet with in midletSuite 
       
   109 class CAppInfo : public CBase
       
   110     {
       
   111 public:
       
   112     static CAppInfo* NewL();
       
   113 
       
   114     ~CAppInfo();
       
   115 
       
   116     static CAppInfo* NewLC();
       
   117     void ConstructL();
       
   118     void Set(TLanguage language,TUid appUid,Usif::TAppCaption caption,TDesC& appIcon,TInt aNoOfIcons);
       
   119     TLanguage GetLanguage();
       
   120     TUid GetAppUid();
       
   121     Usif::TAppCaption GetCaption();
       
   122     HBufC* GetAppIcon();
       
   123     TInt NoOfIcons();
       
   124 protected:
       
   125         
       
   126     CAppInfo();
       
   127     
       
   128     
       
   129 private:
       
   130     TLanguage iLanguage;
       
   131     TUid iAppUid;
       
   132     Usif::TAppCaption iCaption;
       
   133     HBufC* iAppIcon;
       
   134     TInt iNoOfIcons;
       
   135     };
       
   136 
       
   137 
       
   138 
       
   139 
       
   140 
       
   141 
       
   142 
       
   143 
       
   144 
       
   145 
       
   146 
       
   147 
       
   148 
       
   149 
       
   150 
       
   151 
       
   152 
       
   153 
       
   154 
       
   155 
       
   156 
       
   157 
       
   158 
       
   159 
       
   160 
       
   161 
       
   162 
       
   163 
       
   164 
       
   165 
       
   166 
       
   167 
       
   168 
       
   169 
       
   170 
       
   171 
       
   172 
       
   173 
       
   174 
       
   175 
       
   176 
       
   177 
       
   178 
       
   179 
       
   180 
       
   181 
       
   182 
       
   183 
       
   184 
       
   185 
       
   186 
       
   187 
       
   188 
       
   189 
       
   190 
       
   191 
       
   192 
       
   193 
       
   194 
       
   195 
       
   196 class CJavaBackupEntries : public CBase
       
   197     {
       
   198 public:
       
   199     ~CJavaBackupEntries();
       
   200     static CJavaBackupEntries* NewL(Usif::TComponentId aId); 
       
   201     
       
   202     static CJavaBackupEntries* NewLC(Usif::TComponentId aId);
       
   203     
       
   204     
       
   205     //used to get the below info
       
   206     /*
       
   207      * will get all the entries in this API
       
   208      * called when restoring
       
   209      */
       
   210     void GetEntries();
       
   211     
       
   212     /*
       
   213      * to set all the entries
       
   214      * 
       
   215      */
       
   216     void SetEntries();
       
   217 private :
       
   218     
       
   219     void ConstructL(Usif::TComponentId aId);
       
   220     
       
   221 private:
       
   222             //check if this duplication can be removed as the same variable is in ccomponentEntry
       
   223     Usif::TComponentId iComponentId;   ///< The unique id of the software component.
       
   224             //HBufC* iName;                ///< Name of the software component.
       
   225             //HBufC* iVendor;              ///< Vendor of the software component.
       
   226             //HBufC* iSwType;              ///< Software type name of the component.
       
   227             //HBufC* iGlobalId;            ///< Globally unique component identifier.
       
   228             //TBool iRemovable;            ///< Whether the component is removable.
       
   229             //TInt64 iSize;                ///< The total size of the component at installation time in bytes.
       
   230             //TScomoState iScomoState;     ///< SCOMO state of the component.
       
   231             //TDriveList iInstalledDrives; ///< The set of drives that files for the software component were installed to.
       
   232             //HBufC* iVersion;             ///< Version identifier of the software component
       
   233                 //HBufC* iInstallTime;         ///< The install time of the component. 
       
   234             //TBool iDrmProtected;         ///< Whether the component is DRM protected.
       
   235                 //TBool iHidden;               ///< Whether the component is hidden in the list of installed components.
       
   236             //TBool iKnownRevoked;         ///< Whether the component has been revoked.
       
   237             //TBool iOriginVerified;       ///< Whether the installer has verified the originator of the component.
       
   238             
       
   239             
       
   240             // TODO Can we keep a pointer here 
       
   241     Usif::CComponentEntry iEntries;
       
   242             TBool iIsComponentPresent;
       
   243             // component property
       
   244             TInt  iMidletSuitId;
       
   245             HBufC *iMidletInfoUrl;
       
   246             HBufC *iMidletDescription;
       
   247             TBool iMidletDeletetionConfirmation; // Didnt got any thing for it 
       
   248             HBufC *iMidletDownloadUrl;
       
   249             HBufC *iDomainCatagory;// didnt got any thing for it 
       
   250             TInt iMediaId;
       
   251             //addtion to CcomponentEntry Class
       
   252             RPointerArray<Usif::CLocalizableComponentInfo> &iCompLocalizedInfoArray;
       
   253             
       
   254             
       
   255             Usif::RSoftwareComponentRegistry *iScr;
       
   256             
       
   257             
       
   258             
       
   259     };
       
   260    }
       
   261 
       
   262    }
       
   263 
       
   264 
       
   265 
       
   266 #endif /* JAVASCRBACKUPUTIL_H_ */