brandingserver/BSClient/cbsclient.h
changeset 31 9dbc70490d9a
equal deleted inserted replaced
30:1fa9b890f29c 31:9dbc70490d9a
       
     1 /*
       
     2 * Copyright (c) 2006 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 the License "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:  CBSClient.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CBSCLIENT_H__
       
    21 #define __CBSCLIENT_H__
       
    22 #include <e32std.h>
       
    23 #include <f32file.h>
       
    24 #include <bamdesca.h>
       
    25 #include <s32mem.h>
       
    26 #include "mbsupdater.h"
       
    27 #include "bsserverdefs.h"
       
    28 #include "mbsbrandobserverregistrar.h"
       
    29 
       
    30 class MBSElement;
       
    31 class MBSBrandChangeObserver;
       
    32 class MBSBackupRestoreStateObserver;
       
    33 class CBSBrandObserver;
       
    34 
       
    35 /**
       
    36  * Simple ClientServer for
       
    37  * testing and example purposes.
       
    38  */
       
    39 class RBSClient : public RSessionBase,
       
    40 				  public MBSBrandObserverRegistrar
       
    41     {
       
    42     
       
    43     public:     // Constructor and destructor
       
    44         RBSClient();
       
    45         ~RBSClient();
       
    46 
       
    47 
       
    48     public:     // New methods
       
    49 
       
    50         TInt Connect();
       
    51         void Close();
       
    52         
       
    53 		void StartTransactionL( const TDesC8& aApplicationId,
       
    54         				  const TDesC8& aBrandId,
       
    55         				  const TDesC8& aDefaultBrandId,
       
    56         				  TLanguage aLanguage,
       
    57         				  TTransactionType aType,
       
    58 						  TInt aReserved = 0 );
       
    59         
       
    60         TInt StopTransactionL( const TDesC8& aApplicationId,
       
    61         				  const TDesC8& aBrandId,
       
    62         				  TLanguage aLanguage,
       
    63         				  TInt aReserved = 0 );
       
    64         
       
    65         void CancelTransactionL( const TDesC8& aApplicationId,
       
    66         				  const TDesC8& aBrandId,
       
    67         				  TLanguage aLanguage,
       
    68         				  TInt aReserved = 0);
       
    69         
       
    70         void InsertL( MBSElement* aElement );
       
    71         void ReplaceL( MBSElement* aElement );
       
    72         void AppendL( MBSElement* aElement );
       
    73         
       
    74         void GetTextL( const TDesC8& aId, HBufC*& aValue );
       
    75         void GetBufferL( const TDesC8& aId, HBufC8*& aValue );
       
    76         void GetIntL( const TDesC8& aId, TInt& aValue );
       
    77 
       
    78         MBSElement* GetSeveralL( MDesC8Array& aIds );
       
    79 		MBSElement* GetStructureL( const TDesC8& aId );
       
    80 		void GetFileL( const TDesC8& aId, RFile& aFile );
       
    81 		
       
    82 		void RemoveBrandL( const TDesC8& aApplicationId,
       
    83 								   const TDesC8& aBrandId );
       
    84 
       
    85 		void RemoveBrandsL( const TDesC8& aApplicationId );
       
    86 
       
    87 		void isBrandUpdateRequiredL (TInt& aUpdateRequired);
       
    88 
       
    89     	/*
       
    90     	* Register to observer brand data updates
       
    91     	* @param aObserver the observer interface
       
    92     	*/
       
    93         void RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver);
       
    94 
       
    95     	/*
       
    96     	* Unregister a brand data update observer
       
    97     	* @param aObserver the observer interface
       
    98     	*/
       
    99         void UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver );
       
   100 
       
   101 
       
   102 	private:
       
   103 
       
   104         void InitClientL( const TDesC8& aApplicationId,
       
   105         				  const TDesC8& aBrandId,
       
   106         				  const TDesC8& aDefaultBrandId,
       
   107         				  TLanguage aLanguage,
       
   108         				  TTransactionType aType,
       
   109         				  TInt aReserved );
       
   110         				  
       
   111 		TIpcArgs CreateArgumentsL( const TDesC8& aApplicationId,
       
   112         				  const TDesC8& aBrandId,
       
   113         				  TLanguage aLanguage,
       
   114         				  TInt aReserved );
       
   115 
       
   116         MBSElement* InternalizeElementL( RReadStream& aStream );
       
   117         
       
   118         void ExternalizeIdArrayL( RWriteStream& aStream, MDesC8Array& aArray );
       
   119 	
       
   120 		void SendUpdateL( MBSElement* aElement, TBSMessages aMessage );
       
   121 		
       
   122 	private: // from MBSBrandObserverRegistrar
       
   123 		/*
       
   124     	* Registeres the brand observer to server
       
   125     	*/
       
   126         void RegisterObserverToServerL( TRequestStatus& aStatus );
       
   127         
       
   128         TInt GetNewVersionL();
       
   129         TInt GetValueL(TInt msg) ;
       
   130         TInt GetBackupStateL() ;
       
   131         TInt GetBackupRestoreL() ;
       
   132         
       
   133         
       
   134 	private:
       
   135 		TTransactionType iType;
       
   136 		CBSBrandObserver* iObserver;
       
   137 		TInt isUpdateRequired;
       
   138     };
       
   139 
       
   140 #endif      //  __CBSCLIENT_H__
       
   141 
       
   142 
       
   143 //  END OF FILE
       
   144