Esempio n. 1
0
 void EventL (const CConnMonEventBase &aConnEvent)
 {
     TInt event = aConnEvent.EventType();
     TUint connId = aConnEvent.ConnectionId();
     TRequestStatus status;
     switch (event) {
     case EConnMonCreateConnection: {
         TBuf<KCommsDbSvrMaxColumnNameLength> iapName;
         m_connMon.GetStringAttribute(connId, 0, KIAPName, iapName, status);
         User::WaitForRequest(status);
         m_currentIAPName = QString(reinterpret_cast<const QChar *>(iapName.Ptr()), iapName.Length());
         qDebug() << "A new connection created using: " << m_currentIAPName;
         break;
     }
     default:
         break;
     }
 }
// -----------------------------------------------------------------------------
// CSipSnapAvailabilityMonitor::EventL
// -----------------------------------------------------------------------------
//
void CSipSnapAvailabilityMonitor::EventL(
    const CConnMonEventBase& aConnMonEvent )
{
    // We're interested only on SNAP availability notifications
    if( aConnMonEvent.EventType() == EConnMonSNAPsAvailabilityChange )
    {
        // Typecast event to appropriate event type
        const CConnMonSNAPsAvailabilityChange& event =
            static_cast< const CConnMonSNAPsAvailabilityChange& >(
                aConnMonEvent );

        TBool snapAvailable =
            IsSnapAvailable( event.SNAPAvailability(), iSnapId );

        if ( SetCurrentState( snapAvailable ) )
        {
            NotifyObservers();
        }
    }
}
void CNsmlNetworkStatusEngine::EventL( const CConnMonEventBase& aConnMonEvent )
{

	DBG_FILE(_S8("CNsmlNetworkStatusEngine::EventL, BEGIN"));
	DBG_ARGS8(_S8("CNsmlNetworkStatusEngine::EventL event is ==  %d"), aConnMonEvent.EventType()  );
	switch ( aConnMonEvent.EventType() )
	{
	case EConnMonNetworkStatusChange:
	{
	const CConnMonNetworkStatusChange* eventNetworkStatus;
    eventNetworkStatus = ( const CConnMonNetworkStatusChange* ) &aConnMonEvent;
    iNetwStatus   = eventNetworkStatus->NetworkStatus();
    DBG_ARGS8(_S8("CNsmlNetworkStatusEngine::EventL EConnMonNetworkStatusChange: Network status event is ==  %d"), iNetwStatus  );   	
    switch( eventNetworkStatus->NetworkStatus() )
	{
		case EConnMonStatusActive:
		DBG_FILE(_S8("Network status ACTIVE"));
	    if(iTimerOn)
	    {
			iTimerOn = EFalse;
		    iSuspendDuration.HomeTime();
		    TTimeIntervalSeconds duration;
		    iSuspendDuration.SecondsFrom(iSuspendedTime,duration);
		    DBG_FILE_CODE(duration.Int(), _S8("CNsmlNetworkStatusEngine::EventL suspendDuration is "));        	 
			if ( iTimedExecuteStopSession ) 
			{
				iTimedExecuteStopSession->Cancel();
				delete iTimedExecuteStopSession;
				iTimedExecuteStopSession = NULL;
			}
		    if(duration.Int() >= KDMMaxHttpAutoResumeDurationSec)
			{
				iAgent->CompleteRequest();
			}
	    } // if itimerOn
	           
        break;
        case EConnMonStatusSuspended:
        DBG_FILE(_S8("HTTP  Network status SUSPEND and Timer will be set ON "));
	   	if(!iTimerOn)
		{
	    	CRepository *rep = NULL;
			TRAPD( err1, rep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ))
			iDMSmlSessionTimeout = -1;
			if(err1 == KErrNone)
			{
				TInt dmsessionTimeout = -1;
				rep->Get( KDevManDMSessionTimeout, dmsessionTimeout );
				delete rep;
				DBG_FILE_CODE(dmsessionTimeout, _S8("CNsmlNetworkStatusEngine::EventL session timeout duration from cenrep is "));        	 
				if( dmsessionTimeout < KNSmlDMMinSessionTimeout  || dmsessionTimeout > KNSmlDMMaxSessionTimeout )
				{
					dmsessionTimeout = -1;
					iDMSmlSessionTimeout = -1;
				}
				else
				{
					iDMSmlSessionTimeout =  dmsessionTimeout * 60* 1000000;
					iTimerOn = ETrue;
	    			iSuspendedTime.HomeTime();
	 		    	iTimedExecuteStopSession = CPeriodic::NewL (EPriorityNormal) ;
					iTimedExecuteStopSession->Start (
		    		TTimeIntervalMicroSeconds32(iDMSmlSessionTimeout)
		    		, TTimeIntervalMicroSeconds32(iDMSmlSessionTimeout)
		    		, TCallBack(StaticDoStopDMSession,this) ) ;
				}
			
			} // if KErrnone
			
	    	
	    } //if !iTimerON
		break;   
	    default: //for eventNetworkStatus->NetworkStatus()
		break;
     }
    break;
    }

	default: // for EConnMonNetworkStatusChange
	    break;
	}
}