|
1 /* |
|
2 * Copyright (c) 2005 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: Session Slot Event container. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CPENGSESSIONSLOTEVENT_H__ |
|
19 #define __CPENGSESSIONSLOTEVENT_H__ |
|
20 |
|
21 // INCLUDES |
|
22 |
|
23 #include <e32base.h> |
|
24 #include "PEngPresenceEngineConsts2.h" |
|
25 |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CPEngSessionSlotId; |
|
29 class RWriteStream; |
|
30 class RReadStream; |
|
31 |
|
32 |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Presence Engine Session Slot Event container. |
|
38 * It is used infernally by the PE for transportation |
|
39 * of the slot event between the engine components. |
|
40 * |
|
41 * @since 3.0 |
|
42 */ |
|
43 class CPEngSessionSlotEvent : public CBase |
|
44 { |
|
45 public: |
|
46 /** |
|
47 * Instantiates CPEngSessionSlotEvent object. |
|
48 * |
|
49 * @return New CPEngSessionSlotEvent instance. |
|
50 */ |
|
51 IMPORT_C static CPEngSessionSlotEvent* NewL( ); |
|
52 IMPORT_C static CPEngSessionSlotEvent* NewLC( ); |
|
53 |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 ~CPEngSessionSlotEvent(); |
|
59 |
|
60 protected: |
|
61 |
|
62 /** |
|
63 * C++ constructor. |
|
64 */ |
|
65 CPEngSessionSlotEvent(); |
|
66 |
|
67 |
|
68 |
|
69 public: // Session slot state identifications |
|
70 |
|
71 /** |
|
72 * Session Slot ID identification |
|
73 * Gets the Session slot ID class from where the event came |
|
74 * |
|
75 * @since 3.0 |
|
76 * @return session slot ID class |
|
77 */ |
|
78 IMPORT_C const CPEngSessionSlotId& SessionSlotIndentification() const; |
|
79 |
|
80 /** |
|
81 * Application Id |
|
82 * |
|
83 * @since 3.0 |
|
84 * @return application Id |
|
85 */ |
|
86 IMPORT_C const TDesC& ApplicationId() const; |
|
87 |
|
88 /** |
|
89 * Global event |
|
90 * |
|
91 * @since 3.0 |
|
92 * @return session slot event |
|
93 */ |
|
94 IMPORT_C TPEngNWSessionSlotEvent Event() const; |
|
95 |
|
96 /** |
|
97 * Application session slot state |
|
98 * |
|
99 * @since 3.0 |
|
100 * @return session slot state |
|
101 */ |
|
102 IMPORT_C TPEngNWSessionSlotState AppSessSltState() const; |
|
103 |
|
104 /** |
|
105 * Global session slot state |
|
106 * |
|
107 * @since 3.0 |
|
108 * @return session slot state |
|
109 */ |
|
110 IMPORT_C TPEngNWSessionSlotState GlobSessSltState() const; |
|
111 |
|
112 /** |
|
113 * Additional event integer |
|
114 * |
|
115 * @since 3.0 |
|
116 * @return additional event integer |
|
117 */ |
|
118 IMPORT_C TInt EventInt() const; |
|
119 |
|
120 |
|
121 /** |
|
122 * Additional event descriptor |
|
123 * |
|
124 * @since 3.0 |
|
125 * @return additional event descriptor |
|
126 */ |
|
127 IMPORT_C const TDesC& EventDesc() const; |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 public: // Global Event management |
|
133 |
|
134 /** |
|
135 * Sets the session slot ID. |
|
136 * |
|
137 * @since 3.0 |
|
138 * @param aSlotId New session slot ID |
|
139 * @param aOwnershipTransfered ETrue if aSlotId ownership is |
|
140 * transfered to CPEngSessionSlotEvent instance |
|
141 */ |
|
142 IMPORT_C void SetSessionSlotId( CPEngSessionSlotId* aSlotId, |
|
143 TBool aOwnershipTransfered = EFalse ); |
|
144 |
|
145 /** |
|
146 * Sets application Id |
|
147 * |
|
148 * @since 3.0 |
|
149 * @param aApplicationId New application id |
|
150 */ |
|
151 IMPORT_C void SetAppIdL( const TDesC& aAppId ); |
|
152 |
|
153 |
|
154 /** |
|
155 * Sets session slot event |
|
156 * |
|
157 * @since 3.0 |
|
158 * @param aEvent New session slot event |
|
159 */ |
|
160 IMPORT_C void SetSessSltEvent( TPEngNWSessionSlotEvent aEvent ); |
|
161 |
|
162 |
|
163 /** |
|
164 * Sets application session slot state |
|
165 * |
|
166 * @since 3.0 |
|
167 * @param aState New application session slot state |
|
168 */ |
|
169 IMPORT_C void SetAppSessSltState( TPEngNWSessionSlotState aState ); |
|
170 |
|
171 |
|
172 /** |
|
173 * Sets new global session slot state |
|
174 * |
|
175 * @since 3.0 |
|
176 * @param aState New global session slot state |
|
177 */ |
|
178 IMPORT_C void SetGlobSessSltState( TPEngNWSessionSlotState aState ); |
|
179 |
|
180 |
|
181 /** |
|
182 * Sets additional event integer identification |
|
183 * |
|
184 * @since 3.0 |
|
185 * @param New additional event integer |
|
186 */ |
|
187 IMPORT_C void SetEventInt( TInt aEventInt ); |
|
188 |
|
189 /** |
|
190 * Set Event descriptor identification |
|
191 * |
|
192 * @since 3.0 |
|
193 * @param New additional event descriptor |
|
194 */ |
|
195 IMPORT_C void SetEventDesL( const TDesC& aEventDes ); |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 public: // Importing the state |
|
201 |
|
202 |
|
203 /** |
|
204 * Internalize session slot event. |
|
205 * |
|
206 * @since 3.0 |
|
207 * @param aStream read stream from to internalize |
|
208 * @param aAllData If ETrue, then all data including sesssion slot id |
|
209 * is internalized. Else only event part. |
|
210 */ |
|
211 IMPORT_C void InternalizeL( RReadStream& aStream, |
|
212 TBool aAllData = ETrue ); |
|
213 |
|
214 /** |
|
215 * Unpacks session slot event from |
|
216 * the descriptor buffer |
|
217 * |
|
218 * @since 3.0 |
|
219 * @param Descriptor containing session slot event |
|
220 * in streamed format. |
|
221 */ |
|
222 IMPORT_C void UnpackEventL( const TDesC8& aDes ); |
|
223 |
|
224 |
|
225 /** |
|
226 * Unpacks session slot event's event part from |
|
227 * the descriptor buffer. |
|
228 * |
|
229 * @since 3.0 |
|
230 * @param Descriptor containing session slot event |
|
231 * in streamed format. Only event part is supposed |
|
232 * to be found from the descriptor. |
|
233 */ |
|
234 IMPORT_C void UnpackEventPartL( const TDesC8& aDes ); |
|
235 |
|
236 |
|
237 |
|
238 public: // Exporting the state |
|
239 |
|
240 /** |
|
241 * Externalize session slot event |
|
242 * |
|
243 * @since 3.0 |
|
244 * @param aStream write stream to externalize the event. |
|
245 * @param aAllData If ETrue, then all data is externalized. |
|
246 * Else only event part. |
|
247 */ |
|
248 IMPORT_C void ExternalizeL( RWriteStream& aStream, |
|
249 TBool aAllData = ETrue ) const; |
|
250 |
|
251 |
|
252 /** |
|
253 * Returns size of the buffer needed for |
|
254 * streaming the session slot event instance. |
|
255 * |
|
256 * @since 3.0 |
|
257 * @param aAllData If ETrue, then size is calculated for all data. |
|
258 * Else size is calculated only for event part. |
|
259 * @return size of the buffer in bytes |
|
260 */ |
|
261 IMPORT_C TInt Size( TBool aAllData = ETrue ) const; |
|
262 |
|
263 |
|
264 /** |
|
265 * Packs full event into descriptor buffer. |
|
266 * |
|
267 * @since 3.0 |
|
268 * @return Descriptor buffer containing full session |
|
269 * slot event data in streamed format. Returns |
|
270 * the buffer ownership. |
|
271 */ |
|
272 IMPORT_C HBufC8* PackEventLC(); |
|
273 |
|
274 IMPORT_C void PackEventL( RBuf8& aBuf ); |
|
275 |
|
276 |
|
277 /** |
|
278 * Packs only event part of the session slot event |
|
279 * container into descriptor buffer. |
|
280 * |
|
281 * @since 3.0 |
|
282 * @return Descriptor buffer containing session |
|
283 * slot event's event part data in streamed format. |
|
284 * Returns the buffer ownership. |
|
285 */ |
|
286 IMPORT_C HBufC8* PackEventPartLC(); |
|
287 |
|
288 |
|
289 private: //Data |
|
290 |
|
291 //OWN/REF: Session Slot ID |
|
292 CPEngSessionSlotId* iSessionId; |
|
293 |
|
294 //OWN: Is previous session Id owned |
|
295 TBool iIdentificationOwned; |
|
296 |
|
297 //OWN: Application Id |
|
298 HBufC* iApplicationId; |
|
299 |
|
300 //OWN: Session event |
|
301 TPEngNWSessionSlotEvent iEvent; |
|
302 |
|
303 //OWN: Application Session Slot state |
|
304 TPEngNWSessionSlotState iAppSessState; |
|
305 |
|
306 //OWN: Global Session Slot state |
|
307 TPEngNWSessionSlotState iGlobSessState; |
|
308 |
|
309 //OWN: Event integer value |
|
310 TInt iEventInt; |
|
311 |
|
312 //OWN: Event descriptor value |
|
313 HBufC* iEventDesc; |
|
314 }; |
|
315 |
|
316 #endif // __CPENGSESSIONSLOTEVENT_H__ |
|
317 |
|
318 // End of File |