os/mm/devsoundextensions/mmfcustominterfaces/ErrConcealmentIntfc/ErrorConcealmentIntfcMsgHdlr/src/ErrorConcealmentIntfcMsgHdlr.cpp
Update contrib.
2 * Copyright (c) 2002-2004 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 error concealment interface
21 #include "ErrorConcealmentIntfcMsgHdlr.h"
22 #include "ErrorConcealmentIntfcMsgs.h"
23 #include <ErrorConcealmentIntfc.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 ===============================
45 // -----------------------------------------------------------------------------
46 // CErrorConcealmentIntfcMsgHdlr::CErrorConcealmentIntfcMsgHdlr
47 // C++ default constructor can NOT contain any code, that
49 // -----------------------------------------------------------------------------
51 CErrorConcealmentIntfcMsgHdlr::CErrorConcealmentIntfcMsgHdlr(
52 CErrorConcealmentIntfc* aErrorConcealmentIntfcCI) :
53 CMMFObject(KUidErrorConcealmentIntfc)
55 iErrorConcealmentIntfcCI = aErrorConcealmentIntfcCI;
58 // -----------------------------------------------------------------------------
59 // CErrorConcealmentIntfcMsgHdlr::ConstructL
60 // Symbian 2nd phase constructor can leave.
61 // -----------------------------------------------------------------------------
63 void CErrorConcealmentIntfcMsgHdlr::ConstructL()
67 // -----------------------------------------------------------------------------
68 // CErrorConcealmentIntfcMsgHdlr::NewL
69 // Two-phased constructor.
70 // -----------------------------------------------------------------------------
72 EXPORT_C CErrorConcealmentIntfcMsgHdlr* CErrorConcealmentIntfcMsgHdlr::NewL(
73 TAny* aErrorConcealmentIntfcCI)
75 CErrorConcealmentIntfc* errorConcealmentIntfcCI =
76 (CErrorConcealmentIntfc*)aErrorConcealmentIntfcCI;
77 CErrorConcealmentIntfcMsgHdlr* self =
78 new (ELeave) CErrorConcealmentIntfcMsgHdlr(errorConcealmentIntfcCI);
79 CleanupStack::PushL( self );
81 CleanupStack::Pop( self );
87 EXPORT_C CErrorConcealmentIntfcMsgHdlr::~CErrorConcealmentIntfcMsgHdlr()
89 delete iErrorConcealmentIntfcCI;
92 // ---------------------------------------------------------
93 // CErrorConcealmentIntfcMsgHdlr::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
98 // (other items were commented in a header).
99 // ---------------------------------------------------------
101 EXPORT_C void CErrorConcealmentIntfcMsgHdlr::HandleRequest(
102 TMMFMessage& aMessage)
104 ASSERT(aMessage.Destination().InterfaceId() == KUidErrorConcealmentIntfc);
105 TRAPD(error,DoHandleRequestL(aMessage));
108 aMessage.Complete(error);
112 // ---------------------------------------------------------
113 // CErrorConcealmentIntfcMsgHdlr::DoHandleRequestL
114 // Determines which custom interface to call.
115 // (other items were commented in a header).
116 // ---------------------------------------------------------
118 void CErrorConcealmentIntfcMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
120 switch(aMessage.Function())
122 case EEcimConcealError:
124 DoConcealErrorForNextBufferL(aMessage);
127 case EEcimSetFrameMode:
129 DoSetFrameModeL(aMessage);
132 case EEcimFrameModeRqrd:
134 DoFrameModeRqrdForEcL(aMessage);
139 aMessage.Complete(KErrNotSupported);
144 // ---------------------------------------------------------
145 // CErrorConcealmentIntfcMsgHdlr::DoConcealErrorForNextBufferL
146 // Handles the message from the proxy and calls the custom interface method.
147 // (other items were commented in a header).
148 // ---------------------------------------------------------
150 void CErrorConcealmentIntfcMsgHdlr::DoConcealErrorForNextBufferL(
151 TMMFMessage& aMessage)
153 TInt status = iErrorConcealmentIntfcCI->ConcealErrorForNextBuffer();
154 aMessage.Complete(status);
157 // ---------------------------------------------------------
158 // CErrorConcealmentIntfcMsgHdlr::DoSetFrameModeL
159 // Handles the message from the proxy and calls the custom interface method.
160 // The data passed from the proxy is read from the message and passed to
161 // the custom interface.
162 // (other items were commented in a header).
163 // ---------------------------------------------------------
165 void CErrorConcealmentIntfcMsgHdlr::DoSetFrameModeL(TMMFMessage& aMessage)
167 TPckgBuf<TBool> pckg;
168 aMessage.ReadData1FromClientL(pckg);
169 TInt status = iErrorConcealmentIntfcCI->SetFrameMode(pckg());
170 aMessage.Complete(status);
173 // ---------------------------------------------------------
174 // CErrorConcealmentIntfcMsgHdlr::DoFrameModeRqrdForEcL
175 // Handles the message from the proxy and calls the custom interface method.
176 // The custom interface returns the data requested and this function
177 // writes it back to the proxy.
178 // (other items were commented in a header).
179 // ---------------------------------------------------------
181 void CErrorConcealmentIntfcMsgHdlr::DoFrameModeRqrdForEcL(TMMFMessage& aMessage)
184 TInt status = iErrorConcealmentIntfcCI->FrameModeRqrdForEC(frameModeRqrd);
185 if (status == KErrNone)
187 TPckgBuf<TBool> pckg;
188 pckg() = frameModeRqrd;
189 aMessage.WriteDataToClientL(pckg);
191 aMessage.Complete(status);