voipplugins/voipadapters/cpvoipadapter/src/CWPVoIPItem.cpp
branchRCL_3
changeset 6 fc8c25e5a2e8
parent 0 a4daefaec16c
child 20 65a3ef1d5bd0
equal deleted inserted replaced
2:7b872347d83b 6:fc8c25e5a2e8
  1589             static_cast<CSIPManagedProfile*>( sipProf );
  1589             static_cast<CSIPManagedProfile*>( sipProf );
  1590         CleanupStack::PushL( sipManagedProf ); // CS:4
  1590         CleanupStack::PushL( sipManagedProf ); // CS:4
  1591 
  1591 
  1592         TUint32 snapId( 0 );
  1592         TUint32 snapId( 0 );
  1593         err = sipManagedProf->GetParameter( KSIPSnapId, snapId );
  1593         err = sipManagedProf->GetParameter( KSIPSnapId, snapId );
       
  1594                 
  1594         if ( KErrNone == err )
  1595         if ( KErrNone == err )
  1595             {
  1596             {
  1596             iSnapId = snapId;
  1597             iSnapId = snapId;
  1597             iSnapIdSet = ETrue;
  1598             iSnapIdSet = ETrue;
  1598             }
  1599             }
       
  1600         else if ( KErrNotFound == err )
       
  1601             {
       
  1602             TUint32 iapId( 0 );
       
  1603             err = sipManagedProf->GetParameter( KSIPAccessPointId, iapId );
       
  1604             
       
  1605             if ( KErrNone == err )
       
  1606                 {
       
  1607                 // Copy connection method to default SNAP
       
  1608                 RCmManagerExt cmManager;
       
  1609                 CleanupClosePushL( cmManager );
       
  1610                 cmManager.OpenL();
       
  1611                 
       
  1612                 TCmDefConnValue defConn;
       
  1613                 cmManager.ReadDefConnL( defConn );
       
  1614                 iSnapId = defConn.iId;  
       
  1615                 iSnapIdSet = ETrue;
       
  1616                 
       
  1617                 RCmDestinationExt defaultSnap;
       
  1618                 CleanupClosePushL( defaultSnap );
       
  1619                 defaultSnap = cmManager.DestinationL( iSnapId );
       
  1620                 
       
  1621                 RCmConnectionMethodExt connection = 
       
  1622                     cmManager.ConnectionMethodL( iapId );
       
  1623                 CleanupClosePushL( connection );
       
  1624                 
       
  1625                 // Get connection name
       
  1626                 HBufC* connectionName = 
       
  1627                     connection.GetStringAttributeL( CMManager::ECmName );
       
  1628                 CleanupStack::PushL( connectionName );   
       
  1629                 
       
  1630                 RBuf parsedConnectionName;
       
  1631                 CleanupClosePushL( parsedConnectionName );
       
  1632                 parsedConnectionName.CreateL( connectionName->Des().Length() );
       
  1633                 
       
  1634                 // Parse possible unique number from end of connection
       
  1635                 // method name. accesspoint(xx) --> accesspoint
       
  1636                 TInt pos = connectionName->Des().Locate( '(' );
       
  1637                 if ( KErrNotFound != pos )
       
  1638                     {
       
  1639                     parsedConnectionName.Copy( 
       
  1640                         connectionName->Des().Left( pos ) );
       
  1641                     }
       
  1642                 else
       
  1643                     {
       
  1644                     parsedConnectionName.Copy( 
       
  1645                         connectionName->Des() );
       
  1646                     }  
       
  1647                 
       
  1648                 // Check if connection method already exists in default snap
       
  1649                 TBool matchFound( EFalse );
       
  1650                 TInt conMethodCount = defaultSnap.ConnectionMethodCount();
       
  1651                 
       
  1652                 for ( TInt i( 0 ) ; 
       
  1653                     i < conMethodCount && matchFound == 0; i ++ )
       
  1654                     {
       
  1655                     RCmConnectionMethodExt cm = 
       
  1656                         defaultSnap.ConnectionMethodL( i );
       
  1657                     CleanupClosePushL( cm );
       
  1658                         
       
  1659                     HBufC* cmName = 
       
  1660                         cm.GetStringAttributeL( CMManager::ECmName );
       
  1661                     CleanupStack::PushL( cmName );    
       
  1662    
       
  1663                     RBuf parsedCmName;
       
  1664                     CleanupClosePushL( parsedCmName );
       
  1665                     parsedCmName.CreateL( cmName->Des().Length() );
       
  1666                     
       
  1667                     // Parse possible unique number from end of connection
       
  1668                     // method name. accesspoint(xx) --> accesspoint
       
  1669                     TInt pos = cmName->Des().Locate( '(' );
       
  1670                     if ( KErrNotFound != pos )
       
  1671                         {
       
  1672                         parsedCmName.Copy( cmName->Des().Left( pos ) );
       
  1673                         }
       
  1674                     else
       
  1675                         {
       
  1676                         parsedCmName.Copy( cmName->Des() );
       
  1677                         }   
       
  1678                     
       
  1679                     // Compare connection method names
       
  1680                     if ( parsedConnectionName.Compare( parsedCmName ) == 0 )
       
  1681                         {
       
  1682                         matchFound = ETrue;
       
  1683                         }
       
  1684 
       
  1685                     CleanupStack::PopAndDestroy( &parsedCmName );
       
  1686                     CleanupStack::PopAndDestroy( cmName );
       
  1687                     CleanupStack::PopAndDestroy( &cm );
       
  1688                     }
       
  1689                 
       
  1690                 CleanupStack::PopAndDestroy( &parsedConnectionName );
       
  1691                 CleanupStack::PopAndDestroy( connectionName );
       
  1692                 
       
  1693                 // Add copy only if not already exists with same name
       
  1694                 if ( !matchFound )
       
  1695                     {
       
  1696                     defaultSnap.AddConnectionMethodL( 
       
  1697                         connection.CreateCopyL() );
       
  1698                     }
       
  1699                 
       
  1700                 // Change seamlessness level for linked WLAN IAP so that
       
  1701                 // roaming is allowed without asking it from the user.
       
  1702                 TUint32 bearerType = connection.GetIntAttributeL( 
       
  1703                     CMManager::ECmBearerType );
       
  1704                 
       
  1705                 if ( KUidWlanBearerType == bearerType )
       
  1706                     {
       
  1707                     connection.SetIntAttributeL( 
       
  1708                         CMManager::ECmSeamlessnessLevel, 
       
  1709                         CMManager::ESeamlessnessShowprogress );
       
  1710                     }
       
  1711                 
       
  1712                 defaultSnap.UpdateL();
       
  1713                 
       
  1714                 CleanupStack::PopAndDestroy( &connection );
       
  1715                 CleanupStack::PopAndDestroy( &defaultSnap );
       
  1716                 CleanupStack::PopAndDestroy( &cmManager );
       
  1717 
       
  1718                 // Update sip profile to use default snap
       
  1719                 sipManagedProf->SetParameter( KSIPAccessPointId, (TUint32)0 );
       
  1720                 sipManagedProf->SetParameter( KSIPSnapId, iSnapId );
       
  1721                 sipReg->SaveL( *sipManagedProf );
       
  1722                 }
       
  1723             }
       
  1724         
  1599         CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3
  1725         CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3
  1600         CleanupStack::Pop( sipProf ); // CS:2
  1726         CleanupStack::Pop( sipProf ); // CS:2
  1601         sipProf = NULL;
  1727         sipProf = NULL;
  1602         // sipReg, sipObs
  1728         // sipReg, sipObs
  1603         CleanupStack::PopAndDestroy( 2, sipObs ); // CS:0
  1729         CleanupStack::PopAndDestroy( 2, sipObs ); // CS:0