brandingserver/BSClient/cbsclient.h
author hgs
Sun, 11 Apr 2010 15:33:49 +0530
changeset 31 9dbc70490d9a
permissions -rw-r--r--
201014
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  CBSClient.h
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
#ifndef __CBSCLIENT_H__
hgs
parents:
diff changeset
    21
#define __CBSCLIENT_H__
hgs
parents:
diff changeset
    22
#include <e32std.h>
hgs
parents:
diff changeset
    23
#include <f32file.h>
hgs
parents:
diff changeset
    24
#include <bamdesca.h>
hgs
parents:
diff changeset
    25
#include <s32mem.h>
hgs
parents:
diff changeset
    26
#include "mbsupdater.h"
hgs
parents:
diff changeset
    27
#include "bsserverdefs.h"
hgs
parents:
diff changeset
    28
#include "mbsbrandobserverregistrar.h"
hgs
parents:
diff changeset
    29
hgs
parents:
diff changeset
    30
class MBSElement;
hgs
parents:
diff changeset
    31
class MBSBrandChangeObserver;
hgs
parents:
diff changeset
    32
class MBSBackupRestoreStateObserver;
hgs
parents:
diff changeset
    33
class CBSBrandObserver;
hgs
parents:
diff changeset
    34
hgs
parents:
diff changeset
    35
/**
hgs
parents:
diff changeset
    36
 * Simple ClientServer for
hgs
parents:
diff changeset
    37
 * testing and example purposes.
hgs
parents:
diff changeset
    38
 */
hgs
parents:
diff changeset
    39
class RBSClient : public RSessionBase,
hgs
parents:
diff changeset
    40
				  public MBSBrandObserverRegistrar
hgs
parents:
diff changeset
    41
    {
hgs
parents:
diff changeset
    42
    
hgs
parents:
diff changeset
    43
    public:     // Constructor and destructor
hgs
parents:
diff changeset
    44
        RBSClient();
hgs
parents:
diff changeset
    45
        ~RBSClient();
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
hgs
parents:
diff changeset
    48
    public:     // New methods
hgs
parents:
diff changeset
    49
hgs
parents:
diff changeset
    50
        TInt Connect();
hgs
parents:
diff changeset
    51
        void Close();
hgs
parents:
diff changeset
    52
        
hgs
parents:
diff changeset
    53
		void StartTransactionL( const TDesC8& aApplicationId,
hgs
parents:
diff changeset
    54
        				  const TDesC8& aBrandId,
hgs
parents:
diff changeset
    55
        				  const TDesC8& aDefaultBrandId,
hgs
parents:
diff changeset
    56
        				  TLanguage aLanguage,
hgs
parents:
diff changeset
    57
        				  TTransactionType aType,
hgs
parents:
diff changeset
    58
						  TInt aReserved = 0 );
hgs
parents:
diff changeset
    59
        
hgs
parents:
diff changeset
    60
        TInt StopTransactionL( const TDesC8& aApplicationId,
hgs
parents:
diff changeset
    61
        				  const TDesC8& aBrandId,
hgs
parents:
diff changeset
    62
        				  TLanguage aLanguage,
hgs
parents:
diff changeset
    63
        				  TInt aReserved = 0 );
hgs
parents:
diff changeset
    64
        
hgs
parents:
diff changeset
    65
        void CancelTransactionL( const TDesC8& aApplicationId,
hgs
parents:
diff changeset
    66
        				  const TDesC8& aBrandId,
hgs
parents:
diff changeset
    67
        				  TLanguage aLanguage,
hgs
parents:
diff changeset
    68
        				  TInt aReserved = 0);
hgs
parents:
diff changeset
    69
        
hgs
parents:
diff changeset
    70
        void InsertL( MBSElement* aElement );
hgs
parents:
diff changeset
    71
        void ReplaceL( MBSElement* aElement );
hgs
parents:
diff changeset
    72
        void AppendL( MBSElement* aElement );
hgs
parents:
diff changeset
    73
        
hgs
parents:
diff changeset
    74
        void GetTextL( const TDesC8& aId, HBufC*& aValue );
hgs
parents:
diff changeset
    75
        void GetBufferL( const TDesC8& aId, HBufC8*& aValue );
hgs
parents:
diff changeset
    76
        void GetIntL( const TDesC8& aId, TInt& aValue );
hgs
parents:
diff changeset
    77
hgs
parents:
diff changeset
    78
        MBSElement* GetSeveralL( MDesC8Array& aIds );
hgs
parents:
diff changeset
    79
		MBSElement* GetStructureL( const TDesC8& aId );
hgs
parents:
diff changeset
    80
		void GetFileL( const TDesC8& aId, RFile& aFile );
hgs
parents:
diff changeset
    81
		
hgs
parents:
diff changeset
    82
		void RemoveBrandL( const TDesC8& aApplicationId,
hgs
parents:
diff changeset
    83
								   const TDesC8& aBrandId );
hgs
parents:
diff changeset
    84
hgs
parents:
diff changeset
    85
		void RemoveBrandsL( const TDesC8& aApplicationId );
hgs
parents:
diff changeset
    86
hgs
parents:
diff changeset
    87
		void isBrandUpdateRequiredL (TInt& aUpdateRequired);
hgs
parents:
diff changeset
    88
hgs
parents:
diff changeset
    89
    	/*
hgs
parents:
diff changeset
    90
    	* Register to observer brand data updates
hgs
parents:
diff changeset
    91
    	* @param aObserver the observer interface
hgs
parents:
diff changeset
    92
    	*/
hgs
parents:
diff changeset
    93
        void RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver);
