vpnengine/vpnconnagt/src/vpnconnagt.cpp
changeset 2 ef893827b4d1
parent 0 33413c0669b9
child 8 032d3a818f49
equal deleted inserted replaced
1:c9c2ad51f972 2:ef893827b4d1
    91     iEventMediator.Close();
    91     iEventMediator.Close();
    92     
    92     
    93     iServiceStartedCallback.Cancel();
    93     iServiceStartedCallback.Cancel();
    94     iConnectCompleteCallback.Cancel();
    94     iConnectCompleteCallback.Cancel();
    95     iDisconnectCallback.Cancel();
    95     iDisconnectCallback.Cancel();
    96 
       
    97     delete iAD;
       
    98     }
    96     }
    99 
    97 
   100 // ---------------------------------------------------------------------------
    98 // ---------------------------------------------------------------------------
   101 // NewL() 
    99 // NewL() 
   102 // ---------------------------------------------------------------------------
   100 // ---------------------------------------------------------------------------
   121     CAgentBase::ConstructL();
   119     CAgentBase::ConstructL();
   122     iConnected = EFalse;
   120     iConnected = EFalse;
   123     iDisconnecting = EFalse;
   121     iDisconnecting = EFalse;
   124     LOG_("CVPNConnAgt::ReadConfigurationL EventMediator");
   122     LOG_("CVPNConnAgt::ReadConfigurationL EventMediator");
   125     User::LeaveIfError(iEventMediator.Connect());
   123     User::LeaveIfError(iEventMediator.Connect());
   126 
       
   127     iAD = CAsyncDisconnecter::NewL(this);  
       
   128     }
   124     }
   129 
   125 
   130 // ---------------------------------------------------------------------------
   126 // ---------------------------------------------------------------------------
   131 // Info() 
   127 // Info() 
   132 // ---------------------------------------------------------------------------
   128 // ---------------------------------------------------------------------------
   410         Log::Printf(_L("%s Disconnecting type is %d\n"),name.PtrZ(), (TInt)iDisconnectType));
   406         Log::Printf(_L("%s Disconnecting type is %d\n"),name.PtrZ(), (TInt)iDisconnectType));
   411 
   407 
   412         return;
   408         return;
   413         }
   409         }
   414 
   410 
   415     iAD->ConfirmDisconnect();
   411     iNotify->AgentProgress(EVPNConnAgtDisconnected, KErrNone);
       
   412     iNotify->DisconnectComplete();
   416     iDisconnecting = EFalse;
   413     iDisconnecting = EFalse;
   417     }
   414     }
   418 
   415 
   419 
   416 
   420 /****************************************************************************/
   417 /****************************************************************************/
   512             if ( iEventActivatedClose )
   509             if ( iEventActivatedClose )
   513                 {
   510                 {
   514                 iEventActivatedClose = EFalse;
   511                 iEventActivatedClose = EFalse;
   515                 iNotify->Notification(EAgentToNifEventTypeDisableConnection, NULL);
   512                 iNotify->Notification(EAgentToNifEventTypeDisableConnection, NULL);
   516                 }
   513                 }
   517 
   514             
   518             iAD->ConfirmDisconnect();
   515             iNotify->AgentProgress(EVPNConnAgtDisconnected, KErrNone);
       
   516             iNotify->DisconnectComplete();
       
   517             
   519             iDisconnecting = EFalse;
   518             iDisconnecting = EFalse;
   520 
       
   521             iConnected = EFalse;
   519             iConnected = EFalse;
   522             
   520             
   523             iState = EIdle;
   521             iState = EIdle;
   524             break;
   522             break;
   525         case EAllInterfaceEvents:
   523         case EAllInterfaceEvents:
   583                 Log::Printf(_L("%s Vpn DNS2 = %s\n"),name.PtrZ(), addrBuf.PtrZ()));
   581                 Log::Printf(_L("%s Vpn DNS2 = %s\n"),name.PtrZ(), addrBuf.PtrZ()));
   584                 }
   582                 }
   585             break;
   583             break;
   586             }
   584             }
   587         default:
   585         default:
       
   586             LOG(Log::Printf(_L("Unknown event --> Silently Ignore.\n")));
   588             break;
   587             break;
   589         }
   588         }
   590     }
   589     }
   591 
   590 
   592 
   591 
   756     LOG_1("CVPNConnAgt::ReadConfigurationL RealIapId:%d", 
   755     LOG_1("CVPNConnAgt::ReadConfigurationL RealIapId:%d", 
   757         iVPNParameters.GetRealIapId());
   756         iVPNParameters.GetRealIapId());
   758     LOG_1("CVPNConnAgt::ReadConfigurationL RealNetworkId:%d", 
   757     LOG_1("CVPNConnAgt::ReadConfigurationL RealNetworkId:%d", 
   759         iVPNParameters.GetRealNetworkId());
   758         iVPNParameters.GetRealNetworkId());
   760     }
   759     }
   761 
       
   762 
       
   763 //////////////////////CAsyncDisconnecter////////////////////
       
   764 
       
   765 // ---------------------------------------------------------------------------
       
   766 // CAsyncDisconnecter 
       
   767 // ---------------------------------------------------------------------------
       
   768 //
       
   769 CAsyncDisconnecter::CAsyncDisconnecter(
       
   770     CVPNConnAgt* aAgent):
       
   771     CAsyncOneShot(EPriorityNormal)
       
   772     {
       
   773     iAgent = aAgent;
       
   774     }
       
   775 
       
   776 // ---------------------------------------------------------------------------
       
   777 // NewL 
       
   778 // ---------------------------------------------------------------------------
       
   779 //
       
   780 CAsyncDisconnecter* CAsyncDisconnecter::NewL(
       
   781     CVPNConnAgt* aAgent)
       
   782     {
       
   783     return new (ELeave) CAsyncDisconnecter(aAgent);
       
   784     }
       
   785 
       
   786 // ---------------------------------------------------------------------------
       
   787 // ConfirmDisconnect 
       
   788 // ---------------------------------------------------------------------------
       
   789 //
       
   790 void CAsyncDisconnecter::ConfirmDisconnect()
       
   791     {
       
   792     Call();
       
   793     }
       
   794 
       
   795 // ---------------------------------------------------------------------------
       
   796 // RunL 
       
   797 // ---------------------------------------------------------------------------
       
   798 //
       
   799 void CAsyncDisconnecter::RunL()
       
   800     {
       
   801     LOG_1("CAsyncDisconnecter::RunL, iStatus:%d", iStatus.Int() );
       
   802     iAgent->Notify()->AgentProgress(EVPNConnAgtDisconnected, KErrNone);
       
   803     iAgent->Notify()->DisconnectComplete();
       
   804     }
       
   805