170 // ConstructL |
166 // ConstructL |
171 // ----------------------------------------------------------------------------- |
167 // ----------------------------------------------------------------------------- |
172 // |
168 // |
173 void CHotSpotServer::ConstructL() |
169 void CHotSpotServer::ConstructL() |
174 { |
170 { |
175 |
|
176 DEBUG("**** HotSpotServer: CHotSpotServer::ConstructL"); |
171 DEBUG("**** HotSpotServer: CHotSpotServer::ConstructL"); |
177 StartL( KHotSpotServerName ); |
172 StartL( KHotSpotServerName ); |
178 |
173 |
179 iIapCheckValue = EFalse; |
174 iIapCheckValue = EFalse; |
180 iLogoutSent = EFalse; |
175 iLogoutSent = EFalse; |
181 iLoginValue = ETrue; |
176 iLoginValue = ETrue; |
182 iAssociationValue = EFalse; |
177 iAssociationValue = EFalse; |
183 |
178 |
184 #ifndef __WINS__ |
179 // Activate notifications for IAP check purposes. Done with every server startup. |
185 |
|
186 // Change config daemon for Easy WLAN access point |
|
187 iConfigDaemonChanged = KErrNone; |
|
188 TBool retVal( EFalse ); |
|
189 iEasyWlanId = KEasyWlanServiceId; // Set to default value |
|
190 TRAPD( leave, retVal = EasyWlanIdL() ); |
|
191 if ( KErrNone != leave ) |
|
192 { |
|
193 iConfigDaemonChanged = leave; |
|
194 } |
|
195 if ( !retVal ) |
|
196 { |
|
197 iConfigDaemonChanged = KErrGeneral; |
|
198 } |
|
199 DEBUG1("**** HotSpotServer: CHotSpotServer::ConstructL iConfigDaemonChanged: %d", iConfigDaemonChanged ); |
|
200 #endif |
|
201 // Activate notifications for IAP check purposes |
|
202 // When EWlanConnectionModeNotConnected is received we can cancel this and |
180 // When EWlanConnectionModeNotConnected is received we can cancel this and |
203 // we know that it safe to go through IAPs. |
181 // we know that it safe to go through IAPs. |
204 iMgtClient = CWlanMgmtClient::NewL(); |
182 iMgtClient = CWlanMgmtClient::NewL(); |
205 #ifndef __WINS__ |
183 #ifndef __WINS__ |
206 iMgtClient->ActivateNotificationsL( *this ); |
184 iMgtClient->ActivateNotificationsL( *this ); |
207 #endif |
185 #endif |
208 } |
186 } |
209 |
187 |
210 // ----------------------------------------------------------------------------- |
188 // ----------------------------------------------------------------------------- |
211 // ConnectionStateChanged |
189 // ConnectionStateChanged |
219 if ( iMgtClient != NULL ) |
197 if ( iMgtClient != NULL ) |
220 { |
198 { |
221 #ifndef __WINS__ |
199 #ifndef __WINS__ |
222 iMgtClient->CancelNotifications(); |
200 iMgtClient->CancelNotifications(); |
223 #endif |
201 #endif |
224 DEBUG("CHotSpotServer::ConnectionStateChanged2"); |
|
225 } |
202 } |
226 |
203 |
227 TRAPD(err, CheckIapsL()); |
204 TRAPD(err, CheckIapsL()); |
228 if ( err != KErrNone ) |
205 if ( err != KErrNone ) |
229 { |
206 { |
230 DEBUG1("CHotSpotServer::ConnectionStateChanged(): %d", err); |
207 DEBUG1("CHotSpotServer::ConnectionStateChanged(): %d", err); |
231 } |
208 } |
232 if ( iConfigDaemonChanged != KErrNone ) |
209 } |
233 { |
|
234 // ConstructL call leaved. Let's call again once more. |
|
235 TRAP_IGNORE( EasyWlanIdL() ); |
|
236 } |
|
237 } |
|
238 } |
210 } |
239 |
211 |
240 // ----------------------------------------------------------------------------- |
212 // ----------------------------------------------------------------------------- |
241 // CheckIapsL |
213 // CheckIapsL |
242 // ----------------------------------------------------------------------------- |
214 // ----------------------------------------------------------------------------- |
531 ReStart(); |
503 ReStart(); |
532 return (KErrNone); |
504 return (KErrNone); |
533 } |
505 } |
534 |
506 |
535 // ----------------------------------------------------------------------------- |
507 // ----------------------------------------------------------------------------- |
536 // EasyWlanIdL |
|
537 // ----------------------------------------------------------------------------- |
|
538 // |
|
539 TBool CHotSpotServer::EasyWlanIdL() |
|
540 { |
|
541 TBool ret( EFalse ); |
|
542 DEBUG("CHotSpotServer::EasyWlanIdL()"); |
|
543 RCmManagerExt cmManager; |
|
544 cmManager.OpenL(); |
|
545 CleanupClosePushL( cmManager ); |
|
546 |
|
547 iEasyWlanId = cmManager.EasyWlanIdL(); |
|
548 DEBUG1("CHotSpotServer::EasyWlanIdL() ret: % d", iEasyWlanId); |
|
549 // if iEasyWlanId is 0, then it was not found |
|
550 if ( iEasyWlanId > 0 ) |
|
551 { |
|
552 RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( iEasyWlanId ); |
|
553 CleanupClosePushL( plugin ); |
|
554 //iEasyWlanId = plugin.GetIntAttributeL( /*ECmIapServiceId*/EWlanServiceId ) |
|
555 plugin.SetStringAttributeL( ECmConfigDaemonManagerName, KHotSpotPlugin ); |
|
556 // commit changes |
|
557 plugin.UpdateL(); |
|
558 CleanupStack::PopAndDestroy( &plugin ); // Close() called on "plugin" |
|
559 ret = ETrue; |
|
560 } |
|
561 CleanupStack::PopAndDestroy( &cmManager ); |
|
562 DEBUG("CHotSpotServer::EasyWlanIdL() DONE"); |
|
563 return ret; |
|
564 } |
|
565 |
|
566 // ----------------------------------------------------------------------------- |
|
567 // GetEasyWlanId |
|
568 // ----------------------------------------------------------------------------- |
|
569 // |
|
570 TUint32 CHotSpotServer::GetEasyWlanId() |
|
571 { |
|
572 return iEasyWlanId; |
|
573 } |
|
574 |
|
575 // ----------------------------------------------------------------------------- |
|
576 // GetLoginTimerMicroSecs |
508 // GetLoginTimerMicroSecs |
577 // ----------------------------------------------------------------------------- |
509 // ----------------------------------------------------------------------------- |
578 // |
510 // |
579 TUint CHotSpotServer::GetLoginTimeMicroSecs( TUid aClientUid ) |
511 TUint CHotSpotServer::GetLoginTimeMicroSecs( TUid aClientUid ) |
580 { |
512 { |