hgs
parents:
diff changeset
    94
hgs
parents:
diff changeset
    95
    	/*
hgs
parents:
diff changeset
    96
    	* Unregister a brand data update observer
hgs
parents:
diff changeset
    97
    	* @param aObserver the observer interface
hgs
parents:
diff changeset
    98
    	*/
hgs
parents:
diff changeset
    99
        void UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver );
hgs
parents:
diff changeset
   100
hgs
parents:
diff changeset
   101
hgs
parents:
diff changeset
   102
	private:
hgs
parents:
diff changeset
   103
hgs
parents:
diff changeset
   104
        void InitClientL( const TDesC8& aApplicationId,
hgs
parents:
diff changeset
   105
        				  const TDesC8& aBrandId,
hgs
parents:
diff changeset
   106
        				  const TDesC8& aDefaultBrandId,
hgs
parents:
diff changeset
   107
        				  TLanguage aLanguage,
hgs
parents:
diff changeset
   108
        				  TTransactionType aType,
hgs
parents:
diff changeset
   109
        				  TInt aReserved );
hgs
parents:
diff changeset
   110
        				  
hgs
parents:
diff changeset
   111
		TIpcArgs CreateArgumentsL( const TDesC8& aApplicationId,
hgs
parents:
diff changeset
   112
        				  const TDesC8& aBrandId,
hgs
parents:
diff changeset
   113
        				  TLanguage aLanguage,
hgs
parents:
diff changeset
   114
        				  TInt aReserved );
hgs
parents:
diff changeset
   115
hgs
parents:
diff changeset
   116
        MBSElement* InternalizeElementL( RReadStream& aStream );
hgs
parents:
diff changeset
   117
        
hgs
parents:
diff changeset
   118
        void ExternalizeIdArrayL( RWriteStream& aStream, MDesC8Array& aArray );
hgs
parents:
diff changeset
   119
	
hgs
parents:
diff changeset
   120
		void SendUpdateL( MBSElement* aElement, TBSMessages aMessage );
hgs
parents:
diff changeset
   121
		
hgs
parents:
diff changeset
   122
	private: // from MBSBrandObserverRegistrar
hgs
parents:
diff changeset
   123
		/*
hgs
parents:
diff changeset
   124
    	* Registeres the brand observer to server
hgs
parents:
diff changeset
   125
    	*/
hgs
parents:
diff changeset
   126
        void RegisterObserverToServerL( TRequestStatus& aStatus );
hgs
parents:
diff changeset
   127
        
hgs
parents:
diff changeset
   128
        TInt GetNewVersionL();
hgs
parents:
diff changeset
   129
        TInt GetValueL(TInt msg) ;
hgs
parents:
diff changeset
   130
        TInt GetBackupStateL() ;
hgs
parents:
diff changeset
   131
        TInt GetBackupRestoreL() ;
hgs
parents:
diff changeset
   132
        
hgs
parents:
diff changeset
   133
        
hgs
parents:
diff changeset
   134
	private:
hgs
parents:
diff changeset
   135
		TTransactionType iType;
hgs
parents:
diff changeset
   136
		CBSBrandObserver* iObserver;
hgs
parents:
diff changeset
   137
		TInt isUpdateRequired;
hgs
parents:
diff changeset
   138
    };
hgs
parents:
diff changeset
   139
hgs
parents:
diff changeset
   140
#endif      //  __CBSCLIENT_H__
hgs
parents:
diff changeset
   141
hgs
parents:
diff changeset
   142
hgs
parents:
diff changeset
   143
//  END OF FILE
hgs
parents:
diff changeset
   144