realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Src/Sipimsprofileusimprovider.cpp
branchRCL_3
changeset 16 43c4dec3cb1f
parent 0 307788aac0a8
child 42 69df6ed78a6a
equal deleted inserted replaced
14:532ef74cdfa0 16:43c4dec3cb1f
    71     {
    71     {
    72     PROFILE_DEBUG1("CSIPProfileUsimProvider::ConstructL")
    72     PROFILE_DEBUG1("CSIPProfileUsimProvider::ConstructL")
    73     
    73     
    74     User::LeaveIfError( iPhone.Open( aTelServer, aPhoneInfo.iName ) );
    74     User::LeaveIfError( iPhone.Open( aTelServer, aPhoneInfo.iName ) );
    75 
    75 
    76 	TUint32 caps;
    76 	TUint32 caps(0);
    77 	User::LeaveIfError(iPhone.GetIccAccessCaps(caps));
    77 	User::LeaveIfError(iPhone.GetIccAccessCaps(caps));
    78 	if(caps & RMobilePhone::KCapsSimAccessSupported)
    78 	if(caps & RMobilePhone::KCapsSimAccessSupported)
    79 		{
    79 		{
       
    80 		PROFILE_DEBUG1("CSIPProfileUsimProvider::ConstructL, sim supported")
    80 		iSIMSupported = ETrue;
    81 		iSIMSupported = ETrue;
    81 		}
       
    82 	
       
    83 	if(caps & RMobilePhone::KCapsRUimAccessSupported)
       
    84 		{
       
    85 		}
    82 		}
    86 	
    83 	
    87 	//usim supported
    84 	//usim supported
    88 	if(caps & RMobilePhone::KCapsUSimAccessSupported)
    85 	if(caps & RMobilePhone::KCapsUSimAccessSupported)
    89 		{			
    86 		{	
       
    87 		PROFILE_DEBUG1("CSIPProfileUsimProvider::ConstructL, usim supported")		
    90 		iUSimSupported = ETrue;
    88 		iUSimSupported = ETrue;
    91 		}
    89 		}
    92 	
    90 	
    93 	if(!iUSimSupported && iSIMSupported)
    91 	if(!iUSimSupported && iSIMSupported)
    94 		{
    92 		{
   114 		}
   112 		}
   115 	if(!iUSimSupported && !iSIMSupported)
   113 	if(!iUSimSupported && !iSIMSupported)
   116 		{
   114 		{
   117 		User::Leave(KErrNotSupported);	
   115 		User::Leave(KErrNotSupported);	
   118 		}
   116 		}
       
   117 		
       
   118     PROFILE_DEBUG1("CSIPProfileUsimProvider::ConstructL, exit")
   119     }
   119     }
   120 
   120 
   121 // ----------------------------------------------------------------------------
   121 // ----------------------------------------------------------------------------
   122 // CSIPProfileUsimProvider::IsSIMSupported
   122 // CSIPProfileUsimProvider::IsSIMSupported
   123 // ----------------------------------------------------------------------------
   123 // ----------------------------------------------------------------------------
   151 
   151 
   152 // ----------------------------------------------------------------------------
   152 // ----------------------------------------------------------------------------
   153 // CSIPProfileUsimProvider::RequestL
   153 // CSIPProfileUsimProvider::RequestL
   154 // ----------------------------------------------------------------------------
   154 // ----------------------------------------------------------------------------
   155 //
   155 //
   156 void CSIPProfileUsimProvider::RequestL(TBool /*aUseSIM*/)
   156 TBool CSIPProfileUsimProvider::RequestL(TBool aUseUSIM)
   157     {
   157     {
   158     TBool requestmade = EFalse;
   158     
   159     if (!iProfileSIMRecord.SIMPrivateIdentity().Length())
   159     TBool requestFailed = EFalse;
   160   		{
   160     TBool credentialsExists = EFalse;
   161   		if (iAuthorizationSIM)
   161    	
   162   			{
   162   	if ( aUseUSIM )
   163   			iAuthorizationSIM->RequestL();
       
   164   			requestmade = ETrue;
       
   165   			}
       
   166 		else
       
   167 			{
       
   168 			User::Leave(KErrArgument);
       
   169 			}
       
   170   		}
       
   171   		
       
   172   	if (IsUsimSupported())
       
   173 		{
   163 		{
   174   		if (!iProfileSIMRecord.PrivateIdentity().Length())
   164   		if (!iProfileSIMRecord.PrivateIdentity().Length())    
   175   			{   
   165   		    {
   176     		iAuthorization->RequestL();
   166             if(iAuthorization->IsImsAuthorizationAllowed())
   177     		requestmade = ETrue;
   167                 {
   178   			}
   168                 iAuthorization->RequestL();
   179 		}
   169                 }
   180     if (!requestmade)
   170             else
       
   171                 {
       
   172                 requestFailed = ETrue;
       
   173                 }
       
   174   		    }
       
   175   		else
       
   176   		    {
       
   177             credentialsExists = ETrue;
       
   178   		    }
       
   179 		}
       
   180   	
       
   181   	else 
       
   182   	    {
       
   183         if (!iProfileSIMRecord.SIMPrivateIdentity().Length())
       
   184   	        { 	
       
   185             if(iAuthorizationSIM->IsSIMAuthorizationAllowed())
       
   186                 {
       
   187                 iAuthorizationSIM->RequestL();
       
   188                 }
       
   189             else
       
   190                 {
       
   191                 requestFailed = ETrue;
       
   192                 } 
       
   193   	        }
       
   194         else
       
   195             {
       
   196             credentialsExists = ETrue;
       
   197             }
       
   198   	    }
       
   199   	
       
   200     if (credentialsExists)
   181     	{
   201     	{
   182     	iObserver.AsyncDeltaTimer();
   202     	iObserver.AsyncDeltaTimer();
   183     	}
   203     	}
       
   204     
       
   205     return requestFailed;
   184     }   
   206     }   
   185             
   207             
   186 // ----------------------------------------------------------------------------
   208 // ----------------------------------------------------------------------------
   187 // CSIPProfileUsimProvider::Cancel
   209 // CSIPProfileUsimProvider::Cancel
   188 // ----------------------------------------------------------------------------
   210 // ----------------------------------------------------------------------------
   207 // CSIPProfileUsimProvider::AuthorizedL
   229 // CSIPProfileUsimProvider::AuthorizedL
   208 // ----------------------------------------------------------------------------
   230 // ----------------------------------------------------------------------------
   209 //
   231 //
   210 void CSIPProfileUsimProvider::AuthorizedL()
   232 void CSIPProfileUsimProvider::AuthorizedL()
   211     {
   233     {
       
   234     PROFILE_DEBUG1("CSIPProfileUsimProvider::AuthorizedL")
       
   235     
   212     if (iAuthorization)
   236     if (iAuthorization)
   213     	{
   237     	{
   214     	RMobilePhone::CImsAuthorizationInfoV5& authorization = 
   238     	RMobilePhone::CImsAuthorizationInfoV5& authorization = 
   215                                             iAuthorization->Response();
   239                                             iAuthorization->Response();
       
   240 
       
   241        	PROFILE_DEBUG3( "CSIPProfileUsimProvider::AuthorizedL, datasource:",
       
   242     	               authorization.iAuthenticationDataSource )
   216 
   243 
   217     	iProfileSIMRecord.SetPrivateIdL(authorization.iIMPI);
   244     	iProfileSIMRecord.SetPrivateIdL(authorization.iIMPI);
   218     	iProfileSIMRecord.SetFirstPublicUserNameL(authorization.iIMPUArray[0]);
   245     	iProfileSIMRecord.SetFirstPublicUserNameL(authorization.iIMPUArray[0]);
   219     	iProfileSIMRecord.SetHomeNetworkDomainNameL(
   246     	iProfileSIMRecord.SetHomeNetworkDomainNameL(
   220     									authorization.iHomeNetworkDomainName);
   247     									authorization.iHomeNetworkDomainName);
   221     	iProfileSIMRecord.SetISIMPresent(
   248     	iProfileSIMRecord.SetISIMPresent(
   222     	    authorization.iAuthenticationDataSource == RMobilePhone::EFromISIM);
   249     	    authorization.iAuthenticationDataSource == RMobilePhone::EFromISIM);
   223     	
   250     	
   224     	iObserver.AuthorizedL();
   251     	iObserver.AuthorizedL();
   225     	}
   252     	}
       
   253     	
       
   254     PROFILE_DEBUG1("CSIPProfileUsimProvider::AuthorizedL, exit")
   226     }    
   255     }    
   227 
   256 
   228 // ----------------------------------------------------------------------------
   257 // ----------------------------------------------------------------------------
   229 // CSIPProfileUsimProvider::AuthorizedSubscriberIdL
   258 // CSIPProfileUsimProvider::AuthorizedSubscriberIdL
   230 // ----------------------------------------------------------------------------
   259 // ----------------------------------------------------------------------------
   247 // CSIPProfileUsimProvider::DeriveValuesL
   276 // CSIPProfileUsimProvider::DeriveValuesL
   248 // ----------------------------------------------------------------------------
   277 // ----------------------------------------------------------------------------
   249 //
   278 //
   250 void CSIPProfileUsimProvider::DeriveValuesL()
   279 void CSIPProfileUsimProvider::DeriveValuesL()
   251     {    
   280     {    
       
   281     PROFILE_DEBUG1("CSIPProfileUsimProvider::DeriveValuesL")
       
   282     
   252     _LIT8(Kimsmnc, "ims.mnc");
   283     _LIT8(Kimsmnc, "ims.mnc");
   253     _LIT8(Kmcc, ".mcc");
   284     _LIT8(Kmcc, ".mcc");
   254     _LIT8(K3gppnetwork, ".3gppnetwork.org");
   285     _LIT8(K3gppnetwork, ".3gppnetwork.org");
   255     _LIT8(Kato, "@");
   286     _LIT8(Kato, "@");
   256     _LIT8(Ksip, "sip:");
   287     _LIT8(Ksip, "sip:");
   325     iProfileSIMRecord.SetSIMFirstPublicUserNameL(*temp);
   356     iProfileSIMRecord.SetSIMFirstPublicUserNameL(*temp);
   326     CleanupStack::Pop(temp);
   357     CleanupStack::Pop(temp);
   327     delete temp;
   358     delete temp;
   328     temp = NULL;
   359     temp = NULL;
   329     iObserver.AuthorizedL();
   360     iObserver.AuthorizedL();
   330      }    
   361     
       
   362     PROFILE_DEBUG1("CSIPProfileUsimProvider::DeriveValuesL, exit")
       
   363     }    
   331 
   364 
   332 // ----------------------------------------------------------------------------
   365 // ----------------------------------------------------------------------------
   333 // CSIPProfileUsimProvider::AuthorizationFailed
   366 // CSIPProfileUsimProvider::AuthorizationFailed
   334 // ----------------------------------------------------------------------------
   367 // ----------------------------------------------------------------------------
   335 //
   368 //
   356 // ----------------------------------------------------------------------------
   389 // ----------------------------------------------------------------------------
   357 //
   390 //
   358 void CSIPProfileUsimProvider::AuthInfoUpdatedL()
   391 void CSIPProfileUsimProvider::AuthInfoUpdatedL()
   359 	{
   392 	{
   360 	iProfileSIMRecord.ResetISIMValuesL();
   393 	iProfileSIMRecord.ResetISIMValuesL();
       
   394 	if(iAuthorizationSIM)
       
   395 	    {
       
   396         iAuthorizationSIM->ResetSIMAuthorizationAllowed(EFalse);
       
   397 	    }
       
   398 	if(iAuthorization)
       
   399 	    {
       
   400         iAuthorization->ResetImsAuthorizationAllowed(EFalse);
       
   401 	    }
   361 	iObserver.UpdateRegistrationsL();
   402 	iObserver.UpdateRegistrationsL();
   362   	if (!iProfileSIMRecord.PrivateIdentity().Length())
   403   	if (!iProfileSIMRecord.PrivateIdentity().Length())
   363   		{   
   404   		{   
   364     	iAuthorization->RequestL();
   405     	iAuthorization->RequestL();
   365   		}
   406   		}