voipplugins/voipadapters/dmvoipadapter/src/nsmldmvoipadapter.cpp
branchRCL_3
changeset 33 2989b291cac7
parent 31 5886d40bb3de
equal deleted inserted replaced
31:5886d40bb3de 33:2989b291cac7
   240 const TUint32 KIMLaunchUid          = 0x200255D0;
   240 const TUint32 KIMLaunchUid          = 0x200255D0;
   241 const TInt    KIMSettingsId         = 1;
   241 const TInt    KIMSettingsId         = 1;
   242 // Default IM message tone
   242 // Default IM message tone
   243 _LIT( KDefaultTone,       "Message 2.aac" );
   243 _LIT( KDefaultTone,       "Message 2.aac" );
   244 
   244 
   245 // Bearer related constants
       
   246 const TUint32 KBearerNotSpecified = 0;
       
   247 const TUint32 KBearerWlanOnly = 1;
       
   248 const TUint32 KBearerCellularOnly = 2;
       
   249 
       
   250 // ---------------------------------------------------------------------------
   245 // ---------------------------------------------------------------------------
   251 // CNSmlDmVoIPAdapter::ConstructL
   246 // CNSmlDmVoIPAdapter::ConstructL
   252 // Symbian 2nd phase constructor can leave.
   247 // Symbian 2nd phase constructor can leave.
   253 // ---------------------------------------------------------------------------
   248 // ---------------------------------------------------------------------------
   254 //
   249 //
   305 
   300 
   306     if ( iCRCSEProfile )
   301     if ( iCRCSEProfile )
   307         {
   302         {
   308         delete iCRCSEProfile; 
   303         delete iCRCSEProfile; 
   309         }
   304         }
   310     delete iTempProfileIdObject;
   305 
   311     iProfileModifs.Close();
   306     iProfileModifs.Close();
   312     iCodecModifs.Close();
   307     iCodecModifs.Close();
   313 
   308 
   314     iSPSettings.ResetAndDestroy();
   309     iSPSettings.ResetAndDestroy();
   315     iSPSettings.Close();
   310     iSPSettings.Close();
  1271             }
  1266             }
  1272         else
  1267         else
  1273             {
  1268             {
  1274             retValue = CSmlDmAdapter::EInvalidObject;   
  1269             retValue = CSmlDmAdapter::EInvalidObject;   
  1275             }
  1270             }
  1276         iAllowVoIPOverWCDMAModified = ETrue; 
       
  1277         }
  1271         }
  1278     // VoIP/x/VoIPDigits
  1272     // VoIP/x/VoIPDigits
  1279     else if ( KNSmlDMVoIPVoIPDigits() == uriSeg )
  1273     else if ( KNSmlDMVoIPVoIPDigits() == uriSeg )
  1280         {
  1274         {
  1281         iProfileEntries[iProfileID]->iMeanCountOfVoIPDigits = 
  1275         iProfileEntries[iProfileID]->iMeanCountOfVoIPDigits = 
  1835         {
  1829         {
  1836         if ( KNSmlDMVoIPProfileTypeSIP() == aObject )
  1830         if ( KNSmlDMVoIPProfileTypeSIP() == aObject )
  1837             {
  1831             {
  1838             iProfileEntries[iProfileID]->iIds[DesToInt( 
  1832             iProfileEntries[iProfileID]->iIds[DesToInt( 
  1839                 LastURISeg( aLUID ).Right( 10 ))].iProfileType = 0;
  1833                 LastURISeg( aLUID ).Right( 10 ))].iProfileType = 0;
  1840             // If the profile id is not saved and the string to fetch it is only temporaly stored,
       
  1841             // the profile id will be fetched from previously-stored member value and set as well 
       
  1842             // when saveing the profiletype.
       
  1843             if( iTempProfileIdObject )
       
  1844                 {
       
  1845                 TUint32 profileId = SetSipRefL( *iTempProfileIdObject ); 
       
  1846                 if ( profileId > 0 )
       
  1847                     {
       
  1848                     // Set profileId to settingsids.
       
  1849                     iProfileEntries[iProfileID]->
       
  1850                         iIds[DesToInt( LastURISeg( aLUID ).Right( 10 ))].
       
  1851                         iProfileId = profileId;
       
  1852                     retValue = CSmlDmAdapter::EOk;
       
  1853                     }
       
  1854                 else
       
  1855                     {
       
  1856                     retValue = CSmlDmAdapter::EInvalidObject;
       
  1857                     }       
       
  1858                 } 
       
  1859             iIsProfileTypeSet = ETrue;
       
  1860             delete iTempProfileIdObject;
       
  1861             iTempProfileIdObject = NULL;
       
  1862             }
  1834             }
  1863         else if ( KNSmlDMVoIPProfileTypeSCCP() == aObject )
  1835         else if ( KNSmlDMVoIPProfileTypeSCCP() == aObject )
  1864             {
  1836             {
  1865             iProfileEntries[iProfileID]->iIds[DesToInt( 
  1837             iProfileEntries[iProfileID]->iIds[DesToInt( 
  1866                 LastURISeg( aLUID ).Right( 10 ))].iProfileType = 1;
  1838                 LastURISeg( aLUID ).Right( 10 ))].iProfileType = 1;
  1867             // If the profile id is not saved and the string to fetch it is only temporaly stored,
       
  1868             // the profile id will be fetched from previously-stored member value and set as well 
       
  1869             // when saveing the profiletype.
       
  1870             if( iTempProfileIdObject )
       
  1871                 {
       
  1872                 TUint32 profileId = SetSccpRefL( *iTempProfileIdObject ); 
       
  1873                 // profileId can be zero
       
  1874                 if ( profileId > 0 || 0 == profileId )
       
  1875                     {
       
  1876                     // set profileId to settingsids
       
  1877                     iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  1878                         LastURISeg( aLUID ).Right( 10 ))].
       
  1879                         iProfileId = profileId;
       
  1880                     retValue = CSmlDmAdapter::EOk;
       
  1881                     }
       
  1882                 else
       
  1883                     {
       
  1884                     retValue = CSmlDmAdapter::EInvalidObject;
       
  1885                     }
       
  1886                 }
       
  1887             iIsProfileTypeSet = ETrue;
       
  1888             delete iTempProfileIdObject;
       
  1889             iTempProfileIdObject = NULL;       
       
  1890             }
  1839             }
  1891         else
  1840         else
  1892             {
  1841             {
  1893             retValue = CSmlDmAdapter::EInvalidObject;   
  1842             retValue = CSmlDmAdapter::EInvalidObject;   
  1894             }
  1843             }
  1931                 }
  1880                 }
  1932             else
  1881             else
  1933                 {
  1882                 {
  1934                 retValue = CSmlDmAdapter::EInvalidObject;
  1883                 retValue = CSmlDmAdapter::EInvalidObject;
  1935                 }
  1884                 }
  1936             }
       
  1937         // If the ProfileType has not been set yet,
       
  1938         // the string used to fetch ProfileId temporarily is stored to a member value. 
       
  1939         else if ( !iIsProfileTypeSet )
       
  1940             {
       
  1941             if( iTempProfileIdObject )
       
  1942             	{
       
  1943             	delete iTempProfileIdObject;
       
  1944             	iTempProfileIdObject = NULL;
       
  1945             	}
       
  1946                 iTempProfileIdObject = aObject.AllocL();
       
  1947             }
  1885             }
  1948         else
  1886         else
  1949             {
  1887             {
  1950             // no SCCP or SIP type found
  1888             // no SCCP or SIP type found
  1951             retValue = CSmlDmAdapter::EError;
  1889             retValue = CSmlDmAdapter::EError;
  2335         segmentResult.Num( iProfileEntries[iProfileID]->iVoIPPluginUID );
  2273         segmentResult.Num( iProfileEntries[iProfileID]->iVoIPPluginUID );
  2336         }
  2274         }
  2337     // VoIP/x/AllowVoIPOverWCDMA
  2275     // VoIP/x/AllowVoIPOverWCDMA
  2338     else if ( KNSmlDMVoIPAllowVoIPOverWCDMA() == uriSeg )
  2276     else if ( KNSmlDMVoIPAllowVoIPOverWCDMA() == uriSeg )
  2339         {
  2277         {
  2340         TInt sipProfileId(0);
  2278         if ( Entry::EOONotSet == iProfileEntries[iProfileID]->
  2341         TUint32 bearerFilttering(0);
  2279             iAllowVoIPoverWCDMA )
  2342         
  2280             {
  2343         for ( TInt index = 0; index < iProfileEntries[iProfileID]->
  2281             segmentResult.Copy( KNSmlDMVoIPValueNotSet );
  2344                 iIds.Count(); index++ )
  2282             }
  2345             {
  2283         if ( Entry::EOn == iProfileEntries[iProfileID]->
  2346             if ( iProfileEntries[iProfileID]->iIds[index].iProfileType == 0 )
  2284             iAllowVoIPoverWCDMA )
  2347                 {
  2285             {
  2348                 sipProfileId = iProfileEntries[iProfileID]->
  2286             segmentResult.Copy( KNSmlDMVoIPValueTrue );
  2349                     iIds[index].iProfileId;
  2287             }
  2350                 break;
  2288         if ( Entry::EOff == iProfileEntries[iProfileID]->
  2351                 }
  2289             iAllowVoIPoverWCDMA )
  2352             }
       
  2353         
       
  2354         CSIPProfile* sipProf = NULL;
       
  2355         CSIPProfileRegistryObserver* sipRegObs =
       
  2356             CSIPProfileRegistryObserver::NewLC(); // CS:1
       
  2357         CSIPManagedProfileRegistry* sipProfReg = 
       
  2358             CSIPManagedProfileRegistry::NewLC( *sipRegObs ); // CS:2
       
  2359         TRAPD( err, ( sipProf = sipProfReg->ProfileL( sipProfileId ) ) );
       
  2360         
       
  2361         if ( KErrNone == err )
       
  2362             {
       
  2363             User::LeaveIfError( sipProf->GetParameter( 
       
  2364                 KBearerType, bearerFilttering ) );
       
  2365             }
       
  2366         
       
  2367         CleanupStack::PopAndDestroy( sipProfReg ); // CS:1
       
  2368         CleanupStack::PopAndDestroy( sipRegObs ); // CS:0
       
  2369         
       
  2370         if ( bearerFilttering == KBearerWlanOnly )
       
  2371             {
  2290             {
  2372             segmentResult.Copy( KNSmlDMVoIPValueFalse );
  2291             segmentResult.Copy( KNSmlDMVoIPValueFalse );
  2373             }
       
  2374         
       
  2375         else if ( bearerFilttering == KBearerNotSpecified )
       
  2376             {
       
  2377             segmentResult.Copy( KNSmlDMVoIPValueTrue );
       
  2378             }
  2292             }
  2379         }
  2293         }
  2380     // VoIP/x/VoIPDigits
  2294     // VoIP/x/VoIPDigits
  2381     else if ( KNSmlDMVoIPVoIPDigits() == uriSeg )
  2295     else if ( KNSmlDMVoIPVoIPDigits() == uriSeg )
  2382         {
  2296         {
  4374                 iIds.Count(); index++ )
  4288                 iIds.Count(); index++ )
  4375                 {
  4289                 {
  4376                 if ( ( 0 == iProfileEntries[counter]->
  4290                 if ( ( 0 == iProfileEntries[counter]->
  4377                     iIds[index].iProfileType ) 
  4291                     iIds[index].iProfileType ) 
  4378                     && iProfileEntries[counter]->
  4292                     && iProfileEntries[counter]->
  4379                         iIds[index].iProfileId > 0
  4293                         iIds[index].iProfileId > 1
  4380                     && ( iProfileEntries[counter]->
  4294                     && ( iProfileEntries[counter]->
  4381                         iSIPVoIPUAHTerminalType ||
  4295                         iSIPVoIPUAHTerminalType ||
  4382                         iProfileEntries[counter]->
  4296                         iProfileEntries[counter]->
  4383                         iSIPVoIPUAHeaderWLANMAC ||
  4297                         iSIPVoIPUAHeaderWLANMAC ||
  4384                         iProfileEntries[counter]->
  4298                         iProfileEntries[counter]->
  4385                         iSIPVoIPUAHeaderString.Length() > 0 ||
  4299                         iSIPVoIPUAHeaderString.Length() > 0 ) )
  4386                         iAllowVoIPOverWCDMAModified ) )
       
  4387                     {
  4300                     {
  4388                     // Create objects that allow the creation of
  4301                     // Create objects that allow the creation of
  4389                     // CSIPManagedProfile object.
  4302                     // CSIPManagedProfile object.
  4390                     CSIPProfile* sipProf = NULL;
  4303                     CSIPProfile* sipProf = NULL;
  4391                     CSIPProfileRegistryObserver* sipRegObs =
  4304                     CSIPProfileRegistryObserver* sipRegObs =
  4442                         if ( userAgentHeader.Length() > 0 )
  4355                         if ( userAgentHeader.Length() > 0 )
  4443                             {
  4356                             {
  4444                             User::LeaveIfError( 
  4357                             User::LeaveIfError( 
  4445                                 sipManProf->SetParameter( 
  4358                                 sipManProf->SetParameter( 
  4446                                 KSIPHeaders, *uahArray ) );
  4359                                 KSIPHeaders, *uahArray ) );
  4447                             }
       
  4448                         
       
  4449                         if ( iAllowVoIPOverWCDMAModified )
       
  4450                             {
       
  4451                             if ( iProfileEntries[iProfileID]->
       
  4452                                     iAllowVoIPoverWCDMA == 
       
  4453                                      CRCSEProfileEntry::EOn )
       
  4454                                 {
       
  4455                                 User::LeaveIfError( 
       
  4456                                     sipManProf->SetParameter( 
       
  4457                                     KBearerType, KBearerNotSpecified ) );
       
  4458                                 }
       
  4459                             else if ( iProfileEntries[iProfileID]->
       
  4460                                          iAllowVoIPoverWCDMA ==
       
  4461                                          CRCSEProfileEntry::EOff )
       
  4462                                 {
       
  4463                                 User::LeaveIfError( 
       
  4464                                     sipManProf->SetParameter( 
       
  4465                                     KBearerType, KBearerWlanOnly ) );
       
  4466                                 }
       
  4467                             iAllowVoIPOverWCDMAModified = EFalse;
       
  4468                             }
  4360                             }
  4469 
  4361 
  4470                         sipProfReg->SaveL( *sipManProf );
  4362                         sipProfReg->SaveL( *sipManProf );
  4471                         uahArray->Reset();
  4363                         uahArray->Reset();
  4472                         // uahArray, sipManProf 
  4364                         // uahArray, sipManProf