os/mm/devsoundextensions/addeddevsoundcontrol/AddedDevSoundControlMsgHdlr/src/AddedDevSoundControlMsgHdlr.cpp
Update contrib.
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Message handler for AddedDevSoundControl CI.
21 #include "AddedDevSoundControlCI.h"
22 #include "AddedDevSoundControlMsgHdlr.h"
23 #include "AddedDevSoundControlMsgs.h"
25 // EXTERNAL DATA STRUCTURES
27 // EXTERNAL FUNCTION PROTOTYPES
33 // LOCAL CONSTANTS AND MACROS
35 // MODULE DATA STRUCTURES
37 // LOCAL FUNCTION PROTOTYPES
39 // FORWARD DECLARATIONS
41 // ============================= LOCAL FUNCTIONS ===============================
43 // ============================ MEMBER FUNCTIONS ===============================
46 * CAddedDevSoundControlMsgHdlr::CAddedDevSoundControlMsgHdlr
47 * C++ default constructor can NOT contain any code, that might leave.
49 CAddedDevSoundControlMsgHdlr::CAddedDevSoundControlMsgHdlr(
50 MAddedDevSoundControl* aAddedDSControlCI) :
51 CMMFObject(KUidAddedDevSoundControlInterface)
53 iAddedDSControlCI = aAddedDSControlCI;
57 * CAddedDevSoundControlMsgHdlr::ConstructL
58 * Symbian 2nd phase constructor can leave.
60 void CAddedDevSoundControlMsgHdlr::ConstructL()
65 * CAddedDevSoundControlMsgHdlr::NewL
66 * Two-phased constructor.
68 EXPORT_C CAddedDevSoundControlMsgHdlr*
69 CAddedDevSoundControlMsgHdlr::NewL(TAny* aAddedDSControlCI)
71 MAddedDevSoundControl* addedDevSoundControlCI =
72 (MAddedDevSoundControl*)aAddedDSControlCI;
73 CAddedDevSoundControlMsgHdlr* self =
74 new (ELeave) CAddedDevSoundControlMsgHdlr(addedDevSoundControlCI);
75 CleanupStack::PushL( self );
77 CleanupStack::Pop( self );
85 CAddedDevSoundControlMsgHdlr::~CAddedDevSoundControlMsgHdlr()
87 delete iAddedDSControlCI;
91 * CAddedDevSoundControlMsgHdlr::HandleRequest
92 * Handles messages from the proxy.
93 * Calls a subfunction, which determines what custom interface to call.
94 * A subfunction is used to contain multiple leaving functions for a single
96 * (other items were commented in a header).
98 void CAddedDevSoundControlMsgHdlr::HandleRequest(TMMFMessage& aMessage)
101 aMessage.Destination().InterfaceId() == KUidAddedDevSoundControlInterface);
103 TRAPD(error, DoHandleRequestL(aMessage));
106 aMessage.Complete(error);
111 * CAddedDevSoundControlMsgHdlr::DoHandleRequestL
112 * Determines which custom interface to call.
113 * (other items were commented in a header).
115 void CAddedDevSoundControlMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
117 switch(aMessage.Function())
119 case EAddedDSControlSetHwAwareness:
121 DoSetHwAwarenessL(aMessage);
124 case EAddedDSControlPauseAndFlush:
126 DoPauseAndFlushL(aMessage);
131 aMessage.Complete(KErrNotSupported);
137 * CAddedDevSoundControlMsgHdlr::DoSetHwAwarenessL
138 * Handles EAddedDSControlSetHwAwareness message from the proxy and calls
139 * custom interface method.
141 * (other items were commented in a header).
143 void CAddedDevSoundControlMsgHdlr::DoSetHwAwarenessL(TMMFMessage& aMessage)
145 TPckgBuf<TBool> pckg;
146 aMessage.ReadData1FromClientL(pckg);
147 TInt status = iAddedDSControlCI->SetHwAwareness(pckg());
148 aMessage.Complete(status);
152 * CAddedDevSoundControlMsgHdlr::DoPauseAndFlushL
153 * Handles EAddedDSControlPauseAndFlush message from the proxy and calls
154 * custom interface method.
156 * (other items were commented in a header).
158 void CAddedDevSoundControlMsgHdlr::DoPauseAndFlushL(TMMFMessage& aMessage)
160 TInt status = iAddedDSControlCI->PauseAndFlush();
161 aMessage.Complete(status);