|
1 /* |
|
2 * Copyright (c) 2008 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: client class to connect to server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CIMCACHECLIENT_H__ |
|
21 #define __CIMCACHECLIENT_H__ |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <imcachedefs.h> |
|
25 #include "mimcacheclient.h" |
|
26 |
|
27 class MIMCacheEventHandler; |
|
28 class CIMCacheEventHandler; |
|
29 class MIMCacheEventHandler; |
|
30 class CIMCacheAccessEventHandler; |
|
31 /** |
|
32 * CIMCacheClient ClientServer |
|
33 */ |
|
34 class CIMCacheClient : public CBase, |
|
35 public RSessionBase, |
|
36 public MIMCacheClient |
|
37 { |
|
38 |
|
39 public: // Constructor and destructor |
|
40 /* |
|
41 * CIMCacheClient |
|
42 */ |
|
43 CIMCacheClient(); |
|
44 |
|
45 /* |
|
46 * ~CIMCacheClient |
|
47 */ |
|
48 ~CIMCacheClient(); |
|
49 |
|
50 |
|
51 public: // New methods |
|
52 |
|
53 /** |
|
54 * Connect |
|
55 */ |
|
56 TInt Connect(); |
|
57 |
|
58 /** |
|
59 * Register to observer converstaionitems data updates |
|
60 * @param aObserver the observer interface |
|
61 */ |
|
62 void RegisterUpdateObserverL( MIMCacheEventHandler& aObserver ); |
|
63 |
|
64 /** |
|
65 * Unregister a converstaionitems data update observer |
|
66 * @param aObserver the observer interface |
|
67 */ |
|
68 void UnRegisterUpdateObserver( MIMCacheEventHandler& aObserver ); |
|
69 /** |
|
70 * Register to observer converstaionitems data access |
|
71 * @param aObserver the observer interface |
|
72 */ |
|
73 void RegisterAccessObserverL( MIMCacheEventHandler& aObserver ); |
|
74 |
|
75 /** |
|
76 * Unregister a converstaionitems data access observer |
|
77 * @param aObserver the observer interface |
|
78 */ |
|
79 void UnRegisterAccessObserver( MIMCacheEventHandler& aObserver); |
|
80 |
|
81 /** |
|
82 * start the transaction and perform the operation |
|
83 * @param aOperationType , operation to perform |
|
84 */ |
|
85 TInt StartTransactionL( EIMCacheOperations aOperationType ); |
|
86 |
|
87 /** |
|
88 * start the transaction and perform the operation |
|
89 * @param aText ,text to send to server |
|
90 * @param aOperationType operation to perform |
|
91 */ |
|
92 void StartTransactionL( EIMCacheOperations aOperationType, |
|
93 const TDesC& aText |
|
94 ) ; |
|
95 |
|
96 /** |
|
97 * start the transaction and perform the operation |
|
98 * @param aServiceId service id to use |
|
99 * @param aUserId user id to use |
|
100 * @param aOperationType operation to perform |
|
101 */ |
|
102 void StartTransactionL( EIMCacheOperations aOperationType , |
|
103 TInt aServiceId, |
|
104 const TDesC& aText |
|
105 ); |
|
106 |
|
107 /** |
|
108 * start the transaction and perform the operation |
|
109 * @param aServiceId service id to use |
|
110 * @param aSender user id to use |
|
111 * @param aRecipient,recipient user id |
|
112 * @param aOperationType operation to perform |
|
113 */ |
|
114 void StartTransactionL( EIMCacheOperations aOperationType, |
|
115 TInt aServiceId, |
|
116 const TDesC& aText1 , |
|
117 const TDesC& aText2 |
|
118 ) ; |
|
119 |
|
120 |
|
121 /** |
|
122 * to get the all unread message count from server |
|
123 * @param , aOwnUserId logged in user id |
|
124 * @return number of unread msg count |
|
125 */ |
|
126 TInt GetInformationL(EIMCacheOperations aOperationType , TInt aServiceId,const TDesC& aBuddyId ); |
|
127 |
|
128 /** |
|
129 * to get the count from server |
|
130 * @param aOperationType operation to perform |
|
131 * @param aServiceId, service id used |
|
132 * @param , aOwnUserId logged in user id |
|
133 * @return number of all unread msg count |
|
134 */ |
|
135 TInt GetInformationL(EIMCacheOperations aOperationType, TInt aServiceId ); |
|
136 |
|
137 |
|
138 /** |
|
139 * to get the list of availabe chats from server |
|
140 * @param aServiceId, service id used |
|
141 * @return list buffer |
|
142 */ |
|
143 TPtr8 GetChatListL( const TInt& aServiceId = -1); |
|
144 |
|
145 private: |
|
146 |
|
147 /** |
|
148 * CreateArgumentsL pack the given parameters |
|
149 * @param aServiceId service id to use |
|
150 * @param aUserId user id to use |
|
151 * @param aText,a text to send |
|
152 * @return TIpcArgs, packed arguments |
|
153 */ |
|
154 TIpcArgs CreateArgumentsL( TInt aServiceId, const TDesC& aText1 , |
|
155 const TDesC& aText2 ); |
|
156 |
|
157 /** |
|
158 * CreateArgumentsL pack the given parameters |
|
159 * @param aServiceId service id to use |
|
160 * @param aUserId user id to use |
|
161 * @return TIpcArgs, packed arguments |
|
162 */ |
|
163 TIpcArgs CreateArgumentsL( TInt aServiceId , |
|
164 const TDesC& aText ); |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 public: // MIMCacheClient |
|
170 |
|
171 /** |
|
172 * Registeres the cache update observer to server |
|
173 * @param aStatus status message to regisetr |
|
174 * @param aRight,right is operations |
|
175 */ |
|
176 void RegisterObserverToServerL( TRequestStatus& aStatus,EIMCacheOperations aRight ) ; |
|
177 |
|
178 |
|
179 /** |
|
180 * unRegisteres the cache update observer to server |
|
181 * @param aStatus status message to regisetr |
|
182 * @param aRight,right is operations |
|
183 */ |
|
184 void UnRegisterObserverToServerL( TRequestStatus& aStatus, EIMCacheOperations aRight ) ; |
|
185 |
|
186 /** |
|
187 * cancels any outstanding requests pending from the server |
|
188 * @param aStatus status message to regisetr |
|
189 * @param aRight,right is operations |
|
190 */ |
|
191 void CancelRequestL( TRequestStatus& aStatus, EIMCacheOperations aRight); |
|
192 |
|
193 /** |
|
194 * Gets called when data update is available. |
|
195 * Client can then decide wether to use the old one |
|
196 * @param aRight, operations |
|
197 * @param abuuferptr |
|
198 */ |
|
199 TPtr8 GetBufferedDataL(EIMCacheOperations aOperationType ); |
|
200 |
|
201 private: |
|
202 |
|
203 // owned , a array for all client who has |
|
204 // register update data change event |
|
205 CIMCacheEventHandler* iUpdateObserver; |
|
206 // owned , a array for all client who has |
|
207 // register update data change event |
|
208 CIMCacheAccessEventHandler* iAccessObserver; |
|
209 //owned buffer to get chats from server. |
|
210 HBufC8* iChatBuffer; |
|
211 |
|
212 }; |
|
213 |
|
214 #endif // __CIMCACHECLIENT_H__ |
|
215 |
|
216 |
|
217 // END OF FILE |
|
218 |