sl@0: /* sl@0: * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: Message handler for AddedDevSoundControl CI. sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: // INCLUDE FILES sl@0: #include "AddedDevSoundControlCI.h" sl@0: #include "AddedDevSoundControlMsgHdlr.h" sl@0: #include "AddedDevSoundControlMsgs.h" sl@0: sl@0: // EXTERNAL DATA STRUCTURES sl@0: sl@0: // EXTERNAL FUNCTION PROTOTYPES sl@0: sl@0: // CONSTANTS sl@0: sl@0: // MACROS sl@0: sl@0: // LOCAL CONSTANTS AND MACROS sl@0: sl@0: // MODULE DATA STRUCTURES sl@0: sl@0: // LOCAL FUNCTION PROTOTYPES sl@0: sl@0: // FORWARD DECLARATIONS sl@0: sl@0: // ============================= LOCAL FUNCTIONS =============================== sl@0: sl@0: // ============================ MEMBER FUNCTIONS =============================== sl@0: sl@0: /** sl@0: * CAddedDevSoundControlMsgHdlr::CAddedDevSoundControlMsgHdlr sl@0: * C++ default constructor can NOT contain any code, that might leave. sl@0: */ sl@0: CAddedDevSoundControlMsgHdlr::CAddedDevSoundControlMsgHdlr( sl@0: MAddedDevSoundControl* aAddedDSControlCI) : sl@0: CMMFObject(KUidAddedDevSoundControlInterface) sl@0: { sl@0: iAddedDSControlCI = aAddedDSControlCI; sl@0: } sl@0: sl@0: /** sl@0: * CAddedDevSoundControlMsgHdlr::ConstructL sl@0: * Symbian 2nd phase constructor can leave. sl@0: */ sl@0: void CAddedDevSoundControlMsgHdlr::ConstructL() sl@0: { sl@0: } sl@0: sl@0: /** sl@0: * CAddedDevSoundControlMsgHdlr::NewL sl@0: * Two-phased constructor. sl@0: */ sl@0: EXPORT_C CAddedDevSoundControlMsgHdlr* sl@0: CAddedDevSoundControlMsgHdlr::NewL(TAny* aAddedDSControlCI) sl@0: { sl@0: MAddedDevSoundControl* addedDevSoundControlCI = sl@0: (MAddedDevSoundControl*)aAddedDSControlCI; sl@0: CAddedDevSoundControlMsgHdlr* self = sl@0: new (ELeave) CAddedDevSoundControlMsgHdlr(addedDevSoundControlCI); sl@0: CleanupStack::PushL( self ); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop( self ); sl@0: sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: * Destructor sl@0: */ sl@0: CAddedDevSoundControlMsgHdlr::~CAddedDevSoundControlMsgHdlr() sl@0: { sl@0: delete iAddedDSControlCI; sl@0: } sl@0: sl@0: /** sl@0: * CAddedDevSoundControlMsgHdlr::HandleRequest sl@0: * Handles messages from the proxy. sl@0: * Calls a subfunction, which determines what custom interface to call. sl@0: * A subfunction is used to contain multiple leaving functions for a single sl@0: * trap. sl@0: * (other items were commented in a header). sl@0: */ sl@0: void CAddedDevSoundControlMsgHdlr::HandleRequest(TMMFMessage& aMessage) sl@0: { sl@0: ASSERT( sl@0: aMessage.Destination().InterfaceId() == KUidAddedDevSoundControlInterface); sl@0: sl@0: TRAPD(error, DoHandleRequestL(aMessage)); sl@0: if (error) sl@0: { sl@0: aMessage.Complete(error); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * CAddedDevSoundControlMsgHdlr::DoHandleRequestL sl@0: * Determines which custom interface to call. sl@0: * (other items were commented in a header). sl@0: */ sl@0: void CAddedDevSoundControlMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage) sl@0: { sl@0: switch(aMessage.Function()) sl@0: { sl@0: case EAddedDSControlSetHwAwareness: sl@0: { sl@0: DoSetHwAwarenessL(aMessage); sl@0: break; sl@0: } sl@0: case EAddedDSControlPauseAndFlush: sl@0: { sl@0: DoPauseAndFlushL(aMessage); sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: aMessage.Complete(KErrNotSupported); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * CAddedDevSoundControlMsgHdlr::DoSetHwAwarenessL sl@0: * Handles EAddedDSControlSetHwAwareness message from the proxy and calls sl@0: * custom interface method. sl@0: * sl@0: * (other items were commented in a header). sl@0: */ sl@0: void CAddedDevSoundControlMsgHdlr::DoSetHwAwarenessL(TMMFMessage& aMessage) sl@0: { sl@0: TPckgBuf pckg; sl@0: aMessage.ReadData1FromClientL(pckg); sl@0: TInt status = iAddedDSControlCI->SetHwAwareness(pckg()); sl@0: aMessage.Complete(status); sl@0: } sl@0: sl@0: /** sl@0: * CAddedDevSoundControlMsgHdlr::DoPauseAndFlushL sl@0: * Handles EAddedDSControlPauseAndFlush message from the proxy and calls sl@0: * custom interface method. sl@0: * sl@0: * (other items were commented in a header). sl@0: */ sl@0: void CAddedDevSoundControlMsgHdlr::DoPauseAndFlushL(TMMFMessage& aMessage) sl@0: { sl@0: TInt status = iAddedDSControlCI->PauseAndFlush(); sl@0: aMessage.Complete(status); sl@0: } sl@0: sl@0: // End of File