connectivitymodules/SeCon/services/pcd/inc/sconsynchandler.h
branchRCL_3
changeset 20 4a793f564d72
parent 18 453dfc402455
equal deleted inserted replaced
19:0aa8cc770c8a 20:4a793f564d72
       
     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:  CSconSyncHandler header
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SCONSYNCHANDLER_H_
       
    20 #define SCONSYNCHANDLER_H_
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <s32file.h>
       
    24 #include "sconsyncclient.h"
       
    25 
       
    26 class RFs;
       
    27 class RWriteStream;
       
    28 class RReadStream;
       
    29 class RFileReadStream;
       
    30 
       
    31 NONSHARABLE_CLASS( TCreatedItem )
       
    32     {
       
    33 public:
       
    34     TInt            iTemporaryId;
       
    35     TInt            iErrorCode;
       
    36     TSmlDbItemUid   iNewUid;
       
    37     };
       
    38 
       
    39 NONSHARABLE_CLASS( TReplacedItem )
       
    40     {
       
    41 public:
       
    42     TSmlDbItemUid   iItemUid;
       
    43     TInt            iErrorCode;
       
    44     };
       
    45 
       
    46 NONSHARABLE_CLASS( CSconSyncHandler ) : public CActive
       
    47 {
       
    48 public:
       
    49     static CSconSyncHandler* NewL( RFs& aFs );
       
    50 	~CSconSyncHandler();
       
    51 	
       
    52 	void HandleGetSyncRequestL( const TDesC8& aRequest, RWriteStream& aResult, TInt aMaxObjectSize );
       
    53 	void HandlePutSyncRequestL( const TDesC8& aRequest, RReadStream& aData );
       
    54 private:
       
    55 	CSconSyncHandler( RFs& aFs );
       
    56 	void ConstructL();
       
    57 	
       
    58 	void ListStoresL( RWriteStream& aResult );
       
    59 	void OpenStoreL( const TDesC8& aParams, RWriteStream& aResult );
       
    60 	void CloseStoreL( RWriteStream& aResult );
       
    61 	
       
    62 	void ListChangesL( RWriteStream& aResult );
       
    63 	void ResetChangeInfoL( RWriteStream& aResult );
       
    64 	void CommitChangesL( const TDesC8& aParams, RWriteStream& aResult );
       
    65 	void ReadItemsL( const TDesC8& aParams, RWriteStream& aResult );
       
    66 	void GetParentsL( const TDesC8& aParams, RWriteStream& aResult );
       
    67 	void CreateItemsL( RReadStream& aData );
       
    68 	void GetCreateItemsResponseL( const TDesC8& aParams, RWriteStream& aResult );
       
    69 	void ReplaceItemsL( RReadStream& aData );
       
    70 	void GetReplaceItemsResponseL( const TDesC8& aParams, RWriteStream& aResult );
       
    71 	void MoveItemsL( const TDesC8& aParams, RWriteStream& aResult );
       
    72 	void DeleteItemsL( const TDesC8& aParams, RWriteStream& aResult );
       
    73 	void SoftDeleteItemsL( const TDesC8& aParams, RWriteStream& aResult );
       
    74 	void DeleteAllItemsL( RWriteStream& aResult );
       
    75 	void GetDeleteAllItemsStatusL( RWriteStream& aResult );
       
    76 	void GetStoreFormatL( RWriteStream& aResult );
       
    77 	void SetRemoteStoreFormatL( RReadStream& aData );
       
    78 	
       
    79 	void CreateNextItemOnStreamL();
       
    80 	void ReplaceNextItemOnStreamL();
       
    81 	
       
    82 	void ReadNextDataBlockL( RWriteStream& aResult );
       
    83 	void ReadItemL( TSmlDbItemUid aUid, CBufFlat& aItemData );
       
    84 	
       
    85 	void LoadRemoteStoreFormatL( TInt aContextId, TInt aProviderId );
       
    86 	void SaveRemoteStoreFormatL( CSmlDataStoreFormat& aStoreFormat, TInt aContextId, TInt aProviderId );
       
    87 	
       
    88 	void CancelOperationsL( RWriteStream& aResult );
       
    89 	
       
    90 	void Reset();
       
    91 	
       
    92 	void SetCalendarCenrepL( TInt aProfileId, const TDesC& aServerId );
       
    93 	void ClearCalendarCenrepL();
       
    94 	
       
    95 private: // from CActive
       
    96     void DoCancel();
       
    97     void RunL();
       
    98     TInt RunError( TInt aError );
       
    99 	
       
   100 private:
       
   101     RFs&                    iFs; // Not owned
       
   102     RSconSyncSession        iSyncSession;
       
   103     TBool                   iConnected;
       
   104     
       
   105     TInt                    iCurrentDataProviderUid;
       
   106     TInt                    iCurrentContextUid;
       
   107     
       
   108     CBufFlat*               iResponseData;
       
   109     
       
   110     enum TSyncStatus
       
   111         {
       
   112         EReady,
       
   113         ECreatingItemsFromFile,
       
   114         EItemsCreated,
       
   115         EReplacingItemsFromFile,
       
   116         EItemsReplaced,
       
   117         EDeletingAllItems
       
   118         };
       
   119     TSyncStatus             iSyncStatus;
       
   120     
       
   121     TInt                    iMaxObjectSize;
       
   122     TInt                    iBytesWrited;
       
   123     TBool                   iHasFileStream;
       
   124     RFileReadStream         iFileStream;
       
   125     TSmlDbItemUid           iCreatedItemUid;
       
   126     TPckg<TSmlDbItemUid>    iCreatedItemUidPckg;
       
   127     TSmlDbItemUid           iTemporaryItemUid;
       
   128     TInt                    iItemsLeftInStream;
       
   129     TInt                    iItemInProgress; // =1 if item is in progress
       
   130     RArray<TCreatedItem>    iCreatedItems;
       
   131     RArray<TReplacedItem>   iReplacedItems;
       
   132     RArray<TSmlDbItemUid>   iItemsToRead;
       
   133     TReplacedItem           iReplacedItem;
       
   134     TFileName               iFileInProgress;
       
   135     TBool                   iCalendarCenrepUsed;
       
   136 };
       
   137 
       
   138 #endif /*SCONSYNCHANDLER_H_*/