|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : sipprofilestatewaitforiap.cpp |
|
15 // Part of : Sip Profile Server |
|
16 // implementation |
|
17 // Version : 1.0 |
|
18 // |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include "sipprofilestatewaitforiap.h" |
|
24 #include "SipProfileServerCore.h" |
|
25 #include "sipconcreteprofile.h" |
|
26 #include "SipProfileCacheItem.h" |
|
27 #include "sipplugindirector.h" |
|
28 #include "sipalrmonitor.h" |
|
29 #include "SipProfileLog.h" |
|
30 |
|
31 |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CSIPProfileStateWaitForIAP::NewL |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CSIPProfileStateWaitForIAP* |
|
40 CSIPProfileStateWaitForIAP::NewL(CSIPPluginDirector& aDirector) |
|
41 { |
|
42 return new (ELeave) CSIPProfileStateWaitForIAP(aDirector); |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CSIPProfileStateWaitForIAP::CSIPProfileStateWaitForIAP |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CSIPProfileStateWaitForIAP::CSIPProfileStateWaitForIAP( |
|
50 CSIPPluginDirector& aDirector): |
|
51 CSIPProfileState(aDirector) |
|
52 { |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CSIPProfileStateWaitForIAP::~CSIPProfileStateWaitForIAP |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CSIPProfileStateWaitForIAP::~CSIPProfileStateWaitForIAP() |
|
60 { |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CSIPProfileStateWaitForIAP::Name |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CSIPConcreteProfile::TStatus CSIPProfileStateWaitForIAP::Name() const |
|
68 { |
|
69 return static_cast<CSIPConcreteProfile::TStatus>(EWaitForIAP); |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CSIPProfileStateWaitForIAP::EnableL |
|
74 // EnableL is used by a profile that doesn't have a SNAP configured, and it |
|
75 // should not be in this state. |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CSIPProfileStateWaitForIAP::EnableL( |
|
79 CSIPProfileCacheItem& aItem, |
|
80 const MSIPExtendedConcreteProfileObserver& /*aObserver*/) |
|
81 { |
|
82 TUint profileId(aItem.ProfileId()); |
|
83 PROFILE_DEBUG3("ProfileStateWaitForIAP::EnableL(profile id)", profileId) |
|
84 |
|
85 User::Leave(KErrArgument); |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CSIPProfileStateWaitForIAP::EnableSnapInUseL |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void CSIPProfileStateWaitForIAP::EnableSnapInUseL( |
|
93 CSIPProfileCacheItem& aItem, |
|
94 const MSIPExtendedConcreteProfileObserver& aObserver, |
|
95 TUint32 /*aSnapId*/) |
|
96 { |
|
97 PROFILE_DEBUG3("ProfileStateWaitForIAP::EnableSnapInUseL id,snap", |
|
98 aItem.ProfileId()) |
|
99 |
|
100 DoCommonEnableL(aItem, aObserver); |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // CSIPProfileStateWaitForIAP::DisableL |
|
105 // Waiting for IAP, so actual registration has not started yet. |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 void CSIPProfileStateWaitForIAP::DisableL(CSIPProfileCacheItem& aItem, |
|
109 const MSIPExtendedConcreteProfileObserver& aObserver) |
|
110 { |
|
111 PROFILE_DEBUG3("ProfileStateWaitForIAP::DisableL id", aItem.ProfileId()) |
|
112 |
|
113 DisableWhileWaitingIAPL(aItem, aObserver, *iUnregInProg, *iUnregistered); |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CSIPProfileStateWaitForIAP::SetNeighbourStates |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void CSIPProfileStateWaitForIAP::SetNeighbourStates( |
|
121 CSIPProfileState& aWaitForPermission, |
|
122 CSIPProfileState& aRegInProg, |
|
123 CSIPProfileState& aUnregInProg, |
|
124 CSIPProfileState& aUnregistered) |
|
125 { |
|
126 iWaitForPermission = &aWaitForPermission; |
|
127 iRegInProg = &aRegInProg; |
|
128 iUnregInProg = &aUnregInProg; |
|
129 iUnregistered = &aUnregistered; |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // CSIPProfileStateWaitForIAP::RegistrationStatusEventL |
|
134 // Called when an action has succeeded. But as registration was not started yet, |
|
135 // this should not be called. |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 void CSIPProfileStateWaitForIAP::RegistrationStatusEventL( |
|
139 CSIPProfileCacheItem& /*aItem*/, |
|
140 CSIPConcreteProfile::TStatus /*aStatus*/) |
|
141 { |
|
142 // No action |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CSIPProfileStateWaitForIAP::ErrorOccurred |
|
147 // CSIPProfileCacheItem::HandleError calls SetLastRegistrationError. No need to |
|
148 // call it here. |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 TBool CSIPProfileStateWaitForIAP::ErrorOccurred(CSIPProfileCacheItem& aItem, |
|
152 TInt /*aError*/) |
|
153 { |
|
154 PROFILE_DEBUG3("ProfileStateWaitForIAP::ErrorOccurred(profile id)", |
|
155 aItem.ProfileId()) |
|
156 DoCommonErrorOccurred(aItem); |
|
157 return ETrue; |
|
158 } |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // CSIPProfileStateWaitForIAP::IapAvailableL |
|
162 // Registration doesn't exist in this state. Don't ask permission from clients. |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 void CSIPProfileStateWaitForIAP::IapAvailableL(CSIPProfileCacheItem& aItem, |
|
166 TUint32 aSnapId, |
|
167 TUint32 aNewIapId) |
|
168 { |
|
169 PROFILE_DEBUG5("ProfileStateWaitForIAP::IapAvailableL id,snap,iap", |
|
170 aItem.ProfileId(), |
|
171 aSnapId, |
|
172 aNewIapId) |
|
173 |
|
174 aItem.HandleNewIapL(aSnapId, aNewIapId, EFalse, *iWaitForPermission); |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CSIPProfileStateWaitForIAP::ShouldRefreshIAPs |
|
179 // Even if aItem.HasProfileUpdate()==ETrue, refresh IAPs as update is queued in |
|
180 // this state. |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 TBool CSIPProfileStateWaitForIAP::ShouldRefreshIAPs( |
|
184 CSIPProfileCacheItem& /*aItem*/) const |
|
185 { |
|
186 return ETrue; |
|
187 } |
|
188 |
|
189 // ----------------------------------------------------------------------------- |
|
190 // CSIPProfileStateWaitForIAP::IsAlrState |
|
191 // ----------------------------------------------------------------------------- |
|
192 // |
|
193 TBool CSIPProfileStateWaitForIAP::IsAlrState() const |
|
194 { |
|
195 return ETrue; |
|
196 } |
|
197 |
|
198 // ----------------------------------------------------------------------------- |
|
199 // CSIPProfileStateWaitForIAP::NoNewIapAvailable |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 void CSIPProfileStateWaitForIAP::NoNewIapAvailable(CSIPProfileCacheItem& aItem) |
|
203 { |
|
204 TInt retryCounter = aItem.SnapRetryCounter(); |
|
205 PROFILE_DEBUG3("CSIPProfileStateWaitForIAP::NoNewIapAvailable, retries", |
|
206 retryCounter) |
|
207 |
|
208 aItem.SetSnapRetryCounter(aItem.SnapRetryCounter() + 1); |
|
209 } |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 // CSIPProfileStateWaitForIAP::CanBePermanentlyRemoved |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 TBool CSIPProfileStateWaitForIAP::CanBePermanentlyRemoved |
|
216 (const CSIPProfileCacheItem& /*aItem*/) const |
|
217 { |
|
218 return ETrue; |
|
219 } |