os/mm/devsoundextensions/addeddevsoundcontrol/AddedDevSoundControlMsgHdlr/src/AddedDevSoundControlMsgHdlr.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsoundextensions/addeddevsoundcontrol/AddedDevSoundControlMsgHdlr/src/AddedDevSoundControlMsgHdlr.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,164 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:   Message handler for AddedDevSoundControl CI.
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +
    1.23 +// INCLUDE FILES
    1.24 +#include "AddedDevSoundControlCI.h"
    1.25 +#include "AddedDevSoundControlMsgHdlr.h"
    1.26 +#include "AddedDevSoundControlMsgs.h"
    1.27 +
    1.28 +// EXTERNAL DATA STRUCTURES
    1.29 +
    1.30 +// EXTERNAL FUNCTION PROTOTYPES
    1.31 +
    1.32 +// CONSTANTS
    1.33 +
    1.34 +// MACROS
    1.35 +
    1.36 +// LOCAL CONSTANTS AND MACROS
    1.37 +
    1.38 +// MODULE DATA STRUCTURES
    1.39 +
    1.40 +// LOCAL FUNCTION PROTOTYPES
    1.41 +
    1.42 +// FORWARD DECLARATIONS
    1.43 +
    1.44 +// ============================= LOCAL FUNCTIONS ===============================
    1.45 +
    1.46 +// ============================ MEMBER FUNCTIONS ===============================
    1.47 +
    1.48 +/**
    1.49 + * CAddedDevSoundControlMsgHdlr::CAddedDevSoundControlMsgHdlr
    1.50 + * C++ default constructor can NOT contain any code, that might leave.
    1.51 + */
    1.52 +CAddedDevSoundControlMsgHdlr::CAddedDevSoundControlMsgHdlr(
    1.53 +                              MAddedDevSoundControl* aAddedDSControlCI) :
    1.54 +	CMMFObject(KUidAddedDevSoundControlInterface)
    1.55 +    {
    1.56 +    iAddedDSControlCI = aAddedDSControlCI;
    1.57 +    }
    1.58 +
    1.59 +/**
    1.60 + * CAddedDevSoundControlMsgHdlr::ConstructL
    1.61 + * Symbian 2nd phase constructor can leave.
    1.62 + */
    1.63 +void CAddedDevSoundControlMsgHdlr::ConstructL()
    1.64 +    {
    1.65 +    }
    1.66 +
    1.67 +/**
    1.68 + * CAddedDevSoundControlMsgHdlr::NewL
    1.69 + * Two-phased constructor.
    1.70 + */
    1.71 +EXPORT_C CAddedDevSoundControlMsgHdlr*
    1.72 +CAddedDevSoundControlMsgHdlr::NewL(TAny* aAddedDSControlCI)
    1.73 +    {
    1.74 +    MAddedDevSoundControl* addedDevSoundControlCI =
    1.75 +            (MAddedDevSoundControl*)aAddedDSControlCI;
    1.76 +    CAddedDevSoundControlMsgHdlr* self =
    1.77 +            new (ELeave) CAddedDevSoundControlMsgHdlr(addedDevSoundControlCI);
    1.78 +    CleanupStack::PushL( self );
    1.79 +    self->ConstructL();
    1.80 +    CleanupStack::Pop( self );
    1.81 +
    1.82 +    return self;
    1.83 +    }
    1.84 +
    1.85 +/**
    1.86 + * Destructor
    1.87 + */
    1.88 +CAddedDevSoundControlMsgHdlr::~CAddedDevSoundControlMsgHdlr()
    1.89 +	{
    1.90 +	delete iAddedDSControlCI;
    1.91 +	}
    1.92 +
    1.93 +/**
    1.94 + * CAddedDevSoundControlMsgHdlr::HandleRequest
    1.95 + * Handles messages from the proxy.
    1.96 + * Calls a subfunction, which determines what custom interface to call.
    1.97 + * A subfunction is used to contain multiple leaving functions for a single
    1.98 + * trap.
    1.99 + * (other items were commented in a header).
   1.100 + */
   1.101 +void CAddedDevSoundControlMsgHdlr::HandleRequest(TMMFMessage& aMessage)
   1.102 +	{
   1.103 +	ASSERT(
   1.104 +	aMessage.Destination().InterfaceId() == KUidAddedDevSoundControlInterface);
   1.105 +
   1.106 +	TRAPD(error, DoHandleRequestL(aMessage));
   1.107 +	if (error)
   1.108 +		{
   1.109 +		aMessage.Complete(error);
   1.110 +		}
   1.111 +	}
   1.112 +
   1.113 +/**
   1.114 + * CAddedDevSoundControlMsgHdlr::DoHandleRequestL
   1.115 + * Determines which custom interface to call.
   1.116 + * (other items were commented in a header).
   1.117 + */
   1.118 +void CAddedDevSoundControlMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
   1.119 +	{
   1.120 +	switch(aMessage.Function())
   1.121 +		{
   1.122 +		case EAddedDSControlSetHwAwareness:
   1.123 +			{
   1.124 +    		DoSetHwAwarenessL(aMessage);
   1.125 +			break;
   1.126 +			}
   1.127 +		case EAddedDSControlPauseAndFlush:
   1.128 +			{
   1.129 +    		DoPauseAndFlushL(aMessage);
   1.130 +			break;
   1.131 +			}
   1.132 +		default:
   1.133 +			{
   1.134 +			aMessage.Complete(KErrNotSupported);
   1.135 +			}
   1.136 +		}
   1.137 +	}
   1.138 +
   1.139 +/**
   1.140 + * CAddedDevSoundControlMsgHdlr::DoSetHwAwarenessL
   1.141 + * Handles EAddedDSControlSetHwAwareness message from the proxy and calls 
   1.142 + * custom interface method.
   1.143 + *
   1.144 + * (other items were commented in a header).
   1.145 + */
   1.146 +void CAddedDevSoundControlMsgHdlr::DoSetHwAwarenessL(TMMFMessage& aMessage)
   1.147 +    {
   1.148 +	TPckgBuf<TBool> pckg;
   1.149 +	aMessage.ReadData1FromClientL(pckg);
   1.150 +	TInt status = iAddedDSControlCI->SetHwAwareness(pckg());
   1.151 +    aMessage.Complete(status);
   1.152 +    }
   1.153 +
   1.154 +/**
   1.155 + * CAddedDevSoundControlMsgHdlr::DoPauseAndFlushL
   1.156 + * Handles EAddedDSControlPauseAndFlush message from the proxy and calls 
   1.157 + * custom interface method.
   1.158 + *
   1.159 + * (other items were commented in a header).
   1.160 + */
   1.161 +void CAddedDevSoundControlMsgHdlr::DoPauseAndFlushL(TMMFMessage& aMessage)
   1.162 +    {
   1.163 +	TInt status = iAddedDSControlCI->PauseAndFlush();
   1.164 +    aMessage.Complete(status);
   1.165 +    }
   1.166 +
   1.167 +// End of File