138 else |
142 else |
139 { |
143 { |
140 //RunL status error: " ) ); |
144 //RunL status error: " ) ); |
141 User::Leave(iStatus.Int()) ; |
145 User::Leave(iStatus.Int()) ; |
142 } |
146 } |
143 } |
147 } |
144 |
148 |
|
149 // On return, aMajor and aMinor contain the version information |
|
150 TBool CALRObserver::IsOCCImplementedSDK() |
|
151 { |
|
152 TBool occ = EFalse; |
|
153 // Obtain the version number |
|
154 TUint major; |
|
155 TUint minor; |
|
156 TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("CSenHttpChannelImpl::IsOCCImplementedSDK()"))); |
|
157 TInt ret = GetS60PlatformVersion(major, minor); |
|
158 if (ret == KErrNone) |
|
159 { |
|
160 if(major == 5 && minor == 2) |
|
161 { |
|
162 occ = ETrue; |
|
163 iOCCenabled = ETrue; |
|
164 TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("---- IsOCCImplementedSDK() returns TRUE"))); |
|
165 } |
|
166 else |
|
167 { |
|
168 TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("---- IsOCCImplementedSDK() returns False"))); |
|
169 } |
|
170 } |
|
171 return occ; |
|
172 } |
|
173 |
|
174 // On return, aMajor and aMinor contain the version information |
|
175 TInt CALRObserver::GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) |
|
176 { |
|
177 TInt ret = KErrNone; |
|
178 // Connect to the file server session |
|
179 RFs fsSession; |
|
180 TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("CSenHttpChannelImpl::GetS60PlatformVersion()"))); |
|
181 ret = fsSession.Connect(); |
|
182 if(ret == KErrNone) |
|
183 { |
|
184 CleanupClosePushL(fsSession); // Obtain the version numberTUint major; |
|
185 VersionInfo::TPlatformVersion platformVersion; |
|
186 TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "--- GetS60PlatformVersion getting Version info"); |
|
187 ret = VersionInfo::GetVersion(platformVersion, fsSession); |
|
188 CleanupStack::PopAndDestroy(); // fsSession |
|
189 if (ret == KErrNone) |
|
190 { |
|
191 aMajor = platformVersion.iMajorVersion; |
|
192 aMinor = platformVersion.iMinorVersion; |
|
193 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("--- GetS60PlatformVersion Version: Major [%d], Minor[%d]"), aMajor, aMinor)); |
|
194 } |
|
195 } |
|
196 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("--- GetS60PlatformVersion returns [%d]"), ret)); |
|
197 return ret; |
|
198 } |
|
199 |
145 // ----------------------------------------------------------------------------- |
200 // ----------------------------------------------------------------------------- |
146 // CALRObserver::RunError |
201 // CALRObserver::RunError |
147 // ----------------------------------------------------------------------------- |
202 // ----------------------------------------------------------------------------- |
148 // |
203 // |
149 TInt CALRObserver::RunError( TInt aError ) |
204 TInt CALRObserver::RunError( TInt aError ) |
361 TBool isSnap(EFalse) ; |
416 TBool isSnap(EFalse) ; |
362 TBool isStartConnectionRequired(EFalse) ; |
417 TBool isStartConnectionRequired(EFalse) ; |
363 |
418 |
364 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get SNAPID from pTransportProperties "); |
419 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get SNAPID from pTransportProperties "); |
365 TInt error = pTransportProperties->SnapIdL(id) ; |
420 TInt error = pTransportProperties->SnapIdL(id) ; |
366 if(error || id >= (TUint)KErrNotFound) // |
421 if(error || id >= (TUint)KErrNotFound) //SNAP not found |
367 { |
422 { |
368 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get IAPID from pTransportProperties "); |
423 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get IAPID from pTransportProperties "); |
369 error = pTransportProperties->IapIdL(id); |
424 error = pTransportProperties->IapIdL(id); |
370 } |
425 } |
371 else |
426 else |
372 { |
427 { |
373 isSnap = ETrue ; |
428 isSnap = ETrue ; |
374 } |
429 } |
375 |
430 |
376 if(error || id >= (TUint)KErrNotFound) |
431 if(error || id >= (TUint)KErrNotFound) //IAP also not found |
377 { |
432 { |
378 //Application Did not provide IAP ID through transport properties |
433 //Application Did not provide IAP ID through transport properties |
379 //Now we need to check consumer and provider policy of service description |
434 //Now we need to check consumer and provider policy of service description |
380 |
435 |
381 if( aInitializer.DescriptionClassType() == MSenServiceDescription::EWSPattern ) |
436 if( aInitializer.DescriptionClassType() == MSenServiceDescription::EWSPattern ) |
443 TUint32 openId(id); |
498 TUint32 openId(id); |
444 if (iIapId == 0 && iSnapId == 0) |
499 if (iIapId == 0 && iSnapId == 0) |
445 { |
500 { |
446 //check with first Snapid |
501 //check with first Snapid |
447 isStartConnectionRequired = ETrue ; |
502 isStartConnectionRequired = ETrue ; |
|
503 if(iOCCenabled != EFalse) |
|
504 { |
|
505 isSnap = ETrue; //We must start with SNAP for OCC |
|
506 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- isSnap Modified for OCC Support "); |
|
507 } |
448 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- StartConnection required as (iIapId == 0 && iSnapId == 0) openId = %d, isSnap = %d, iIapId = %d and iSnapId = %d "), openId, isSnap, iIapId, iSnapId)); |
508 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- StartConnection required as (iIapId == 0 && iSnapId == 0) openId = %d, isSnap = %d, iIapId = %d and iSnapId = %d "), openId, isSnap, iIapId, iSnapId)); |
449 } |
509 } |
450 else if(isSnap != EFalse && openId != iSnapId) |
510 else if(isSnap != EFalse && openId != iSnapId) |
451 { |
511 { |
452 isStartConnectionRequired = ETrue ; |
512 isStartConnectionRequired = ETrue ; |
493 } |
553 } |
494 } |
554 } |
495 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::OpenConnectionL returnd %d "), error)); |
555 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::OpenConnectionL returnd %d "), error)); |
496 return error ; |
556 return error ; |
497 } |
557 } |
|
558 |
|
559 TInt CALRObserver::SetID(TUint32 aId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer, TBool aSNAP) |
|
560 { |
|
561 /* |
|
562 * Single click connectivity feature has been implemented by CSock (RConnection class). |
|
563 * According to this client no need to set the IAP ID. |
|
564 * Automatically RConnection will use the suitable IAP |
|
565 */ |
|
566 TInt retVal = KErrNone; |
|
567 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("CSenHttpChannelImpl called with ID [%d]"), aId)); |
|
568 |
|
569 if (iOCCenabled == EFalse) |
|
570 { |
|
571 if(aSNAP != EFalse && aId) |
|
572 { |
|
573 TConnSnapPref SNAPPrefs; |
|
574 iSnapId = aId ; |
|
575 SNAPPrefs.SetSnap( aId ); |
|
576 // Start connecting with Snap |
|
577 retVal = iConnection.Start(SNAPPrefs); |
|
578 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection Started with SNAP"); |
|
579 } |
|
580 else //default is iap |
|
581 { |
|
582 if( aId ) |
|
583 { |
|
584 TCommDbConnPref iapPrefs ; |
|
585 iapPrefs.SetIapId( aId ); |
|
586 iapPrefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt ); |
|
587 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::SetDialogPref is FALSE"); |
|
588 //iapPrefs.SetDialogPreference( ECommDbDialogPrefPrompt ); |
|
589 // Start connecting with IAP |
|
590 retVal = iConnection.Start(iapPrefs); |
|
591 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::StartConnection connection started with iapid %d and preference"), aId)); |
|
592 } |
|
593 else |
|
594 { |
|
595 if (iIapId != 0) |
|
596 { |
|
597 //OpenSocketSever is already called for this iIapId When multiple |
|
598 //sendL are calld for the same IAPId StartConnection may be called |
|
599 //unintentionaly and may create crash |
|
600 //strange case StartConnection must not be called in this case |
|
601 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection StartConnection must not be called as aId == 0 and iIapId != 0"); |
|
602 } |
|
603 else |
|
604 { |
|
605 //Using Default Connection |
|
606 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection started Using Default Connection"); |
|
607 retVal = iConnection.Start(); |
|
608 } |
|
609 } |
|
610 } |
|
611 } |
|
612 else |
|
613 { |
|
614 if (aSNAP == EFalse) |
|
615 { |
|
616 /* If IAP id is zero, it is interpreted as |
|
617 * client's request for not requesting any specific IAP. |
|
618 * Default value is 0. |
|
619 * |
|
620 * If IAP id is set, SNAP id shall be zero. |
|
621 * If IAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown. |
|
622 * If IAP id is set, Connection selection dialog shall be disabled. |
|
623 * If IAP id is set, bearer set shall be EExtendedConnBearerUnknown. |
|
624 * If IAP id is set, forced roaming is disabled automatically. |
|
625 * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection |
|
626 * selection dialog shall be enabled. |
|
627 */ |
|
628 |
|
629 TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC with IAP Settings"); |
|
630 TConnPrefList prefList; |
|
631 TExtendedConnPref extPrefs; |
|
632 //extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown); |
|
633 //TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC Silent Connection"); |
|
634 //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
|
635 //extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown); |
|
636 extPrefs.SetIapId(aId); |
|
637 extPrefs.SetSnapId(0); |
|
638 prefList.AppendL(&extPrefs); |
|
639 retVal = aConnection.Start(prefList); |
|
640 if(retVal == KErrNone) |
|
641 { |
|
642 iIapId = aId; |
|
643 } |
|
644 else |
|
645 { |
|
646 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("IAP ->Start retVal [%d]"), retVal)); |
|
647 } |
|
648 } |
|
649 else |
|
650 { |
|
651 /** |
|
652 * Sets SNAP id. If SNAP id is zero, it is interpreted as |
|
653 * client's request for not requesting any specific SNAP. |
|
654 * Default value is 0. |
|
655 * |
|
656 * If SNAP id is set, IAP id shall be zero. |
|
657 * If SNAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown. |
|
658 * If SNAP id is set, Connection selection dialog shall be disabled. |
|
659 * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection |
|
660 * selection dialog shall be enabled. |
|
661 */ |
|
662 TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC with SNAP Settings"); |
|
663 TConnPrefList prefList; |
|
664 TExtendedConnPref extPrefs; |
|
665 //extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown); |
|
666 //TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC Silent Connection"); |
|
667 //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
|
668 //extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown); |
|
669 if(aId == 0) |
|
670 { |
|
671 TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting SnapPurpose Internet"); |
|
672 if(aDialogPref) //If it fails because of unavailibility of access points |
|
673 { |
|
674 extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown); |
|
675 extPrefs.SetConnSelectionDialog(ETrue); |
|
676 } |
|
677 else |
|
678 { |
|
679 extPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
|
680 //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
|
681 } |
|
682 } |
|
683 else |
|
684 { |
|
685 extPrefs.SetSnapId(aId); |
|
686 extPrefs.SetIapId(0); |
|
687 extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown); |
|
688 extPrefs.SetConnSelectionDialog(EFalse); |
|
689 } |
|
690 prefList.AppendL(&extPrefs); |
|
691 retVal = aConnection.Start(prefList); |
|
692 } |
|
693 } |
|
694 |
|
695 return retVal; |
|
696 } |
|
697 |
498 // ----------------------------------------------------------------------------- |
698 // ----------------------------------------------------------------------------- |
499 // CALRObserver::StartConnection |
699 // CALRObserver::StartConnection |
500 // ----------------------------------------------------------------------------- |
700 // ----------------------------------------------------------------------------- |
501 // |
701 // |
502 TInt CALRObserver::StartConnection(TUint32& aId, TBool aIsSnapId) |
702 TInt CALRObserver::StartConnection(TUint32& aId, TBool aIsSnapId) |
528 //but openId must not be Zero (0) |
728 //but openId must not be Zero (0) |
529 iConnection.Close(); |
729 iConnection.Close(); |
530 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection closed as new SNAPID for the same connection"); |
730 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection closed as new SNAPID for the same connection"); |
531 } |
731 } |
532 } |
732 } |
533 errRet = OpenSocketSever(); |
733 |
|
734 errRet = OpenSocketSever(); |
|
735 |
534 if (!errRet) |
736 if (!errRet) |
535 { |
737 { |
536 if(aIsSnapId != EFalse && aId) |
738 errRet = SetID(aId, EFalse, iConnection, iSocketServer, aIsSnapId); |
537 { |
739 |
538 TConnSnapPref SNAPPrefs; |
|
539 iSnapId = aId ; |
|
540 SNAPPrefs.SetSnap( aId ); |
|
541 // Start connecting with Snap |
|
542 errRet = iConnection.Start(SNAPPrefs); |
|
543 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection Started with SNAP"); |
|
544 } |
|
545 else //default is iap |
|
546 { |
|
547 if( aId ) |
|
548 { |
|
549 TCommDbConnPref iapPrefs ; |
|
550 iapPrefs.SetIapId( aId ); |
|
551 iapPrefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt ); |
|
552 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::SetDialogPref is FALSE"); |
|
553 //iapPrefs.SetDialogPreference( ECommDbDialogPrefPrompt ); |
|
554 // Start connecting with IAP |
|
555 errRet = iConnection.Start(iapPrefs); |
|
556 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::StartConnection connection started with iapid %d and preference"), aId)); |
|
557 } |
|
558 else |
|
559 { |
|
560 if (iIapId != 0) |
|
561 { |
|
562 //OpenSocketSever is already called for this iIapId When multiple |
|
563 //sendL are calld for the same IAPId StartConnection may be called |
|
564 //unintentionaly and may create crash |
|
565 //strange case StartConnection must not be called in this case |
|
566 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection StartConnection must not be called as aId == 0 and iIapId != 0"); |
|
567 } |
|
568 else |
|
569 { |
|
570 //Using Default Connection |
|
571 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection started Using Default Connection"); |
|
572 errRet = iConnection.Start(); |
|
573 } |
|
574 } |
|
575 } |
|
576 if (errRet == KErrNone) |
740 if (errRet == KErrNone) |
577 { |
741 { |
578 //iConnection.GetIntSetting( _L( "IAP\\Id" ), aId ); |
742 //iConnection.GetIntSetting( _L( "IAP\\Id" ), aId ); |
579 _LIT( KIapId, "IAP\\Id"); |
743 _LIT( KIapId, "IAP\\Id"); |
580 iConnection.GetIntSetting( KIapId, aId ); |
744 iConnection.GetIntSetting( KIapId, aId ); |