devsoundextensions/addeddevsoundcontrol/AddedDevSoundControlProxy/src/AddedDevSoundControlProxy.cpp
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Interface proxy for AddedDevSoundControl CI.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <CustomCommandUtility.h>
       
    22 #include <CustomInterfaceUtility.h>
       
    23 #include "AddedDevSoundControlMsgs.h"
       
    24 #include <AddedDevSoundControlProxy.h>
       
    25 
       
    26 // EXTERNAL DATA STRUCTURES
       
    27 
       
    28 // EXTERNAL FUNCTION PROTOTYPES
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // LOCAL CONSTANTS AND MACROS
       
    35 
       
    36 // MODULE DATA STRUCTURES
       
    37 
       
    38 // LOCAL FUNCTION PROTOTYPES
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 
       
    42 // ============================= LOCAL FUNCTIONS ===============================
       
    43 
       
    44 // ============================= MEMBER FUNCTIONS ==============================
       
    45 
       
    46 /**
       
    47  * CAddedDevSoundControlProxy::CAddedDevSoundControlProxy
       
    48  * C++ default constructor can NOT contain any code, that
       
    49  * might leave.
       
    50  */
       
    51 CAddedDevSoundControlProxy::CAddedDevSoundControlProxy(
       
    52                             TMMFMessageDestinationPckg aMessageHandler,
       
    53                             MCustomCommand& aCustomCommand,
       
    54                             CCustomInterfaceUtility* aCustomInterfaceUtility) :
       
    55     iCustomCommand(aCustomCommand),
       
    56     iMessageHandler(aMessageHandler),
       
    57     iCustomInterfaceUtility(aCustomInterfaceUtility)
       
    58     {
       
    59     }
       
    60 
       
    61 /**
       
    62  * CAddedDevSoundControlProxy::NewL
       
    63  * Two-phased constructor.
       
    64  */
       
    65 EXPORT_C CAddedDevSoundControlProxy* CAddedDevSoundControlProxy::NewL(
       
    66                             TMMFMessageDestinationPckg aMessageHandler,
       
    67                             MCustomCommand& aCustomCommand,
       
    68                             CCustomInterfaceUtility* aCustomInterfaceUtility)
       
    69     {
       
    70     CAddedDevSoundControlProxy* self =
       
    71             new(ELeave) CAddedDevSoundControlProxy(aMessageHandler,
       
    72                                                    aCustomCommand,
       
    73                                                    aCustomInterfaceUtility);
       
    74     return self;                                                   
       
    75     }
       
    76 
       
    77 /**
       
    78  * Destructor
       
    79  */
       
    80 CAddedDevSoundControlProxy::~CAddedDevSoundControlProxy()
       
    81     {
       
    82     if(iCustomInterfaceUtility)
       
    83      { 
       
    84         iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
       
    85         delete iCustomInterfaceUtility;
       
    86         iCustomInterfaceUtility = NULL;
       
    87      }
       
    88     }
       
    89 
       
    90 
       
    91 // From MAddedDevSoundControl
       
    92 
       
    93 /**
       
    94  * Handles client request to alter DevSound's behavior for Pause.
       
    95  * (other items defined in the header)
       
    96  */
       
    97 TInt CAddedDevSoundControlProxy::SetHwAwareness(TBool aHwAware)
       
    98     {
       
    99 	TPckgBuf<TBool> hwAwarePckgBuf(aHwAware);
       
   100 	return iCustomCommand.CustomCommandSync(iMessageHandler,
       
   101                                             EAddedDSControlSetHwAwareness,
       
   102                                             hwAwarePckgBuf,
       
   103                                             KNullDesC8);
       
   104     }
       
   105 
       
   106 /**
       
   107  * Handles client request to pause the audio resources and flush.
       
   108  * (other items defined in the header)
       
   109  */
       
   110 TInt CAddedDevSoundControlProxy::PauseAndFlush()
       
   111     {
       
   112 	return iCustomCommand.CustomCommandSync(iMessageHandler,
       
   113                                             EAddedDSControlPauseAndFlush,
       
   114                                             KNullDesC8,
       
   115                                             KNullDesC8);
       
   116     }
       
   117 
       
   118 // End of File