1 /* |
|
2 * Copyright (c) 2002-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: Creates SMS message if Event in MailBox has occurred |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef IPVMBXBASE_H |
|
21 #define IPVMBXBASE_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <sipprofile.h> |
|
25 |
|
26 #include "ipvmbxconstants.h" |
|
27 |
|
28 |
|
29 class CMceOutEvent; |
|
30 class CMceManager; |
|
31 class CSIPProfile; |
|
32 class CIpVmbxEngine; |
|
33 |
|
34 |
|
35 /** |
|
36 * Creates SMS message if Event in MailBox has occurred. |
|
37 * |
|
38 * @lib ipvmbxengine.dll |
|
39 */ |
|
40 NONSHARABLE_CLASS( CIpVmbxBase ) : public CBase |
|
41 { |
|
42 |
|
43 public: |
|
44 |
|
45 /** States for base class */ |
|
46 enum TIpVmbxBaseStates |
|
47 { |
|
48 ESubscribing, |
|
49 ERegistered, |
|
50 ETerminating, |
|
51 EDisabled |
|
52 }; |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * |
|
57 * @param aVmbxEngine Instance to engine |
|
58 * @param aVoiceMailUri Address of voice mail account |
|
59 * @param aMceManager Manager instance of IPVME |
|
60 * @return Created base class |
|
61 */ |
|
62 static CIpVmbxBase* NewL( |
|
63 CIpVmbxEngine& aVmbxEngine, |
|
64 TDesC8& aVoiceMailUri8, |
|
65 CMceManager& aMceManager ); |
|
66 |
|
67 /** |
|
68 * Destructor. |
|
69 */ |
|
70 virtual ~CIpVmbxBase(); |
|
71 |
|
72 /** |
|
73 * Set changing parameters for spescfic voice mail account. |
|
74 * |
|
75 * @param aServiceProviderId Service provider id |
|
76 * @param aSipProfile Sip profile |
|
77 */ |
|
78 void Initialize( |
|
79 TUint32 aServiceProviderId, |
|
80 CSIPProfile& aSipProfile ); |
|
81 |
|
82 /** |
|
83 * Subscribes to mail server. If refresh value is not entered, |
|
84 * defaults to KReSubscribe. |
|
85 * |
|
86 * @param aReSubscribe Parameter for refresh initiated by IPVME |
|
87 */ |
|
88 void SubscribeL( TInt aReSubscribe ); |
|
89 |
|
90 /** |
|
91 * Unsubscribes from mail server. |
|
92 */ |
|
93 void TerminateEventL(); |
|
94 |
|
95 /** |
|
96 * Cleans MceEvent instance. |
|
97 */ |
|
98 void DeleteEvent(); |
|
99 |
|
100 /** |
|
101 * Update status of voice mails. |
|
102 */ |
|
103 static TInt ReSubscribe( TAny* aThis ); |
|
104 |
|
105 /** |
|
106 * Cancel resubscribe timer |
|
107 */ |
|
108 void Cancel(); |
|
109 |
|
110 /** |
|
111 * Get service provider data |
|
112 * |
|
113 * @return Service id |
|
114 */ |
|
115 TUint32 ServiceProviderId() const; |
|
116 |
|
117 /** |
|
118 * Account uri to which app base has connected |
|
119 * |
|
120 * @return MBX account |
|
121 */ |
|
122 const TDesC8& VmbxUrl() const; |
|
123 |
|
124 /** |
|
125 * Sets base state to connected state and starts |
|
126 * resubscription process. |
|
127 */ |
|
128 void SetStateRegistered(); |
|
129 |
|
130 /** |
|
131 * State of base class |
|
132 * |
|
133 * @return State of base class |
|
134 */ |
|
135 CIpVmbxBase::TIpVmbxBaseStates State() const; |
|
136 |
|
137 /** |
|
138 * Save current message state of mailbox |
|
139 * |
|
140 * @param Total messages |
|
141 * @param New messages |
|
142 */ |
|
143 void SetAccountMessageCount( TInt aTotalCount, TInt aNewCount ); |
|
144 |
|
145 /** |
|
146 * Get previous message state of mailbox |
|
147 * |
|
148 * @param Total messages |
|
149 * @param New messages |
|
150 */ |
|
151 void AccountMessageCount( TInt& aTotalCount, TInt& aNewCount); |
|
152 |
|
153 private: |
|
154 |
|
155 void ConstructL( TDesC8& aVoiceMailUri8 ); |
|
156 |
|
157 /** |
|
158 * C++ default constructor. |
|
159 * |
|
160 * @param aVmbxEngine Engine instance to send status messages |
|
161 * @param aVoiceMailUri Uri which this base class will subscribe |
|
162 * @param aMceManager Required manager instance for outbound connections |
|
163 */ |
|
164 CIpVmbxBase( |
|
165 CIpVmbxEngine& aVmbxEngine, |
|
166 CMceManager& aMceManager ); |
|
167 |
|
168 private: // Data |
|
169 |
|
170 /** |
|
171 * SIP profile information |
|
172 * Not own. |
|
173 */ |
|
174 CSIPProfile* iSipProfile; |
|
175 |
|
176 /** |
|
177 * MO events |
|
178 * Own. |
|
179 */ |
|
180 CMceOutEvent* iMceOutEvent; |
|
181 |
|
182 /** |
|
183 * MCE server connection |
|
184 */ |
|
185 CMceManager& iMceManager; |
|
186 |
|
187 /** |
|
188 * Re SUBSCRIBE timer |
|
189 * Own. |
|
190 */ |
|
191 CDeltaTimer* iReSubscribe; |
|
192 |
|
193 /** |
|
194 * Re SUBSCRIBE period |
|
195 */ |
|
196 TTimeIntervalMicroSeconds iReSubscribePeriod; |
|
197 |
|
198 /** |
|
199 * State of base class |
|
200 */ |
|
201 TIpVmbxBaseStates iState; |
|
202 |
|
203 /** |
|
204 * Id of service this base class is using |
|
205 */ |
|
206 TUint32 iServiceProviderId; |
|
207 |
|
208 /** |
|
209 * Uri this base class is monitoring |
|
210 */ |
|
211 TBuf8< KMaxIpVoiceMailBoxUriLength > iVmbxUri8; |
|
212 |
|
213 /** |
|
214 * Server total messages |
|
215 */ |
|
216 TInt iTotalMessageCount; |
|
217 |
|
218 /** |
|
219 * Server new messages |
|
220 */ |
|
221 TInt iNewMessageCount; |
|
222 |
|
223 /** |
|
224 * Amount of pending resubscribes |
|
225 */ |
|
226 TInt iPendingResubscribeCount; |
|
227 |
|
228 /** |
|
229 * Message sender |
|
230 */ |
|
231 CIpVmbxEngine& iVmbxEngine; |
|
232 |
|
233 /** |
|
234 * Re subscribe callback |
|
235 */ |
|
236 TDeltaTimerEntry iUpdateEvent; |
|
237 |
|
238 |
|
239 EUNIT_IMPLEMENTATION |
|
240 }; |
|
241 |
|
242 #endif // IPVMBXBASE_H |
|