os/mm/devsoundextensions/mmfcustominterfaces/Ra8DecoderIntfc/Ra8DecoderIntfcProxy/src/ra8custominterfaceproxy.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsoundextensions/mmfcustominterfaces/Ra8DecoderIntfc/Ra8DecoderIntfcProxy/src/ra8custominterfaceproxy.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,167 @@
1.4 +/*
1.5 +* Copyright (c) 2002-2007 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: Custom Interface proxy for RA8 decoder.
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +// INCLUDE FILES
1.24 +#include <CustomCommandUtility.h>
1.25 +#include <CustomInterfaceUtility.h>
1.26 +#include <sounddevice.h>
1.27 +#include "Ra8CustomInterfaceProxy.h"
1.28 +#include "Ra8CustomInterfaceMsgs.h"
1.29 +
1.30 +// EXTERNAL DATA STRUCTURES
1.31 +
1.32 +// EXTERNAL FUNCTION PROTOTYPES
1.33 +
1.34 +// CONSTANTS
1.35 +
1.36 +// MACROS
1.37 +
1.38 +// LOCAL CONSTANTS AND MACROS
1.39 +
1.40 +// MODULE DATA STRUCTURES
1.41 +
1.42 +// LOCAL FUNCTION PROTOTYPES
1.43 +
1.44 +// FORWARD DECLARATIONS
1.45 +
1.46 +// ============================= LOCAL FUNCTIONS ===============================
1.47 +
1.48 +// ================= MEMBER FUNCTIONS =======================
1.49 +
1.50 +// -----------------------------------------------------------------------------
1.51 +// CRa8CustomInterfaceProxy::CRa8CustomInterfaceProxy
1.52 +// C++ default constructor can NOT contain any code, that
1.53 +// might leave.
1.54 +// -----------------------------------------------------------------------------
1.55 +//
1.56 +CRa8CustomInterfaceProxy::CRa8CustomInterfaceProxy(
1.57 + TMMFMessageDestinationPckg aMessageHandler,
1.58 + MCustomCommand& aCustomCommand,
1.59 + CCustomInterfaceUtility* aCustomInterfaceUtility) :
1.60 + iCustomCommand(aCustomCommand),
1.61 + iMessageHandler(aMessageHandler),
1.62 + iCustomInterfaceUtility(aCustomInterfaceUtility)
1.63 + {
1.64 + }
1.65 +
1.66 +
1.67 +// -----------------------------------------------------------------------------
1.68 +// CRa8CustomInterfaceProxy::ConstructL
1.69 +// Symbian 2nd phase constructor can leave.
1.70 +// -----------------------------------------------------------------------------
1.71 +//
1.72 +void CRa8CustomInterfaceProxy::ConstructL()
1.73 + {
1.74 + }
1.75 +
1.76 +// -----------------------------------------------------------------------------
1.77 +// CRa8CustomInterfaceProxy::NewL
1.78 +// Two-phased constructor.
1.79 +// -----------------------------------------------------------------------------
1.80 +//
1.81 +EXPORT_C CRa8CustomInterfaceProxy* CRa8CustomInterfaceProxy::NewL(
1.82 + TMMFMessageDestinationPckg aMessageHandler,
1.83 + MCustomCommand& aCustomCommand,
1.84 + CCustomInterfaceUtility* aCustomInterfaceUtility)
1.85 + {
1.86 + CRa8CustomInterfaceProxy* self = new(ELeave) CRa8CustomInterfaceProxy(
1.87 + aMessageHandler,
1.88 + aCustomCommand,
1.89 + aCustomInterfaceUtility);
1.90 + CleanupStack::PushL( self );
1.91 + self->ConstructL();
1.92 + CleanupStack::Pop(self);
1.93 + return self;
1.94 + }
1.95 +
1.96 +// -----------------------------------------------------------------------------
1.97 +// CRa8CustomInterfaceProxy::NewL
1.98 +// Two-phased constructor (overloaded version).
1.99 +// -----------------------------------------------------------------------------
1.100 +//
1.101 +EXPORT_C CRa8CustomInterfaceProxy* CRa8CustomInterfaceProxy::NewL(
1.102 + CMMFDevSound& aDevSound)
1.103 + {
1.104 + CRa8CustomInterfaceProxy* ra8CustomInterfaceProxy;
1.105 + ra8CustomInterfaceProxy =
1.106 + (CRa8CustomInterfaceProxy*)aDevSound.CustomInterface(KUidRa8DecHwDeviceCI);
1.107 +
1.108 + if (!ra8CustomInterfaceProxy)
1.109 + {
1.110 + User::Leave(KErrNotFound);
1.111 + }
1.112 +
1.113 + return ra8CustomInterfaceProxy;
1.114 + }
1.115 +
1.116 +// -----------------------------------------------------------------------------
1.117 +// Destructor
1.118 +// -----------------------------------------------------------------------------
1.119 +//
1.120 +EXPORT_C CRa8CustomInterfaceProxy::~CRa8CustomInterfaceProxy()
1.121 + {
1.122 + iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
1.123 + delete iCustomInterfaceUtility;
1.124 + }
1.125 +
1.126 +// -----------------------------------------------------------------------------
1.127 +// CRa8CustomInterfaceProxy::FrameNumber
1.128 +// Sends the custom command for this function to its message handler.
1.129 +// (other items were commented in a header).
1.130 +// -----------------------------------------------------------------------------
1.131 +//
1.132 +EXPORT_C TInt CRa8CustomInterfaceProxy::FrameNumber()
1.133 + {
1.134 + TInt frame = 0;
1.135 + TPckgBuf<TInt> frameBuf(frame);
1.136 + TInt status = iCustomCommand.CustomCommandSync(iMessageHandler,
1.137 + ERa8CiFrameNumber,
1.138 + KNullDesC8,
1.139 + KNullDesC8,
1.140 + frameBuf);
1.141 + if (status == KErrNone)
1.142 + {
1.143 + frame = frameBuf();
1.144 + }
1.145 + else
1.146 + {
1.147 + frame = status;
1.148 + }
1.149 +
1.150 + return frame;
1.151 + }
1.152 +
1.153 +// -----------------------------------------------------------------------------
1.154 +// CRa8CustomInterfaceProxy::SetInitString
1.155 +// Sends the custom command for this function to its message handler.
1.156 +// (other items were commented in a header).
1.157 +// -----------------------------------------------------------------------------
1.158 +//
1.159 +EXPORT_C TInt CRa8CustomInterfaceProxy::SetInitString(TDesC8& aInitString)
1.160 + {
1.161 + TInt status = iCustomCommand.CustomCommandSync(iMessageHandler,
1.162 + ERa8CiSetInitString,
1.163 + aInitString,
1.164 + KNullDesC8);
1.165 + return status;
1.166 + }
1.167 +
1.168 +// ========================== OTHER EXPORTED FUNCTIONS =========================
1.169 +
1.170 +// End of File