コード例 #1
0
void T_CSPSettings::T_CSPSettings_CheckSupportedLsL(  )
    {    
    // Test CheckSupportedL( TServiceId aServiceId, const RPropertyNameArray& aNameArray )
    
    CSPProperty* property = CSPProperty::NewLC();
    iCSPSettings->FindPropertyL( 0, EPropertyVoIPSubServicePluginId, *property );
    iCSPSettings->FindPropertyL( 2, EPropertyVoIPSubServicePluginId, *property );
    CleanupStack::PopAndDestroy( property );

    
    // Test CheckSupportedL( TServiceId aServiceId )
    
    CSPEntry* entry = CSPEntry::NewLC();
    iCSPSettings->FindEntryL( 0, *entry );
    entry->SetServiceId( 2 );
    iCSPSettings->FindEntryL( 2, *entry );
    CleanupStack::PopAndDestroy( entry );
    
    
    // Test CheckSupportedL( TSPItemType aPropertyType )
    
    RPropertyArray* propertyArray = new (ELeave) RPropertyArray( 3 );
    CleanupStack::PushL( propertyArray );
    iCSPSettings->FindSubServicePropertiesL( 0, EItemTypeVMBXSubProperty, *propertyArray );

    
    // Test CheckSupportedL( const RPropertyArray& aPropertyArray )
    
    RIdArray serviceIds;
    CleanupClosePushL( serviceIds );
    iCSPSettings->FindServiceIdsFromPropertiesL( *propertyArray, serviceIds );

    CleanupStack::PopAndDestroy( &serviceIds );    
    CleanupStack::PopAndDestroy( propertyArray );
    }
コード例 #2
0
// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CSpsBackupHelperPerformer::ReadSettingsL()
    {
    XSPSLOGSTRING( "CSpsBackupHelperPerformer::ReadSettingsL IN" );
    RIdArray ids;
    CleanupClosePushL( ids );
    iServiceProviderSettings->FindServiceIdsL( ids );
    
    // Make sure that id's are in correct order!
    for( TInt i = 0; i < ids.Count(); i++ )
        {
        TRAP_IGNORE( 
            CSPEntry* entry = CSPEntry::NewLC();
            User::LeaveIfError( 
                iServiceProviderSettings->FindEntryL( ids[i], *entry ) );
            
            // Make sure that all properties are loaded
            entry->GetAllProperties(); 
            iEntries.AppendL( entry );
            CleanupStack::Pop( entry );
            )

        }
    
    XSPSLOGSTRING2( 
        "CSpsBackupHelperPerformer::ReadSettingsL Service count=%i", 
        iEntries.Count() );
    
    CleanupStack::PopAndDestroy( &ids );
    XSPSLOGSTRING( "CSpsBackupHelperPerformer::ReadSettingsL OUT" );
    }
コード例 #3
0
// ---------------------------------------------------------------------------
// Update existing service provider settings entry
// ---------------------------------------------------------------------------
//
TInt CSPSettingsEngine::UpdateEntryL( const CSPEntry& aEntry )
    {
    XSPSLOGSTRING( "CSPSettingsEngine::UpdateEntry() - IN" );

    TServiceId serviceId( aEntry.GetServiceId() );

    // Leave if there is no service ID 
    if ( KSPNoId == serviceId || aEntry.GetServiceName().Length() == 0 )
        {
        User::Leave( KErrArgument );
        }

    // construct RIpAppPropArray
    RIpAppPropArray array;
    TCleanupItem cleanup( CSPSettingsEngine::CleanupPointerArray, &array );
    CleanupStack::PushL( cleanup );
    
    ConvertSpEntryToCenRepArrayL( aEntry, array );

    TInt err = iCenRepUtils->UpdateEntryL( (TInt) serviceId, array );
    
    CleanupStack::PopAndDestroy( &array );
    
    XSPSLOGSTRING( "CSPSettingsEngine::UpdateEntry() - OUT" );
    
    return err;
    }
