sl@0: /* sl@0: * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: Custom Interface proxy for RA8 decoder. sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: // INCLUDE FILES sl@0: #include sl@0: #include sl@0: #include sl@0: #include "Ra8CustomInterfaceProxy.h" sl@0: #include "Ra8CustomInterfaceMsgs.h" sl@0: sl@0: // EXTERNAL DATA STRUCTURES sl@0: sl@0: // EXTERNAL FUNCTION PROTOTYPES sl@0: sl@0: // CONSTANTS sl@0: sl@0: // MACROS sl@0: sl@0: // LOCAL CONSTANTS AND MACROS sl@0: sl@0: // MODULE DATA STRUCTURES sl@0: sl@0: // LOCAL FUNCTION PROTOTYPES sl@0: sl@0: // FORWARD DECLARATIONS sl@0: sl@0: // ============================= LOCAL FUNCTIONS =============================== sl@0: sl@0: // ================= MEMBER FUNCTIONS ======================= sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRa8CustomInterfaceProxy::CRa8CustomInterfaceProxy sl@0: // C++ default constructor can NOT contain any code, that sl@0: // might leave. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: CRa8CustomInterfaceProxy::CRa8CustomInterfaceProxy( sl@0: TMMFMessageDestinationPckg aMessageHandler, sl@0: MCustomCommand& aCustomCommand, sl@0: CCustomInterfaceUtility* aCustomInterfaceUtility) : sl@0: iCustomCommand(aCustomCommand), sl@0: iMessageHandler(aMessageHandler), sl@0: iCustomInterfaceUtility(aCustomInterfaceUtility) sl@0: { sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRa8CustomInterfaceProxy::ConstructL sl@0: // Symbian 2nd phase constructor can leave. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CRa8CustomInterfaceProxy::ConstructL() sl@0: { sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRa8CustomInterfaceProxy::NewL sl@0: // Two-phased constructor. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRa8CustomInterfaceProxy* CRa8CustomInterfaceProxy::NewL( sl@0: TMMFMessageDestinationPckg aMessageHandler, sl@0: MCustomCommand& aCustomCommand, sl@0: CCustomInterfaceUtility* aCustomInterfaceUtility) sl@0: { sl@0: CRa8CustomInterfaceProxy* self = new(ELeave) CRa8CustomInterfaceProxy( sl@0: aMessageHandler, sl@0: aCustomCommand, sl@0: aCustomInterfaceUtility); sl@0: CleanupStack::PushL( self ); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRa8CustomInterfaceProxy::NewL sl@0: // Two-phased constructor (overloaded version). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRa8CustomInterfaceProxy* CRa8CustomInterfaceProxy::NewL( sl@0: CMMFDevSound& aDevSound) sl@0: { sl@0: CRa8CustomInterfaceProxy* ra8CustomInterfaceProxy; sl@0: ra8CustomInterfaceProxy = sl@0: (CRa8CustomInterfaceProxy*)aDevSound.CustomInterface(KUidRa8DecHwDeviceCI); sl@0: sl@0: if (!ra8CustomInterfaceProxy) sl@0: { sl@0: User::Leave(KErrNotFound); sl@0: } sl@0: sl@0: return ra8CustomInterfaceProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Destructor sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRa8CustomInterfaceProxy::~CRa8CustomInterfaceProxy() sl@0: { sl@0: iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler); sl@0: delete iCustomInterfaceUtility; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRa8CustomInterfaceProxy::FrameNumber sl@0: // Sends the custom command for this function to its message handler. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt CRa8CustomInterfaceProxy::FrameNumber() sl@0: { sl@0: TInt frame = 0; sl@0: TPckgBuf frameBuf(frame); sl@0: TInt status = iCustomCommand.CustomCommandSync(iMessageHandler, sl@0: ERa8CiFrameNumber, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: frameBuf); sl@0: if (status == KErrNone) sl@0: { sl@0: frame = frameBuf(); sl@0: } sl@0: else sl@0: { sl@0: frame = status; sl@0: } sl@0: sl@0: return frame; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRa8CustomInterfaceProxy::SetInitString sl@0: // Sends the custom command for this function to its message handler. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt CRa8CustomInterfaceProxy::SetInitString(TDesC8& aInitString) sl@0: { sl@0: TInt status = iCustomCommand.CustomCommandSync(iMessageHandler, sl@0: ERa8CiSetInitString, sl@0: aInitString, sl@0: KNullDesC8); sl@0: return status; sl@0: } sl@0: sl@0: // ========================== OTHER EXPORTED FUNCTIONS ========================= sl@0: sl@0: // End of File