devsoundextensions/mmfcustominterfaces/IlbcEncoderIntfc/IlbcEncoderIntfcProxy/src/IlbcEncoderIntfcProxy.cpp
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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 Ilbc encoder.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "IlbcEncoderIntfcProxy.h"
       
    22 #include "IlbcEncoderIntfcMsgs.h"
       
    23 #include <CustomCommandUtility.h>
       
    24 #include <CustomInterfaceUtility.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 // CIlbcEncoderIntfcProxy::CIlbcEncoderIntfcProxy
       
    48 // C++ default constructor can NOT contain any code, that
       
    49 // might leave.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CIlbcEncoderIntfcProxy::CIlbcEncoderIntfcProxy(
       
    53                              TMMFMessageDestinationPckg aMessageHandler, 
       
    54                              MCustomCommand& aCustomCommand,
       
    55                              CCustomInterfaceUtility* aCustomInterfaceUtility) :
       
    56 	iCustomCommand(aCustomCommand),
       
    57 	iMessageHandler(aMessageHandler),
       
    58 	iCustomInterfaceUtility(aCustomInterfaceUtility)
       
    59     {
       
    60     }
       
    61 
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CIlbcEncoderIntfcProxy::ConstructL
       
    65 // Symbian 2nd phase constructor can leave.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 void CIlbcEncoderIntfcProxy::ConstructL()
       
    69     {
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CIlbcEncoderIntfcProxy::NewL
       
    74 // Two-phased constructor.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 EXPORT_C CIlbcEncoderIntfcProxy* CIlbcEncoderIntfcProxy::NewL(
       
    78                               TMMFMessageDestinationPckg aMessageHandler, 
       
    79                               MCustomCommand& aCustomCommand,
       
    80                               CCustomInterfaceUtility* aCustomInterfaceUtility)
       
    81     {
       
    82     CIlbcEncoderIntfcProxy* self = new(ELeave) CIlbcEncoderIntfcProxy(
       
    83                                                         aMessageHandler,
       
    84                                                         aCustomCommand,
       
    85                                                         aCustomInterfaceUtility);
       
    86     CleanupStack::PushL( self );
       
    87     self->ConstructL();
       
    88     CleanupStack::Pop( self );
       
    89     return self;
       
    90     }
       
    91     
       
    92 // Destructor
       
    93 EXPORT_C CIlbcEncoderIntfcProxy::~CIlbcEncoderIntfcProxy()
       
    94     {
       
    95     iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
       
    96     delete iCustomInterfaceUtility;
       
    97     }
       
    98 
       
    99 // ---------------------------------------------------------
       
   100 // CIlbcEncoderIntfcProxy::SetEncoderMode
       
   101 // Sends the custom command for this function to its message handler.
       
   102 // (other items were commented in a header).
       
   103 // ---------------------------------------------------------
       
   104 //
       
   105 EXPORT_C TInt CIlbcEncoderIntfcProxy::SetEncoderMode(TEncodeMode aEncodeMode)
       
   106     {
       
   107 	TPckgBuf<TEncodeMode> pckgBuf(aEncodeMode);
       
   108 	TInt status = iCustomCommand.CustomCommandSync(iMessageHandler,
       
   109 	                                               EIlbceimSetEncoderMode,
       
   110 	                                               pckgBuf,
       
   111 	                                               KNullDesC8);
       
   112 	return status;
       
   113     
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------
       
   117 // CIlbcEncoderIntfcProxy::SetVadMode
       
   118 // Sends the custom command for this function to its message handler.
       
   119 // (other items were commented in a header).
       
   120 // ---------------------------------------------------------
       
   121 //
       
   122 EXPORT_C TInt CIlbcEncoderIntfcProxy::SetVadMode(TBool aVadMode)
       
   123 	{
       
   124 	TPckgBuf<TBool> pckgBuf(aVadMode);
       
   125 	TInt status = iCustomCommand.CustomCommandSync(iMessageHandler,
       
   126 	                                               EIlbceimSetVadMode,
       
   127 	                                               pckgBuf,
       
   128 	                                               KNullDesC8);
       
   129 	return status;
       
   130 	}
       
   131 
       
   132 // ---------------------------------------------------------
       
   133 // CIlbcEncoderIntfcProxy::GetVadMode
       
   134 // Sends the custom command for this function to its message handler.
       
   135 // (other items were commented in a header).
       
   136 // ---------------------------------------------------------
       
   137 //
       
   138 EXPORT_C TInt CIlbcEncoderIntfcProxy::GetVadMode(TBool& aVadMode)
       
   139 	{
       
   140 	TInt vadMode = EFalse;
       
   141 	TPckgBuf<TBool> pckgBuf(vadMode);
       
   142 	TInt status = iCustomCommand.CustomCommandSync(iMessageHandler,
       
   143 	                                               EIlbceimGetVadMode,
       
   144 	                                               KNullDesC8,
       
   145 	                                               KNullDesC8,
       
   146 	                                               pckgBuf);
       
   147 	if (status == KErrNone)
       
   148 	    aVadMode = pckgBuf();
       
   149 	return status;
       
   150 	}
       
   151     
       
   152 
       
   153 
       
   154 // End of File