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