qtmobility/src/bearer/qnetworksession_s60_p.cpp
branchRCL_3
changeset 3 eb34711bcc75
parent 1 5822d84012fb
child 5 4ea83c148e84
equal deleted inserted replaced
2:87be51aa5b5b 3:eb34711bcc75
    55     : CActive(CActive::EPriorityStandard), state(QNetworkSession::Invalid),
    55     : CActive(CActive::EPriorityStandard), state(QNetworkSession::Invalid),
    56       isOpen(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError),
    56       isOpen(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError),
    57       iALREnabled(0), iConnectInBackground(false)
    57       iALREnabled(0), iConnectInBackground(false)
    58 {
    58 {
    59     CActiveScheduler::Add(this);
    59     CActiveScheduler::Add(this);
    60     
    60 
       
    61 #ifdef SNAP_FUNCTIONALITY_AVAILABLE
       
    62     iMobility = NULL;
       
    63 #endif
    61     TRAP_IGNORE(iConnectionMonitor.ConnectL());
    64     TRAP_IGNORE(iConnectionMonitor.ConnectL());
    62 }
    65 }
    63 
    66 
    64 QNetworkSessionPrivate::~QNetworkSessionPrivate()
    67 QNetworkSessionPrivate::~QNetworkSessionPrivate()
    65 {
    68 {
   505 }
   508 }
   506 
   509 
   507 void QNetworkSessionPrivate::migrate()
   510 void QNetworkSessionPrivate::migrate()
   508 {
   511 {
   509 #ifdef SNAP_FUNCTIONALITY_AVAILABLE
   512 #ifdef SNAP_FUNCTIONALITY_AVAILABLE
   510     // Close global 'Open C' RConnection
   513     if (iMobility) {
   511     setdefaultif(0);
   514         // Close global 'Open C' RConnection
   512     
   515         setdefaultif(0);
   513     // Start migrating to new IAP
   516         // Start migrating to new IAP
   514     iMobility->MigrateToPreferredCarrier();
   517         iMobility->MigrateToPreferredCarrier();
       
   518     }
   515 #endif
   519 #endif
   516 }
   520 }
   517 
   521 
   518 void QNetworkSessionPrivate::ignore()
   522 void QNetworkSessionPrivate::ignore()
   519 {
   523 {
   520 #ifdef SNAP_FUNCTIONALITY_AVAILABLE
   524 #ifdef SNAP_FUNCTIONALITY_AVAILABLE
   521     iMobility->IgnorePreferredCarrier();
   525     if (iMobility) {
   522     if (!iALRUpgradingConnection) {
   526         iMobility->IgnorePreferredCarrier();
   523         newState(QNetworkSession::Disconnected);
   527 
   524     } else {
   528         if (!iALRUpgradingConnection) {
   525         newState(QNetworkSession::Connected,iOldRoamingIap);
   529             newState(QNetworkSession::Disconnected);
       
   530         } else {
       
   531             newState(QNetworkSession::Connected,iOldRoamingIap);
       
   532         }
   526     }
   533     }
   527 #endif
   534 #endif
   528 }
   535 }
   529 
   536 
   530 void QNetworkSessionPrivate::accept()
   537 void QNetworkSessionPrivate::accept()
   531 {
   538 {
   532 #ifdef SNAP_FUNCTIONALITY_AVAILABLE
   539 #ifdef SNAP_FUNCTIONALITY_AVAILABLE
   533     iMobility->NewCarrierAccepted();
   540     if (iMobility) {
   534     
   541         iMobility->NewCarrierAccepted();
   535     QNetworkConfiguration newActiveConfig = activeConfiguration(iNewRoamingIap);
   542 
   536 
   543         QNetworkConfiguration newActiveConfig = activeConfiguration(iNewRoamingIap);
   537     // Use name of the new IAP to open global 'Open C' RConnection
   544 
   538     QByteArray nameAsByteArray = newActiveConfig.name().toUtf8();
   545         // Use name of the new IAP to open global 'Open C' RConnection
   539     ifreq ifr;
       
   540     memset(&ifr, 0, sizeof(struct ifreq));
       
   541     strcpy(ifr.ifr_name, nameAsByteArray.constData());
       
   542     setdefaultif(&ifr);
       
   543     
       
   544     newState(QNetworkSession::Connected, iNewRoamingIap);
       
   545 #endif
       
   546 }
       
   547 
       
   548 void QNetworkSessionPrivate::reject()
       
   549 {
       
   550 #ifdef SNAP_FUNCTIONALITY_AVAILABLE
       
   551     iMobility->NewCarrierRejected();
       
   552 
       
   553     if (!iALRUpgradingConnection) {
       
   554         newState(QNetworkSession::Disconnected);
       
   555     } else {
       
   556         QNetworkConfiguration newActiveConfig = activeConfiguration(iOldRoamingIap);
       
   557 
       
   558         // Use name of the old IAP to open global 'Open C' RConnection
       
   559         QByteArray nameAsByteArray = newActiveConfig.name().toUtf8();
   546         QByteArray nameAsByteArray = newActiveConfig.name().toUtf8();
   560         ifreq ifr;
   547         ifreq ifr;
   561         memset(&ifr, 0, sizeof(struct ifreq));
   548         memset(&ifr, 0, sizeof(struct ifreq));
   562         strcpy(ifr.ifr_name, nameAsByteArray.constData());
   549         strcpy(ifr.ifr_name, nameAsByteArray.constData());
   563         setdefaultif(&ifr);
   550         setdefaultif(&ifr);
   564 
   551 
   565         newState(QNetworkSession::Connected, iOldRoamingIap);
   552         newState(QNetworkSession::Connected, iNewRoamingIap);
       
   553     }
       
   554 #endif
       
   555 }
       
   556 
       
   557 void QNetworkSessionPrivate::reject()
       
   558 {
       
   559 #ifdef SNAP_FUNCTIONALITY_AVAILABLE
       
   560     if (iMobility) {
       
   561         iMobility->NewCarrierRejected();
       
   562 
       
   563         if (!iALRUpgradingConnection) {
       
   564             newState(QNetworkSession::Disconnected);
       
   565         } else {
       
   566             QNetworkConfiguration newActiveConfig = activeConfiguration(iOldRoamingIap);
       
   567 
       
   568             // Use name of the old IAP to open global 'Open C' RConnection
       
   569             QByteArray nameAsByteArray = newActiveConfig.name().toUtf8();
       
   570             ifreq ifr;
       
   571             memset(&ifr, 0, sizeof(struct ifreq));
       
   572             strcpy(ifr.ifr_name, nameAsByteArray.constData());
       
   573             setdefaultif(&ifr);
       
   574 
       
   575             newState(QNetworkSession::Connected, iOldRoamingIap);
       
   576         }
   566     }
   577     }
   567 #endif
   578 #endif
   568 }
   579 }
   569 
   580 
   570 #ifdef SNAP_FUNCTIONALITY_AVAILABLE
   581 #ifdef SNAP_FUNCTIONALITY_AVAILABLE