|
1 /* |
|
2 * Copyright (c) 2005-2007 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 * Version : %version: 15.1.5 % << Don't touch! Updated by Synergy at check-out. |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: Provide interface for the client requestin register availability. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __MUSAVAREGISTERAVAILABILITY_H__ |
|
22 #define __MUSAVAREGISTERAVAILABILITY_H___ |
|
23 |
|
24 |
|
25 #include "musunittesting.h" |
|
26 #include "musavaavailability.h" |
|
27 #include "musavasipconnectionadapter.h" |
|
28 #include "musavasipprofileregistryadapter.h" |
|
29 #include <sipprofileregistryobserver.h> |
|
30 #include <e32base.h> |
|
31 |
|
32 |
|
33 class CMusAvaSettingsImp; |
|
34 class CSIPProfileRegistry; |
|
35 class CSIPProfile; |
|
36 class MMusAvaObserver; |
|
37 class CMusAvaSharedObject; |
|
38 class CSIPProfile; |
|
39 class CSIPProfileRegistry; |
|
40 class CSIPConnection; |
|
41 |
|
42 |
|
43 /** |
|
44 * Implemets register vailability. |
|
45 * |
|
46 * Provide interface for the client to availability class. |
|
47 * |
|
48 * @lib musavailabilityplugin.lib |
|
49 * @since S60 v3.2 |
|
50 */ |
|
51 class CMusAvaRegisterAvailability : public CMusAvaAvailability, |
|
52 public MMusAvaSipProfileRegistryAdapter |
|
53 { |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Two-phased constructor |
|
58 * |
|
59 * @param aObserver Pointer to observer intercase |
|
60 * @param aModules is data container |
|
61 * @return Returns pointer to CMusAvaInterface object |
|
62 */ |
|
63 static CMusAvaRegisterAvailability* NewL( |
|
64 MMusAvaAvailabilityObserver& aObserver, |
|
65 CMusAvaSettingsImp& aSettings ); |
|
66 |
|
67 |
|
68 static CMusAvaRegisterAvailability* NewLC( |
|
69 MMusAvaAvailabilityObserver& aObserver, |
|
70 CMusAvaSettingsImp& aSettings ); |
|
71 |
|
72 /** |
|
73 * Destructor |
|
74 */ |
|
75 |
|
76 ~CMusAvaRegisterAvailability(); |
|
77 |
|
78 protected: |
|
79 |
|
80 /** |
|
81 * Constructor |
|
82 * |
|
83 * @param aObserver Pointer to observer intercase |
|
84 * @param aName availability name |
|
85 * @param aModules is data container |
|
86 * @return |
|
87 */ |
|
88 CMusAvaRegisterAvailability( |
|
89 MMusAvaAvailabilityObserver& aObserver, |
|
90 CMusAvaSettingsImp& aSettings ); |
|
91 |
|
92 void ConstructL(); |
|
93 |
|
94 // from base class CMusAvaAvailability |
|
95 |
|
96 public: |
|
97 |
|
98 /** |
|
99 * Executes for the availability. |
|
100 */ |
|
101 virtual void DoExecuteL(); |
|
102 |
|
103 /** |
|
104 * Stop the execution. |
|
105 */ |
|
106 virtual void Stop(); |
|
107 |
|
108 /** |
|
109 * From CMusAvaAvailability. |
|
110 * Returns availability name. |
|
111 * |
|
112 * @return Name of *this* availability. |
|
113 */ |
|
114 virtual MMusAvaObserver::TAvailabilityName Name(); |
|
115 |
|
116 // from base class MSIPProfileRegistryObserver |
|
117 |
|
118 public: |
|
119 |
|
120 /** |
|
121 * An event related to SIP Profile has accorred |
|
122 * @param aProfileId a profile Id |
|
123 * @param aEvent an occurred event |
|
124 **/ |
|
125 virtual void ProfileRegistryEventOccurred( |
|
126 TUint32 aProfileId, |
|
127 MSIPProfileRegistryObserver::TEvent aEvent ); |
|
128 |
|
129 /** |
|
130 * An asynchronous error has occurred related to SIP profile |
|
131 * Event is send to those observers, who have the |
|
132 * corresponding profile instantiated. |
|
133 * @param aProfileId the id of failed profile |
|
134 * @param aError an occurred error |
|
135 */ |
|
136 virtual void ProfileRegistryErrorOccurred( |
|
137 TUint32 aProfileId, |
|
138 TInt aError ); |
|
139 |
|
140 // from base class MMusAvaSipConnectionAdapter |
|
141 |
|
142 public: |
|
143 |
|
144 /** |
|
145 * Connection state has changed. |
|
146 * If connection state has changed to EInactive or EUnavailable, |
|
147 * SIP stack has removed all stand-alone SIP refreshes, registrations |
|
148 * and dialog associations that client requested to refresh. Client may |
|
149 * re-issue refresh requests (stand-alone, registration or dialog |
|
150 * association related) when connection becomes EActive again. |
|
151 * SIP stack also terminates all pending SIP client transactions and no |
|
152 * errors are reported back to the client about the terminated |
|
153 * transactions nor about removed refreshes in order to avoid event |
|
154 * flood. |
|
155 * |
|
156 * @param aState indicates the current connection state |
|
157 */ |
|
158 TInt ConnectionStateChanged (CSIPConnection::TState aState ); |
|
159 |
|
160 |
|
161 private: // Helpers |
|
162 |
|
163 /** |
|
164 * Creates proposal sip address and send event. |
|
165 * |
|
166 */ |
|
167 void CreateSipAddressProposalL(); |
|
168 |
|
169 /** |
|
170 * Enables SIP Register. |
|
171 * |
|
172 */ |
|
173 void EnableRegisterL(); |
|
174 |
|
175 /** |
|
176 * Initialize SIP Register request. |
|
177 * |
|
178 * @return ETrue if Register request was initialized |
|
179 * successfully; EFalse otherwise |
|
180 */ |
|
181 TBool InitializeRegister(); |
|
182 |
|
183 /** |
|
184 * Send SIP Register request. |
|
185 * |
|
186 * @return ETrue if Register operation was |
|
187 * successfully executed; EFalse otherwise |
|
188 */ |
|
189 TBool RegisterL(); |
|
190 |
|
191 /** |
|
192 * Update SIP profile for general data. |
|
193 * |
|
194 * @return ETrue if SIP Profile was found; |
|
195 * EFalse otherwise |
|
196 */ |
|
197 TBool UpdateSIPProfile(); |
|
198 |
|
199 /** |
|
200 * Current SIP profile status. |
|
201 * |
|
202 * @return ETrue if SIP Profile is registred; |
|
203 * EFalse otherwise |
|
204 */ |
|
205 TBool RegistrationStatusL(); |
|
206 |
|
207 private: // Data |
|
208 |
|
209 /** |
|
210 * Pointer to CMusAvaSharedObject object |
|
211 */ |
|
212 CMusAvaSharedObject* iSharedObj; |
|
213 |
|
214 /** |
|
215 * Pointer to CSIPProfileRegistry object |
|
216 */ |
|
217 CSIPProfileRegistry* iRegistry; |
|
218 |
|
219 /** |
|
220 * Reference to CMusAvaSettingsImp object |
|
221 */ |
|
222 CMusAvaSettingsImp& iSettings; |
|
223 |
|
224 /** |
|
225 * Pointer to CSIPConnection object |
|
226 */ |
|
227 CSIPConnection* iConnection; |
|
228 |
|
229 |
|
230 MUS_UNITTEST( UT_CMusAvaRegisterAvailability ) |
|
231 }; |
|
232 |
|
233 |
|
234 #endif // __MUSAVAREGISTERAVAILABILITY_H__ |