Exemplo n.º 1
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" );
    }
Exemplo n.º 2
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;
    }
Exemplo n.º 3
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 );
    }