realtimenetprots/sipfw/ProfileAgent/AlrMonitor/src/sipalrmonitor.cpp
changeset 37 0295359a7673
parent 0 307788aac0a8
child 42 69df6ed78a6a
equal deleted inserted replaced
33:b8a7e07b2677 37:0295359a7673
    69 
    69 
    70 // -----------------------------------------------------------------------------
    70 // -----------------------------------------------------------------------------
    71 // CSipAlrMonitor::RefreshIapAvailabilityL
    71 // CSipAlrMonitor::RefreshIapAvailabilityL
    72 // -----------------------------------------------------------------------------
    72 // -----------------------------------------------------------------------------
    73 //	
    73 //	
    74 void CSipAlrMonitor::RefreshIapAvailabilityL ( TUint32 aSnapId )
    74 void CSipAlrMonitor::RefreshIapAvailabilityL ( TSipSNAPConfigurationData & aConfigData )
    75 	{
    75 	{
    76     PROFILE_DEBUG3( "CSipAlrMonitorImplementation::RefreshIapAvailabilityL",
    76     PROFILE_DEBUG3( "CSipAlrMonitorImplementation::RefreshIapAvailabilityL",
    77 	                 aSnapId )
    77             aConfigData.iSnapId )
    78     
    78     
    79     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aSnapId );
    79     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aConfigData );
    80     if ( monitor )
    80     if ( monitor )
    81         {
    81         {
    82 		monitor->RefreshL();
    82 		monitor->RefreshL();
    83 		}
    83 		}
    84 	}
    84 	}
    85 	    
    85 	    
    86 // -----------------------------------------------------------------------------
    86 // -----------------------------------------------------------------------------
    87 // CSipAlrMonitor::AllowMigration
    87 // CSipAlrMonitor::AllowMigration
    88 // -----------------------------------------------------------------------------
    88 // -----------------------------------------------------------------------------
    89 //
    89 //
    90 TInt CSipAlrMonitor::AllowMigration( TUint32 aSnapId )
    90 TInt CSipAlrMonitor::AllowMigration( TSipSNAPConfigurationData & aConfigData )
    91     {
    91     {
    92     PROFILE_DEBUG3("CSipAlrMonitor::AllowMigration, SnapId",aSnapId)
    92     PROFILE_DEBUG3("CSipAlrMonitor::AllowMigration, SnapId",aConfigData.iSnapId)
    93     
    93     PROFILE_DEBUG3("CSipAlrMonitor::AllowMigration, BearerFiltering",aConfigData.iBearerId)
    94     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aSnapId );
    94     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aConfigData );
    95     if ( monitor )
    95     if ( monitor )
    96         {
    96         {
    97         monitor->AllowMigration();     
    97         monitor->AllowMigration();     
    98         return KErrNone;
    98         return KErrNone;
    99 		}
    99 		}
   101     }
   101     }
   102 // -----------------------------------------------------------------------------
   102 // -----------------------------------------------------------------------------
   103 // CSipAlrMonitor::DisallowMigration
   103 // CSipAlrMonitor::DisallowMigration
   104 // -----------------------------------------------------------------------------
   104 // -----------------------------------------------------------------------------
   105 //
   105 //
   106 TInt CSipAlrMonitor::DisallowMigration( TUint32 aSnapId )
   106 TInt CSipAlrMonitor::DisallowMigration( TSipSNAPConfigurationData& aConfigData )
   107     {
   107     {
   108     PROFILE_DEBUG3("CSipAlrMonitor::DisallowMigration, SnapId",aSnapId)
   108     PROFILE_DEBUG3("CSipAlrMonitor::DisallowMigration, SnapId",aConfigData.iSnapId)
   109     
   109     PROFILE_DEBUG3("CSipAlrMonitor::DisallowMigration, BearerFiltering",aConfigData.iBearerId)
   110     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aSnapId );
   110     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aConfigData );
   111     if ( monitor )
   111     if ( monitor )
   112         {
   112         {
   113         monitor->DisallowMigration();     
   113         monitor->DisallowMigration();     
   114         return KErrNone;
   114         return KErrNone;
   115 		}
   115 		}
   118     
   118     
   119 // -----------------------------------------------------------------------------
   119 // -----------------------------------------------------------------------------
   120 // CSipAlrMonitor::NewIapAccepted
   120 // CSipAlrMonitor::NewIapAccepted
   121 // -----------------------------------------------------------------------------
   121 // -----------------------------------------------------------------------------
   122 //    
   122 //    
   123 TInt CSipAlrMonitor::NewIapAccepted( TUint32 aSnapId )  
   123 TInt CSipAlrMonitor::NewIapAccepted( TSipSNAPConfigurationData & aConfigData)  
   124     {
   124     {
   125     PROFILE_DEBUG3("CSipAlrMonitor::NewIapAccepted, SnapId",aSnapId)
   125     PROFILE_DEBUG3("CSipAlrMonitor::NewIapAccepted, SnapId",aConfigData.iSnapId)
   126     
   126     
   127     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aSnapId );
   127     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aConfigData );
   128     if ( monitor )
   128     if ( monitor )
   129         {
   129         {
   130         monitor->NewIapAccepted();     
   130         monitor->NewIapAccepted();     
   131         return KErrNone;
   131         return KErrNone;
   132 		}
   132 		}
   135     
   135     
   136 // -----------------------------------------------------------------------------
   136 // -----------------------------------------------------------------------------
   137 // CSipAlrMonitor::NewIapRejected
   137 // CSipAlrMonitor::NewIapRejected
   138 // -----------------------------------------------------------------------------
   138 // -----------------------------------------------------------------------------
   139 //  
   139 //  
   140 TInt CSipAlrMonitor::NewIapRejected( TUint32 aSnapId )
   140 TInt CSipAlrMonitor::NewIapRejected( TSipSNAPConfigurationData & aConfigData )
   141     {
   141     {
   142     PROFILE_DEBUG3( "CSipAlrMonitor::NewIapRejected, SnapId",aSnapId )
   142     PROFILE_DEBUG3( "CSipAlrMonitor::NewIapRejected, SnapId",aConfigData.iSnapId )
   143     
   143     
   144     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aSnapId );
   144     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aConfigData );
   145     if ( monitor )
   145     if ( monitor )
   146         {
   146         {
   147         monitor->NewIapRejected();
   147         monitor->NewIapRejected();
   148         return KErrNone;
   148         return KErrNone;
   149         }
   149         }
   153 // -----------------------------------------------------------------------------
   153 // -----------------------------------------------------------------------------
   154 // CSipAlrMonitor::MonitorSnapL
   154 // CSipAlrMonitor::MonitorSnapL
   155 // -----------------------------------------------------------------------------
   155 // -----------------------------------------------------------------------------
   156 //
   156 //
   157 void CSipAlrMonitor::MonitorSnapL( 
   157 void CSipAlrMonitor::MonitorSnapL( 
   158     TUint32 aSnapId,
   158     TSipSNAPConfigurationData& aConfigData,
   159     MSipAlrObserver& aObserver )
   159     MSipAlrObserver& aObserver)
   160     {
   160     {
   161     PROFILE_DEBUG4( "CSipAlrMonitor::MonitorSnapL",
   161     PROFILE_DEBUG4( "CSipAlrMonitor::MonitorSnapL",
   162                     aSnapId, reinterpret_cast< TUint >( &aObserver ) )    
   162             aConfigData.iSnapId, reinterpret_cast< TUint >( &aObserver ) ) 
   163     
   163                     
   164     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aSnapId );
   164  
       
   165     CSipAlrSnapMonitor* monitor = FindSnapMonitor( aConfigData);
   165     if ( monitor )
   166     if ( monitor )
   166         {
   167         {
   167         // Monitor exists, add observer and get current IAP availability
   168         // Monitor exists, add observer and get current IAP availability
   168         monitor->AddObserverL(aObserver);
   169         monitor->AddObserverL(aObserver);
   169         monitor->RefreshL();
   170         monitor->RefreshL();
   171         PROFILE_DEBUG1("CSipAlrMonitor::MonitorSnapL: observer added" )
   172         PROFILE_DEBUG1("CSipAlrMonitor::MonitorSnapL: observer added" )
   172         }
   173         }
   173     else
   174     else
   174         {
   175         {
   175     	monitor = CSipAlrSnapMonitor::NewLC( 
   176     	monitor = CSipAlrSnapMonitor::NewLC( 
   176     	    aSnapId, aObserver, iSocketServer, iSystemStateMonitor );
   177     	        aConfigData, aObserver, iSocketServer, iSystemStateMonitor);
   177     	iSnapMonitors.AppendL( monitor );
   178     	iSnapMonitors.AppendL( monitor );
   178     	CleanupStack::Pop( monitor );
   179     	CleanupStack::Pop( monitor );
   179     	
   180     	
   180     	PROFILE_DEBUG1("CSipAlrMonitor::MonitorSnapL: new monitor created" )
   181     	PROFILE_DEBUG1("CSipAlrMonitor::MonitorSnapL: new monitor created" )
   181         }
   182         }
   201 
   202 
   202 // -----------------------------------------------------------------------------
   203 // -----------------------------------------------------------------------------
   203 // CSipAlrMonitor::FindSnapMonitor
   204 // CSipAlrMonitor::FindSnapMonitor
   204 // -----------------------------------------------------------------------------
   205 // -----------------------------------------------------------------------------
   205 //
   206 //
   206 CSipAlrSnapMonitor* CSipAlrMonitor::FindSnapMonitor( TUint32 aSnapId )
   207 CSipAlrSnapMonitor* CSipAlrMonitor::FindSnapMonitor( TSipSNAPConfigurationData & aConfigData)
   207     {
   208     {
   208     CSipAlrSnapMonitor* monitor = NULL;
   209     CSipAlrSnapMonitor* monitor = NULL;
   209 	for ( TInt i = 0; i < iSnapMonitors.Count() && !monitor; i++ )
   210 	for ( TInt i = 0; i < iSnapMonitors.Count() && !monitor; i++ )
   210 		{
   211 		{
   211 		if ( iSnapMonitors[i]->SnapId() == aSnapId )
   212 		if ( iSnapMonitors[i]->SnapId() == aConfigData.iSnapId && iSnapMonitors[i]->BearerId() == aConfigData.iBearerId ) //mtr found
   212 			{    
   213 		    {
   213 			monitor = iSnapMonitors[i];
   214 		   	monitor = iSnapMonitors[i];
   214 			}
   215 			}
   215         }
   216         }
   216     return monitor;
   217     return monitor;
   217     }
   218     }
       
   219 
       
   220 
       
   221