os/mm/devsoundextensions/mmfcustominterfaces/Ra8DecoderIntfc/Ra8DecoderIntfcProxy/src/ra8custominterfaceproxy.cpp
First public contribution.
2 * Copyright (c) 2002-2007 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: Custom Interface proxy for RA8 decoder.
21 #include <CustomCommandUtility.h>
22 #include <CustomInterfaceUtility.h>
23 #include <sounddevice.h>
24 #include "Ra8CustomInterfaceProxy.h"
25 #include "Ra8CustomInterfaceMsgs.h"
27 // EXTERNAL DATA STRUCTURES
29 // EXTERNAL FUNCTION PROTOTYPES
35 // LOCAL CONSTANTS AND MACROS
37 // MODULE DATA STRUCTURES
39 // LOCAL FUNCTION PROTOTYPES
41 // FORWARD DECLARATIONS
43 // ============================= LOCAL FUNCTIONS ===============================
45 // ================= MEMBER FUNCTIONS =======================
47 // -----------------------------------------------------------------------------
48 // CRa8CustomInterfaceProxy::CRa8CustomInterfaceProxy
49 // C++ default constructor can NOT contain any code, that
51 // -----------------------------------------------------------------------------
53 CRa8CustomInterfaceProxy::CRa8CustomInterfaceProxy(
54 TMMFMessageDestinationPckg aMessageHandler,
55 MCustomCommand& aCustomCommand,
56 CCustomInterfaceUtility* aCustomInterfaceUtility) :
57 iCustomCommand(aCustomCommand),
58 iMessageHandler(aMessageHandler),
59 iCustomInterfaceUtility(aCustomInterfaceUtility)
64 // -----------------------------------------------------------------------------
65 // CRa8CustomInterfaceProxy::ConstructL
66 // Symbian 2nd phase constructor can leave.
67 // -----------------------------------------------------------------------------
69 void CRa8CustomInterfaceProxy::ConstructL()
73 // -----------------------------------------------------------------------------
74 // CRa8CustomInterfaceProxy::NewL
75 // Two-phased constructor.
76 // -----------------------------------------------------------------------------
78 EXPORT_C CRa8CustomInterfaceProxy* CRa8CustomInterfaceProxy::NewL(
79 TMMFMessageDestinationPckg aMessageHandler,
80 MCustomCommand& aCustomCommand,
81 CCustomInterfaceUtility* aCustomInterfaceUtility)
83 CRa8CustomInterfaceProxy* self = new(ELeave) CRa8CustomInterfaceProxy(
86 aCustomInterfaceUtility);
87 CleanupStack::PushL( self );
89 CleanupStack::Pop(self);
93 // -----------------------------------------------------------------------------
94 // CRa8CustomInterfaceProxy::NewL
95 // Two-phased constructor (overloaded version).
96 // -----------------------------------------------------------------------------
98 EXPORT_C CRa8CustomInterfaceProxy* CRa8CustomInterfaceProxy::NewL(
99 CMMFDevSound& aDevSound)
101 CRa8CustomInterfaceProxy* ra8CustomInterfaceProxy;
102 ra8CustomInterfaceProxy =
103 (CRa8CustomInterfaceProxy*)aDevSound.CustomInterface(KUidRa8DecHwDeviceCI);
105 if (!ra8CustomInterfaceProxy)
107 User::Leave(KErrNotFound);
110 return ra8CustomInterfaceProxy;
113 // -----------------------------------------------------------------------------
115 // -----------------------------------------------------------------------------
117 EXPORT_C CRa8CustomInterfaceProxy::~CRa8CustomInterfaceProxy()
119 iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
120 delete iCustomInterfaceUtility;
123 // -----------------------------------------------------------------------------
124 // CRa8CustomInterfaceProxy::FrameNumber
125 // Sends the custom command for this function to its message handler.
126 // (other items were commented in a header).
127 // -----------------------------------------------------------------------------
129 EXPORT_C TInt CRa8CustomInterfaceProxy::FrameNumber()
132 TPckgBuf<TInt> frameBuf(frame);
133 TInt status = iCustomCommand.CustomCommandSync(iMessageHandler,
138 if (status == KErrNone)
150 // -----------------------------------------------------------------------------
151 // CRa8CustomInterfaceProxy::SetInitString
152 // Sends the custom command for this function to its message handler.
153 // (other items were commented in a header).
154 // -----------------------------------------------------------------------------
156 EXPORT_C TInt CRa8CustomInterfaceProxy::SetInitString(TDesC8& aInitString)
158 TInt status = iCustomCommand.CustomCommandSync(iMessageHandler,
165 // ========================== OTHER EXPORTED FUNCTIONS =========================