omadm/omadmappui/inc/NSmlDMFotaModel.h
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 2005 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: Implementation of DM UI component
       
    15 * 	This is part of omadmappui.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CNSMLDMFOTAMODEL_H
       
    22 #define CNSMLDMFOTAMODEL_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <fotaengine.h>
       
    26 
       
    27 #include "NSmlDMFotaView.h"
       
    28 // FORWARD DECLARATIONS
       
    29 class CNSmlDMSyncDocument;
       
    30 class RFotaEngineSession;
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 *  Functionality required by the fota user interface.
       
    35 *
       
    36 *  @lib NSmlDMSyncApp
       
    37 *  @since Series 60 3.1
       
    38 */
       
    39 class CNSmlDMFotaModel : public CBase
       
    40     {
       
    41     public:  // Constructors and destructor
       
    42         
       
    43         /**
       
    44         * Two-phased constructor.
       
    45         */
       
    46         static CNSmlDMFotaModel* NewL( CNSmlDMSyncDocument* aDocument );
       
    47         
       
    48         /**
       
    49         * Destructor.
       
    50         */
       
    51         virtual ~CNSmlDMFotaModel();
       
    52 
       
    53     public: // New functions
       
    54         
       
    55         /**
       
    56         * Retrieves the human readable name of the profile.
       
    57         * @since Series 60 3.1
       
    58         * @param aProfileId Profile identifier
       
    59         * @param aProfileId Human readable name of the profile, or KNullDesC if not found.
       
    60         * @return None
       
    61         */
       
    62         void GetProfileNameL( const TInt aProfileId,
       
    63                                     HBufC* aProfileName ) const;
       
    64 
       
    65         /**
       
    66         * Retrieves the default fota profile identifier from
       
    67         * the central repository.
       
    68         * @since Series 60 3.1
       
    69         * @param None
       
    70         * @return Profile identifier
       
    71         */
       
    72         TInt DefaultFotaProfileIdL() const;
       
    73 
       
    74         /**
       
    75         * Saves the default fota profile identifier to the
       
    76         * central repository.
       
    77         * @since Series 60 3.1
       
    78         * @param aProfileId Profile identifier.
       
    79         * @return None
       
    80         */
       
    81         void SetDefaultFotaProfileIdL( const TInt aProfileId );
       
    82 
       
    83         /**
       
    84         * Sets the central repository key to indicate that the
       
    85         * defined profile should be used to request firmware
       
    86         * update.
       
    87         * @since Series 60 3.1
       
    88         * @param aProfileId Profile identifier.
       
    89         * @return None
       
    90         */
       
    91         void EnableFwUpdRequestL( const TInt aProfileId );
       
    92         
       
    93         /**
       
    94         * Retrieves the device management profile names into a list.
       
    95         * @since Series 60 3.1
       
    96         * @param aItems Array into which the profile names are appended.
       
    97         * @return None
       
    98         */
       
    99         void ReadProfileListL( CDesCArray* aItems,
       
   100                                CArrayFixFlat<TInt>* aProfileIdList );
       
   101 
       
   102         /**
       
   103         * Returns the index of the default fota profile in the
       
   104         * given list of identifiers.
       
   105         * @since Series 60 3.1
       
   106         * @param aProfileIdList List of profile identifiers.
       
   107         * @return Index of the default fota profile in the list.
       
   108         */
       
   109         TInt SelectDefaultProfileFromList(
       
   110             const CArrayFixFlat<TInt>* aProfileIdList ) const;
       
   111 
       
   112         /**
       
   113         * Checks that the profile identifier is included in the
       
   114         * devie management profiles list.
       
   115         * @since Series 60 3.1
       
   116         * @param aProfileIdList List of profile identifiers.
       
   117         * @return Index of the default fota profile in the list.
       
   118         */
       
   119         TBool VerifyProfileL( const TInt aProfileId ) const;
       
   120         
       
   121         /**
       
   122         * Retrieves the list of firmware update packages known to
       
   123         * the FOTA server component.
       
   124         * @since Series 60 3.1
       
   125         * @param None.
       
   126         * @return Array that includes the package identifiers.
       
   127         */
       
   128         TInt RetrieveFwUpdPkgIdListL(TFotaState aState);
       
   129         
       
   130         /**
       
   131         * Checks if the FOTA server component has knowledge of firmware update
       
   132         * packages that are in the given state. 
       
   133         * @since Series 60 3.1
       
   134         * @param aState Package state to be searched for.
       
   135         * @return Identifier of the package that has the given state, or
       
   136         *         KErrNotFound if none are found.
       
   137         */
       
   138         TInt FindFwUpdPkgWithStateL( TFotaState aState );
       
   139 
       
   140         /**
       
   141         * Initiates the instalklation of a firmware update package.
       
   142         * @since Series 60 3.1
       
   143         * @param aPkgId Identifier of the update package.
       
   144         * @return error code.
       
   145         */
       
   146         TInt InitiateFwUpdInstall( TInt aPkgId, TInt aProfileId );
       
   147 		
       
   148 		/**
       
   149         * Continues the installation of a firmware update package.
       
   150         * @since Series 60 3.2
       
   151         * @param None.
       
   152         * @return None.
       
   153         */
       
   154         void ContinueFwUpdInstall( );
       
   155         
       
   156         /**
       
   157         * Returns the version string of the current firmware.
       
   158         * @since Series 60 3.1
       
   159         * @param aVersionString The version string of the current firmware.
       
   160         * @return Error code.
       
   161         */
       
   162         TInt CurrentFwVersionString( TDes& aVersionString );
       
   163 
       
   164         /**
       
   165         * Returns the time of the last successful firmware update.
       
   166         * @since Series 60 3.1
       
   167         * @param aVersionString The time of the last firmware update.
       
   168         * @return Error code.
       
   169         */
       
   170         TInt LastUpdateTime( TTime& aTime );
       
   171 
       
   172         /**
       
   173         * Saves the current state of update packages.
       
   174         * @param None.
       
   175         * @return None.
       
   176         */
       
   177         void MarkFwUpdChangesStartL();
       
   178 
       
   179         /**
       
   180         * Checks if the state of update packages has changed since the saved
       
   181         * situation.
       
   182         * @param None.
       
   183         * @return True if there are differences in pcakage identifiers or states.
       
   184         */
       
   185         TBool FwUpdStatesChangedL();
       
   186         
       
   187        TFotaState GetCurrentFwUpdState();
       
   188 
       
   189         
       
   190     public: // Functions from base classes
       
   191 
       
   192         /**
       
   193         * From ?base_class ?member_description.
       
   194         * @since Series ?XX ?SeriesXX_version
       
   195         * @param ?arg1 ?description
       
   196         * @return ?description
       
   197         */
       
   198         //?type ?member_function( ?type ?arg1 );
       
   199         
       
   200     protected:  // New functions
       
   201         
       
   202         /**
       
   203         * ?member_description.
       
   204         * @since Series ?XX ?SeriesXX_version
       
   205         * @param ?arg1 ?description
       
   206         * @return ?description
       
   207         */
       
   208         //?type ?member_function( ?type ?arg1 );
       
   209 
       
   210     protected:  // Functions from base classes
       
   211         
       
   212         /**
       
   213         * From ?base_class ?member_description
       
   214         */
       
   215         //?type ?member_function();
       
   216 
       
   217     private:
       
   218 
       
   219         /**
       
   220         * C++ default constructor.
       
   221         */
       
   222         CNSmlDMFotaModel( CNSmlDMSyncDocument* aDocument );
       
   223 
       
   224         /**
       
   225         * By default Symbian 2nd phase constructor is private.
       
   226         */
       
   227         void ConstructL();
       
   228 
       
   229     private:    // Data
       
   230     
       
   231         // Pointer to the application document instance.
       
   232         CNSmlDMSyncDocument*    iDocument;
       
   233         
       
   234         // Is the data package download in progress.
       
   235         TBool                   iDpDlInProgress;
       
   236     
       
   237         RFotaEngineSession      iFotaEngine;     
       
   238     };
       
   239 
       
   240 #endif      // CNSMLDMFOTAMODEL_H   
       
   241             
       
   242 // End of File