コード例 #4
0
// ---------------------------------------------------------------------------
// Stores new service provider settings entry
// ---------------------------------------------------------------------------
//
void CSPSettingsEngine::AddEntryL( CSPEntry& aEntry )
    {
    XSPSLOGSTRING( "CSPSettingsEngine::AddEntryL() - IN" );
    
    // check the service name is not empty
    if( aEntry.GetServiceName().Length() == 0 )
        {
        User::LeaveIfError( KErrArgument );
        }

    // construct RIpAppPropArray
    RIpAppPropArray array;
    TCleanupItem cleanup( CSPSettingsEngine::CleanupPointerArray, &array );
    CleanupStack::PushL( cleanup );
    
    ConvertSpEntryToCenRepArrayL( aEntry, array );

    // Create new unique service ID
    TInt newId = 0;
    iCenRepUtils->AddEntryL( newId, array );
    aEntry.SetServiceId( newId );
    
    CleanupStack::PopAndDestroy( &array );
    
    XSPSLOGSTRING( "CSPSettingsEngine::AddEntryL() - OUT" );
    }
コード例 #5
0
void T_CSPSettings::T_CSPSettings_AddEntryLL(  )
    {
    CSPEntry* entry = CSPEntry::NewLC();
    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );

    EUNIT_ASSERT( KErrNone == iCSPSettings->AddEntryL( *entry ) );
    
    CleanupStack::PopAndDestroy( entry );
    }
コード例 #6
0
void T_CSPSettings::T_CSPSettings_DeleteEntryLL(  )
    {
    CSPEntry* entry = CSPEntry::NewLC();
    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
    TInt id = entry->GetServiceId();
    
    EUNIT_ASSERT( KErrNotFound == iCSPSettings->DeleteEntryL( id ) );
    
    iCSPSettings->AddEntryL( *entry );
    id = entry->GetServiceId();
    EUNIT_ASSERT( KErrNone == iCSPSettings->DeleteEntryL( id ) );
    CleanupStack::PopAndDestroy( entry );
    }
コード例 #7
0
void T_CSPSettingsEngine::T_CSPSettingsEngine_AddEntryLL(  )
    {
    CSPEntry* entry = CSPEntry::NewLC();
    TServiceId id = entry->GetServiceId();

    EUNIT_ASSERT_SPECIFIC_LEAVE( iCSPSettingsEngine->AddEntryL( *entry ), KErrArgument ) ;
    
    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
    iCSPSettingsEngine->AddEntryL( *entry );
    EUNIT_ASSERT( id != entry->GetServiceId() );

    CleanupStack::PopAndDestroy( entry );    
    }
コード例 #8
0
void CSPSettingsEngine::ConvertSpEntryToCenRepArrayL( const CSPEntry& aEntry, 
                                                     RIpAppPropArray& aArray )
    {
    CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
    
    property->SetName( EServiceName );
    property->SetValue( aEntry.GetServiceName() );
    User::LeaveIfError( aArray.Append( property ) );
    CleanupStack::Pop( property );
    
    TInt count = aEntry.PropertyCount();
    const RPropertyArray& entryArray = aEntry.GetAllProperties();
    
    ConvertSpArrayToCenRepArrayL( entryArray, aArray );
    }
コード例 #9
0
// ---------------------------------------------------------------------------
// Find service provider settings entry by service ID
// ---------------------------------------------------------------------------
//
 TInt CSPSettingsEngine::FindEntryL( TServiceId aServiceId, CSPEntry& aEntry )
    {
    XSPSLOGSTRING2( "CSPSettingsEngine::FindEntryL( %d ) - IN", aServiceId );
    
    RIpAppPropArray array;
    TCleanupItem cleanup( CSPSettingsEngine::CleanupPointerArray, &array );
    CleanupStack::PushL( cleanup );

    TInt err = iCenRepUtils->FindEntryL( aServiceId, array );
    
    if( err == KErrNone )
        {
        TInt count = array.Count();

        for( TInt i = 0; i < count; i++ )
            {
            CCenRepDatabaseProperty* property = array[i];
            
            if( property->GetName() == EServiceName )
                {
                User::LeaveIfError( aEntry.SetServiceName( property->GetDesValue() ) );
                }
            else
                {
                CSPProperty* spProperty = CSPProperty::NewLC();
                User::LeaveIfError( spProperty->SetName( (TServicePropertyName)( property->GetName() )));
                User::LeaveIfError( spProperty->SetValue( property->GetDesValue() ));
                
                User::LeaveIfError( aEntry.AddPropertyL( *spProperty ));
                CleanupStack::PopAndDestroy( spProperty );
                }
            }
        }
    CleanupStack::PopAndDestroy( &array );
    
    aEntry.SetServiceId( aServiceId );
    
    XSPSLOGSTRING2( "CSPSettingsEngine::FindEntryL( %d ) - OUT", aServiceId );
    
    return err;
    }