coreapplicationuis/Rfs/src/rfsConnectionObserver.cpp
changeset 53 920c9a724929
parent 29 6a787171e1de
child 81 676b6116ca93
equal deleted inserted replaced
51:50b444048a8d 53:920c9a724929
    21 #include <rfs.rsg>                      
    21 #include <rfs.rsg>                      
    22 #include <PSVariables.h>
    22 #include <PSVariables.h>
    23 #include <featmgr.h>
    23 #include <featmgr.h>
    24 #include <eikenv.h>  
    24 #include <eikenv.h>  
    25 #include <centralrepository.h>
    25 #include <centralrepository.h>
    26 #include <pdpcontextmanagerpskeys.h>
       
    27 #include <pdpcontextmanagerinternalcrkeys.h>
    26 #include <pdpcontextmanagerinternalcrkeys.h>
    28 #include <StringLoader.h> 
    27 #include <StringLoader.h> 
    29 
    28 
    30 // P&S KEYS FROM SIP & PDP CONNECTION
    29 
    31 #include <e32property.h>
       
    32 #include <pdpcontextmanagerpskeys.h>
       
    33 #include <sipsystemstatemonitorpskeys.h>
       
    34 
    30 
    35 // USER INCLUDES
    31 // USER INCLUDES
    36 #include "rfsConnectionObserver.h"
    32 #include "rfsConnectionObserver.h"
    37 #include "RfsTraces.h"
    33 #include "RfsTraces.h"
    38 
    34 
   139     if (iIsSIPConnectionsPresent || iIsPDPFeatureEnabled)
   135     if (iIsSIPConnectionsPresent || iIsPDPFeatureEnabled)
   140         {
   136         {
   141         Subscribe();
   137         Subscribe();
   142         }
   138         }
   143     
   139     
       
   140     // Create the Timer Active Object
       
   141     iRfsConTimer = CRfsConTimer :: NewL(this);
       
   142     
   144     TRACES("CRfsConnectionObserver::ConstructL(): End");
   143     TRACES("CRfsConnectionObserver::ConstructL(): End");
   145     }
   144     }
   146 
   145 
   147 // ---------------------------------------------------------------------------
   146 // ---------------------------------------------------------------------------
   148 // C++ constructor
   147 // C++ constructor
   168 // C++ destructor
   167 // C++ destructor
   169 // ---------------------------------------------------------------------------
   168 // ---------------------------------------------------------------------------
   170 CRfsConnectionObserver::~CRfsConnectionObserver()
   169 CRfsConnectionObserver::~CRfsConnectionObserver()
   171     {
   170     {
   172     TRACES("CRfsConnectionObserver::~CRfsConnectionObserver()");
   171     TRACES("CRfsConnectionObserver::~CRfsConnectionObserver()");
       
   172     
       
   173     if(iRfsConTimer)
       
   174         {
       
   175         delete iRfsConTimer;
       
   176         }
   173     Cancel();
   177     Cancel();
   174     delete iWait;
   178     delete iWait;
   175     TRACES("CRfsConnectionObserver::~CRfsConnectionObserver(): End");
   179     TRACES("CRfsConnectionObserver::~CRfsConnectionObserver(): End");
   176     }
   180     }
   177 
   181 
   189         }
   193         }
   190 
   194 
   191     // only perform the following operation if the 'iIsClosingConnectionsApplicable' is ETrue 
   195     // only perform the following operation if the 'iIsClosingConnectionsApplicable' is ETrue 
   192     iAllConnectionClosed = EFalse;
   196     iAllConnectionClosed = EFalse;
   193       
   197       
   194     // Send P&S notification to SIP that RFS has started
       
   195     TInt err(KErrNone);
   198     TInt err(KErrNone);
   196     if (iIsSIPConnectionsPresent && iState == ESipConnectionClose)
   199     if (iIsSIPConnectionsPresent && iState == ESipConnectionClose)
   197         {
   200         {
       
   201         // Send P&S notification to SIP that RFS has started and start the timer
       
   202    
   198         err = iSIPProperty.Set(KPSSipRfsUid, KSipRfsState, ESipRfsStarted );
   203         err = iSIPProperty.Set(KPSSipRfsUid, KSipRfsState, ESipRfsStarted );
       
   204         iRfsConTimer->IssueTimerRequest();
   199         iIsSipInformedForClosingAllConnection = ETrue;
   205         iIsSipInformedForClosingAllConnection = ETrue;
   200         }
   206         }
   201     else if (iIsPDPFeatureEnabled && iState == EPdpConnectionClose)
   207     else if (iIsPDPFeatureEnabled && iState == EPdpConnectionClose)
   202         {
   208         {
       
   209         // Send P&S notification to PDP that RFS has started and start the timer
       
   210     
   203         err = iPDPProperty.Set(KPDPContextManager2,KPDPContextManagerFactorySettingsReset,EPDPContextManagerFactorySettingsResetStart );
   211         err = iPDPProperty.Set(KPDPContextManager2,KPDPContextManagerFactorySettingsReset,EPDPContextManagerFactorySettingsResetStart );
       
   212         iRfsConTimer->IssueTimerRequest();
   204         iIsPDPInformedforClosingAllConnection = ETrue;
   213         iIsPDPInformedforClosingAllConnection = ETrue;
   205         }
   214         }
   206     
   215     
   207     
   216     
   208     // Leave from here is there is any error setting the intial handshake information
   217     // Leave from here is there is any error setting the intial handshake information
   209     // This means that RFS has failed as there was some problem setting the P&S keys
   218     // This means that RFS has failed as there was some problem setting the P&S keys
   210     User::LeaveIfError(err);
   219     User::LeaveIfError(err);
   211     if(err != KErrNone)
       
   212         {
       
   213         TRACES1("CRfsConnectionObserver::CloseAlwaysOnConnectionL(): Err = %d", err);
       
   214         // This means that the RFS has failed
       
   215         return EFalse; 
       
   216         }
       
   217     
   220     
   218     // we set the flag to indicate showl is called and the dialog needs to be
   221     // we set the flag to indicate showl is called and the dialog needs to be
   219     // dismissed from within the RunL()
   222     // dismissed from within the RunL()
   220     iIsWaitForDialogExecuted = ETrue;
   223     iIsWaitForDialogExecuted = ETrue;
   221     // Start displaying the dialog which will then be closed form the RunL()
   224     // Start displaying the dialog which will then be closed form the RunL()
   253                 }
   256                 }
   254     if (iIsPDPInformedforClosingAllConnection)
   257     if (iIsPDPInformedforClosingAllConnection)
   255                 {
   258                 {
   256                 iPDPProperty.Set(KPDPContextManager2,KPDPContextManagerFactorySettingsReset,EPDPContextManagerFactorySettingsResetStop);
   259                 iPDPProperty.Set(KPDPContextManager2,KPDPContextManagerFactorySettingsReset,EPDPContextManagerFactorySettingsResetStop);
   257                 }
   260                 }
   258        
   261     if(iRfsConTimer)
   259                    
   262             {
   260         
   263             // Cancel the Active timer if the user cancel the Rfs operation
       
   264             iRfsConTimer->Cancel();
       
   265             }        
   261 }
   266 }
   262 
   267 
   263 
   268 
   264 void CRfsConnectionObserver::ProgressDialogClosed(const CHbDeviceProgressDialogSymbian *  iDialog)
   269 void CRfsConnectionObserver::ProgressDialogClosed(const CHbDeviceProgressDialogSymbian *  iDialog)
   265 {
   270 {
   343                 {
   348                 {
   344                 if (iIsWaitForDialogExecuted && !iIsPDPFeatureEnabled)
   349                 if (iIsWaitForDialogExecuted && !iIsPDPFeatureEnabled)
   345                     {
   350                     {
   346                     // set the information that we have closed all the active connections
   351                     // set the information that we have closed all the active connections
   347                     // here itself because the PDP connection/feature doen't exist
   352                     // here itself because the PDP connection/feature doen't exist
       
   353                     // Cancel the outstanding timer request
   348                     iAllConnectionClosed = ETrue;
   354                     iAllConnectionClosed = ETrue;
       
   355                     iRfsConTimer->Cancel();
   349                     DismissWaitDialog();
   356                     DismissWaitDialog();
   350                     }
   357                     }
   351                 
   358                 
   352                 if (iIsPDPFeatureEnabled)
   359                 if (iIsPDPFeatureEnabled)
   353                     {
   360                     {
   354                     iPDPProperty.Set(KPDPContextManager2,KPDPContextManagerFactorySettingsReset,EPDPContextManagerFactorySettingsResetStart );
   361                     iPDPProperty.Set(KPDPContextManager2,KPDPContextManagerFactorySettingsReset,EPDPContextManagerFactorySettingsResetStart );
   355                     
   362                     
   356                     // change the state to the next from within this as we are done with closing the SIP connection
   363                     // change the state to the next from within this as we are done with closing the SIP connection
   357                     iState = EPdpConnectionClose;
   364                     // Cancel the Outstanding SIP  and timer request
       
   365                     // Subscribe to PDP  and start the timer
       
   366                     Cancel();
       
   367                     iRfsConTimer->Cancel();
       
   368                     iState = EPdpConnectionClose;                                        
       
   369                     Subscribe(); 
       
   370                     iRfsConTimer->IssueTimerRequest();
       
   371                                         
   358                     //
   372                     //
   359                     // Under following cases the 'iIsPDPInformedforClosingAllConnection' will be set
   373                     // Under following cases the 'iIsPDPInformedforClosingAllConnection' will be set
   360                     //
   374                     //
   361                     // CASE 1:
   375                     // CASE 1:
   362                     //          When from within CloseAlwaysOnConnectionL we inform the PDP to 
   376                     //          When from within CloseAlwaysOnConnectionL we inform the PDP to 
   393                 {
   407                 {
   394                 // The response from PDP of closing all its connections have been recieved 
   408                 // The response from PDP of closing all its connections have been recieved 
   395                 // Now we may proceed to dsmiss the dialog and also set the state to the True for 
   409                 // Now we may proceed to dsmiss the dialog and also set the state to the True for 
   396                 // all active connections closed
   410                 // all active connections closed
   397                 iAllConnectionClosed = ETrue;
   411                 iAllConnectionClosed = ETrue;
       
   412                 iRfsConTimer->Cancel();                                    
   398                 DismissWaitDialog();
   413                 DismissWaitDialog();
   399                 }
   414                 }
   400             }
   415             }
   401         } // end switch-case block
   416         } // end switch-case block
   402     }
   417     }
   427 // ---------------------------------------------------------------------------
   442 // ---------------------------------------------------------------------------
   428 void CRfsConnectionObserver::DoCancel()
   443 void CRfsConnectionObserver::DoCancel()
   429     {
   444     {
   430     TRACES("CRfsConnectionObserver::DoCancel()");
   445     TRACES("CRfsConnectionObserver::DoCancel()");
   431     
   446     
   432     if(iIsPDPFeatureEnabled)
   447     if(iIsSIPConnectionsPresent && iState == ESipConnectionClose)
       
   448         {
       
   449         iSIPProperty.Cancel();
       
   450         if(!iIsPDPFeatureEnabled)
       
   451             {
       
   452             DismissWaitDialog();
       
   453             }
       
   454         }
       
   455     if(iIsPDPFeatureEnabled && iState == EPdpConnectionClose)
   433         {
   456         {
   434         iPDPProperty.Cancel();
   457         iPDPProperty.Cancel();
   435         }
   458         DismissWaitDialog();            
   436     if(iIsSIPConnectionsPresent)
   459         }
   437         {
       
   438         iSIPProperty.Cancel();
       
   439         }
       
   440 
       
   441     DismissWaitDialog();
       
   442     
       
   443     TRACES("CRfsConnectionObserver::DoCancel(): End");
   460     TRACES("CRfsConnectionObserver::DoCancel(): End");
   444     }
   461     }
   445 
   462 
   446 // ---------------------------------------------------------------------------
   463 // ---------------------------------------------------------------------------
   447 // CRfsConnectionObserver::Subscribe
   464 // CRfsConnectionObserver::Subscribe