mediasettings/mediasettingsengine/src/MPSettingsModelForROP.cpp
changeset 0 96612d01cf9f
child 1 6711b85517b7
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   MMF ROP plugin specific settings model.*
       
    15 */
       
    16 
       
    17 
       
    18 // Version : %version: 7 %
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <mmf/common/mmfbase.h>
       
    25 #include <MMFROPCustomCommandConstants.h>
       
    26 #include <f32file.h>
       
    27 #include <bautils.h>
       
    28 #include <barsc.h>
       
    29 #include <barsread.h>
       
    30 #include <f32file.h>
       
    31 #include <commdb.h>             // CMDBSession
       
    32 #include <commsdattypesv1_1.h>  // CCDWAPIPBearerRecord
       
    33 #include <MPSettingsROPModel.rsg>
       
    34 
       
    35 #include    <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR
       
    36 
       
    37 #include    "MPSettingsModelForROP.h"
       
    38 #include    "MPSettingsRopConfigParser.h"
       
    39 #include    "MPSettingsROPSettings.hrh"
       
    40 #include    "MediaPlayerPrivateCRKeys.h"
       
    41 #include	"MediaPlayerVariant.hrh" 
       
    42 #include	"mpxlog.h"
       
    43 
       
    44 // CONSTANTS
       
    45 // ROP controller UID
       
    46 const TUid KRopControllerUid = {0x101F8514};
       
    47 // This should be used only as the granularity for iItems array
       
    48 const TInt KMPRopItemsArrayGranularity = 8;
       
    49 // Initial config string length
       
    50 const TInt KMPRopConfigStringLength = 2048;
       
    51 // Seconds to milli seconds multiplier
       
    52 const TInt KMPRopSecondsMultiplier = 1000;
       
    53 // Unlocalized resource file path
       
    54 _LIT( KMPSettROPResource, "MPSettingsROPModel.rsc" );
       
    55 
       
    56 
       
    57 // CLASS DECLARATION
       
    58 
       
    59 // ============================ MEMBER FUNCTIONS ===============================
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // CMPSettingsModelForROP::CMPSettingsModelForROP
       
    63 // C++ default constructor can NOT contain any code, that
       
    64 // might leave.
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 CMPSettingsModelForROP::CMPSettingsModelForROP()
       
    68     {
       
    69     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::CMPSettingsModelForROP()"));
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CMPSettingsModelForROP::ConstructL
       
    74 // Symbian 2nd phase constructor can leave.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 void CMPSettingsModelForROP::ConstructL()
       
    78     {
       
    79     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::ConstructL()"));
       
    80     InitializeCentralRepositoryL();
       
    81     iItems = new(ELeave) CArrayPtrSeg<CMPRopSettingItem>(KMPRopItemsArrayGranularity);
       
    82 
       
    83     // Connect RFs
       
    84     RFs fs;
       
    85     User::LeaveIfError(fs.Connect());
       
    86     CleanupClosePushL(fs);
       
    87 
       
    88     // Locate resource file
       
    89     TFileName fileName;
       
    90     LocateResourceFileL( fileName, fs );
       
    91             
       
    92     // Open resource file
       
    93     RResourceFile resourceFile;
       
    94     resourceFile.OpenL(fs, fileName);
       
    95     CleanupClosePushL(resourceFile);
       
    96     
       
    97     // Read array from resource file to a buffer
       
    98     resourceFile.ConfirmSignatureL(0); // Magic: dummy value
       
    99 
       
   100     HBufC8* buf = resourceFile.AllocReadLC(R_MPSETT_ROP_SETTINGS_ARRAY);
       
   101 
       
   102     CMPRopSettingItem* item = NULL;
       
   103     TInt id = 0;
       
   104     HBufC* key = NULL;
       
   105 
       
   106     // Set buffer to resource reader
       
   107     TResourceReader reader;
       
   108     reader.SetBuffer(buf);
       
   109     // Read number of items from the resource structure
       
   110     TInt count = reader.ReadInt16();
       
   111  
       
   112     for (TInt index = 0; index < count; ++index)
       
   113         {
       
   114         // Read id and key
       
   115         id = reader.ReadInt16();
       
   116         key = reader.ReadHBufCL();
       
   117         CleanupStack::PushL(key);
       
   118 
       
   119         // key's ownership is transferred to item
       
   120         item = CMPRopSettingItem::NewLC(id, *key);
       
   121         iItems->AppendL(item); // Ownership transferred
       
   122         CleanupStack::Pop(2); // item & key
       
   123         delete key;
       
   124         key = NULL;
       
   125         }
       
   126 
       
   127     CleanupStack::PopAndDestroy(3); // fs, resourceFile & buf
       
   128 
       
   129     // Create config parser
       
   130     iParser = CMPSettingsRopConfigParser::NewL();
       
   131 
       
   132     // Open ROP controller
       
   133     TMMFPrioritySettings prioritySettings;
       
   134     prioritySettings.iPriority = EMdaPriorityNormal;
       
   135     prioritySettings.iPref = EMdaPriorityPreferenceNone;
       
   136     prioritySettings.iState = EMMFStateIdle;
       
   137     User::LeaveIfError(iMMFController.Open(KRopControllerUid,
       
   138                                            prioritySettings));
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CMPSettingsModelForROP::NewL
       
   143 // Two-phased constructor.
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 CMPSettingsModelForROP* CMPSettingsModelForROP::NewL()
       
   147     {
       
   148     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::NewL()"));
       
   149     CMPSettingsModelForROP* self = new(ELeave) CMPSettingsModelForROP;    
       
   150     CleanupStack::PushL(self);
       
   151     self->ConstructL();
       
   152     CleanupStack::Pop();
       
   153 
       
   154     return self;
       
   155     }
       
   156    
       
   157 // -----------------------------------------------------------------------------
       
   158 // CMPSettingsModelForROP::~CMPSettingsModelForROP
       
   159 // Destructor
       
   160 // -----------------------------------------------------------------------------
       
   161 //
       
   162 CMPSettingsModelForROP::~CMPSettingsModelForROP()
       
   163     {  
       
   164     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::~CMPSettingsModelForROP()"));
       
   165 	UninitializeCentralRepository();
       
   166 
       
   167     if (iItems)
       
   168         {
       
   169         iItems->ResetAndDestroy();
       
   170         delete iItems;
       
   171         }
       
   172 
       
   173     if (iParser) 
       
   174         {
       
   175         delete iParser;
       
   176         }
       
   177 
       
   178     if (iROPSettings) 
       
   179         {
       
   180         delete iROPSettings;
       
   181         }
       
   182 
       
   183     if (iROPHeader) 
       
   184         {
       
   185         delete iROPHeader;
       
   186         }
       
   187 
       
   188     iMMFController.Close();
       
   189     }
       
   190 
       
   191 // -----------------------------------------------------------------------------
       
   192 // CMPSettingsModelForROP::LoadSettingsL
       
   193 // -----------------------------------------------------------------------------
       
   194 //
       
   195 void CMPSettingsModelForROP::LoadSettingsL(TInt aConfigVersion)
       
   196     {
       
   197     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::LoadSettingsL(%d)"),aConfigVersion);
       
   198     // Initialize variables
       
   199     TInt configLength(KMPRopConfigStringLength);
       
   200     TInt error(KErrOverflow);
       
   201     const TMMFMessageDestinationPckg destinationPckg(KUidInterfaceMMFROPController);
       
   202 
       
   203     TInt ropConfigVersion;
       
   204     switch (aConfigVersion)
       
   205         {
       
   206         case EConfigDefault:
       
   207             ropConfigVersion = KMMFAudioVideoConfigDefault;
       
   208             break;
       
   209         case EConfigUser:
       
   210         default:
       
   211             ropConfigVersion = KMMFAudioVideoConfigUser;
       
   212             break;
       
   213         }
       
   214 
       
   215     const TPckgBuf<TInt> verPckg(ropConfigVersion);
       
   216 
       
   217 
       
   218     // If iROPSettings is not large enough, increase the length and try again 
       
   219     for (TInt i = 0; i < 2 && error == KErrOverflow; ++i)
       
   220         {
       
   221         delete iROPSettings;
       
   222         iROPSettings = NULL;
       
   223         iROPSettings = HBufC8::NewL(configLength);
       
   224         TPtr8 ptr = iROPSettings->Des();
       
   225 
       
   226         error = iMMFController.CustomCommandSync(destinationPckg, EMMFROPControllerGetApplicationConfig,
       
   227             verPckg, KNullDesC8, ptr);
       
   228 
       
   229         if (error == KErrOverflow)
       
   230             {
       
   231             // iROPSettings is not large enough => increase length:
       
   232             // extract correct length from iROPSettings
       
   233             TPckgBuf<TInt> newLength;
       
   234             newLength.Copy(ptr);
       
   235             configLength = newLength();
       
   236             }
       
   237         else 
       
   238             {
       
   239             // Leave if unexpected error occurred
       
   240             User::LeaveIfError(error);
       
   241             }               
       
   242         }
       
   243 
       
   244     // Leave if unexpected error occurred
       
   245     User::LeaveIfError(error);
       
   246 
       
   247     delete iROPHeader;
       
   248     iROPHeader = NULL;
       
   249     iROPHeader = iParser->ParseConfigStringL(*iROPSettings, iItems);
       
   250 
       
   251     delete iROPSettings;
       
   252     iROPSettings = NULL;
       
   253     }
       
   254 
       
   255 // -----------------------------------------------------------------------------
       
   256 // CMPSettingsModelForROP::StoreSettingsL
       
   257 // -----------------------------------------------------------------------------
       
   258 //
       
   259 void CMPSettingsModelForROP::StoreSettingsL()
       
   260     {
       
   261     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::StoreSettingsL()"));
       
   262     delete iROPSettings;
       
   263     iROPSettings = NULL;
       
   264     iROPSettings = iParser->CreateConfigStringL(iItems, *iROPHeader);
       
   265 
       
   266     if (iROPSettings)
       
   267         {
       
   268         const TMMFMessageDestinationPckg destinationPckg(KUidInterfaceMMFROPController);
       
   269         const TPckgBuf<TBool> savePckg(ETrue);
       
   270 
       
   271         User::LeaveIfError(iMMFController.CustomCommandSync(destinationPckg, EMMFROPControllerSetApplicationConfig,
       
   272             *iROPSettings, savePckg));
       
   273         }
       
   274 
       
   275     // Set iValueChanged status to EFalse for all items
       
   276     TInt count = iItems->Count();
       
   277     for (TInt i = 0; i < count; ++i)
       
   278         {
       
   279         iItems->At(i)->iValueChanged = EFalse;
       
   280         }
       
   281     }
       
   282 
       
   283 // -----------------------------------------------------------------------------
       
   284 // CMPSettingsModelForROP::SetVideoContrast
       
   285 // -----------------------------------------------------------------------------
       
   286 //
       
   287 TInt CMPSettingsModelForROP::SetVideoContrast(TInt aContrast)
       
   288     {
       
   289     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetVideoContrast(%d)"),aContrast);
       
   290     return SetIntegerValue(EMPRopContrast, aContrast);
       
   291     }
       
   292 
       
   293 // -----------------------------------------------------------------------------
       
   294 // CMPSettingsModelForROP::GetVideoContrast
       
   295 // -----------------------------------------------------------------------------
       
   296 //
       
   297 TInt CMPSettingsModelForROP::GetVideoContrast(TInt& aContrast)
       
   298     {
       
   299     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetVideoContrast()"));
       
   300     return GetIntegerValue(EMPRopContrast, aContrast);
       
   301     }
       
   302 
       
   303 
       
   304 
       
   305 // -----------------------------------------------------------------------------
       
   306 // CMPSettingsModelForROP::SetProxyMode
       
   307 // -----------------------------------------------------------------------------
       
   308 //
       
   309 TInt CMPSettingsModelForROP::SetProxyMode(TInt aMode)
       
   310     {
       
   311     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetProxyMode(%d)"),aMode);
       
   312     return SetIntegerValue(EMPRopProxyMode, aMode);
       
   313     }
       
   314 
       
   315 // -----------------------------------------------------------------------------
       
   316 // CMPSettingsModelForROP::GetProxyMode
       
   317 // -----------------------------------------------------------------------------
       
   318 //
       
   319 TInt CMPSettingsModelForROP::GetProxyMode(TInt& aMode)
       
   320     {
       
   321     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetProxyMode()"));
       
   322     return GetIntegerValue(EMPRopProxyMode, aMode);
       
   323     }
       
   324 
       
   325 // -----------------------------------------------------------------------------
       
   326 // CMPSettingsModelForROP::SetProxyHostNameL
       
   327 // -----------------------------------------------------------------------------
       
   328 //
       
   329 TInt CMPSettingsModelForROP::SetProxyHostNameL(const TDesC& aHostName)
       
   330     {
       
   331     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetProxyHostNameL(%S)"),&aHostName);
       
   332     CMPRopSettingItem* item = NULL;
       
   333     TInt error = GetItem(EMPRopProxyHostName, item);
       
   334 
       
   335     if (!error)
       
   336         {
       
   337         delete item->iStringValue;
       
   338         item->iStringValue = NULL;
       
   339         item->iStringValue = aHostName.AllocL();
       
   340 
       
   341         item->iValueChanged = ETrue;
       
   342         item->iError = KErrNone;
       
   343         }
       
   344 
       
   345     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetProxyHostNameL() ret %d"),error);
       
   346     return error;
       
   347     }
       
   348 
       
   349 // -----------------------------------------------------------------------------
       
   350 // CMPSettingsModelForROP::GetProxyHostName
       
   351 // -----------------------------------------------------------------------------
       
   352 //
       
   353 TInt CMPSettingsModelForROP::GetProxyHostName(TDes& aHostName)
       
   354     {
       
   355     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetProxyHostName(%S)"),&aHostName);
       
   356     CMPRopSettingItem* item = NULL;
       
   357     TInt error = GetItem(EMPRopProxyHostName, item);
       
   358 
       
   359     if (!error)
       
   360         {
       
   361         error = item->iError;
       
   362         }
       
   363 
       
   364     if (!error)
       
   365         {
       
   366         // Fail safe: aHostName's length is not exceeded in the copy operation
       
   367         aHostName.Copy(item->iStringValue->Left(aHostName.MaxLength()));
       
   368         }
       
   369 
       
   370     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetProxyHostName() ret %d"),error);
       
   371     return error;
       
   372     }
       
   373 
       
   374 // -----------------------------------------------------------------------------
       
   375 // CMPSettingsModelForROP::SetProxyPort
       
   376 // -----------------------------------------------------------------------------
       
   377 //
       
   378 TInt CMPSettingsModelForROP::SetProxyPort(TInt aPort)
       
   379     {
       
   380     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetProxyPort(%d)"),aPort);
       
   381     return SetIntegerValue(EMPRopProxyPort, aPort);
       
   382     }
       
   383 
       
   384 // -----------------------------------------------------------------------------
       
   385 // CMPSettingsModelForROP::GetProxyPort
       
   386 // -----------------------------------------------------------------------------
       
   387 //
       
   388 TInt CMPSettingsModelForROP::GetProxyPort(TInt& aPort)
       
   389     {
       
   390     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetProxyPort()"));
       
   391     return GetIntegerValue(EMPRopProxyPort, aPort);
       
   392     }
       
   393         
       
   394 // -----------------------------------------------------------------------------
       
   395 // CMPSettingsModelForROP::SetDefaultAp
       
   396 // -----------------------------------------------------------------------------
       
   397 //
       
   398 TInt CMPSettingsModelForROP::SetDefaultAp(TUint32 aApId)
       
   399     {
       
   400     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetDefaultAp(%d)"),aApId);
       
   401     TInt error = KErrNone;
       
   402 
       
   403     TUint32 tmp = 0;
       
   404     TRAP( error, tmp = IapIdFromWapIdL( aApId ) );
       
   405     if ( !error )
       
   406         {
       
   407         error = SetIntegerValue(EMPRopDefaultAP, tmp );
       
   408         }
       
   409     
       
   410     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetDefaultAp() ret %d"),error);
       
   411     return error;
       
   412     }
       
   413 
       
   414 // -----------------------------------------------------------------------------
       
   415 // CMPSettingsModelForROP::GetDefaultAp
       
   416 // -----------------------------------------------------------------------------
       
   417 //
       
   418 TInt CMPSettingsModelForROP::GetDefaultAp(TUint32& aApId)
       
   419     {
       
   420     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetDefaultAp()"));
       
   421     TInt tmp = 0;
       
   422       
       
   423 	TInt error = GetIntegerValue(EMPRopDefaultAP, tmp);
       
   424     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetDefaultAp - Got iap id %d"),tmp);
       
   425 	if ( tmp != 0 )
       
   426 	    {
       
   427 		TRAP( error, aApId = WapIdFromIapIdL(static_cast<TUint32>(tmp)) );
       
   428 	    }
       
   429 	else {
       
   430         aApId = 0;
       
   431         }
       
   432     
       
   433 	return error;
       
   434     }
       
   435 
       
   436 // -----------------------------------------------------------------------------
       
   437 // CMPSettingsModelForROP::SetBandwidthControlMode
       
   438 // -----------------------------------------------------------------------------
       
   439 //
       
   440 TInt CMPSettingsModelForROP::SetBandwidthControlMode(TInt /*aMode*/)
       
   441     {
       
   442     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::SetBandwidthControlMode()"));
       
   443     return KErrNotSupported;
       
   444     }
       
   445 
       
   446 // -----------------------------------------------------------------------------
       
   447 // CMPSettingsModelForROP::GetBandwidthControlMode
       
   448 // -----------------------------------------------------------------------------
       
   449 //
       
   450 TInt CMPSettingsModelForROP::GetBandwidthControlMode(TInt& /*aMode*/)
       
   451     {
       
   452     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetBandwidthControlMode()"));
       
   453     return KErrNotSupported;
       
   454     }
       
   455 
       
   456 // -----------------------------------------------------------------------------
       
   457 // CMPSettingsModelForROP::SetMaxBandwidth
       
   458 // -----------------------------------------------------------------------------
       
   459 //
       
   460 TInt CMPSettingsModelForROP::SetMaxBandwidth(TInt aMaxBw, TDataBearer aBearer)
       
   461     {
       
   462     MPX_DEBUG3(_L("#MS# CMPSettingsModelForROP::SetMaxBandwidth(%d,%d)"),aMaxBw,aBearer);
       
   463     TInt error = KErrNone;
       
   464 
       
   465     switch (aBearer)
       
   466         {
       
   467         case EBearerGPRS:
       
   468             error = SetIntegerValue(EMPRopGPRSMaxBw, aMaxBw);
       
   469             break;
       
   470         case EBearerEGPRS:
       
   471             error = SetIntegerValue(EMPRopEGPRSMaxBw, aMaxBw);
       
   472             break;
       
   473         case EBearerWCDMA:
       
   474             error = SetIntegerValue(EMPRopWCDMAMaxBw, aMaxBw);
       
   475             break;
       
   476         case EBearerWLAN:
       
   477             error = SetIntegerValue(EMPRopWLANMaxBw, aMaxBw);
       
   478             break;
       
   479         case EBearerHSDPA:
       
   480             error = SetIntegerValue(EMPRopHSDPAMaxBw, aMaxBw);
       
   481             break;
       
   482         default:
       
   483             error = KErrNotSupported;
       
   484             break;
       
   485         }
       
   486     
       
   487     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetMaxBandwidth() ret %d"),error);
       
   488     return error;
       
   489     }
       
   490 
       
   491 // -----------------------------------------------------------------------------
       
   492 // CMPSettingsModelForROP::GetMaxBandwidth
       
   493 // -----------------------------------------------------------------------------
       
   494 //
       
   495 TInt CMPSettingsModelForROP::GetMaxBandwidth(TInt& aMaxBw, TDataBearer aBearer)
       
   496     {
       
   497     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetMaxBandwidth()"));
       
   498     TInt error = KErrNone;
       
   499     
       
   500     switch (aBearer)
       
   501         {
       
   502         case EBearerGPRS:
       
   503             error = GetIntegerValue(EMPRopGPRSMaxBw, aMaxBw);
       
   504             break;
       
   505         case EBearerEGPRS:
       
   506             error = GetIntegerValue(EMPRopEGPRSMaxBw, aMaxBw);
       
   507             break;
       
   508         case EBearerWCDMA:
       
   509             error = GetIntegerValue(EMPRopWCDMAMaxBw, aMaxBw);
       
   510             break;
       
   511         case EBearerWLAN:
       
   512             error = GetIntegerValue(EMPRopWLANMaxBw, aMaxBw);
       
   513             break;
       
   514         case EBearerHSDPA:
       
   515             error = GetIntegerValue(EMPRopHSDPAMaxBw, aMaxBw);
       
   516             break;
       
   517         default:
       
   518             error = KErrNotSupported;
       
   519             break;
       
   520         }
       
   521 
       
   522     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetMaxBandwidth() ret %d"),error);
       
   523     return error;
       
   524     }
       
   525 
       
   526 // -----------------------------------------------------------------------------
       
   527 // CMPSettingsModelForROP::SetConnectionTimeout
       
   528 // -----------------------------------------------------------------------------
       
   529 //
       
   530 TInt CMPSettingsModelForROP::SetConnectionTimeout(TInt aTimeout)
       
   531     {
       
   532     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetConnectionTimeout(%d)"),aTimeout);
       
   533     return SetIntegerValue(EMPRopConnTimeout, aTimeout * KMPRopSecondsMultiplier);
       
   534     }
       
   535 
       
   536 // -----------------------------------------------------------------------------
       
   537 // CMPSettingsModelForROP::GetConnectionTimeout
       
   538 // -----------------------------------------------------------------------------
       
   539 //
       
   540 TInt CMPSettingsModelForROP::GetConnectionTimeout(TInt& aTimeout)
       
   541     {
       
   542     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetConnectionTimeout()"));
       
   543     TInt error = GetIntegerValue(EMPRopConnTimeout, aTimeout);
       
   544     if (!error)
       
   545         {
       
   546         aTimeout = aTimeout / KMPRopSecondsMultiplier;
       
   547         }
       
   548 
       
   549     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetConnectionTimeout() ret %d"),error);
       
   550     return error;
       
   551     }
       
   552         
       
   553 // -----------------------------------------------------------------------------
       
   554 // CMPSettingsModelForROP::SetServerTimeout
       
   555 // -----------------------------------------------------------------------------
       
   556 //
       
   557 TInt CMPSettingsModelForROP::SetServerTimeout(TInt aTimeout)
       
   558     {
       
   559     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetServerTimeout(%d)"),aTimeout);
       
   560     return SetIntegerValue(EMPRopServerTimeout, aTimeout * KMPRopSecondsMultiplier);
       
   561     }
       
   562 
       
   563 // -----------------------------------------------------------------------------
       
   564 // CMPSettingsModelForROP::GetServerTimeout
       
   565 // -----------------------------------------------------------------------------
       
   566 //
       
   567 TInt CMPSettingsModelForROP::GetServerTimeout(TInt& aTimeout)
       
   568     {
       
   569     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetServerTimeout()"));
       
   570     TInt error = GetIntegerValue(EMPRopServerTimeout, aTimeout);
       
   571     if (!error)
       
   572         {
       
   573         aTimeout = aTimeout / KMPRopSecondsMultiplier;
       
   574         }
       
   575 
       
   576     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetServerTimeout() ret %d"),error);
       
   577     return error;
       
   578     }
       
   579 
       
   580 // -----------------------------------------------------------------------------
       
   581 // CMPSettingsModelForROP::SetMinUDPPort
       
   582 // -----------------------------------------------------------------------------
       
   583 //
       
   584 TInt CMPSettingsModelForROP::SetMinUDPPort(TInt aPort)
       
   585     {
       
   586     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetMinUDPPort(%d)"),aPort);
       
   587     return SetIntegerValue(EMPRopMinUDPPort, aPort);
       
   588     }
       
   589 
       
   590 // -----------------------------------------------------------------------------
       
   591 // CMPSettingsModelForROP::GetMinUDPPort
       
   592 // -----------------------------------------------------------------------------
       
   593 //
       
   594 TInt CMPSettingsModelForROP::GetMinUDPPort(TInt& aPort)
       
   595     {
       
   596     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetMinUDPPort()"));
       
   597     return GetIntegerValue(EMPRopMinUDPPort, aPort);
       
   598     }
       
   599 
       
   600 // -----------------------------------------------------------------------------
       
   601 // CMPSettingsModelForROP::SetMaxUDPPort
       
   602 // -----------------------------------------------------------------------------
       
   603 //
       
   604 TInt CMPSettingsModelForROP::SetMaxUDPPort(TInt aPort)
       
   605     {
       
   606     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetMaxUDPPort(%d)"),aPort);
       
   607     return SetIntegerValue(EMPRopMaxUDPPort, aPort);
       
   608     }
       
   609 
       
   610 // -----------------------------------------------------------------------------
       
   611 // CMPSettingsModelForROP::GetMaxUDPPort
       
   612 // -----------------------------------------------------------------------------
       
   613 //
       
   614 TInt CMPSettingsModelForROP::GetMaxUDPPort(TInt& aPort)
       
   615     {
       
   616     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetMaxUDPPort()"));
       
   617     return GetIntegerValue(EMPRopMaxUDPPort, aPort);
       
   618     }
       
   619 
       
   620 // -----------------------------------------------------------------------------
       
   621 // CMPSettingsModelForROP::GetControllerVersionInfo
       
   622 // -----------------------------------------------------------------------------
       
   623 //
       
   624 TInt CMPSettingsModelForROP::GetControllerVersionInfo(TDes& aVersion)
       
   625     {
       
   626     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetControllerVersionInfo(%S)"),&aVersion);
       
   627     return GetStringValue(EMPRopCntrlVersion, aVersion);
       
   628     }
       
   629 
       
   630 // -----------------------------------------------------------------------------
       
   631 // CMPSettingsModelForROP::GetControllerBuildDate
       
   632 // -----------------------------------------------------------------------------
       
   633 //
       
   634 TInt CMPSettingsModelForROP::GetControllerBuildDate(TDes& aBldDate)
       
   635     {
       
   636     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetControllerBuildDate(%S)"),&aBldDate);
       
   637     return GetStringValue(EMPRopCntrlBldDate, aBldDate);
       
   638     }
       
   639 
       
   640 // -----------------------------------------------------------------------------
       
   641 // CMPSettingsModelForROP::GetControllerAdditionalInfo
       
   642 // -----------------------------------------------------------------------------
       
   643 //
       
   644 TInt CMPSettingsModelForROP::GetControllerAdditionalInfo(TDes& aAdditionalInfo)
       
   645     {
       
   646     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetControllerAdditionalInfo(%S)"),&aAdditionalInfo);
       
   647     return GetStringValue(EMPRopCntrlPlatform, aAdditionalInfo);
       
   648     }
       
   649 
       
   650 // -----------------------------------------------------------------------------
       
   651 // CMPSettingsModelForROP::SetDemandBwFactor
       
   652 // -----------------------------------------------------------------------------
       
   653 //
       
   654 TInt CMPSettingsModelForROP::SetDemandBwFactor(TInt aFactor)
       
   655     {
       
   656     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetDemandBwFactor(%d)"),aFactor);
       
   657     return SetIntegerValue(EMPRopDemandBwFactor, aFactor);
       
   658     }
       
   659 
       
   660 // -----------------------------------------------------------------------------
       
   661 // CMPSettingsModelForROP::GetDemandBwFactor
       
   662 // -----------------------------------------------------------------------------
       
   663 //
       
   664 TInt CMPSettingsModelForROP::GetDemandBwFactor(TInt& aFactor)
       
   665     {
       
   666     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetDemandBwFactor()"));
       
   667     return GetIntegerValue(EMPRopDemandBwFactor, aFactor);
       
   668     }
       
   669 
       
   670 // -----------------------------------------------------------------------------
       
   671 // CMPSettingsModelForROP::SetSustainBandwidth
       
   672 // -----------------------------------------------------------------------------
       
   673 //
       
   674 TInt CMPSettingsModelForROP::SetSustainBandwidth(TInt aSustainBw, TDataBearer aBearer)
       
   675     {
       
   676     MPX_DEBUG3(_L("#MS# CMPSettingsModelForROP::SetSustainBandwidth(%d,%d)"),aSustainBw,aBearer);
       
   677     TInt error = KErrNone;
       
   678 
       
   679     switch (aBearer)
       
   680         {
       
   681         case EBearerGPRS:
       
   682             error = SetIntegerValue(EMPRopGPRSSustainBw, aSustainBw);
       
   683             break;
       
   684         case EBearerEGPRS:
       
   685             error = SetIntegerValue(EMPRopEGPRSSustainBw, aSustainBw);
       
   686             break;
       
   687         case EBearerWCDMA:
       
   688             error = SetIntegerValue(EMPRopWCDMASustainBw, aSustainBw);
       
   689             break;
       
   690         case EBearerWLAN:
       
   691             error = SetIntegerValue(EMPRopWLANSustainBw, aSustainBw);
       
   692             break;
       
   693         case EBearerHSDPA:
       
   694             error = SetIntegerValue(EMPRopHSDPASustainBw, aSustainBw);
       
   695             break;
       
   696         default:
       
   697             error = KErrNotSupported;
       
   698             break;
       
   699         }
       
   700     
       
   701     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetSustainBandwidth() ret %d"),error);
       
   702     return error;
       
   703     }
       
   704 
       
   705 // -----------------------------------------------------------------------------
       
   706 // CMPSettingsModelForROP::GetSustainBandwidth
       
   707 // -----------------------------------------------------------------------------
       
   708 //
       
   709 TInt CMPSettingsModelForROP::GetSustainBandwidth(TInt& aSustainBw, TDataBearer aBearer)
       
   710     {
       
   711     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetSustainBandwidth()"));
       
   712     TInt error = KErrNone;
       
   713     
       
   714     switch (aBearer)
       
   715         {
       
   716         case EBearerGPRS:
       
   717             error = GetIntegerValue(EMPRopGPRSSustainBw, aSustainBw);
       
   718             break;
       
   719         case EBearerEGPRS:
       
   720             error = GetIntegerValue(EMPRopEGPRSSustainBw, aSustainBw);
       
   721             break;
       
   722         case EBearerWCDMA:
       
   723             error = GetIntegerValue(EMPRopWCDMASustainBw, aSustainBw);
       
   724             break;
       
   725         case EBearerWLAN:
       
   726             error = GetIntegerValue(EMPRopWLANSustainBw, aSustainBw);
       
   727             break;
       
   728         case EBearerHSDPA:
       
   729             error = GetIntegerValue(EMPRopHSDPASustainBw, aSustainBw);
       
   730             break;
       
   731         default:
       
   732             error = KErrNotSupported;
       
   733             break;
       
   734         }
       
   735 
       
   736     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetSustainBandwidth() ret %d"),error);
       
   737     return error;
       
   738     }
       
   739 
       
   740 // -----------------------------------------------------------------------------
       
   741 // CMPSettingsModelForROP::GetSustainBwPresetsL
       
   742 // -----------------------------------------------------------------------------
       
   743 //
       
   744 TInt CMPSettingsModelForROP::GetSustainBwPresetsL(RArray<TInt>& aBwArray, TDataBearer aBearer)
       
   745     {
       
   746     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetSustainBwPresetsL()"));
       
   747     TInt error = KErrNone;
       
   748     
       
   749     switch (aBearer)
       
   750         {
       
   751         case EBearerGPRS:
       
   752             error = GetArrayL(EMPRopGPRSSustainBwPresets, aBwArray);
       
   753             break;
       
   754         case EBearerEGPRS:
       
   755             error = GetArrayL(EMPRopEGPRSSustainBwPresets, aBwArray);
       
   756             break;
       
   757         case EBearerWCDMA:
       
   758             error = GetArrayL(EMPRopWCDMASustainBwPresets, aBwArray);
       
   759             break;
       
   760         case EBearerWLAN:
       
   761             error = GetArrayL(EMPRopWLANSustainBwPresets, aBwArray);
       
   762             break;
       
   763         case EBearerHSDPA:
       
   764             error = GetArrayL(EMPRopHSDPASustainBwPresets, aBwArray);
       
   765             break;
       
   766         default:
       
   767             error = KErrNotSupported;
       
   768             break;
       
   769         }
       
   770 
       
   771     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetSustainBwPresetsL() ret %d"),error);
       
   772     return error;
       
   773     }
       
   774 
       
   775 // -----------------------------------------------------------------------------
       
   776 // CMPSettingsModelForROP::GetMaxBwPresetsL
       
   777 // -----------------------------------------------------------------------------
       
   778 //
       
   779 TInt CMPSettingsModelForROP::GetMaxBwPresetsL(RArray<TInt>& aBwArray, TDataBearer aBearer)
       
   780     {
       
   781     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetMaxBwPresetsL()"));
       
   782     TInt error = KErrNone;
       
   783     
       
   784     switch (aBearer)
       
   785         {
       
   786         case EBearerGPRS:
       
   787             error = GetArrayL(EMPRopGPRSMaxBwPresets, aBwArray);
       
   788             break;
       
   789         case EBearerEGPRS:
       
   790             error = GetArrayL(EMPRopEGPRSMaxBwPresets, aBwArray);
       
   791             break;
       
   792         case EBearerWCDMA:
       
   793             error = GetArrayL(EMPRopWCDMAMaxBwPresets, aBwArray);
       
   794             break;
       
   795         case EBearerWLAN:
       
   796             error = GetArrayL(EMPRopWLANMaxBwPresets, aBwArray);
       
   797             break;
       
   798         case EBearerHSDPA:
       
   799             error = GetArrayL(EMPRopHSDPAMaxBwPresets, aBwArray);
       
   800             break;
       
   801         default:
       
   802             error = KErrNotSupported;
       
   803             break;
       
   804         }
       
   805 
       
   806     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetMaxBwPresetsL() ret %d"),error);
       
   807     return error;
       
   808     }
       
   809 
       
   810 // -----------------------------------------------------------------------------
       
   811 // CMPSettingsModelForROP::SetIntegerValue
       
   812 // -----------------------------------------------------------------------------
       
   813 //
       
   814 TInt CMPSettingsModelForROP::SetIntegerValue(TInt aId, TInt aValue)
       
   815     {
       
   816     MPX_DEBUG3(_L("#MS# CMPSettingsModelForROP::SetIntegerValue(%d,%d)"),aId,aValue);
       
   817     CMPRopSettingItem* item = NULL;
       
   818     TInt error = GetItem(aId, item);
       
   819 
       
   820     if (!error)
       
   821         {
       
   822         item->iIntValue = aValue;
       
   823         item->iValueChanged = ETrue;
       
   824         item->iError = KErrNone; 
       
   825         }
       
   826    
       
   827     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetIntegerValue() ret %d"),error);
       
   828     return error;
       
   829     }
       
   830 
       
   831 // -----------------------------------------------------------------------------
       
   832 // CMPSettingsModelForROP::GetIntegerValue
       
   833 // -----------------------------------------------------------------------------
       
   834 //
       
   835 TInt CMPSettingsModelForROP::GetIntegerValue(TInt aId, TInt& aValue)
       
   836     {
       
   837     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetIntegerValue(%d)"),aId);
       
   838     CMPRopSettingItem* item = NULL;
       
   839     TInt error = GetItem(aId, item);
       
   840     
       
   841     if (!error)
       
   842         {
       
   843         error = item->iError;
       
   844         }
       
   845 
       
   846     if (!error)
       
   847         {
       
   848         if (item->iType == EMPRopConfTypeInteger)
       
   849             {
       
   850             aValue = item->iIntValue;
       
   851             }
       
   852         else
       
   853             {
       
   854             // Setting value's type is not integer
       
   855             error = KErrNotFound;
       
   856             }
       
   857         }
       
   858 
       
   859     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetIntegerValue() ret %d"),error);
       
   860     return error;
       
   861     }
       
   862 
       
   863 // -----------------------------------------------------------------------------
       
   864 // CMPSettingsModelForROP::GetStringValue
       
   865 // -----------------------------------------------------------------------------
       
   866 //
       
   867 TInt CMPSettingsModelForROP::GetStringValue(TInt aId, TDes& aString)
       
   868     {
       
   869     MPX_DEBUG3(_L("#MS# CMPSettingsModelForROP::GetStringValue(%d,%S)"),aId,&aString);
       
   870     CMPRopSettingItem* item = NULL;
       
   871     TInt error = GetItem(aId, item);
       
   872     
       
   873     if (!error)
       
   874         {
       
   875         error = item->iError;
       
   876         }
       
   877     
       
   878     if (!error)
       
   879         {
       
   880         if (item->iType == EMPRopConfTypeString)
       
   881             {
       
   882             HBufC* string = item->iStringValue;
       
   883 
       
   884             if (aString.MaxLength() >= string->Length())
       
   885                 {
       
   886                 aString.Copy(*string);    
       
   887                 }
       
   888             else
       
   889                 {
       
   890                 error = KErrOverflow;
       
   891                 }
       
   892             }
       
   893         else
       
   894             {
       
   895            // Setting value's type is not string
       
   896             error = KErrNotFound;
       
   897             }
       
   898         }
       
   899 
       
   900     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetStringValue() ret %d"),error);
       
   901     return error;
       
   902     }
       
   903 
       
   904 // -----------------------------------------------------------------------------
       
   905 // CMPSettingsModelForROP::GetArrayL
       
   906 // -----------------------------------------------------------------------------
       
   907 //
       
   908 TInt CMPSettingsModelForROP::GetArrayL(TInt aId, RArray<TInt>& aArray)
       
   909     {
       
   910     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::GetArrayL()"));
       
   911     CMPRopSettingItem* item = NULL;
       
   912     TInt error = GetItem(aId, item);
       
   913     
       
   914     if (!error)
       
   915         {
       
   916         error = item->iError;
       
   917         }
       
   918 
       
   919     if (!error)
       
   920         {
       
   921         if (item->iType == EMPRopConfTypeIntArray)
       
   922             {
       
   923             TInt count = item->iIntArray.Count();
       
   924             aArray.Reset();
       
   925 
       
   926             for (TInt index = 0; index < count; ++index)
       
   927                 {
       
   928                 User::LeaveIfError(aArray.Append(item->iIntArray[index]));
       
   929                 }
       
   930             }
       
   931         else
       
   932             {
       
   933             error = KErrNotFound;
       
   934             }
       
   935         }
       
   936 
       
   937     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetArrayL() ret %d"),error);
       
   938     return error;
       
   939     }
       
   940 
       
   941 // -----------------------------------------------------------------------------
       
   942 // CMPSettingsModelForROP::GetItem
       
   943 // -----------------------------------------------------------------------------
       
   944 //
       
   945 TInt CMPSettingsModelForROP::GetItem(TInt aId, CMPRopSettingItem*& aItem)
       
   946     {
       
   947     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetItem(%d)"),aId);
       
   948     CMPRopSettingItem* item = NULL;
       
   949     TInt count = iItems->Count();
       
   950     TInt error = KErrNone;
       
   951     aItem = NULL;
       
   952 
       
   953     for (TInt index = 0; index < count; ++index)
       
   954         {
       
   955         item = iItems->At(index);
       
   956 
       
   957         if (aId == item->iId)
       
   958             {
       
   959             aItem = item;
       
   960             break;
       
   961             }
       
   962         }
       
   963 
       
   964     if (!aItem)
       
   965         {
       
   966         error = KErrNotFound;
       
   967         }
       
   968 
       
   969     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::GetItem() ret %d"),error);
       
   970     return error;
       
   971     }
       
   972 
       
   973 // -----------------------------------------------------------------------------
       
   974 // CMPSettingsModelForROP::SetAutoDisconTimeL
       
   975 // -----------------------------------------------------------------------------
       
   976 //
       
   977 
       
   978 void CMPSettingsModelForROP::SetAutoDisconTimeL( const TInt aTime )
       
   979     {   
       
   980     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetAutoDisconTimeL(%d)"),aTime);
       
   981     if ( iClient->Set( KMPAutoDisconnectTime, aTime ) == KErrNotFound )
       
   982         {
       
   983         User::LeaveIfError( iClient->Create( KMPAutoDisconnectTime, aTime ) );   
       
   984         }       
       
   985     }
       
   986 
       
   987 // -----------------------------------------------------------------------------
       
   988 // CMPSettingsModelForROP::AutoDisconTimeL
       
   989 // -----------------------------------------------------------------------------
       
   990 //
       
   991 
       
   992 TInt CMPSettingsModelForROP::AutoDisconTimeL()
       
   993     {
       
   994     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::AutoDisconTimeL()"));
       
   995     TInt time = 0;
       
   996     User::LeaveIfError( iClient->Get( KMPAutoDisconnectTime, time ) );   
       
   997     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::AutoDisconTimeL() ret %d"),time);
       
   998     return time;
       
   999     }
       
  1000 
       
  1001 // -----------------------------------------------------------------------------
       
  1002 // CMPSettingsModelForROP::SetVideoRepeatL
       
  1003 // -----------------------------------------------------------------------------
       
  1004 //
       
  1005 
       
  1006 void CMPSettingsModelForROP::SetVideoRepeatL( TBool aRepeat )
       
  1007     {
       
  1008     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetVideoRepeatL(%d)"),aRepeat);
       
  1009     iClient->Set( KMPRepeat, aRepeat );  
       
  1010     }
       
  1011 
       
  1012 // -----------------------------------------------------------------------------
       
  1013 // CMPSettingsModelForROP::IsVideoRepeatOnL
       
  1014 // -----------------------------------------------------------------------------
       
  1015 //
       
  1016 
       
  1017 TBool CMPSettingsModelForROP::IsVideoRepeatOnL()
       
  1018     {
       
  1019     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::IsVideoRepeatOnL()"));
       
  1020     TInt repeat;
       
  1021     User::LeaveIfError( iClient->Get( KMPRepeat, repeat ) );   
       
  1022     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::IsVideoRepeatOnL() ret %d"),repeat);
       
  1023     return repeat;
       
  1024     }
       
  1025 
       
  1026 // ----------------------------------------------------------------------------
       
  1027 // CMPSettingsModelForROP::InitializeCentralRepositoryL
       
  1028 //
       
  1029 // Creating and setting keys for the Central Repository
       
  1030 // ----------------------------------------------------------------------------
       
  1031 //
       
  1032 void CMPSettingsModelForROP::InitializeCentralRepositoryL()
       
  1033     {
       
  1034     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::InitializeCentralRepositoryL()"));
       
  1035     iClient = CRepository::NewL( KCRUidMediaPlayerSettings );
       
  1036     iMediaPlayerClient = CRepository::NewL( KCRUidMediaPlayerFeatures );
       
  1037     }
       
  1038 
       
  1039 // ----------------------------------------------------------------------------
       
  1040 // CMPSettingsModelForROP::UninitializeCentralRepositoryL
       
  1041 //
       
  1042 // Removes Central Repository objects
       
  1043 // ----------------------------------------------------------------------------
       
  1044 //
       
  1045 void CMPSettingsModelForROP::UninitializeCentralRepository()
       
  1046     {
       
  1047     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::UninitializeCentralRepository()"));
       
  1048     delete iClient;
       
  1049     iClient = NULL;
       
  1050 
       
  1051 	delete iMediaPlayerClient;
       
  1052 	iMediaPlayerClient = NULL;
       
  1053     }
       
  1054 
       
  1055 // -----------------------------------------------------------------------------
       
  1056 // CMPSettingsModelForROP::SetDefaultViewL
       
  1057 // -----------------------------------------------------------------------------
       
  1058 //
       
  1059 void CMPSettingsModelForROP::SetDefaultViewL( TBool aView )
       
  1060     {
       
  1061     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::SetDefaultViewL(%d)"),aView);
       
  1062     iClient->Set( KMPDefaultView, aView );  
       
  1063     }
       
  1064 
       
  1065 // -----------------------------------------------------------------------------
       
  1066 // CMPSettingsModelForROP::IsDefaultViewOnL
       
  1067 // -----------------------------------------------------------------------------
       
  1068 //
       
  1069 TBool CMPSettingsModelForROP::IsDefaultViewOnL()
       
  1070     {
       
  1071     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::IsDefaultViewOnL()"));
       
  1072     TInt view;
       
  1073 	User::LeaveIfError( iClient->Get( KMPDefaultView, view ) );   
       
  1074 	MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::IsDefaultViewOnL() ret %d"),view);
       
  1075     return view;
       
  1076     }
       
  1077 
       
  1078 // -----------------------------------------------------------------------------
       
  1079 // CMPSettingsModelForROP::SetRockerKeysL
       
  1080 // -----------------------------------------------------------------------------
       
  1081 //
       
  1082 void CMPSettingsModelForROP::SetRockerKeysL( TBool aRockerKeys )
       
  1083     {
       
  1084     iClient->Set( KMPRockerKeys, aRockerKeys );  
       
  1085     }
       
  1086 
       
  1087 // -----------------------------------------------------------------------------
       
  1088 // CMPSettingsModelForROP::ShowRockerKeysL
       
  1089 // -----------------------------------------------------------------------------
       
  1090 //
       
  1091 TBool CMPSettingsModelForROP::ShowRockerKeysL()
       
  1092     {
       
  1093 	if (IsRockerKeysSupportedL())
       
  1094 		{
       
  1095 		TInt rockerKeys;
       
  1096 		User::LeaveIfError( iClient->Get( KMPRockerKeys, rockerKeys ) );   
       
  1097 		return rockerKeys;
       
  1098 		}
       
  1099 	else
       
  1100 		{
       
  1101 		return EFalse;
       
  1102 		}
       
  1103     }
       
  1104 
       
  1105 // -----------------------------------------------------------------------------
       
  1106 // CMPSettingsModelForROP::IsRockerKeysSupportedL
       
  1107 // -----------------------------------------------------------------------------
       
  1108 //
       
  1109 TBool CMPSettingsModelForROP::IsRockerKeysSupportedL()
       
  1110     {
       
  1111 	TBool isRockerKeysSupported( EFalse );
       
  1112     TInt value( 0 );
       
  1113     // Check if feature is enabled. See MediaPlayerVariant.hrh.
       
  1114     if ( !iMediaPlayerClient->Get( KMPLocalVariation, value ) )
       
  1115 		{
       
  1116         isRockerKeysSupported = static_cast<TBool> ( value & KMediaPlayerRockerKeys );
       
  1117 		}
       
  1118 
       
  1119 	RDebug::Print(_L("#MP# CMPSettingsModelForROP::CMPSettingsModelForROP(): return %d"),isRockerKeysSupported);
       
  1120     return isRockerKeysSupported;
       
  1121     }
       
  1122 
       
  1123 // -----------------------------------------------------------------------------
       
  1124 // CMPSettingsModelForROP::LocateResourceFileL
       
  1125 // -----------------------------------------------------------------------------
       
  1126 //
       
  1127 void CMPSettingsModelForROP::LocateResourceFileL( TFileName& aFileName, RFs& aFs )
       
  1128     {
       
  1129     MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::LocateResourceFileL()"));
       
  1130     
       
  1131     // Get the path & file name with the drive not specified.
       
  1132     TParse parse;
       
  1133     parse.Set( KMPSettROPResource, &KDC_RESOURCE_FILES_DIR, NULL );
       
  1134     TPtrC rscFile = parse.FullName();
       
  1135 
       
  1136     // This is done to ensure upgraded file is used first.
       
  1137     TFindFile find( aFs );
       
  1138     TInt err = find.FindByDir( rscFile, KNullDesC );
       
  1139     
       
  1140     if ( err )
       
  1141         {
       
  1142         MPX_DEBUG1(_L("#MS# CMPSettingsModelForROP::LocateResourceFileL() LEAVE: KErrNotFound"));
       
  1143         User::Leave( KErrNotFound );
       
  1144         }
       
  1145     else
       
  1146         {
       
  1147         aFileName.Append( find.File() );
       
  1148         }
       
  1149     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::LocateResourceFileL(%S)"),&aFileName);
       
  1150     }
       
  1151 
       
  1152 // -----------------------------------------------------------------------------
       
  1153 // CVcxConnUtilImpl::WapIdFromIapIdL
       
  1154 // -----------------------------------------------------------------------------
       
  1155 //
       
  1156 TUint32 CMPSettingsModelForROP::WapIdFromIapIdL( TUint32 aIapId )
       
  1157     {
       
  1158     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::WapIdFromIapIdL(%d)"),aIapId);
       
  1159     
       
  1160     CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
       
  1161     CleanupStack::PushL( db );
       
  1162     
       
  1163     // WapIpBearer table contains the mapping between wap and iap id's.
       
  1164     CCDWAPIPBearerRecord* wapBearerRecord = 
       
  1165         static_cast<CCDWAPIPBearerRecord*>( CCDRecordBase::RecordFactoryL( KCDTIdWAPIPBearerRecord ) );
       
  1166         
       
  1167     CleanupStack::PushL( wapBearerRecord );
       
  1168     
       
  1169     wapBearerRecord->iWAPIAP = aIapId;
       
  1170     
       
  1171     TBool found = wapBearerRecord->FindL( *db );
       
  1172     
       
  1173     if ( !found )
       
  1174         {
       
  1175         User::Leave(KErrNotFound);
       
  1176         }
       
  1177 
       
  1178     TUint32 wap = static_cast<TUint32>( wapBearerRecord->iWAPAccessPointId );
       
  1179     
       
  1180     CleanupStack::PopAndDestroy( wapBearerRecord );
       
  1181     CleanupStack::PopAndDestroy( db );
       
  1182     
       
  1183     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::IapIdFromWapIdL() - return wap id: %d "), wap);
       
  1184     return wap;
       
  1185     }
       
  1186 
       
  1187 // -----------------------------------------------------------------------------
       
  1188 // CVcxConnUtilImpl::IapIdFromWapIdL
       
  1189 // -----------------------------------------------------------------------------
       
  1190 //
       
  1191 TUint32 CMPSettingsModelForROP::IapIdFromWapIdL( TUint32 aWapId )
       
  1192     {
       
  1193     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::IapIdFromWapIdL(%d)"),aWapId);
       
  1194     
       
  1195     CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
       
  1196     CleanupStack::PushL( db );
       
  1197     
       
  1198     // WapIpBearer table contains the mapping between wap and iap id's.
       
  1199     CCDWAPIPBearerRecord* wapBearerRecord = 
       
  1200         static_cast<CCDWAPIPBearerRecord*>( CCDRecordBase::RecordFactoryL( KCDTIdWAPIPBearerRecord ) );
       
  1201         
       
  1202     CleanupStack::PushL( wapBearerRecord );
       
  1203     
       
  1204     wapBearerRecord->iWAPAccessPointId = aWapId;
       
  1205     
       
  1206     TBool found = wapBearerRecord->FindL( *db );
       
  1207     
       
  1208     if ( !found )
       
  1209         {
       
  1210         User::Leave(KErrNotFound);
       
  1211         }
       
  1212 
       
  1213     TUint32 iap = static_cast<TUint32>( wapBearerRecord->iWAPIAP );
       
  1214     
       
  1215     CleanupStack::PopAndDestroy( wapBearerRecord );
       
  1216     CleanupStack::PopAndDestroy( db );
       
  1217     
       
  1218     MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::IapIdFromWapIdL() - return iap id: %d "), iap);
       
  1219     return iap;
       
  1220     }
       
  1221 
       
  1222 //  End of File