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