XDMEngine/XdmDeviceManagement/src/xdmdmadapter.cpp
branchRCL_3
changeset 35 fbd2e7cec7ef
parent 34 2669f8761a99
equal deleted inserted replaced
34:2669f8761a99 35:fbd2e7cec7ef
   233             currentList->InsertL( currentList->Size(), segmentName );
   233             currentList->InsertL( currentList->Size(), segmentName );
   234             currentList->InsertL( currentList->Size(), KXdmDmSeparator );
   234             currentList->InsertL( currentList->Size(), KXdmDmSeparator );
   235             }
   235             }
   236         Callback().SetResultsL( aResultsRef, *currentList, KNullDesC8 );
   236         Callback().SetResultsL( aResultsRef, *currentList, KNullDesC8 );
   237         Callback().SetStatusL( aStatusRef, retValue );
   237         Callback().SetStatusL( aStatusRef, retValue );
   238         CleanupStack::PopAndDestroy( 3, currentList ); // >>> settingIds, names, currentList
   238         CleanupStack::PopAndDestroy( names );       // >>> names
       
   239         CleanupStack::PopAndDestroy();              // >>> settingIds
       
   240         CleanupStack::PopAndDestroy( currentList ); // >>> currentList
   239         return;
   241         return;
   240         }   
   242         }   
   241 
   243 
   242     // ./OMA_XDM/X   
   244     // ./OMA_XDM/X   
   243     if( NSmlDmURI::NumOfURISegs( aUri ) == KXdmDmLevel )   
   245     if( NSmlDmURI::NumOfURISegs( aUri ) == KXdmDmLevel )   
   244         {
   246         {
       
   247 #ifdef _DEBUG
       
   248     WriteToLog(_L8("CXdmDMAdapter::ChildURIListL(): /OMA_XDM/X") );
       
   249 #endif 
   245         segmentName.Copy( KXdmDmAppId );
   250         segmentName.Copy( KXdmDmAppId );
   246         currentList->InsertL( currentList->Size(), segmentName );
   251         currentList->InsertL( currentList->Size(), segmentName );
   247         currentList->InsertL( currentList->Size(), KXdmDmSeparator );
   252         currentList->InsertL( currentList->Size(), KXdmDmSeparator );
   248         
   253         
   249         segmentName.Copy( KXdmDmName );
   254         segmentName.Copy( KXdmDmName );
   276         }
   281         }
   277         
   282         
   278     // ./OMA_XDM/X/ToConRef   
   283     // ./OMA_XDM/X/ToConRef   
   279     else if ( Match( lastUriSeg, KXdmDmToConRef ) ) 
   284     else if ( Match( lastUriSeg, KXdmDmToConRef ) ) 
   280         {
   285         {
       
   286 #ifdef _DEBUG
       
   287     WriteToLog(_L8("CXdmDMAdapter::ChildURIListL(): /OMA_XDM/X/ToConRef") );
       
   288 #endif
   281         segmentName.Copy( KXdmDmSip );
   289         segmentName.Copy( KXdmDmSip );
   282         currentList->InsertL( currentList->Size(), segmentName );
   290         currentList->InsertL( currentList->Size(), segmentName );
   283         currentList->InsertL( currentList->Size(), KXdmDmSeparator );
   291         currentList->InsertL( currentList->Size(), KXdmDmSeparator );
   284         
   292         
   285         segmentName.Copy( KXdmDmToNapId );
   293         segmentName.Copy( KXdmDmToNapId );
   288         }
   296         }
   289         
   297         
   290     // ./OMA_XDM/X/ToConRef/SIP
   298     // ./OMA_XDM/X/ToConRef/SIP
   291     else if( Match( lastUriSeg, KXdmDmSip ) ) 
   299     else if( Match( lastUriSeg, KXdmDmSip ) ) 
   292         {
   300         {
       
   301 #ifdef _DEBUG
       
   302     WriteToLog(_L8("CXdmDMAdapter::ChildURIListL(): /OMA_XDM/X/ToConRef/SIP") );
       
   303 #endif
   293         segmentName.Copy( KXdmDmConRef );
   304         segmentName.Copy( KXdmDmConRef );
   294         currentList->InsertL( currentList->Size(), segmentName );
   305         currentList->InsertL( currentList->Size(), segmentName );
   295         currentList->InsertL( currentList->Size(), KXdmDmSeparator );
   306         currentList->InsertL( currentList->Size(), KXdmDmSeparator );
   296         }
   307         }
   297         
   308         
   298     // ./OMA_XDM/X/ToConRef/TO-NAPID
   309     // ./OMA_XDM/X/ToConRef/TO-NAPID
   299     else if( Match ( lastUriSeg, KXdmDmToNapId ) ) 
   310     else if( Match ( lastUriSeg, KXdmDmToNapId ) ) 
   300         {
   311         {
       
   312 #ifdef _DEBUG
       
   313     WriteToLog(_L8("CXdmDMAdapter::ChildURIListL(): /OMA_XDM/X/ToConRef/TO-NAPID") );
       
   314 #endif
   301         segmentName.Copy( KXdmDmConRef );
   315         segmentName.Copy( KXdmDmConRef );
   302         currentList->InsertL( currentList->Size(), segmentName );
   316         currentList->InsertL( currentList->Size(), segmentName );
   303         currentList->InsertL( currentList->Size(), KXdmDmSeparator );
   317         currentList->InsertL( currentList->Size(), KXdmDmSeparator );
   304         }
   318         }
   305     else
   319     else
   306         {
   320         {
   307         // if none of asked nodes found return error.
   321         // if none of asked nodes found return error.
       
   322 #ifdef _DEBUG
       
   323     WriteToLog(_L8("CXdmDMAdapter::ChildURIListL(): return ENotFound") );
       
   324 #endif
   308         retValue = CSmlDmAdapter::ENotFound;
   325         retValue = CSmlDmAdapter::ENotFound;
   309         }
   326         }
   310        
   327        
   311     Callback().SetResultsL( aResultsRef, *currentList, KNullDesC8 );
   328     Callback().SetResultsL( aResultsRef, *currentList, KNullDesC8 );
   312     Callback().SetStatusL( aStatusRef, retValue );
   329     Callback().SetStatusL( aStatusRef, retValue );
   500                                        const TDesC8& /*aType*/, 
   517                                        const TDesC8& /*aType*/, 
   501                                        const TInt aStatusRef )
   518                                        const TInt aStatusRef )
   502     {
   519     {
   503 #ifdef _DEBUG
   520 #ifdef _DEBUG
   504     WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL(): begin") );
   521     WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL(): begin") );
       
   522     WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL() -    aUri: %S"), &aUri );
       
   523     WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL() -   aLUID: %S"), &aLUID );
       
   524     WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL() - aObject: %S"), &aObject );
   505 #endif   
   525 #endif   
   506     CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
   526     CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
   507 
   527 
   508     TInt settingsId = FindSettingsIdL( aLUID, aUri );
   528     TInt settingsId = FindSettingsIdL( aLUID, aUri );
   509     
   529     
   519         {
   539         {
   520         // first check if the new value is same as earlier
   540         // first check if the new value is same as earlier
   521         HBufC* current = NULL;
   541         HBufC* current = NULL;
   522         TInt error( KErrNone );
   542         TInt error( KErrNone );
   523         TRAP( error, ( current = TXdmSettingsApi::PropertyL( settingsId, EXdmPropName ) ) );
   543         TRAP( error, ( current = TXdmSettingsApi::PropertyL( settingsId, EXdmPropName ) ) );
       
   544 #ifdef _DEBUG
       
   545     WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL() - EXdmPropName error: %d"), error );
       
   546 #endif 
   524         if ( error == KErrNone )
   547         if ( error == KErrNone )
   525             {
   548             {
   526             TBool same ( EFalse );
   549             TBool same ( EFalse );
   527             CleanupStack::PushL( current );   // << current
   550             CleanupStack::PushL( current );   // << current
   528             HBufC8* current8 = ConvertLC( *current ); // << current8
   551             HBufC8* current8 = ConvertLC( *current ); // << current8
   529             if ( Match( current8->Des(), aObject ) )
   552             if ( Match( current8->Des(), aObject ) )
   530                 {
   553                 {
   531                 same = ETrue;
   554                 same = ETrue;
   532                 }
   555                 }
   533             CleanupStack::PopAndDestroy( 2, current8 );  // >>> current, current8
   556             CleanupStack::PopAndDestroy( current8 );  // >>> current8
       
   557             CleanupStack::PopAndDestroy( current );  // >>> current
   534             if ( same )
   558             if ( same )
   535                 {
   559                 {
   536                 Callback().SetStatusL( aStatusRef, status );
   560                 Callback().SetStatusL( aStatusRef, status );
   537                 return;
   561                 return; // value was same, just return without change
   538                 }
   562                 }
   539             }
   563             }
   540         // if the name is already in use, new name with index is created
   564         // if the name is already in use, new name with index is created
   541         HBufC* value = CheckExistingNamesLC( aObject );     // << value
   565         HBufC* value = CheckExistingNamesLC( aObject );     // << value
   542         TRAP( error, TXdmSettingsApi::UpdatePropertyL( settingsId, *value, EXdmPropName ) );
   566         TRAP( error, TXdmSettingsApi::UpdatePropertyL( settingsId, *value, EXdmPropName ) );
       
   567 #ifdef _DEBUG
       
   568     WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL() - EXdmPropName error: %d"), error );
       
   569 #endif
   543         CleanupStack::PopAndDestroy( value );                      // >>> value
   570         CleanupStack::PopAndDestroy( value );                      // >>> value
   544         if ( error != KErrNone )
   571         if ( error != KErrNone )
   545             {
   572             {
   546             status = CSmlDmAdapter::ENotFound;
   573             status = CSmlDmAdapter::ENotFound;
   547             }
   574             }
   645         CleanupStack::PushL( collection );  // << collection
   672         CleanupStack::PushL( collection );  // << collection
   646         collection->AppendL( KXdmDefaultId, EXdmPropSettingsId );
   673         collection->AppendL( KXdmDefaultId, EXdmPropSettingsId );
   647         TInt id = TXdmSettingsApi::CreateCollectionL( *collection );
   674         TInt id = TXdmSettingsApi::CreateCollectionL( *collection );
   648         HBufC8* luid = IntToDes8LC( id );   // << luid
   675         HBufC8* luid = IntToDes8LC( id );   // << luid
   649         Callback().SetMappingL( aUri, *luid );
   676         Callback().SetMappingL( aUri, *luid );
   650         CleanupStack::PopAndDestroy( 2, luid );   // >>> collection, luid  
   677         status =  CSmlDmAdapter::EOk;
   651         status =  CSmlDmAdapter::EOk;  
       
   652 #ifdef _DEBUG
   678 #ifdef _DEBUG
   653     WriteToLog(_L8("CXdmDMAdapter::AddNodeObjectL(): Settings created id=%d"), id );
   679     WriteToLog(_L8("CXdmDMAdapter::AddNodeObjectL(): Settings created id=%d"), id );
   654 #endif
   680 #endif
   655         }
   681         HBufC8* nameUri = HBufC8::NewLC( aUri.Length() +
   656     Callback().SetStatusL( aStatusRef, status );
   682                                          KXdmDmSeparator().Length() +
   657     
   683                                          KXdmDmName().Length() );
       
   684         TPtr8 nameUriPtr = nameUri->Des();
       
   685         nameUriPtr.Append( aUri );
       
   686         nameUriPtr.Append( KXdmDmSeparator );
       
   687         nameUriPtr.Append( KXdmDmName );
       
   688 
       
   689         // Update Node's NAME to default so UI can recognize settings
       
   690         UpdateLeafObjectL( nameUriPtr,
       
   691                            *luid,
       
   692                            KXdmDefaultSettingsName,
       
   693                            KXdmDmName,
       
   694                            aStatusRef );
       
   695         CleanupStack::PopAndDestroy( nameUri );    // >> nameUri
       
   696         CleanupStack::PopAndDestroy( luid );       // >> luid
       
   697         CleanupStack::PopAndDestroy( collection ); // >> collection
       
   698         }
       
   699     else
       
   700         {
       
   701         Callback().SetStatusL( aStatusRef, status );
       
   702         }
       
   703         
   658 #ifdef _DEBUG
   704 #ifdef _DEBUG
   659     WriteToLog(_L8("CXdmDMAdapter::AddNodeObjectL(): end") );
   705     WriteToLog(_L8("CXdmDMAdapter::AddNodeObjectL(): end") );
   660 #endif
   706 #endif
   661     }
   707     }
   662     
   708     
   701                                        const TDesC8& /*aLUID*/, 
   747                                        const TDesC8& /*aLUID*/, 
   702                                        RWriteStream*& /*aStream*/, 
   748                                        RWriteStream*& /*aStream*/, 
   703                                        const TDesC8& /*aType*/, 
   749                                        const TDesC8& /*aType*/, 
   704                                        const TInt aStatusRef )
   750                                        const TInt aStatusRef )
   705     {  
   751     {  
       
   752 #ifdef _DEBUG
       
   753     WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL( ): begin / end") );
       
   754 #endif
   706     // Update from stream not used
   755     // Update from stream not used
   707     Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
   756     Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
   708     }
   757     }
   709     
   758     
   710 // -----------------------------------------------------------------------------
   759 // -----------------------------------------------------------------------------
   715                                      const TDesC8& /*aLUID*/, 
   764                                      const TDesC8& /*aLUID*/, 
   716                                      const TDesC8& /*aArgument*/, 
   765                                      const TDesC8& /*aArgument*/, 
   717                                      const TDesC8& /*aType*/, 
   766                                      const TDesC8& /*aType*/, 
   718                                      const TInt aStatusRef )
   767                                      const TInt aStatusRef )
   719     {
   768     {
       
   769 #ifdef _DEBUG
       
   770     WriteToLog(_L8("CXdmDMAdapter::ExecuteCommandL( ): Not supported") );
       
   771 #endif
   720     // Not supported 
   772     // Not supported 
   721     Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
   773     Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
   722     }
   774     }
   723 
   775 
   724 // -----------------------------------------------------------------------------
   776 // -----------------------------------------------------------------------------
   729                                      const TDesC8& /*aLUID*/, 
   781                                      const TDesC8& /*aLUID*/, 
   730                                      RWriteStream*& /*aStream*/, 
   782                                      RWriteStream*& /*aStream*/, 
   731                                      const TDesC8& /*aType*/, 
   783                                      const TDesC8& /*aType*/, 
   732                                      const TInt aStatusRef )
   784                                      const TInt aStatusRef )
   733     {
   785     {
       
   786 #ifdef _DEBUG
       
   787     WriteToLog(_L8("CXdmDMAdapter::ExecuteCommandL( ): Not supported") );
       
   788 #endif
   734     // Not supported
   789     // Not supported
   735     Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
   790     Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
   736     }
   791     }
   737 
   792 
   738 // -----------------------------------------------------------------------------
   793 // -----------------------------------------------------------------------------
   744                                   const TDesC8& /*aSourceURI*/, 
   799                                   const TDesC8& /*aSourceURI*/, 
   745                                   const TDesC8& /*aSourceLUID*/, 
   800                                   const TDesC8& /*aSourceLUID*/, 
   746                                   const TDesC8& /*aType*/, 
   801                                   const TDesC8& /*aType*/, 
   747                                   TInt aStatusRef )
   802                                   TInt aStatusRef )
   748     {
   803     {
       
   804 #ifdef _DEBUG
       
   805     WriteToLog(_L8("CXdmDMAdapter::CopyCommandL( ): Not supported") );
       
   806 #endif
   749     // Not supported
   807     // Not supported
   750     Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
   808     Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
   751     }
   809     }
   752 
   810 
   753 // -----------------------------------------------------------------------------
   811 // -----------------------------------------------------------------------------
   755 // -----------------------------------------------------------------------------
   813 // -----------------------------------------------------------------------------
   756 //
   814 //
   757 void CXdmDMAdapter::StartAtomicL()
   815 void CXdmDMAdapter::StartAtomicL()
   758     {
   816     {
   759     // Not supported
   817     // Not supported
       
   818 #ifdef _DEBUG
       
   819     WriteToLog(_L8("CXdmDMAdapter::StartAtomicL( ): Not supported") );
       
   820 #endif
   760     }
   821     }
   761 
   822 
   762 // -----------------------------------------------------------------------------
   823 // -----------------------------------------------------------------------------
   763 // CXdmDMAdapter::CommitAtomicL()
   824 // CXdmDMAdapter::CommitAtomicL()
   764 // -----------------------------------------------------------------------------
   825 // -----------------------------------------------------------------------------
   765 //
   826 //
   766 void CXdmDMAdapter::CommitAtomicL()
   827 void CXdmDMAdapter::CommitAtomicL()
   767     {
   828     {
   768     // Not supported
   829     // Not supported
       
   830 #ifdef _DEBUG
       
   831     WriteToLog(_L8("CXdmDMAdapter::CommitAtomicL( ): Not supported") );
       
   832 #endif
   769     }
   833     }
   770 
   834 
   771 // -----------------------------------------------------------------------------
   835 // -----------------------------------------------------------------------------
   772 // CXdmDMAdapter::RollbackAtomicL()
   836 // CXdmDMAdapter::RollbackAtomicL()
   773 // -----------------------------------------------------------------------------
   837 // -----------------------------------------------------------------------------
   774 //
   838 //
   775 void CXdmDMAdapter::RollbackAtomicL()
   839 void CXdmDMAdapter::RollbackAtomicL()
   776     {
   840     {
   777     // Not supported
   841     // Not supported
       
   842 #ifdef _DEBUG
       
   843     WriteToLog(_L8("CXdmDMAdapter::RollBackAtomicL( ): Not supported") );
       
   844 #endif
   778     }
   845     }
   779 
   846 
   780 // -----------------------------------------------------------------------------
   847 // -----------------------------------------------------------------------------
   781 // CXdmDMAdapter::StreamingSupport()
   848 // CXdmDMAdapter::StreamingSupport()
   782 // -----------------------------------------------------------------------------
   849 // -----------------------------------------------------------------------------
   783 //
   850 //
   784 TBool CXdmDMAdapter::StreamingSupport( TInt& /*aItemSize*/ )
   851 TBool CXdmDMAdapter::StreamingSupport( TInt& /*aItemSize*/ )
   785     {
   852     {
       
   853 #ifdef _DEBUG
       
   854     WriteToLog(_L8("CXdmDMAdapter::StreamingSupport( ): Return EFalse") );
       
   855 #endif
   786     return EFalse;
   856     return EFalse;
   787     }
   857     }
   788 
   858 
   789 // -----------------------------------------------------------------------------
   859 // -----------------------------------------------------------------------------
   790 // CXdmDMAdapter::StreamCommittedL()
   860 // CXdmDMAdapter::StreamCommittedL()
   791 // -----------------------------------------------------------------------------
   861 // -----------------------------------------------------------------------------
   792 //
   862 //
   793 void CXdmDMAdapter::StreamCommittedL()
   863 void CXdmDMAdapter::StreamCommittedL()
   794     {
   864     {
   795     // Not supported
   865     // Not supported
       
   866 #ifdef _DEBUG
       
   867     WriteToLog(_L8("CXdmDMAdapter::StreamCommittedL( ): Not supported") );
       
   868 #endif
   796     }
   869     }
   797     
   870     
   798 // -----------------------------------------------------------------------------
   871 // -----------------------------------------------------------------------------
   799 // CXdmDMAdapter::CompleteOutstandingCmdsL()
   872 // CXdmDMAdapter::CompleteOutstandingCmdsL()
   800 // -----------------------------------------------------------------------------
   873 // -----------------------------------------------------------------------------
   812 //
   885 //
   813 CSmlDmAdapter::TError CXdmDMAdapter::GetPropertyL( TInt aSettingsId, 
   886 CSmlDmAdapter::TError CXdmDMAdapter::GetPropertyL( TInt aSettingsId, 
   814                                                    TXdmSettingsProperty aProperty, 
   887                                                    TXdmSettingsProperty aProperty, 
   815                                                    CBufBase& aObject )
   888                                                    CBufBase& aObject )
   816     {
   889     {
       
   890 #ifdef _DEBUG
       
   891     WriteToLog(_L8("CXdmDMAdapter::GetPropertyL( ) - aSettingsId = %d"), &aSettingsId );
       
   892 #endif
   817     HBufC* value = NULL;
   893     HBufC* value = NULL;
   818     TInt error( KErrNone );
   894     TInt error( KErrNone );
   819     TRAP( error, ( value = TXdmSettingsApi::PropertyL( aSettingsId, aProperty ) ) );
   895     TRAP( error, ( value = TXdmSettingsApi::PropertyL( aSettingsId, aProperty ) ) );
   820     if ( error == KErrNone )
   896     if ( error == KErrNone )
   821         {
   897         {
   822         CleanupStack::PushL( value );           // << value
   898         CleanupStack::PushL( value );           // << value
   823         HBufC8* utfValue = ConvertLC( *value ); // << utfValue
   899         HBufC8* utfValue = ConvertLC( *value ); // << utfValue
   824         aObject.InsertL( 0, *utfValue );
   900         aObject.InsertL( 0, *utfValue );
   825         CleanupStack::PopAndDestroy( 2, utfValue );       // >>> value, utfValue
   901         CleanupStack::PopAndDestroy( utfValue );       // >>> utfValue
       
   902         CleanupStack::PopAndDestroy( value );       // >>> value
       
   903 #ifdef _DEBUG
       
   904     WriteToLog(_L8("CXdmDMAdapter::GetPropertyL( ): return EOk") );
       
   905 #endif
   826         return CSmlDmAdapter::EOk;
   906         return CSmlDmAdapter::EOk;
   827         }
   907         }
       
   908 #ifdef _DEBUG
       
   909     WriteToLog(_L8("CXdmDMAdapter::GetPropertyL( ): return ENotFound") );
       
   910 #endif
   828     return CSmlDmAdapter::ENotFound;
   911     return CSmlDmAdapter::ENotFound;
   829     }
   912     }
   830     
   913     
   831 
   914 
   832 // -----------------------------------------------------------------------------
   915 // -----------------------------------------------------------------------------
   835 //
   918 //
   836 CSmlDmAdapter::TError CXdmDMAdapter::UpdatePropertyL( TInt aSettingsId, 
   919 CSmlDmAdapter::TError CXdmDMAdapter::UpdatePropertyL( TInt aSettingsId, 
   837                                                       TXdmSettingsProperty aProperty, 
   920                                                       TXdmSettingsProperty aProperty, 
   838                                                       const TDesC8& aObject )
   921                                                       const TDesC8& aObject )
   839     {
   922     {
       
   923 #ifdef _DEBUG
       
   924     WriteToLog(_L8("CXdmDMAdapter::UpdatePropertyL( ): begin") );
       
   925 #endif
   840     HBufC* value = ConvertLC( aObject ); // << value
   926     HBufC* value = ConvertLC( aObject ); // << value
   841     TInt error( KErrNone );
   927     TInt error( KErrNone );
   842     TRAP( error, TXdmSettingsApi::UpdatePropertyL( aSettingsId, *value, aProperty )  );
   928     TRAP( error, TXdmSettingsApi::UpdatePropertyL( aSettingsId, *value, aProperty )  );
   843     CleanupStack::PopAndDestroy( value );     // >>> value
   929     CleanupStack::PopAndDestroy( value );     // >>> value
   844 
   930 
   845     if ( error == KErrNone )
   931     if ( error == KErrNone )
   846         {
   932         {
       
   933 #ifdef _DEBUG
       
   934     WriteToLog(_L8("CXdmDMAdapter::UpdatePropertyL( ): return EOk") );
       
   935 #endif
   847         return CSmlDmAdapter::EOk;
   936         return CSmlDmAdapter::EOk;
   848         }
   937         }
       
   938 #ifdef _DEBUG
       
   939     WriteToLog(_L8("CXdmDMAdapter::UpdatePropertyL( ): return ENotFound") );
       
   940 #endif
   849     return CSmlDmAdapter::ENotFound;
   941     return CSmlDmAdapter::ENotFound;
   850     }
   942     }
   851           
   943           
   852  
   944  
   853 // -----------------------------------------------------------------------------
   945 // -----------------------------------------------------------------------------
   859                                    MSmlDmDDFObject::TOccurence aOccurrence, 
   951                                    MSmlDmDDFObject::TOccurence aOccurrence, 
   860                                    MSmlDmDDFObject::TScope aScope, 
   952                                    MSmlDmDDFObject::TScope aScope, 
   861                                    MSmlDmDDFObject::TDFFormat aFormat,
   953                                    MSmlDmDDFObject::TDFFormat aFormat,
   862                                    const TDesC8& aDescription)
   954                                    const TDesC8& aDescription)
   863     {
   955     {
       
   956 #ifdef _DEBUG
       
   957     WriteToLog(_L8("CXdmDMAdapter::FillNodeInfoL( ): begin") );
       
   958 #endif
   864     aNode.SetAccessTypesL( aAccTypes );
   959     aNode.SetAccessTypesL( aAccTypes );
   865     aNode.SetOccurenceL( aOccurrence );
   960     aNode.SetOccurenceL( aOccurrence );
   866     aNode.SetScopeL( aScope );
   961     aNode.SetScopeL( aScope );
   867     aNode.SetDFFormatL( aFormat );
   962     aNode.SetDFFormatL( aFormat );
   868     
   963     
   869     if( aFormat != MSmlDmDDFObject::ENode )
   964     if( aFormat != MSmlDmDDFObject::ENode )
   870         {
   965         {
   871         aNode.AddDFTypeMimeTypeL( KXdmDmTextPlain );
   966         aNode.AddDFTypeMimeTypeL( KXdmDmTextPlain );
   872         }
   967         }
   873     aNode.SetDescriptionL( aDescription );
   968     aNode.SetDescriptionL( aDescription );
       
   969 #ifdef _DEBUG
       
   970     WriteToLog(_L8("CXdmDMAdapter::FillNodeInfoL( ): end") );
       
   971 #endif
   874     }
   972     }
   875     
   973     
   876 
   974 
   877 // ----------------------------------------------------------------------------
   975 // ----------------------------------------------------------------------------
   878 // CXdmDMAdapter::IapIdFromURIL
   976 // CXdmDMAdapter::IapIdFromURIL
   879 // ----------------------------------------------------------------------------
   977 // ----------------------------------------------------------------------------
   880 //
   978 //
   881 TInt CXdmDMAdapter::IapIdFromURIL( const TDesC8& aUri )
   979 TInt CXdmDMAdapter::IapIdFromURIL( const TDesC8& aUri )
   882     {
   980     {
       
   981 #ifdef _DEBUG
       
   982     WriteToLog(_L8("CXdmDMAdapter::IapIdFromUriL( ): begin") );
       
   983 #endif
   883     TInt id( KErrNotFound );
   984     TInt id( KErrNotFound );
   884     MSmlDmAdapter::TError status( MSmlDmAdapter::EError );
   985     MSmlDmAdapter::TError status( MSmlDmAdapter::EError );
   885     CBufBase* result = CBufFlat::NewL(1);
   986     CBufBase* result = CBufFlat::NewL(1);
   886     CleanupStack::PushL( result );  // << result
   987     CleanupStack::PushL( result );  // << result
   887        
   988        
   899         delete luid;
  1000         delete luid;
   900         luid = NULL;
  1001         luid = NULL;
   901         }
  1002         }
   902 
  1003 
   903     CleanupStack::PopAndDestroy( result );  // >>> result
  1004     CleanupStack::PopAndDestroy( result );  // >>> result
       
  1005 #ifdef _DEBUG
       
  1006     WriteToLog(_L8("CXdmDMAdapter::IapIdFromUriL( ): end") );
       
  1007 #endif
   904     return id;
  1008     return id;
   905     } 
  1009     } 
   906 
  1010 
   907 // ----------------------------------------------------------------------------
  1011 // ----------------------------------------------------------------------------
   908 // CXdmDMAdapter::URIFromIapIdL
  1012 // CXdmDMAdapter::URIFromIapIdL
   909 // ----------------------------------------------------------------------------
  1013 // ----------------------------------------------------------------------------
   910 //
  1014 //
   911 HBufC8* CXdmDMAdapter::URIFromIapIdL( TInt aId )
  1015 HBufC8* CXdmDMAdapter::URIFromIapIdL( TInt aId )
   912     {
  1016     {
       
  1017 #ifdef _DEBUG
       
  1018     WriteToLog(_L8("CXdmDMAdapter::UriFromIapIdL( ): begin") );
       
  1019 #endif
   913     CBufBase *allIds = CBufFlat::NewL(KXdmDmIdTableSize);
  1020     CBufBase *allIds = CBufFlat::NewL(KXdmDmIdTableSize);
   914     CleanupStack::PushL( allIds );  // << allIds
  1021     CleanupStack::PushL( allIds );  // << allIds
   915     MSmlDmAdapter::TError status;
  1022     MSmlDmAdapter::TError status;
   916     // Fetch all IAP ids
  1023     // Fetch all IAP ids
   917     Callback().FetchLinkL( KXdmDmAP, *allIds, status );
  1024     Callback().FetchLinkL( KXdmDmAP, *allIds, status );
   934                 uriSeg = uriSeg8Ptr.AllocLC();  // << uriSeg
  1041                 uriSeg = uriSeg8Ptr.AllocLC();  // << uriSeg
   935                 }
  1042                 }
   936             else
  1043             else
   937                 {
  1044                 {
   938                 TPtrC8 uriSeg8Ptr = allIds->Ptr(segStart).Mid( 0, index );
  1045                 TPtrC8 uriSeg8Ptr = allIds->Ptr(segStart).Mid( 0, index );
   939                 uriSeg = uriSeg8Ptr.AllocLC();  // << uriSeg8Ptr
  1046                 uriSeg = uriSeg8Ptr.AllocLC();  // << uriSeg
   940                 }
  1047                 }
   941             // Construct the uri
  1048             // Construct the uri
   942             HBufC8* uri = HBufC8::NewLC( KXdmDmAP().Length() 
  1049             HBufC8* uri = HBufC8::NewLC( KXdmDmAP().Length() 
   943                                          + KXdmDmSeparator().Length() 
  1050                                          + KXdmDmSeparator().Length() 
   944                                          + uriSeg->Length() ); // << uri
  1051                                          + uriSeg->Length() ); // << uri
   955                 delete luid;
  1062                 delete luid;
   956                 luid = NULL;
  1063                 luid = NULL;
   957                 if ( id == aId )
  1064                 if ( id == aId )
   958                     {
  1065                     {
   959                     // The correct one found
  1066                     // The correct one found
   960                     CleanupStack::Pop();  // >>> uri
  1067                     CleanupStack::Pop();                     // >>> uri
   961                     CleanupStack::PopAndDestroy( 2, allIds );  // >>> uriSeg, allIds
  1068                     CleanupStack::PopAndDestroy( uriSeg );   // >>> uriSeg 
       
  1069                     CleanupStack::PopAndDestroy( allIds );   // >>> allIds
       
  1070 #ifdef _DEBUG
       
  1071     WriteToLog(_L8("CXdmDMAdapter::UriFromIapIdL( ): return uri") );
       
  1072 #endif
   962                     return uri;
  1073                     return uri;
   963                     }
  1074                     }
   964                 }
  1075                 }
   965             // This was wrong, delete and get the next one
  1076             // This was wrong, delete and get the next one
   966             CleanupStack::PopAndDestroy( 2, uriSeg ); // >>> uri, uriSeg
  1077             CleanupStack::PopAndDestroy( uri );      // >>> uri
       
  1078             CleanupStack::PopAndDestroy( uriSeg );   // >>> uriSeg 
   967             segStart += index + 1;
  1079             segStart += index + 1;
   968             }        
  1080             }        
   969         }
  1081         }
   970     CleanupStack::PopAndDestroy( allIds ); // >>> allIds
  1082     CleanupStack::PopAndDestroy( allIds ); // >>> allIds
       
  1083 #ifdef _DEBUG
       
  1084     WriteToLog(_L8("CXdmDMAdapter::UriFromIapIdL( ): return NULL") );
       
  1085 #endif
   971     return NULL;
  1086     return NULL;
   972     }  
  1087     }  
   973 // -----------------------------------------------------------------------------
  1088 // -----------------------------------------------------------------------------
   974 // CXdmDMAdapter::GetSipIdL
  1089 // CXdmDMAdapter::GetSipIdL
   975 // -----------------------------------------------------------------------------
  1090 // -----------------------------------------------------------------------------
   976 //
  1091 //
   977 TInt CXdmDMAdapter::GetSipIdL( const TDesC8& aUri )
  1092 TInt CXdmDMAdapter::GetSipIdL( const TDesC8& aUri )
   978     {
  1093     {
   979 
  1094 #ifdef _DEBUG
       
  1095     WriteToLog(_L8("CXdmDMAdapter::GetSipIdL( ): begin") );
       
  1096 #endif
   980     CSmlDmAdapter::TError status = EOk;
  1097     CSmlDmAdapter::TError status = EOk;
   981     CBufBase* result = CBufFlat::NewL(1);
  1098     CBufBase* result = CBufFlat::NewL(1);
   982     CleanupStack::PushL( result );    // << result
  1099     CleanupStack::PushL( result );    // << result
   983 
  1100 
   984     TPtrC8 uri = NSmlDmURI::RemoveDotSlash( aUri );
  1101     TPtrC8 uri = NSmlDmURI::RemoveDotSlash( aUri );
   989         {
  1106         {
   990         TUint32 id( 0 );
  1107         TUint32 id( 0 );
   991         TPtrC8 hexIndex = uri.Right( KXdmDmHexLength );
  1108         TPtrC8 hexIndex = uri.Right( KXdmDmHexLength );
   992         TLex8 lexer( hexIndex );
  1109         TLex8 lexer( hexIndex );
   993         lexer.Val( id, EHex );
  1110         lexer.Val( id, EHex );
   994         CleanupStack::PopAndDestroy( result );   // >>> result   
  1111         CleanupStack::PopAndDestroy( result );   // >>> result
       
  1112 #ifdef _DEBUG
       
  1113     WriteToLog(_L8("CXdmDMAdapter::GetSipIdL( ): return id: %d"), id );
       
  1114 #endif
   995         return id;       
  1115         return id;       
   996         }
  1116         }
   997     CleanupStack::PopAndDestroy( result );   // >>> result   
  1117     CleanupStack::PopAndDestroy( result );   // >>> result
       
  1118 #ifdef _DEBUG
       
  1119     WriteToLog(_L8("CXdmDMAdapter::GetSipIdL( ): return KErrNotFound") );
       
  1120 #endif
   998     return KErrNotFound;       
  1121     return KErrNotFound;       
   999     }
  1122     }
  1000 // -----------------------------------------------------------------------------
  1123 // -----------------------------------------------------------------------------
  1001 // CXdmDMAdapter::FetchSipConRefL
  1124 // CXdmDMAdapter::FetchSipConRefL
  1002 // -----------------------------------------------------------------------------
  1125 // -----------------------------------------------------------------------------
  1003 //
  1126 //
  1004 CSmlDmAdapter::TError CXdmDMAdapter::FetchSipConRefL( TInt aSettingsId,
  1127 CSmlDmAdapter::TError CXdmDMAdapter::FetchSipConRefL( TInt aSettingsId,
  1005                                                       CBufBase& aObject)
  1128                                                       CBufBase& aObject)
  1006     {
  1129     {
  1007 
  1130 #ifdef _DEBUG
       
  1131     WriteToLog(_L8("CXdmDMAdapter::FetchSipConRefL( ): begin") );
       
  1132 #endif
  1008     CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
  1133     CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
  1009     TInt sipSettingsId( KErrNotFound );
  1134     TInt sipSettingsId( KErrNotFound );
  1010     
  1135     
  1011     HBufC* value = NULL;
  1136     HBufC* value = NULL;
  1012     TInt error( KErrNone );
  1137     TInt error( KErrNone );
  1082         }
  1207         }
  1083     else
  1208     else
  1084         {
  1209         {
  1085         status = CSmlDmAdapter::ENotFound;
  1210         status = CSmlDmAdapter::ENotFound;
  1086         }
  1211         }
  1087     
  1212 #ifdef _DEBUG
       
  1213     WriteToLog(_L8("CXdmDMAdapter::FetchSipConRefL( ): return status") );
       
  1214 #endif
  1088     return status;
  1215     return status;
  1089     }   
  1216     }   
  1090 
  1217 
  1091 // -----------------------------------------------------------------------------
  1218 // -----------------------------------------------------------------------------
  1092 // CXdmDMAdapter::FindSettingsIdL
  1219 // CXdmDMAdapter::FindSettingsIdL
  1093 // -----------------------------------------------------------------------------
  1220 // -----------------------------------------------------------------------------
  1094 //      
  1221 //      
  1095 TInt CXdmDMAdapter::FindSettingsIdL( const TDesC8& aLUID, const TDesC8& aUri )
  1222 TInt CXdmDMAdapter::FindSettingsIdL( const TDesC8& aLUID, const TDesC8& aUri )
  1096     {
  1223     {
       
  1224 #ifdef _DEBUG
       
  1225     WriteToLog(_L8("CXdmDMAdapter::FindSettingsIdL( ): begin") );
       
  1226 #endif
  1097     TInt settingsId(0);
  1227     TInt settingsId(0);
  1098     if ( aLUID.Length() > 0 )
  1228     if ( aLUID.Length() > 0 )
  1099         {
  1229         {
  1100         settingsId = DesToInt( aLUID );
  1230         settingsId = DesToInt( aLUID );
       
  1231 #ifdef _DEBUG
       
  1232     WriteToLog(_L8("CXdmDMAdapter::FindSettingsIdL( ): return settingsId: %d "), settingsId );
       
  1233 #endif
  1101         return settingsId;
  1234         return settingsId;
  1102         }
  1235         }
  1103     else
  1236     else
  1104         {
  1237         {
  1105         TPtrC8 name = NSmlDmURI:: URISeg( aUri, KXdmDmLevel );
  1238         TPtrC8 name = NSmlDmURI:: URISeg( aUri, KXdmDmLevel );
  1106         settingsId = DesToInt( name );
  1239         settingsId = DesToInt( name );
  1107         HBufC8* luid = IntToDes8LC( settingsId ); // << luid
  1240         HBufC8* luid = IntToDes8LC( settingsId ); // << luid
  1108         Callback().SetMappingL( aUri, *luid );
  1241         Callback().SetMappingL( aUri, *luid );
  1109         CleanupStack::PopAndDestroy( luid ); // luid 
  1242         CleanupStack::PopAndDestroy( luid ); // luid 
       
  1243 #ifdef _DEBUG
       
  1244     WriteToLog(_L8("CXdmDMAdapter::FindSettingsIdL( ): return settingsId: %d "), settingsId );
       
  1245 #endif
  1110         return settingsId;
  1246         return settingsId;
  1111         }
  1247         }
  1112     }
  1248     }
  1113 
  1249 
  1114 // -----------------------------------------------------------------------------
  1250 // -----------------------------------------------------------------------------
  1115 // CXdmDMAdapter::CheckExistingNamesLC()
  1251 // CXdmDMAdapter::CheckExistingNamesLC()
  1116 // -----------------------------------------------------------------------------
  1252 // -----------------------------------------------------------------------------
  1117 // 
  1253 // 
  1118 HBufC* CXdmDMAdapter::CheckExistingNamesLC( const TDesC8& aName )
  1254 HBufC* CXdmDMAdapter::CheckExistingNamesLC( const TDesC8& aName )
  1119     {    
  1255     {
       
  1256 #ifdef _DEBUG
       
  1257     WriteToLog(_L8("CXdmDMAdapter::CheckExistingNamesLC( ): begin") );
       
  1258 #endif
  1120     TBool ready( EFalse );  
  1259     TBool ready( EFalse );  
  1121     RArray<TInt> settingIds;
  1260     RArray<TInt> settingIds;
  1122     CleanupClosePushL( settingIds );                // << settingIds
  1261     CleanupClosePushL( settingIds );                // << settingIds
  1123     CDesCArray* settingNames = TXdmSettingsApi::CollectionNamesLC( settingIds ); // << settingNames
  1262     CDesCArray* settingNames = TXdmSettingsApi::CollectionNamesLC( settingIds ); // << settingNames
  1124     TInt index( 0 );
  1263     TInt index( 0 );
  1145         if ( !found )
  1284         if ( !found )
  1146             {
  1285             {
  1147             ready = ETrue;
  1286             ready = ETrue;
  1148             }
  1287             }
  1149         }
  1288         }
  1150     CleanupStack::PopAndDestroy( 2 );   // >>> settingNames, settingIds
  1289     CleanupStack::PopAndDestroy( settingNames );   // >>> settingNames
       
  1290     CleanupStack::PopAndDestroy();                 // >>> settingIds
  1151     HBufC* newName = tempName.AllocLC();    // << newName
  1291     HBufC* newName = tempName.AllocLC();    // << newName
       
  1292 #ifdef _DEBUG
       
  1293     WriteToLog(_L8("CXdmDMAdapter::CheckExistingNamesLC( ): end") );
       
  1294 #endif
  1152     return newName;
  1295     return newName;
  1153     }
  1296     }
  1154     
  1297     
  1155 // -----------------------------------------------------------------------------
  1298 // -----------------------------------------------------------------------------
  1156 // CXdmDMAdapter::Match
  1299 // CXdmDMAdapter::Match