bearermanagement/mpm/src/mpmcommsdataccess.cpp
changeset 73 70ee5458c95d
parent 61 8b0c979bbe8c
equal deleted inserted replaced
72:0c32cf868819 73:70ee5458c95d
   123         dnRecord->LoadL( *db );
   123         dnRecord->LoadL( *db );
   124 
   124 
   125         TUint snapId = dnRecord->iSNAP;
   125         TUint snapId = dnRecord->iSNAP;
   126         MPMLOGSTRING2( "CMPMCommsDatAccess::FindAllSnapsL snap %d", snapId )
   126         MPMLOGSTRING2( "CMPMCommsDatAccess::FindAllSnapsL snap %d", snapId )
   127 
   127 
   128         // Insert unique ids to array
   128         // Insert unique IDs to array.
   129         //
   129         TInt err = aSnapIds.InsertInOrder( snapId );
   130         aSnapIds.InsertInOrder( snapId );
   130         if ( err && err != KErrAlreadyExists )
       
   131             {
       
   132             User::Leave( err );
       
   133             }
   131         delete dnRecord;
   134         delete dnRecord;
   132         }
   135         }
   133 
   136 
   134     CleanupStack::PopAndDestroy( dnIAPRecordSet );
   137     CleanupStack::PopAndDestroy( dnIAPRecordSet );
   135     CleanupStack::PopAndDestroy( generic );
   138     CleanupStack::PopAndDestroy( generic );
   238                 // Store Iap Id, Net Id and empty APN to TConnInfo, 
   241                 // Store Iap Id, Net Id and empty APN to TConnInfo, 
   239                 // so that FindAPN can utilise the information 
   242                 // so that FindAPN can utilise the information 
   240                 // during the validation of next IAP to support 
   243                 // during the validation of next IAP to support 
   241                 // using existing WLAN connection SSID.
   244                 // using existing WLAN connection SSID.
   242                 //
   245                 //
   243                 aSession.MyServer().Events()->AppendConnInfo( aConnId );
   246                 aSession.MyServer().Events()->AppendConnInfoL( aConnId );
   244                 aSession.MyServer().Events()->SetConnInfo( aConnId, 
   247                 aSession.MyServer().Events()->SetConnInfo( aConnId, 
   245                                                            aIapId, 
   248                                                            aIapId, 
   246                                                            presumedIapId, 
   249                                                            presumedIapId, 
   247                                                            aNetId, 
   250                                                            aNetId, 
   248                                                            ssid );
   251                                                            ssid );
   300         // Store Iap Id, Net Id and APN to TConnInfo, 
   303         // Store Iap Id, Net Id and APN to TConnInfo, 
   301         // so that FindAPN can utilise the information 
   304         // so that FindAPN can utilise the information 
   302         // during the validation of next IAP to support 
   305         // during the validation of next IAP to support 
   303         // using existing PDP context per APN.
   306         // using existing PDP context per APN.
   304         //
   307         //
   305         aSession.MyServer().Events()->AppendConnInfo( aConnId );
   308         aSession.MyServer().Events()->AppendConnInfoL( aConnId );
   306         aSession.MyServer().Events()->SetConnInfo( aConnId, 
   309         aSession.MyServer().Events()->SetConnInfo( aConnId, 
   307                                                    aIapId, 
   310                                                    aIapId, 
   308                                                    presumedIapId, 
   311                                                    presumedIapId, 
   309                                                    aNetId, 
   312                                                    aNetId, 
   310                                                    ptr2 );
   313                                                    ptr2 );
   550 
   553 
   551         // Don't print duplicates
   554         // Don't print duplicates
   552         // 
   555         // 
   553         if ( found && KErrNotFound == prevRecordIds.Find( linkedAP->RecordId() ) )
   556         if ( found && KErrNotFound == prevRecordIds.Find( linkedAP->RecordId() ) )
   554             {
   557             {
   555             prevRecordIds.Append( linkedAP->RecordId() );
   558             prevRecordIds.AppendL( linkedAP->RecordId() );
   556             
   559 
   557             // Print the DN and host name pointed by DN-IAP entry.
   560             // Print the DN and host name pointed by DN-IAP entry.
   558             // HostName is EText field.
   561             // HostName is EText field.
   559             // 
   562             // 
   560             TBuf<KCommsDatTextBufferLength> dn = linkedAP->iRecordName.GetL();
   563             TBuf<KCommsDatTextBufferLength> dn = linkedAP->iRecordName.GetL();
   561             MPMLOGSTRING3( "Snap: %d Snap Name = %s", (TInt)linkedAP->iRecordTag, dn.PtrZ() )
   564             MPMLOGSTRING3( "Snap: %d Snap Name = %s", (TInt)linkedAP->iRecordTag, dn.PtrZ() )
  1412         linkedAP->iRecordTag = (TInt)dnIAPRecord->iSNAP;
  1415         linkedAP->iRecordTag = (TInt)dnIAPRecord->iSNAP;
  1413         TBool found = linkedAP->FindL( *db );
  1416         TBool found = linkedAP->FindL( *db );
  1414 
  1417 
  1415         if ( found && KErrNotFound == prevRecordIds.Find( linkedAP->RecordId() ) )
  1418         if ( found && KErrNotFound == prevRecordIds.Find( linkedAP->RecordId() ) )
  1416             {
  1419             {
  1417             prevRecordIds.Append( linkedAP->RecordId() );
  1420             prevRecordIds.AppendL( linkedAP->RecordId() );
  1418             
  1421 
  1419             // Print the DN and host name pointed by DN-IAP entry.
  1422             // Print the DN and host name pointed by DN-IAP entry.
  1420             // HostName is EText field.
  1423             // HostName is EText field.
  1421             // 
  1424             // 
  1422             TBuf<KMaxTextLength + 1> dn = linkedAP->iRecordName.GetL();
  1425             TBuf<KMaxTextLength + 1> dn = linkedAP->iRecordName.GetL();
  1423             MPMLOGSTRING3( "    Snap: %d Snap Name = %s", (TInt)linkedAP->iRecordTag, dn.PtrZ() )
  1426             MPMLOGSTRING3( "    Snap: %d Snap Name = %s", (TInt)linkedAP->iRecordTag, dn.PtrZ() )
  1579     //
  1582     //
  1580     if( aIapPath.Find( aVirtualIapId ) == KErrNotFound )
  1583     if( aIapPath.Find( aVirtualIapId ) == KErrNotFound )
  1581         {
  1584         {
  1582         // append this Iap to path
  1585         // append this Iap to path
  1583         //
  1586         //
  1584         aIapPath.Append( aVirtualIapId );
  1587         aIapPath.AppendL( aVirtualIapId );
  1585         }
  1588         }
  1586     else
  1589     else
  1587         {
  1590         {
  1588         MPMLOGSTRING( "CMPMCommsDatAccess::WlanUnderVirtualL: Error, loop\
  1591         MPMLOGSTRING( "CMPMCommsDatAccess::WlanUnderVirtualL: Error, loop\
  1589 detected in configuration. Iap handling not continued" )
  1592 detected in configuration. Iap handling not continued" )
  1765             // to belong to the deleted IAP.
  1768             // to belong to the deleted IAP.
  1766             // 
  1769             // 
  1767             if ( elem.iRanking > 0 )
  1770             if ( elem.iRanking > 0 )
  1768                 {
  1771                 {
  1769                 // Insert elem into RArray
  1772                 // Insert elem into RArray
  1770                 // 
  1773                 aDestNetIds.InsertInOrderAllowRepeatsL( elem, TNetIap::CompareRanking );
  1771                 aDestNetIds.InsertInOrderAllowRepeats(elem, TNetIap::CompareRanking);
       
  1772                 }
  1774                 }
  1773             else
  1775             else
  1774                 {
  1776                 {
  1775                 if ( elem.iIapId != 0 )
  1777                 if ( elem.iIapId != 0 )
  1776                     {
  1778                     {
  1891                 // drop this virtual iap out from the list of
  1893                 // drop this virtual iap out from the list of
  1892                 // available iaps to prevent from infinitely looping
  1894                 // available iaps to prevent from infinitely looping
  1893                 //	
  1895                 //	
  1894                 if ( aAvailableIAPList[i] != aVirtualIapId )
  1896                 if ( aAvailableIAPList[i] != aVirtualIapId )
  1895                     {
  1897                     {
  1896                     tempList.Append( aAvailableIAPList[i] );
  1898                     tempList.AppendL( aAvailableIAPList[i] );
  1897                     }
  1899                     }
  1898                 }
  1900                 }
  1899             aSession.IapSelectionL()->ChooseBestIAPL( tempMpmConnPref, tempList );
  1901             aSession.IapSelectionL()->ChooseBestIAPL( tempMpmConnPref, tempList );
  1900             CleanupStack::PopAndDestroy( &tempList );
  1902             CleanupStack::PopAndDestroy( &tempList );
  1901 
  1903 
  2176 
  2178 
  2177 // -----------------------------------------------------------------------------
  2179 // -----------------------------------------------------------------------------
  2178 // CMPMCommsDatAccess::GetBearerTypeL
  2180 // CMPMCommsDatAccess::GetBearerTypeL
  2179 // -----------------------------------------------------------------------------
  2181 // -----------------------------------------------------------------------------
  2180 //
  2182 //
  2181 TMPMBearerType CMPMCommsDatAccess::GetBearerTypeL( TUint32 aIapId )
  2183 TMPMBearerType CMPMCommsDatAccess::GetBearerTypeL( const TUint32 aIapId )
  2182     {
  2184     {
  2183     MPMLOGSTRING( "CMPMCommsDatAccess::GetBearerTypeL" )
  2185     MPMLOGSTRING( "CMPMCommsDatAccess::GetBearerTypeL" )
  2184     TMPMBearerType bearerType = EMPMBearerTypeOther;
  2186     TMPMBearerType bearerType = EMPMBearerTypeOther;
  2185     RArray<TUint32> wlanArray;
  2187 
  2186     
       
  2187     CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
  2188     CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
  2188     
       
  2189     CleanupClosePushL( wlanArray );
       
  2190     BuildWlanArrayL(*db, wlanArray);
       
  2191     
       
  2192     CCDIAPRecord* record = LoadIapRecordLC( aIapId, db );
  2189     CCDIAPRecord* record = LoadIapRecordLC( aIapId, db );
  2193     
  2190 
  2194     TBuf<KMaxTextLength> bearerTypeName( record->iBearerType.GetL() );
       
  2195     TBuf<KMaxTextLength> serviceTypeName( record->iServiceType.GetL() );
  2191     TBuf<KMaxTextLength> serviceTypeName( record->iServiceType.GetL() );
  2196         
  2192 
  2197     if ( ( serviceTypeName == TPtrC( KCDTypeNameOutgoingWCDMA ) ) ||
  2193     if ( ( serviceTypeName == TPtrC( KCDTypeNameOutgoingWCDMA ) ) ||
  2198          ( serviceTypeName == TPtrC( KCDTypeNameIncomingWCDMA ) ) )
  2194             ( serviceTypeName == TPtrC( KCDTypeNameIncomingWCDMA ) ) )
  2199         {
  2195         {
  2200         // Packet data
  2196         // Packet data
  2201         bearerType = EMPMBearerTypePacketData;
  2197         bearerType = EMPMBearerTypePacketData;
  2202         }
  2198         }
  2203     else if ( serviceTypeName == TPtrC( KCDTypeNameLANService ) )
  2199     else
  2204         {
  2200         {
  2205         // LAN or WLAN
  2201         TBuf<KMaxTextLength> bearerTypeName( record->iBearerType.GetL() );
  2206         TUint32 bearerId( record->iBearer );
  2202         if ( serviceTypeName == TPtrC( KCDTypeNameLANService ) )
  2207             
  2203             {
  2208         if ( ( bearerTypeName == TPtrC( KCDTypeNameLANBearer ) ) &&
  2204             // LAN or WLAN
  2209              ( IsWlanBearer( wlanArray, record->iBearer ) ) )
  2205             RArray<TUint32> wlanArray;
  2210             {
  2206             CleanupClosePushL( wlanArray );
  2211             // WLAN
  2207             BuildWlanArrayL( *db, wlanArray );
  2212             bearerType = EMPMBearerTypeWlan;
  2208 
       
  2209             if ( ( bearerTypeName == TPtrC( KCDTypeNameLANBearer ) ) &&
       
  2210                     ( IsWlanBearer( wlanArray, record->iBearer ) ) )
       
  2211                 {
       
  2212                 // WLAN
       
  2213                 bearerType = EMPMBearerTypeWlan;
       
  2214                 }
       
  2215             CleanupStack::PopAndDestroy( &wlanArray );
  2213             }
  2216             }
  2214         }
  2217         else if ( ( bearerTypeName == TPtrC( KCDTypeNameVirtualBearer ) ) &&
  2215     else if ( ( bearerTypeName == TPtrC( KCDTypeNameVirtualBearer ) ) &&
  2218                 ( serviceTypeName == TPtrC ( KCDTypeNameVPNService ) ) )
  2216               ( serviceTypeName == TPtrC ( KCDTypeNameVPNService ) ) )
  2219             {
  2217         {
  2220             // VPN
  2218         // VPN
  2221             bearerType = EMPMBearerTypeVpn;
  2219         bearerType = EMPMBearerTypeVpn;
  2222             }
  2220         }
  2223         }
  2221     
  2224 
  2222     CleanupStack::PopAndDestroy( record );
  2225     CleanupStack::PopAndDestroy( record );
  2223     CleanupStack::PopAndDestroy( &wlanArray );
       
  2224     CleanupStack::PopAndDestroy( db );
  2226     CleanupStack::PopAndDestroy( db );
  2225     
  2227 
  2226     return bearerType;
  2228     return bearerType;
  2227     }
  2229     }
  2228 
  2230 
  2229 // -----------------------------------------------------------------------------
  2231 // -----------------------------------------------------------------------------
  2230 // CMPMCommsDatAccess::IsWlanBearerL
  2232 // CMPMCommsDatAccess::IsWlanBearerL