1 /* |
|
2 * Copyright (c) 2007-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: single entry context observer implementation class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CIMCVENGINECONTEXTOBSERVER_H_ |
|
20 #define CIMCVENGINECONTEXTOBSERVER_H_ |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <ximpcontextobserver.h> |
|
26 #include <ximpcontext.h> |
|
27 #include <ximpcontextstate.h> |
|
28 #include "mimcvenginenewmessagehandler.h" |
|
29 |
|
30 // CLASS DESCRIPTION |
|
31 |
|
32 class TIMCVStateEnums |
|
33 { |
|
34 public: |
|
35 enum TIMCVOpersationState |
|
36 { |
|
37 EIMCVUnknown = -1, |
|
38 EIMCVLogging, |
|
39 EIMCVLoggingOut, |
|
40 EIMCVSendingMsg |
|
41 }; |
|
42 }; |
|
43 |
|
44 /** |
|
45 * ximp context observer for usage scenario tests. |
|
46 */ |
|
47 class CIMCVEngineContextObserver : public CBase, |
|
48 public MXIMPContextObserver, |
|
49 public MIMCVEngineServiceSessionObserver |
|
50 |
|
51 |
|
52 |
|
53 { |
|
54 |
|
55 enum TXIMPReqType |
|
56 { |
|
57 EReqUnknown = -1, |
|
58 ELoginReq, |
|
59 ELogoutReq |
|
60 }; |
|
61 |
|
62 public: |
|
63 |
|
64 |
|
65 /** |
|
66 * Two-phased constructor. |
|
67 */ |
|
68 static CIMCVEngineContextObserver* NewL(); |
|
69 /** |
|
70 * Two-phased constructor. |
|
71 */ |
|
72 static CIMCVEngineContextObserver* NewLC(); |
|
73 |
|
74 /** |
|
75 * CIMCVEngineContextObserver |
|
76 */ |
|
77 CIMCVEngineContextObserver(); |
|
78 |
|
79 /** |
|
80 * ~CIMCVEngineContextObserver |
|
81 */ |
|
82 ~CIMCVEngineContextObserver(); |
|
83 |
|
84 /** |
|
85 * GetConnectedSessionL |
|
86 * bind to the same session to the ximpfw |
|
87 *@param aContext, context to ximpfw |
|
88 *@param aProtocolUid, uid of protocol used |
|
89 */ |
|
90 |
|
91 void GetConnectedSessionL(MXIMPContext& aContext, TInt aServiceId, TUid aProtocolUid ); |
|
92 /** |
|
93 * ReleaseConnectionL |
|
94 * releasse the session to the ximpfw |
|
95 *@param aContext, context to ximpfw |
|
96 */ |
|
97 void ReleaseConnectionL(MXIMPContext& aContext); |
|
98 |
|
99 /** |
|
100 * IsLoggedIn |
|
101 * return ETrue if binded |
|
102 */ |
|
103 TBool IsLoggedIn() const; |
|
104 |
|
105 /** |
|
106 * SetLoggedIn |
|
107 * ETrue if binded |
|
108 */ |
|
109 void SetLoggedIn(TBool aState) ; |
|
110 |
|
111 public : // MIMCVEngineServiceSessionObserver |
|
112 |
|
113 /** |
|
114 * RegisterObserver |
|
115 * register to listen the new message |
|
116 */ |
|
117 void RegisterObserver(MIMCVEngineServiceSessionHandler* aObserver) ; |
|
118 /** |
|
119 * UnRegisterObserver |
|
120 * unregister the message observer |
|
121 */ |
|
122 void UnRegisterObserver(MIMCVEngineServiceSessionHandler* aObserver) ; |
|
123 |
|
124 |
|
125 public: |
|
126 |
|
127 /** |
|
128 * HandleximpContextEvent method from context obsrver |
|
129 * ximp framework |
|
130 * @param aContext |
|
131 * @param aEvent, event |
|
132 */ |
|
133 |
|
134 void HandlePresenceContextEvent( const MXIMPContext& aContext, |
|
135 const MXIMPBase& aEvent ); |
|
136 |
|
137 |
|
138 private: |
|
139 |
|
140 |
|
141 /** |
|
142 *constructL |
|
143 */ |
|
144 void ConstructL(); |
|
145 |
|
146 private: //Data |
|
147 |
|
148 |
|
149 //OWN: Result code from waited request |
|
150 // owned |
|
151 TBool iLoggedIn; |
|
152 // login state |
|
153 |
|
154 //owned , to handle the recieving ,messages |
|
155 MIMCVEngineServiceSessionHandler* iSessionObserver; |
|
156 |
|
157 // owned, wait for login\logout to complete |
|
158 CActiveSchedulerWait iWait; |
|
159 |
|
160 // ongoing reuest id |
|
161 TIMCVStateEnums::TIMCVOpersationState iOngoingOperation; |
|
162 |
|
163 TXIMPRequestId iCurrentXIMPReq; |
|
164 |
|
165 TXIMPReqType iCurrentReqType; |
|
166 |
|
167 }; |
|
168 |
|
169 |
|
170 |
|
171 #endif //CConversationContextObserver_H_ |
|
172 |
|
173 |
|