mmserv/tms/tmsserver/src/tmsglobaleffectssettings.cpp
branchRCL_3
changeset 7 3d8c721bf319
child 17 60e492b28869
equal deleted inserted replaced
6:e35735ece90c 7:3d8c721bf319
       
     1 /*
       
     2  * Copyright (c) 2009 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 "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: Telephony Multimedia Service
       
    15  *
       
    16  */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "tmsglobaleffectssettings.h"
       
    20 #include "tmsclientserver.h"
       
    21 
       
    22 using namespace TMS;
       
    23 // CONSTANTS
       
    24 const TInt KDefaultVolume = 4;
       
    25 const TInt KDefaultMaxVolume = 10;
       
    26 const TInt KDefaultGain = 1;
       
    27 const TInt KDefaultMaxGain = 64;
       
    28 
       
    29 TUid KCRUidTmseffects = {0x10207C80};
       
    30 const TUint32 KTmsEarPieceVolume = 0x00000001;
       
    31 const TUint32 KTmsLoudSpkrVolume = 0x00000002;
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // TMSGlobalEffectsSettings::TMSGlobalEffectsSettings
       
    35 // C++ default constructor can NOT contain any code, that
       
    36 // might leave.
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 TMSGlobalEffectsSettings::TMSGlobalEffectsSettings() :
       
    40     iGain(KDefaultGain),
       
    41     iMaxVolume(KDefaultMaxVolume),
       
    42     iMaxGain(KDefaultMaxGain),
       
    43     iEarVolume(KDefaultVolume),
       
    44     iLoudSpkrVolume(KDefaultVolume)
       
    45     {
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // TMSGlobalEffectsSettings::ConstructL
       
    50 // Symbian 2nd phase constructor can leave.
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 void TMSGlobalEffectsSettings::ConstructL()
       
    54     {
       
    55     // Create repository instance
       
    56     iRepository = CRepository::NewL(KCRUidTmseffects);
       
    57     if (iRepository)
       
    58         {
       
    59         iRepository->Get(KTmsLoudSpkrVolume, iLoudSpkrVolume);
       
    60         iRepository->Get(KTmsEarPieceVolume, iEarVolume);
       
    61         }
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // TMSGlobalEffectsSettings::NewL
       
    66 // Two-phased constructor.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 TMSGlobalEffectsSettings* TMSGlobalEffectsSettings::NewL()
       
    70     {
       
    71     TMSGlobalEffectsSettings* self = new (ELeave) TMSGlobalEffectsSettings();
       
    72     CleanupStack::PushL(self);
       
    73     self->ConstructL();
       
    74     CleanupStack::Pop(self);
       
    75     return self;
       
    76     }
       
    77 
       
    78 // Destructor
       
    79 TMSGlobalEffectsSettings::~TMSGlobalEffectsSettings()
       
    80     {
       
    81     delete iRepository;
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // TMSGlobalEffectsSettings::SetLoudSpkrVolume
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 void TMSGlobalEffectsSettings::SetLoudSpkrVolume(TInt aVolume)
       
    89     {
       
    90     TInt status(KErrNone);
       
    91     if (iRepository)
       
    92         {
       
    93         status = iRepository->Set(KTmsLoudSpkrVolume, aVolume);
       
    94         if (status == KErrNone)
       
    95             {
       
    96             iLoudSpkrVolume = aVolume;
       
    97             }
       
    98         }
       
    99     }
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // TMSGlobalEffectsSettings::SetEarPieceVolume
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 void TMSGlobalEffectsSettings::SetEarPieceVolume(TInt aVolume)
       
   106     {
       
   107     TInt status(KErrNone);
       
   108     if (iRepository)
       
   109         {
       
   110         status = iRepository->Set(KTmsEarPieceVolume, aVolume);
       
   111         if (status == KErrNone)
       
   112             {
       
   113             iEarVolume = aVolume;
       
   114             }
       
   115         }
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // TMSGlobalEffectsSettings::GetLoudSpkrVolume
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 void TMSGlobalEffectsSettings::GetLoudSpkrVolume(TInt& aVolume)
       
   123     {
       
   124     aVolume = iLoudSpkrVolume;
       
   125     }
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // TMSGlobalEffectsSettings::GetEarPieceVolume
       
   129 // -----------------------------------------------------------------------------
       
   130 //
       
   131 void TMSGlobalEffectsSettings::GetEarPieceVolume(TInt& aVolume)
       
   132     {
       
   133     aVolume = iEarVolume;
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // TMSGlobalEffectsSettings::MaxVolume
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 TInt TMSGlobalEffectsSettings::MaxVolume() const
       
   141     {
       
   142     return iMaxVolume;
       
   143     }
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 // TMSGlobalEffectsSettings::SetGain
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 void TMSGlobalEffectsSettings::SetGain(TInt aGain)
       
   150     {
       
   151     iGain = aGain;
       
   152     }
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 // TMSGlobalEffectsSettings::Gain
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 TInt TMSGlobalEffectsSettings::Gain() const
       
   159     {
       
   160     return iGain;
       
   161     }
       
   162 
       
   163 // -----------------------------------------------------------------------------
       
   164 // TMSGlobalEffectsSettings::MaxGain
       
   165 // -----------------------------------------------------------------------------
       
   166 //
       
   167 TInt TMSGlobalEffectsSettings::MaxGain() const
       
   168     {
       
   169     return iMaxGain;
       
   170     }
       
   171 
       
   172 //  End of File