os/mm/devsoundextensions/mmfcustominterfaces/G729DecoderIntfc/G729DecoderIntfcMsgHdlr/src/G729DecoderIntfcMsgHdlr.cpp
First public contribution.
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 G729 decoder interface
21 #include "G729DecoderIntfcMsgHdlr.h"
22 #include "G729DecoderIntfcMsgs.h"
23 #include <G729DecoderIntfc.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 // CG729DecoderIntfcMsgHdlr::CG729DecoderIntfcMsgHdlr
47 // C++ default constructor can NOT contain any code, that
49 // -----------------------------------------------------------------------------
51 CG729DecoderIntfcMsgHdlr::CG729DecoderIntfcMsgHdlr(
52 CG729DecoderIntfc* aG729DecoderIntfcCI) :
53 CMMFObject(KUidG729DecoderIntfc)
55 iG729DecoderIntfcCI = aG729DecoderIntfcCI;
58 // -----------------------------------------------------------------------------
59 // CG729DecoderIntfcMsgHdlr::ConstructL
60 // Symbian 2nd phase constructor can leave.
61 // -----------------------------------------------------------------------------
63 void CG729DecoderIntfcMsgHdlr::ConstructL()
67 // -----------------------------------------------------------------------------
68 // CG729DecoderIntfcMsgHdlr::NewL
69 // Two-phased constructor.
70 // -----------------------------------------------------------------------------
72 EXPORT_C CG729DecoderIntfcMsgHdlr* CG729DecoderIntfcMsgHdlr::NewL(
73 TAny* aG729DecoderIntfcCI)
75 CG729DecoderIntfc* errorConcealmentIntfcCI =
76 (CG729DecoderIntfc*)aG729DecoderIntfcCI;
77 CG729DecoderIntfcMsgHdlr* self =
78 new (ELeave) CG729DecoderIntfcMsgHdlr(errorConcealmentIntfcCI);
79 CleanupStack::PushL( self );
81 CleanupStack::Pop( self );
87 EXPORT_C CG729DecoderIntfcMsgHdlr::~CG729DecoderIntfcMsgHdlr()
89 delete iG729DecoderIntfcCI;
92 // ---------------------------------------------------------
93 // CG729DecoderIntfcMsgHdlr::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 CG729DecoderIntfcMsgHdlr::HandleRequest(
102 TMMFMessage& aMessage)
104 ASSERT(aMessage.Destination().InterfaceId() == KUidG729DecoderIntfc);
105 TRAPD(error,DoHandleRequestL(aMessage));
108 aMessage.Complete(error);
112 // ---------------------------------------------------------
113 // CG729DecoderIntfcMsgHdlr::DoHandleRequestL
114 // Determines which custom interface to call.
115 // (other items were commented in a header).
116 // ---------------------------------------------------------
118 void CG729DecoderIntfcMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
120 switch(aMessage.Function())
122 case EG729dimBadLsfNextBuffer:
124 DoBadLsfNextBufferL(aMessage);
129 aMessage.Complete(KErrNotSupported);
134 // ---------------------------------------------------------
135 // CG729DecoderIntfcMsgHdlr::DoBadLsfNextBufferL
136 // Handles the message from the proxy and calls the custom interface method.
137 // The data passed from the proxy is read from the message and passed to
138 // the custom interface.
139 // (other items were commented in a header).
140 // ---------------------------------------------------------
142 void CG729DecoderIntfcMsgHdlr::DoBadLsfNextBufferL(TMMFMessage& aMessage)
144 TInt status = iG729DecoderIntfcCI->BadLsfNextBuffer();
145 aMessage.Complete(status);