cmmanager/cmmgr/Framework/Src/cmmanagerimpl.cpp
changeset 1 40cb640ef159
parent 0 5a93021fdf25
child 2 086aae6fc07e
equal deleted inserted replaced
0:5a93021fdf25 1:40cb640ef159
    58 // if a CmId is grater than KMaxIapId, than it has no iap record
    58 // if a CmId is grater than KMaxIapId, than it has no iap record
    59 // Otherwise cmId is the same as the IapId
    59 // Otherwise cmId is the same as the IapId
    60 const TUint32 KMaxIapID = 255;
    60 const TUint32 KMaxIapID = 255;
    61 // Safety margin when checking disk space
    61 // Safety margin when checking disk space
    62 const TUint32 KBytesToWrite = 8000; 
    62 const TUint32 KBytesToWrite = 8000; 
       
    63 
       
    64 const TUint32 KEndOfArray = KMaxTUint;
       
    65 /**
       
    66 * This array lists all the bearerspecific attributes.
       
    67 * The bearerspecific attributes can be queried via both 
       
    68 * the manager interface's and connection method interface's ::Get functions.
       
    69 */
       
    70 static const TUint32 KBearerSpecificAttributes[]=
       
    71     {
       
    72     /**
       
    73     */
       
    74     ECmCoverage,                        
       
    75     ECmDefaultPriority,                        
       
    76     ECmDestination,     
       
    77     ECmBearerHasUi,   
       
    78     ECmIPv6Supported,           
       
    79     ECmDefaultUiPriority,
       
    80     ECmBearerIcon,
       
    81     ECmBearerAvailableIcon,
       
    82     ECmBearerAvailableName,
       
    83     ECmBearerSupportedName,
       
    84     ECmBearerAvailableText,                        
       
    85     ECmBearerNamePopupNote,
       
    86     ECmCommsDBBearerType,   
       
    87     ECmBearerSettingName,
       
    88     ECmVirtual,
       
    89     ECmExtensionLevel,
       
    90     ECmAddToAvailableList,
       
    91     KEndOfArray
       
    92     };
    63 
    93 
    64 // -----------------------------------------------------------------------------
    94 // -----------------------------------------------------------------------------
    65 // Test functions
    95 // Test functions
    66 // -----------------------------------------------------------------------------
    96 // -----------------------------------------------------------------------------
    67 //
    97 //
  1591 //
  1621 //
  1592 EXPORT_C TUint32 CCmManagerImpl::GetBearerInfoIntL( TUint32 aBearerType,
  1622 EXPORT_C TUint32 CCmManagerImpl::GetBearerInfoIntL( TUint32 aBearerType,
  1593                                            TUint32 aAttribute ) const
  1623                                            TUint32 aAttribute ) const
  1594     {
  1624     {
  1595     LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoIntL" );
  1625     LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoIntL" );
       
  1626     if( !IsBearerSpecific( aAttribute ) )
       
  1627         {
       
  1628         User::Leave( KErrNotSupported );
       
  1629         }
       
  1630     
  1596     for ( TInt i = 0; i < iPlugins->Count(); ++i )
  1631     for ( TInt i = 0; i < iPlugins->Count(); ++i )
  1597         {
  1632         {
  1598         if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
  1633         if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
  1599             {
  1634             {
  1600             return (*iPlugins)[i]->GetIntAttributeL( aAttribute );
  1635             return (*iPlugins)[i]->GetIntAttributeL( aAttribute );
  1603         
  1638         
  1604     User::Leave( KErrNotSupported );
  1639     User::Leave( KErrNotSupported );
  1605     
  1640     
  1606     return 0;
  1641     return 0;
  1607     }
  1642     }
  1608     
  1643 
  1609 // -----------------------------------------------------------------------------
  1644 // -----------------------------------------------------------------------------
  1610 // CCmManagerImpl::GetBearerInfoBoolL()
  1645 // CCmManagerImpl::GetBearerInfoBoolL()
  1611 // -----------------------------------------------------------------------------
  1646 // -----------------------------------------------------------------------------
  1612 //
  1647 //
  1613 EXPORT_C TBool CCmManagerImpl::GetBearerInfoBoolL( TUint32 aBearerType,
  1648 EXPORT_C TBool CCmManagerImpl::GetBearerInfoBoolL( TUint32 aBearerType,
  1614                                           TUint32 aAttribute ) const
  1649                                           TUint32 aAttribute ) const
  1615     {
  1650     {
  1616     LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoBoolL" );
  1651     LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoBoolL" );
       
  1652     if( !IsBearerSpecific( aAttribute ) )
       
  1653         {
       
  1654         User::Leave( KErrNotSupported );
       
  1655         }
       
  1656         
  1617     for ( TInt i = 0; i < iPlugins->Count(); ++i )
  1657     for ( TInt i = 0; i < iPlugins->Count(); ++i )
  1618         {
  1658         {
  1619         if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
  1659         if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
  1620             {
  1660             {
  1621             return (*iPlugins)[i]->GetBoolAttributeL( aAttribute );
  1661             return (*iPlugins)[i]->GetBoolAttributeL( aAttribute );
  1633 //
  1673 //
  1634 EXPORT_C HBufC* CCmManagerImpl::GetBearerInfoStringL( TUint32 aBearerType,
  1674 EXPORT_C HBufC* CCmManagerImpl::GetBearerInfoStringL( TUint32 aBearerType,
  1635                                              TUint32 aAttribute ) const
  1675                                              TUint32 aAttribute ) const
  1636     {
  1676     {
  1637     LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoStringL" );
  1677     LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoStringL" );
       
  1678     if( !IsBearerSpecific( aAttribute ) )
       
  1679         {
       
  1680         User::Leave( KErrNotSupported );
       
  1681         }
       
  1682     
  1638     for ( TInt i = 0; i < iPlugins->Count(); ++i )
  1683     for ( TInt i = 0; i < iPlugins->Count(); ++i )
  1639         {
  1684         {
  1640         if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
  1685         if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
  1641             {
  1686             {
  1642             return (*iPlugins)[i]->GetStringAttributeL( aAttribute );
  1687             return (*iPlugins)[i]->GetStringAttributeL( aAttribute );
  1654 //
  1699 //
  1655 EXPORT_C HBufC8* CCmManagerImpl::GetBearerInfoString8L( TUint32 aBearerType,
  1700 EXPORT_C HBufC8* CCmManagerImpl::GetBearerInfoString8L( TUint32 aBearerType,
  1656                                                TUint32 aAttribute ) const
  1701                                                TUint32 aAttribute ) const
  1657     {
  1702     {
  1658     LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoStringL" );
  1703     LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoStringL" );
       
  1704     if( !IsBearerSpecific( aAttribute ) )
       
  1705         {
       
  1706         User::Leave( KErrNotSupported );
       
  1707         }
       
  1708     
  1659     for ( TInt i = 0; i < iPlugins->Count(); ++i )
  1709     for ( TInt i = 0; i < iPlugins->Count(); ++i )
  1660         {
  1710         {
  1661         if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
  1711         if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
  1662             {
  1712             {
  1663             return (*iPlugins)[i]->GetString8AttributeL( aAttribute );
  1713             return (*iPlugins)[i]->GetString8AttributeL( aAttribute );
  2331     if ( ( aDCSetting.iType == ECmDefConnAlwaysAsk ) ||
  2381     if ( ( aDCSetting.iType == ECmDefConnAlwaysAsk ) ||
  2332          ( aDCSetting.iType == ECmDefConnAskOnce ) )
  2382          ( aDCSetting.iType == ECmDefConnAskOnce ) )
  2333         {
  2383         {
  2334         User::Leave( KErrNotSupported );
  2384         User::Leave( KErrNotSupported );
  2335         }
  2385         }
       
  2386     
  2336     if ( IsDefConnSupported() )
  2387     if ( IsDefConnSupported() )
  2337         {
  2388         {
  2338         OpenTransactionLC();
  2389         OpenTransactionLC();
  2339 
  2390 
  2340         ReplaceDefConnRecordL( aDCSetting );
  2391         ReplaceDefConnRecordL( aDCSetting );
  2978 
  3029 
  2979     CleanupStack::PopAndDestroy( db );
  3030     CleanupStack::PopAndDestroy( db );
  2980     
  3031     
  2981     return snapTableId;
  3032     return snapTableId;
  2982     }
  3033     }
       
  3034 
       
  3035 // -----------------------------------------------------------------------------
       
  3036 // CCmManagerImpl::IsBearerSpecific()
       
  3037 // -----------------------------------------------------------------------------
       
  3038 //
       
  3039 TBool CCmManagerImpl::IsBearerSpecific( TUint32 aAttribute ) const
       
  3040     {
       
  3041     TUint32 i = 0;
       
  3042     while( KBearerSpecificAttributes[i] != KEndOfArray )
       
  3043         {
       
  3044         if( KBearerSpecificAttributes[i] == aAttribute )
       
  3045             {
       
  3046             return ETrue;
       
  3047             }
       
  3048         i++;
       
  3049         }        
       
  3050     return EFalse;
       
  3051     }