connectivitymodules/SeCon/services/pcd/inc/sconsbeclient.h
branchRCL_3
changeset 25 4f0867e42d62
parent 24 8e7494275d3a
child 26 3e6957da2ff8
equal deleted inserted replaced
24:8e7494275d3a 25:4f0867e42d62
     1 /*
       
     2 * Copyright (c) 2005-2010 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:  CSConSBEClient header file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _SCONSBECLIENT_H_
       
    20 #define _SCONSBECLIENT_H_
       
    21 
       
    22 // INCLUDES
       
    23 #include <connect/sbeclient.h>
       
    24 #include "sconconmltask.h"
       
    25 
       
    26 using namespace conn;
       
    27 
       
    28 //============================================================
       
    29 // Class CSConSBEClient declaration
       
    30 //============================================================
       
    31 NONSHARABLE_CLASS ( CSConSBEClient ) : public CActive
       
    32     {
       
    33     public:
       
    34         /**
       
    35          * Two-phase constructor
       
    36          * @param aFs aReference to RFs connection.
       
    37          * @return CSConSBEClient instance
       
    38          */
       
    39         static CSConSBEClient* NewL( RFs& aFs );
       
    40         /**
       
    41          * Destructor
       
    42          * @return none
       
    43          */
       
    44         ~CSConSBEClient();
       
    45         /**
       
    46          * Set backup/restore mode
       
    47          * @param aStatus TRequestStatus of the request
       
    48          * @param aTask Task parameters
       
    49          * @return none
       
    50          */
       
    51         void SetBURMode( TRequestStatus& aStatus, CSConTask*& aTask );
       
    52         /**
       
    53          * Lists public files from data owners
       
    54          * @param aStatus TRequestStatus of the request
       
    55          * @param aTask Task parameters
       
    56          * @return none
       
    57          */
       
    58         void ListPublicFiles( TRequestStatus& aStatus, CSConTask*& aTask );
       
    59         /**
       
    60          * Lists participant data owners
       
    61          * @param aStatus TRequestStatus of the request
       
    62          * @param aTask Task parameters
       
    63          * @return none
       
    64          */
       
    65         void ListDataOwners( TRequestStatus& aStatus, CSConTask*& aTask );
       
    66         /**
       
    67          * Lists data sizes from data owners
       
    68          * @param aStatus TRequestStatus of the request
       
    69          * @param aTask Task parameters
       
    70          * @return none
       
    71          */
       
    72         void GetDataSize( TRequestStatus& aStatus, CSConTask*& aTask );
       
    73         /**
       
    74          * Request a data from a data owner
       
    75          * @param aStatus TRequestStatus of the request
       
    76          * @param aTask Task parameters
       
    77          * @return none
       
    78          */
       
    79         void RequestData( TRequestStatus& aStatus, CSConTask*& aTask );
       
    80         /**
       
    81          * Lists the status of data owners
       
    82          * @param aStatus TRequestStatus of the request
       
    83          * @param aTask Task parameters
       
    84          * @return none
       
    85          */
       
    86         void GetDataOwnerStatus( TRequestStatus& aStatus, CSConTask*& aTask );
       
    87         /**
       
    88          * Supplies a data to a data owner
       
    89          * @param aStatus TRequestStatus of the request
       
    90          * @param aTask Task parameters
       
    91          * @return none
       
    92          */
       
    93         void SupplyData( TRequestStatus& aStatus, CSConTask*& aTask );
       
    94     
       
    95     private:
       
    96         /**
       
    97          * Constructor
       
    98          * @param aFs aReference to RFs connection.
       
    99          * @return none
       
   100          */
       
   101         CSConSBEClient( RFs& aFs );
       
   102         
       
   103         /**
       
   104          * Implementation of CActive::DoCancel()
       
   105          * @return none
       
   106          */
       
   107         void DoCancel();
       
   108         /**
       
   109          * Implementation of CActive::RunL()
       
   110          * @return none
       
   111          */
       
   112         void RunL();
       
   113         
       
   114         /**
       
   115          * Executes SetBURMode task
       
   116          * @return none
       
   117          */
       
   118         void ProcessSetBURModeL();
       
   119         /**
       
   120          * Executes ListPublicFiles task
       
   121          * @return none
       
   122          */
       
   123         void ProcessListPublicFilesL();
       
   124         /**
       
   125          * Executes ListDataOwners task
       
   126          * @return none
       
   127          */
       
   128         void ProcessListDataOwnersL();
       
   129         /**
       
   130          * Executes GetDataSize task
       
   131          * @return none
       
   132          */
       
   133         void ProcessGetDataSizeL();
       
   134         /**
       
   135          * Executes RequestData task
       
   136          * @return KErrNone if no erros. Else system wide error codes.
       
   137          */
       
   138         TInt ProcessRequestDataL();
       
   139 		/**
       
   140 		 * Request data to iDataBuffer
       
   141 		 * @return none
       
   142 		 */
       
   143 		void RequestDataL( CSBGenericTransferType& aGenericTransferType );
       
   144 		/**
       
   145          * Executes GetDataOwnerStatus task
       
   146          * @return none
       
   147          */
       
   148         void ProcessGetDataOwnerStatusL();
       
   149         /**
       
   150          * Executes SupplyData task
       
   151          * @return KErrNone if no errors. Else system wide error codes.
       
   152          */
       
   153         TInt ProcessSupplyDataL();
       
   154         /**
       
   155          * Maps TInt drive number to TDriveNumber
       
   156          * @param aDrive Drive number as TInt
       
   157          * @return drive number as TDriveNumber
       
   158          */
       
   159         TDriveNumber GetDriveNumber( TInt aDrive ) const;
       
   160         /**
       
   161          * Filters the drive list
       
   162          * @param aDriveList Drive list to be filtered
       
   163          * @return none
       
   164          */     
       
   165         void FilterDriveList( TDriveList& aDriveList ) const;
       
   166         /**
       
   167          * Matches the uids
       
   168          * @param aFirst The first uid
       
   169          * @param aSecon The second uid
       
   170          * @return ETrue if uids match, else EFalse
       
   171          */
       
   172         static TBool Match( const TUid& aFirst, 
       
   173                             const TUid& aSecond );
       
   174         /**
       
   175          * Handle error received from Secure Backup Engine
       
   176          * @param aErr Error code from Secure Backup Engine
       
   177          * @return none
       
   178          */
       
   179         void HandleSBEErrorL( TInt& aErr );
       
   180         
       
   181         /**
       
   182          * Appends public files to CSConFile array.
       
   183          * @param aFiles source files to append
       
   184          * @param aSconFiles dataowner list where to add
       
   185          * @return none
       
   186          */
       
   187         void AppendFilesToFilelistL( const RFileArray& aFiles, RPointerArray<CSConFile>& aSconFiles );
       
   188         
       
   189         /**
       
   190          * Gets Package dataowner size
       
   191          * @param aPackageId dataowner
       
   192          * @param TDriveList drives to include
       
   193          * @param TPackageDataType package data type 
       
   194          * @return dataowner data size in specified drives
       
   195          */
       
   196         TUint PackageDataSizeL( TUid aPackageId, const TDriveList& aDriveList,
       
   197                 TPackageDataType aPackageDataType ) const;
       
   198         
       
   199         /**
       
   200          * Gets Sid dataowner size
       
   201          * @param aSid dataowner
       
   202          * @param TDriveList drives to include
       
   203          * @param TTransferDataType transfer data type 
       
   204          * @return dataowner data size in specified drives
       
   205          */
       
   206         TUint SidDataSizeL( TUid aSid, const TDriveList& aDriveList,
       
   207                 TTransferDataType aTransferDataType ) const;
       
   208         
       
   209         /**
       
   210          * Gets Java dataowner size
       
   211          * @param aJavaHash Java hash value
       
   212          * @param TDriveList drives to include
       
   213          * @return dataowner data size in specified drives
       
   214          */
       
   215          TUint JavaDataSizeL( const TDesC& aJavaHash, const TDriveList& aDriveList ) const;
       
   216          
       
   217 	private:
       
   218 		CSBEClient*						iSBEClient;
       
   219 		TRequestStatus* 				iCallerStatus;
       
   220 		CSConTask*						iCurrentTask;
       
   221 		TBool							iBURModeNormal;
       
   222 		TBool                           iRestoreMode;
       
   223 		RFs&                            iFs;
       
   224 		TBool                           iAllSnapshotsSuppliedCalled;
       
   225 		TBool                           iLastChunk;
       
   226 		CBufFlat*                       iDataBuffer;
       
   227 		TInt                            iDataBufferSize;
       
   228 	};
       
   229 
       
   230 #endif
       
   231 
       
   232 // End of file