cmmanager/cmmgr/cmmserver/src/cmmconnmethodinstance.cpp
changeset 40 c5b848e6c7d1
parent 30 8dde790cab74
child 44 a0c4ceac30d0
equal deleted inserted replaced
34:3b0cec605979 40:c5b848e6c7d1
   142 
   142 
   143 // ---------------------------------------------------------------------------
   143 // ---------------------------------------------------------------------------
   144 // Set connection method ID.
   144 // Set connection method ID.
   145 // ---------------------------------------------------------------------------
   145 // ---------------------------------------------------------------------------
   146 //
   146 //
   147 void CCmmConnMethodInstance::SetId( const TUint32& aConnMethodId )
   147 void CCmmConnMethodInstance::SetId( const TUint32 aConnMethodId )
   148     {
   148     {
   149     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETID_ENTRY );
   149     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETID_ENTRY );
   150 
   150 
   151     iConnMethodId = aConnMethodId;
   151     iConnMethodId = aConnMethodId;
   152 
   152 
   173 
   173 
   174 // ---------------------------------------------------------------------------
   174 // ---------------------------------------------------------------------------
   175 // Set handle ID.
   175 // Set handle ID.
   176 // ---------------------------------------------------------------------------
   176 // ---------------------------------------------------------------------------
   177 //
   177 //
   178 void CCmmConnMethodInstance::SetHandle( const TInt& aHandle )
   178 void CCmmConnMethodInstance::SetHandle( const TInt aHandle )
   179     {
   179     {
   180     iHandle = aHandle;
   180     iHandle = aHandle;
   181     }
   181     }
   182 
   182 
   183 // ---------------------------------------------------------------------------
   183 // ---------------------------------------------------------------------------
   240     if ( !iPlugin )
   240     if ( !iPlugin )
   241         {
   241         {
   242         User::Leave( KErrCorrupt );
   242         User::Leave( KErrCorrupt );
   243         }
   243         }
   244 
   244 
   245     iPlugin->GetPluginDataL( iPluginDataInstance ); //TODO, check deletes for iPluginDataInstance
   245     // Embedded destination does not have any data.
       
   246     if ( !IsEmbeddedDestination() )
       
   247         {
       
   248         iPlugin->GetPluginDataL( iPluginDataInstance );
       
   249         }
       
   250 
   246     aConnMethodStruct->IncrementReferenceCounter();
   251     aConnMethodStruct->IncrementReferenceCounter();
   247 
   252 
   248     switch ( aConnMethodStruct->GetStatus() )
   253     switch ( aConnMethodStruct->GetStatus() )
   249         {
   254         {
   250         case ECmmConnMethodStatusNotSaved:
   255         case ECmmConnMethodStatusNotSaved:
   269 
   274 
   270 // ---------------------------------------------------------------------------
   275 // ---------------------------------------------------------------------------
   271 // CCmmConnMethodInstance::GetIntAttributeL
   276 // CCmmConnMethodInstance::GetIntAttributeL
   272 // ---------------------------------------------------------------------------
   277 // ---------------------------------------------------------------------------
   273 //
   278 //
   274 TUint32 CCmmConnMethodInstance::GetIntAttributeL( const TUint32& aAttribute )
   279 TUint32 CCmmConnMethodInstance::GetIntAttributeL( const TUint32 aAttribute )
   275     {
   280     {
   276     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETINTATTRIBUTEL_ENTRY );
   281     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETINTATTRIBUTEL_ENTRY );
   277 
   282 
   278     if ( !iPlugin )
   283     if ( !iPlugin )
   279         {
   284         {
   280         User::Leave( KErrCorrupt );
   285         User::Leave( KErrCorrupt );
       
   286         }
       
   287 
       
   288     // Embedded destination has only limited set of attributes.
       
   289     if ( IsEmbeddedDestination() )
       
   290         {
       
   291         switch ( aAttribute )
       
   292             {
       
   293             case CMManager::ECmId:
       
   294             case CMManager::ECmBearerType:
       
   295             case CMManager::ECmDefaultPriority:
       
   296             case CMManager::ECmDefaultUiPriority:
       
   297             case ECmExtensionLevel:
       
   298                 {
       
   299                 break;
       
   300                 }
       
   301             default:
       
   302                 {
       
   303                 User::Leave( KErrNotSupported );
       
   304                 }
       
   305             }
   281         }
   306         }
   282 
   307 
   283     TUint32 result = iPlugin->GetIntAttributeL( aAttribute, iPluginDataInstance );
   308     TUint32 result = iPlugin->GetIntAttributeL( aAttribute, iPluginDataInstance );
   284 
   309 
   285     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETINTATTRIBUTEL_EXIT );
   310     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETINTATTRIBUTEL_EXIT );
   288 
   313 
   289 // ---------------------------------------------------------------------------
   314 // ---------------------------------------------------------------------------
   290 // CCmmConnMethodInstance::GetBoolAttributeL
   315 // CCmmConnMethodInstance::GetBoolAttributeL
   291 // ---------------------------------------------------------------------------
   316 // ---------------------------------------------------------------------------
   292 //
   317 //
   293 TBool CCmmConnMethodInstance::GetBoolAttributeL( const TUint32& aAttribute )
   318 TBool CCmmConnMethodInstance::GetBoolAttributeL( const TUint32 aAttribute )
   294     {
   319     {
   295     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETBOOLATTRIBUTEL_ENTRY );
   320     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETBOOLATTRIBUTEL_ENTRY );
   296 
   321 
   297     if ( !iPlugin )
   322     if ( !iPlugin )
   298         {
   323         {
   299         User::Leave( KErrCorrupt );
   324         User::Leave( KErrCorrupt );
       
   325         }
       
   326 
       
   327     // Embedded destination has only limited set of attributes.
       
   328     if ( IsEmbeddedDestination() )
       
   329         {
       
   330         switch ( aAttribute )
       
   331             {
       
   332             case CMManager::ECmCoverage:
       
   333             case CMManager::ECmDestination:
       
   334             case CMManager::ECmProtected:
       
   335             case CMManager::ECmHidden:
       
   336             case CMManager::ECmBearerHasUi:
       
   337             case CMManager::ECmVirtual:
       
   338                 {
       
   339                 break;
       
   340                 }
       
   341             default:
       
   342                 {
       
   343                 User::Leave( KErrNotSupported );
       
   344                 }
       
   345             }
   300         }
   346         }
   301 
   347 
   302     TBool retVal( EFalse );
   348     TBool retVal( EFalse );
   303     switch ( aAttribute )
   349     switch ( aAttribute )
   304         {
   350         {
   305         case CMManager::ECmConnected:
   351         case CMManager::ECmConnected:
   306             {
   352             {
   307             if ( GetId() > 0 )
   353             if ( GetId() > 0 )
   308                 {
   354                 {
   309                 if ( iCache )
   355                 // Check first if this is embedded destination.
       
   356                 retVal = iPlugin->GetBoolAttributeL( CMManager::ECmDestination,
       
   357                         iPluginDataInstance );
       
   358                 if ( retVal )
   310                     {
   359                     {
   311                     retVal = iCache->CheckIfCmConnected( GetId() );
   360                     retVal = iCache->DestinationConnectedL( GetId() );
       
   361                     }
       
   362                 else
       
   363                     {
       
   364                     if ( iCache )
       
   365                         {
       
   366                         retVal = iCache->CheckIfCmConnected( GetId() );
       
   367                         }
   312                     }
   368                     }
   313                 }
   369                 }
   314             }
   370             }
   315             break;
   371             break;
   316         case CMManager::ECmIsLinked:
   372         case CMManager::ECmIsLinked:
   317             {
   373             {
   318             //TODO
   374             // Does any virtual iap point to this connection method.
       
   375             // Check first if this connection method is an embedded destination.
       
   376             if ( GetId() > 0 )
       
   377                 {
       
   378                 retVal = iPlugin->GetBoolAttributeL( CMManager::ECmDestination,
       
   379                         iPluginDataInstance );
       
   380                 if ( retVal )
       
   381                     {
       
   382                     retVal = iCache->DestinationPointedToByVirtualIap( GetId() );
       
   383                     }
       
   384                 else
       
   385                     {
       
   386                     retVal = iCache->ConnMethodPointedToByVirtualIap( GetId() );
       
   387                     }
       
   388                 }
   319             }
   389             }
   320             break;
   390             break;
   321         default:
   391         default:
   322             {
   392             {
   323             retVal = iPlugin->GetBoolAttributeL( aAttribute, iPluginDataInstance );
   393             retVal = iPlugin->GetBoolAttributeL( aAttribute, iPluginDataInstance );
   331 
   401 
   332 // ---------------------------------------------------------------------------
   402 // ---------------------------------------------------------------------------
   333 // CCmmConnMethodInstance::GetStringAttributeL
   403 // CCmmConnMethodInstance::GetStringAttributeL
   334 // ---------------------------------------------------------------------------
   404 // ---------------------------------------------------------------------------
   335 //
   405 //
   336 HBufC* CCmmConnMethodInstance::GetStringAttributeL( const TUint32& aAttribute )
   406 HBufC* CCmmConnMethodInstance::GetStringAttributeL( const TUint32 aAttribute )
   337     {
   407     {
   338     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETSTRINGATTRIBUTEL_ENTRY );
   408     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETSTRINGATTRIBUTEL_ENTRY );
   339 
   409 
   340     if ( !iPlugin )
   410     if ( !iPlugin )
   341         {
   411         {
   342         User::Leave( KErrCorrupt );
   412         User::Leave( KErrCorrupt );
       
   413         }
       
   414 
       
   415     // Embedded destination has only limited set of attributes.
       
   416     if ( IsEmbeddedDestination() )
       
   417         {
       
   418         User::Leave( KErrNotSupported );
   343         }
   419         }
   344 
   420 
   345     HBufC* result = iPlugin->GetStringAttributeL( aAttribute, iPluginDataInstance );
   421     HBufC* result = iPlugin->GetStringAttributeL( aAttribute, iPluginDataInstance );
   346 
   422 
   347     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETSTRINGATTRIBUTEL_EXIT );
   423     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETSTRINGATTRIBUTEL_EXIT );
   350 
   426 
   351 // ---------------------------------------------------------------------------
   427 // ---------------------------------------------------------------------------
   352 // CCmmConnMethodInstance::GetString8AttributeL
   428 // CCmmConnMethodInstance::GetString8AttributeL
   353 // ---------------------------------------------------------------------------
   429 // ---------------------------------------------------------------------------
   354 //
   430 //
   355 HBufC8* CCmmConnMethodInstance::GetString8AttributeL( const TUint32& aAttribute )
   431 HBufC8* CCmmConnMethodInstance::GetString8AttributeL( const TUint32 aAttribute )
   356     {
   432     {
   357     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETSTRING8ATTRIBUTEL_ENTRY );
   433     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_GETSTRING8ATTRIBUTEL_ENTRY );
   358 
   434 
   359     if ( !iPlugin )
   435     if ( !iPlugin )
   360         {
   436         {
   361         User::Leave( KErrCorrupt );
   437         User::Leave( KErrCorrupt );
       
   438         }
       
   439 
       
   440     // Embedded destination has only limited set of attributes.
       
   441     if ( IsEmbeddedDestination() )
       
   442         {
       
   443         User::Leave( KErrNotSupported );
   362         }
   444         }
   363 
   445 
   364     HBufC8* result = iPlugin->GetString8AttributeL( aAttribute, iPluginDataInstance );
   446     HBufC8* result = iPlugin->GetString8AttributeL( aAttribute, iPluginDataInstance );
   365 
   447 
   366     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETSTRING8ATTRIBUTEL_EXIT );
   448     OstTraceFunctionExit0( CCMMCONNMETHODINSTANCE_GETSTRING8ATTRIBUTEL_EXIT );
   370 // ---------------------------------------------------------------------------
   452 // ---------------------------------------------------------------------------
   371 // CCmmConnMethodInstance::SetIntAttributeL
   453 // CCmmConnMethodInstance::SetIntAttributeL
   372 // ---------------------------------------------------------------------------
   454 // ---------------------------------------------------------------------------
   373 //
   455 //
   374 void CCmmConnMethodInstance::SetIntAttributeL(
   456 void CCmmConnMethodInstance::SetIntAttributeL(
   375         const TUint32& aAttribute,
   457         const TUint32 aAttribute,
   376         const TUint32& aValue )
   458         const TUint32 aValue )
   377     {
   459     {
   378     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETINTATTRIBUTEL_ENTRY );
   460     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETINTATTRIBUTEL_ENTRY );
   379 
   461 
   380     if ( !iPlugin )
   462     if ( !iPlugin )
   381         {
   463         {
   390 // ---------------------------------------------------------------------------
   472 // ---------------------------------------------------------------------------
   391 // CCmmConnMethodInstance::SetBoolAttributeL
   473 // CCmmConnMethodInstance::SetBoolAttributeL
   392 // ---------------------------------------------------------------------------
   474 // ---------------------------------------------------------------------------
   393 //
   475 //
   394 void CCmmConnMethodInstance::SetBoolAttributeL(
   476 void CCmmConnMethodInstance::SetBoolAttributeL(
   395         const TUint32& aAttribute,
   477         const TUint32 aAttribute,
   396         const TBool& aValue )
   478         const TBool aValue )
   397     {
   479     {
   398     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETBOOLATTRIBUTEL_ENTRY );
   480     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETBOOLATTRIBUTEL_ENTRY );
   399 
   481 
   400     if ( !iPlugin )
   482     if ( !iPlugin )
   401         {
   483         {
   410 // ---------------------------------------------------------------------------
   492 // ---------------------------------------------------------------------------
   411 // CCmmConnMethodInstance::SetStringAttributeL
   493 // CCmmConnMethodInstance::SetStringAttributeL
   412 // ---------------------------------------------------------------------------
   494 // ---------------------------------------------------------------------------
   413 //
   495 //
   414 void CCmmConnMethodInstance::SetStringAttributeL(
   496 void CCmmConnMethodInstance::SetStringAttributeL(
   415         const TUint32& aAttribute,
   497         const TUint32 aAttribute,
   416         const TDesC16& aValue )
   498         const TDesC16& aValue )
   417     {
   499     {
   418     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETSTRINGATTRIBUTEL_ENTRY );
   500     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETSTRINGATTRIBUTEL_ENTRY );
   419 
   501 
   420     if ( !iPlugin )
   502     if ( !iPlugin )
   430 // ---------------------------------------------------------------------------
   512 // ---------------------------------------------------------------------------
   431 // CCmmConnMethodInstance::SetString8AttributeL
   513 // CCmmConnMethodInstance::SetString8AttributeL
   432 // ---------------------------------------------------------------------------
   514 // ---------------------------------------------------------------------------
   433 //
   515 //
   434 void CCmmConnMethodInstance::SetString8AttributeL(
   516 void CCmmConnMethodInstance::SetString8AttributeL(
   435         const TUint32& aAttribute,
   517         const TUint32 aAttribute,
   436         const TDesC8& aValue )
   518         const TDesC8& aValue )
   437     {
   519     {
   438     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETSTRING8ATTRIBUTEL_ENTRY );
   520     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_SETSTRING8ATTRIBUTEL_ENTRY );
   439 
   521 
   440     if ( !iPlugin )
   522     if ( !iPlugin )
   479 // Called after this connection method has been deleted and database
   561 // Called after this connection method has been deleted and database
   480 // transaction has completed successfully. Sets the internal state of this
   562 // transaction has completed successfully. Sets the internal state of this
   481 // connection method structure to reflect the new deleted state.
   563 // connection method structure to reflect the new deleted state.
   482 // ---------------------------------------------------------------------------
   564 // ---------------------------------------------------------------------------
   483 //
   565 //
   484 void CCmmConnMethodInstance::DeleteSuccessful( const TUint32& aNewSecondaryId )
   566 void CCmmConnMethodInstance::DeleteSuccessful( const TUint32 aNewSecondaryId )
   485     {
   567     {
   486     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_DELETESUCCESSFUL_ENTRY );
   568     OstTraceFunctionEntry0( CCMMCONNMETHODINSTANCE_DELETESUCCESSFUL_ENTRY );
   487 
   569 
   488     SetStatus( ECmmConnMethodStatusChanged );
   570     SetStatus( ECmmConnMethodStatusChanged );
   489     SetId( aNewSecondaryId );
   571     SetId( aNewSecondaryId );
   514 // Removes a connection method from any open destination handle in the same
   596 // Removes a connection method from any open destination handle in the same
   515 // session.
   597 // session.
   516 // ---------------------------------------------------------------------------
   598 // ---------------------------------------------------------------------------
   517 //
   599 //
   518 void CCmmConnMethodInstance::RemoveConnMethodFromSessionDestinationHandles(
   600 void CCmmConnMethodInstance::RemoveConnMethodFromSessionDestinationHandles(
   519         const TUint32& aConnMethodId )
   601         const TUint32 aConnMethodId )
   520     {
   602     {
   521     if ( iCmmSession )
   603     if ( iCmmSession )
   522         {
   604         {
   523         iCmmSession->RemoveConnMethodFromDestinationHandles( aConnMethodId );
   605         iCmmSession->RemoveConnMethodFromDestinationHandles( aConnMethodId );
   524         }
   606         }