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