os/mm/devsoundextensions/mmfcustominterfaces/ErrConcealmentIntfc/ErrorConcealmentIntfcMsgHdlr/src/ErrorConcealmentIntfcMsgHdlr.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsoundextensions/mmfcustominterfaces/ErrConcealmentIntfc/ErrorConcealmentIntfcMsgHdlr/src/ErrorConcealmentIntfcMsgHdlr.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,194 @@
1.4 +/*
1.5 +* Copyright (c) 2002-2004 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 error concealment interface
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +// INCLUDE FILES
1.24 +#include "ErrorConcealmentIntfcMsgHdlr.h"
1.25 +#include "ErrorConcealmentIntfcMsgs.h"
1.26 +#include <ErrorConcealmentIntfc.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 +// CErrorConcealmentIntfcMsgHdlr::CErrorConcealmentIntfcMsgHdlr
1.50 +// C++ default constructor can NOT contain any code, that
1.51 +// might leave.
1.52 +// -----------------------------------------------------------------------------
1.53 +//
1.54 +CErrorConcealmentIntfcMsgHdlr::CErrorConcealmentIntfcMsgHdlr(
1.55 + CErrorConcealmentIntfc* aErrorConcealmentIntfcCI) :
1.56 + CMMFObject(KUidErrorConcealmentIntfc)
1.57 + {
1.58 + iErrorConcealmentIntfcCI = aErrorConcealmentIntfcCI;
1.59 + }
1.60 +
1.61 +// -----------------------------------------------------------------------------
1.62 +// CErrorConcealmentIntfcMsgHdlr::ConstructL
1.63 +// Symbian 2nd phase constructor can leave.
1.64 +// -----------------------------------------------------------------------------
1.65 +//
1.66 +void CErrorConcealmentIntfcMsgHdlr::ConstructL()
1.67 + {
1.68 + }
1.69 +
1.70 +// -----------------------------------------------------------------------------
1.71 +// CErrorConcealmentIntfcMsgHdlr::NewL
1.72 +// Two-phased constructor.
1.73 +// -----------------------------------------------------------------------------
1.74 +//
1.75 +EXPORT_C CErrorConcealmentIntfcMsgHdlr* CErrorConcealmentIntfcMsgHdlr::NewL(
1.76 + TAny* aErrorConcealmentIntfcCI)
1.77 + {
1.78 + CErrorConcealmentIntfc* errorConcealmentIntfcCI =
1.79 + (CErrorConcealmentIntfc*)aErrorConcealmentIntfcCI;
1.80 + CErrorConcealmentIntfcMsgHdlr* self =
1.81 + new (ELeave) CErrorConcealmentIntfcMsgHdlr(errorConcealmentIntfcCI);
1.82 + CleanupStack::PushL( self );
1.83 + self->ConstructL();
1.84 + CleanupStack::Pop( self );
1.85 +
1.86 + return self;
1.87 + }
1.88 +
1.89 +// Destructor
1.90 +EXPORT_C CErrorConcealmentIntfcMsgHdlr::~CErrorConcealmentIntfcMsgHdlr()
1.91 + {
1.92 + delete iErrorConcealmentIntfcCI;
1.93 + }
1.94 +
1.95 +// ---------------------------------------------------------
1.96 +// CErrorConcealmentIntfcMsgHdlr::HandleRequest
1.97 +// Handles the messages from the proxy.
1.98 +// Calls a subfunction which determines which custom interface to call.
1.99 +// A subfunction is used to contain multiple leaving functions for a single
1.100 +// trap.
1.101 +// (other items were commented in a header).
1.102 +// ---------------------------------------------------------
1.103 +//
1.104 +EXPORT_C void CErrorConcealmentIntfcMsgHdlr::HandleRequest(
1.105 + TMMFMessage& aMessage)
1.106 + {
1.107 + ASSERT(aMessage.Destination().InterfaceId() == KUidErrorConcealmentIntfc);
1.108 + TRAPD(error,DoHandleRequestL(aMessage));
1.109 + if(error)
1.110 + {
1.111 + aMessage.Complete(error);
1.112 + }
1.113 + }
1.114 +
1.115 +// ---------------------------------------------------------
1.116 +// CErrorConcealmentIntfcMsgHdlr::DoHandleRequestL
1.117 +// Determines which custom interface to call.
1.118 +// (other items were commented in a header).
1.119 +// ---------------------------------------------------------
1.120 +//
1.121 +void CErrorConcealmentIntfcMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
1.122 + {
1.123 + switch(aMessage.Function())
1.124 + {
1.125 + case EEcimConcealError:
1.126 + {
1.127 + DoConcealErrorForNextBufferL(aMessage);
1.128 + break;
1.129 + }
1.130 + case EEcimSetFrameMode:
1.131 + {
1.132 + DoSetFrameModeL(aMessage);
1.133 + break;
1.134 + }
1.135 + case EEcimFrameModeRqrd:
1.136 + {
1.137 + DoFrameModeRqrdForEcL(aMessage);
1.138 + break;
1.139 + }
1.140 + default:
1.141 + {
1.142 + aMessage.Complete(KErrNotSupported);
1.143 + }
1.144 + }
1.145 + }
1.146 +
1.147 +// ---------------------------------------------------------
1.148 +// CErrorConcealmentIntfcMsgHdlr::DoConcealErrorForNextBufferL
1.149 +// Handles the message from the proxy and calls the custom interface method.
1.150 +// (other items were commented in a header).
1.151 +// ---------------------------------------------------------
1.152 +//
1.153 +void CErrorConcealmentIntfcMsgHdlr::DoConcealErrorForNextBufferL(
1.154 + TMMFMessage& aMessage)
1.155 + {
1.156 + TInt status = iErrorConcealmentIntfcCI->ConcealErrorForNextBuffer();
1.157 + aMessage.Complete(status);
1.158 + }
1.159 +
1.160 +// ---------------------------------------------------------
1.161 +// CErrorConcealmentIntfcMsgHdlr::DoSetFrameModeL
1.162 +// Handles the message from the proxy and calls the custom interface method.
1.163 +// The data passed from the proxy is read from the message and passed to
1.164 +// the custom interface.
1.165 +// (other items were commented in a header).
1.166 +// ---------------------------------------------------------
1.167 +//
1.168 +void CErrorConcealmentIntfcMsgHdlr::DoSetFrameModeL(TMMFMessage& aMessage)
1.169 + {
1.170 + TPckgBuf<TBool> pckg;
1.171 + aMessage.ReadData1FromClientL(pckg);
1.172 + TInt status = iErrorConcealmentIntfcCI->SetFrameMode(pckg());
1.173 + aMessage.Complete(status);
1.174 + }
1.175 +
1.176 +// ---------------------------------------------------------
1.177 +// CErrorConcealmentIntfcMsgHdlr::DoFrameModeRqrdForEcL
1.178 +// Handles the message from the proxy and calls the custom interface method.
1.179 +// The custom interface returns the data requested and this function
1.180 +// writes it back to the proxy.
1.181 +// (other items were commented in a header).
1.182 +// ---------------------------------------------------------
1.183 +//
1.184 +void CErrorConcealmentIntfcMsgHdlr::DoFrameModeRqrdForEcL(TMMFMessage& aMessage)
1.185 + {
1.186 + TBool frameModeRqrd;
1.187 + TInt status = iErrorConcealmentIntfcCI->FrameModeRqrdForEC(frameModeRqrd);
1.188 + if (status == KErrNone)
1.189 + {
1.190 + TPckgBuf<TBool> pckg;
1.191 + pckg() = frameModeRqrd;
1.192 + aMessage.WriteDataToClientL(pckg);
1.193 + }
1.194 + aMessage.Complete(status);
1.195 + }
1.196 +
1.197 +// End of File