142 else |
137 else |
143 { |
138 { |
144 //RunL status error: " ) ); |
139 //RunL status error: " ) ); |
145 User::Leave(iStatus.Int()) ; |
140 User::Leave(iStatus.Int()) ; |
146 } |
141 } |
147 } |
142 } |
148 |
143 |
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 |
|
200 // ----------------------------------------------------------------------------- |
144 // ----------------------------------------------------------------------------- |
201 // CALRObserver::RunError |
145 // CALRObserver::RunError |
202 // ----------------------------------------------------------------------------- |
146 // ----------------------------------------------------------------------------- |
203 // |
147 // |
204 TInt CALRObserver::RunError( TInt aError ) |
148 TInt CALRObserver::RunError( TInt aError ) |
416 TBool isSnap(EFalse) ; |
360 TBool isSnap(EFalse) ; |
417 TBool isStartConnectionRequired(EFalse) ; |
361 TBool isStartConnectionRequired(EFalse) ; |
418 |
362 |
419 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get SNAPID from pTransportProperties "); |
363 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get SNAPID from pTransportProperties "); |
420 TInt error = pTransportProperties->SnapIdL(id) ; |
364 TInt error = pTransportProperties->SnapIdL(id) ; |
421 if(error || id >= (TUint)KErrNotFound) //SNAP not found |
365 if(error || id >= (TUint)KErrNotFound) // |
422 { |
366 { |
423 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get IAPID from pTransportProperties "); |
367 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get IAPID from pTransportProperties "); |
424 error = pTransportProperties->IapIdL(id); |
368 error = pTransportProperties->IapIdL(id); |
425 } |
369 } |
426 else |
370 else |
427 { |
371 { |
428 isSnap = ETrue ; |
372 isSnap = ETrue ; |
429 } |
373 } |
430 |
374 |
431 if(error || id >= (TUint)KErrNotFound) //IAP also not found |
375 if(error || id >= (TUint)KErrNotFound) |
432 { |
376 { |
433 //Application Did not provide IAP ID through transport properties |
377 //Application Did not provide IAP ID through transport properties |
434 //Now we need to check consumer and provider policy of service description |
378 //Now we need to check consumer and provider policy of service description |
435 |
379 |
436 if( aInitializer.DescriptionClassType() == MSenServiceDescription::EWSPattern ) |
380 if( aInitializer.DescriptionClassType() == MSenServiceDescription::EWSPattern ) |
498 TUint32 openId(id); |
442 TUint32 openId(id); |
499 if (iIapId == 0 && iSnapId == 0) |
443 if (iIapId == 0 && iSnapId == 0) |
500 { |
444 { |
501 //check with first Snapid |
445 //check with first Snapid |
502 isStartConnectionRequired = ETrue ; |
446 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 } |
|
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)); |
447 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)); |
509 } |
448 } |
510 else if(isSnap != EFalse && openId != iSnapId) |
449 else if(isSnap != EFalse && openId != iSnapId) |
511 { |
450 { |
512 isStartConnectionRequired = ETrue ; |
451 isStartConnectionRequired = ETrue ; |
553 } |
492 } |
554 } |
493 } |
555 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::OpenConnectionL returnd %d "), error)); |
494 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::OpenConnectionL returnd %d "), error)); |
556 return error ; |
495 return error ; |
557 } |
496 } |
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 |
|
698 // ----------------------------------------------------------------------------- |
497 // ----------------------------------------------------------------------------- |
699 // CALRObserver::StartConnection |
498 // CALRObserver::StartConnection |
700 // ----------------------------------------------------------------------------- |
499 // ----------------------------------------------------------------------------- |
701 // |
500 // |
702 TInt CALRObserver::StartConnection(TUint32& aId, TBool aIsSnapId) |
501 TInt CALRObserver::StartConnection(TUint32& aId, TBool aIsSnapId) |
728 //but openId must not be Zero (0) |
527 //but openId must not be Zero (0) |
729 iConnection.Close(); |
528 iConnection.Close(); |
730 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection closed as new SNAPID for the same connection"); |
529 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection closed as new SNAPID for the same connection"); |
731 } |
530 } |
732 } |
531 } |
733 |
532 errRet = OpenSocketSever(); |
734 errRet = OpenSocketSever(); |
|
735 |
|
736 if (!errRet) |
533 if (!errRet) |
737 { |
534 { |
738 errRet = SetID(aId, EFalse, iConnection, iSocketServer, aIsSnapId); |
535 if(aIsSnapId != EFalse && aId) |
739 |
536 { |
|
537 iSnapId = aId ; |
|
538 iSNAPPrefs.SetSnap( aId ); |
|
539 // Start connecting with Snap |
|
540 errRet = iConnection.Start(iSNAPPrefs); |
|
541 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection Started with SNAP"); |
|
542 } |
|
543 else //default is iap |
|
544 { |
|
545 if( aId ) |
|
546 { |
|
547 iPrefs.SetIapId( aId ); |
|
548 SetDialogPref(EFalse) ; |
|
549 // Start connecting with IAP |
|
550 errRet = iConnection.Start(iPrefs); |
|
551 TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::StartConnection connection started with iapid %d and preference"), aId)); |
|
552 } |
|
553 else |
|
554 { |
|
555 if (iIapId != 0) |
|
556 { |
|
557 //OpenSocketSever is already called for this iIapId When multiple |
|
558 //sendL are calld for the same IAPId StartConnection may be called |
|
559 //unintentionaly and may create crash |
|
560 //strange case StartConnection must not be called in this case |
|
561 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection StartConnection must not be called as aId == 0 and iIapId != 0"); |
|
562 } |
|
563 else |
|
564 { |
|
565 //Using Default Connection |
|
566 TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection started Using Default Connection"); |
|
567 errRet = iConnection.Start(); |
|
568 } |
|
569 } |
|
570 } |
740 if (errRet == KErrNone) |
571 if (errRet == KErrNone) |
741 { |
572 { |
742 //iConnection.GetIntSetting( _L( "IAP\\Id" ), aId ); |
573 //iConnection.GetIntSetting( _L( "IAP\\Id" ), aId ); |
743 _LIT( KIapId, "IAP\\Id"); |
574 _LIT( KIapId, "IAP\\Id"); |
744 iConnection.GetIntSetting( KIapId, aId ); |
575 iConnection.GetIntSetting( KIapId, aId ); |