os/mm/devsoundextensions/mmfcustominterfaces/AacDecoderConfig/AacDecoderConfigMsgHdlr/src/AacDecoderConfigMsgHdlr.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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:   Message handler for AAC decoder configuration interface
    15 *
    16 */
    17 
    18 
    19 
    20 // INCLUDE FILES
    21 #include    "AacDecoderConfigMsgHdlr.h"
    22 #include    "AacDecoderConfigMsgs.h"
    23 #include    <AacDecoderConfig.h>
    24 
    25 // EXTERNAL DATA STRUCTURES
    26 
    27 // EXTERNAL FUNCTION PROTOTYPES  
    28 
    29 // CONSTANTS
    30 
    31 // MACROS
    32 
    33 // LOCAL CONSTANTS AND MACROS
    34 
    35 // MODULE DATA STRUCTURES
    36 
    37 // LOCAL FUNCTION PROTOTYPES
    38 
    39 // FORWARD DECLARATIONS
    40 
    41 // ============================= LOCAL FUNCTIONS ===============================
    42 
    43 // ============================ MEMBER FUNCTIONS ===============================
    44 
    45 // -----------------------------------------------------------------------------
    46 // CAacDecoderConfigMsgHdlr::CAacDecoderConfigMsgHdlr
    47 // C++ default constructor can NOT contain any code, that
    48 // might leave.
    49 // -----------------------------------------------------------------------------
    50 //
    51 CAacDecoderConfigMsgHdlr::CAacDecoderConfigMsgHdlr(
    52                                        CAacDecoderConfig* aAacDecoderConfigCI) :
    53 	CMMFObject(KUidAacDecoderConfig)
    54     {
    55     iAacDecoderConfigCI = aAacDecoderConfigCI;
    56     }
    57 
    58 // -----------------------------------------------------------------------------
    59 // CAacDecoderConfigMsgHdlr::ConstructL
    60 // Symbian 2nd phase constructor can leave.
    61 // -----------------------------------------------------------------------------
    62 //
    63 void CAacDecoderConfigMsgHdlr::ConstructL()
    64     {
    65     }
    66 
    67 // -----------------------------------------------------------------------------
    68 // CAacDecoderConfigMsgHdlr::NewL
    69 // Two-phased constructor.
    70 // -----------------------------------------------------------------------------
    71 //
    72 EXPORT_C CAacDecoderConfigMsgHdlr* CAacDecoderConfigMsgHdlr::NewL(
    73                                                      TAny*  aAacDecoderConfigCI)
    74     {
    75     CAacDecoderConfig* aacDecoderConfigCI = 
    76                                         (CAacDecoderConfig*)aAacDecoderConfigCI;
    77     CAacDecoderConfigMsgHdlr* self = 
    78                       new (ELeave) CAacDecoderConfigMsgHdlr(aacDecoderConfigCI);
    79     CleanupStack::PushL( self );
    80     self->ConstructL();
    81     CleanupStack::Pop( self );
    82 
    83     return self;
    84     }
    85 
    86 // Destructor
    87 EXPORT_C CAacDecoderConfigMsgHdlr::~CAacDecoderConfigMsgHdlr()
    88 	{
    89 	delete iAacDecoderConfigCI;
    90 	}
    91 
    92 // ---------------------------------------------------------
    93 // CAacDecoderConfigMsgHdlr::HandleRequest
    94 // Handles the messages from the proxy.
    95 // Calls a subfunction which determines which custom interface to call.
    96 // A subfunction is used to contain multiple leaving functions for a single
    97 // trap.
    98 // (other items were commented in a header).
    99 // ---------------------------------------------------------
   100 //
   101 EXPORT_C void CAacDecoderConfigMsgHdlr::HandleRequest(TMMFMessage& aMessage)
   102 	{
   103 	ASSERT(aMessage.Destination().InterfaceId() == KUidAacDecoderConfig);
   104 	TRAPD(error,DoHandleRequestL(aMessage));
   105 	if(error)
   106 		{
   107 		aMessage.Complete(error);
   108 		}
   109 	}
   110 
   111 // ---------------------------------------------------------
   112 // CAacDecoderConfigMsgHdlr::DoHandleRequestL
   113 // Determines which custom interface to call.
   114 // (other items were commented in a header).
   115 // ---------------------------------------------------------
   116 //
   117 void CAacDecoderConfigMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
   118 	{
   119 	switch(aMessage.Function())
   120 		{
   121 		case EAdcmSetConfig:
   122 			{
   123     		DoSetAudioConfigL(aMessage);
   124 			break;
   125 			}
   126 		default:
   127 			{
   128 			aMessage.Complete(KErrNotSupported);
   129 			}
   130 		}
   131 	}
   132 
   133 // ---------------------------------------------------------
   134 // CAacDecoderConfigMsgHdlr::DoSetAudioConfigL
   135 // Handles the message from the proxy and calls the custom interface method.
   136 // (other items were commented in a header).
   137 // ---------------------------------------------------------
   138 //
   139 void CAacDecoderConfigMsgHdlr::DoSetAudioConfigL(TMMFMessage& aMessage)
   140     {
   141 	TPckgBuf<TAudioConfig> pckg;
   142 	aMessage.ReadData1FromClientL(pckg);
   143 	TInt status = iAacDecoderConfigCI->SetAudioConfig(pckg());
   144     aMessage.Complete(status);
   145     }
   146 
   147 
   148 // End of File