sl@0: /* sl@0: * Copyright (c) 2006 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: Interface proxy for BT SBC Encoder configuration CI. sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: // INCLUDE FILES sl@0: #include sl@0: #include sl@0: #include "SbcEncoderIntfcMsgs.h" sl@0: #include "SbcEncoderIntfcProxy.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: * CSbcEncoderIntfcProxy::CSbcEncoderIntfcProxy sl@0: * C++ default constructor can NOT contain any code, that might leave. sl@0: */ sl@0: CSbcEncoderIntfcProxy::CSbcEncoderIntfcProxy( 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: * CSbcEncoderIntfcProxy::ConstructL sl@0: * Symbian 2nd phase constructor can leave. sl@0: */ sl@0: void CSbcEncoderIntfcProxy::ConstructL() sl@0: { sl@0: iHasBeenApplied = EFalse; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::NewL sl@0: * Two-phased constructor. sl@0: */ sl@0: EXPORT_C CSbcEncoderIntfcProxy* CSbcEncoderIntfcProxy::NewL( sl@0: TMMFMessageDestinationPckg aMessageHandler, sl@0: MCustomCommand& aCustomCommand, sl@0: CCustomInterfaceUtility* aCustomInterfaceUtility) sl@0: { sl@0: CSbcEncoderIntfcProxy* self = new(ELeave) CSbcEncoderIntfcProxy( 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: * Destructor sl@0: */ sl@0: EXPORT_C CSbcEncoderIntfcProxy::~CSbcEncoderIntfcProxy() sl@0: { sl@0: iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler); sl@0: delete iCustomInterfaceUtility; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedSamplingFrequencies sl@0: * Returns an array of supported sampling frequencies. sl@0: * Calls a subfunction, which sends the appropriate custom command sl@0: * to its message handler. A subfunction is used to contain multiple sl@0: * leaving functions in a single trap. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedSamplingFrequencies( sl@0: RArray& sl@0: aSupportedSamplingFrequencies) sl@0: { sl@0: TRAPD(status, sl@0: GetSupportedSamplingFrequenciesL(aSupportedSamplingFrequencies)); sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedSamplingFrequenciesL sl@0: * Returns an array of supported sampling frequencies. sl@0: * Sends the custom command for this function to its message handler. This sl@0: * requires two commands. The first is a request for the number of supported sl@0: * sampling frequencies. A buffer is allocated locally to hold this number of sl@0: * frequencies that will be returned. A pointer to this buffer is sent with the sl@0: * next command, which is a request for the frequencies. This buffer will be sl@0: * filled with the frequency values. These values are then copied into the sl@0: * array provided to this function and the local buffer is deleted. sl@0: * (other items were commented in a header). sl@0: */ sl@0: void CSbcEncoderIntfcProxy::GetSupportedSamplingFrequenciesL( sl@0: RArray& aSupportedSamplingFrequencies) sl@0: { sl@0: aSupportedSamplingFrequencies.Reset(); sl@0: sl@0: TPckgBuf pckgBuf; sl@0: User::LeaveIfError(iCustomCommand.CustomCommandSync( sl@0: iMessageHandler, sl@0: ESbceimGetNumOfSupportedSamplingFrequencies, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: pckgBuf)); sl@0: sl@0: HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint)); sl@0: TPtr8 ptr = buf->Des(); sl@0: sl@0: User::LeaveIfError(iCustomCommand.CustomCommandSync( sl@0: iMessageHandler, sl@0: ESbceimGetSupportedSamplingFrequencies, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: ptr)); sl@0: sl@0: PopulateArrayL(aSupportedSamplingFrequencies, ptr, pckgBuf()); sl@0: CleanupStack::PopAndDestroy(buf); sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedChannelModes sl@0: * Returns an array of supported channel modes. sl@0: * Calls a subfunction which sends the appropriate custom command to its sl@0: * message handler. A subfunction is used to contain multiple leaving sl@0: * functions for a single trap. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedChannelModes( sl@0: RArray& sl@0: aSupportedChannelModes) sl@0: { sl@0: TRAPD(status, GetSupportedChannelModesL(aSupportedChannelModes)); sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedChannelModesL sl@0: * Returns an array of supported channel modes. sl@0: * Sends the custom command for this function to its message handler. This sl@0: * requires two commands. The first is a request for the number of supported sl@0: * channel modes. A buffer is allocated locally to hold this number of channel sl@0: * modes that will be returned. A pointer to this buffer is sent with the next sl@0: * command, which is a request for the channel modes. This buffer will be sl@0: * filled with the frequency values. These values are then copied into the array sl@0: * provided to this function and the local buffer is deleted. sl@0: * (other items were commented in a header). sl@0: */ sl@0: void CSbcEncoderIntfcProxy::GetSupportedChannelModesL( sl@0: RArray& aSupportedChannelModes) sl@0: { sl@0: aSupportedChannelModes.Reset(); sl@0: sl@0: TPckgBuf pckgBuf; sl@0: User::LeaveIfError(iCustomCommand.CustomCommandSync( sl@0: iMessageHandler, sl@0: ESbceimGetNumOfSupportedChannelModes, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: pckgBuf)); sl@0: sl@0: HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint)); sl@0: TPtr8 ptr = buf->Des(); sl@0: User::LeaveIfError(iCustomCommand.CustomCommandSync( sl@0: iMessageHandler, sl@0: ESbceimGetSupportedChannelModes, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: ptr)); sl@0: sl@0: RDesReadStream stream(ptr); sl@0: CleanupClosePushL(stream); sl@0: sl@0: for (TInt i = 0; i < pckgBuf(); i++) sl@0: { sl@0: aSupportedChannelModes.AppendL( sl@0: static_cast(stream.ReadUint32L())); sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(&stream); sl@0: CleanupStack::PopAndDestroy(buf); sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks sl@0: * Returns an array of supported blocks. sl@0: * Calls a subfunction, which sends the appropriate custom command to its sl@0: * message handler. A subfunction is used to contain multiple leaving functions sl@0: * for a single trap. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks( sl@0: RArray& aSupportedNumOfBlocks) sl@0: { sl@0: TRAPD(status, GetSupportedNumOfBlocksL(aSupportedNumOfBlocks)); sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks sl@0: * Returns an array of supported blocks. sl@0: * Sends the custom command for this function to its message handler. This sl@0: * requires two commands. The first is a request for the number of supported sl@0: * blocks. A buffer is allocated locally to hold this number of blocks that sl@0: * will be returned. A pointer to this buffer is then sent with the next sl@0: * command, which is a request for the blocks. This buffer will be filled sl@0: * with the block values. These values are then copied into the array provided sl@0: * to this function and the local buffer is deleted. sl@0: * (other items were commented in a header). sl@0: */ sl@0: void CSbcEncoderIntfcProxy::GetSupportedNumOfBlocksL( sl@0: RArray& aSupportedNumOfBlocks) sl@0: { sl@0: aSupportedNumOfBlocks.Reset(); sl@0: sl@0: TPckgBuf pckgBuf; sl@0: User::LeaveIfError(iCustomCommand.CustomCommandSync( sl@0: iMessageHandler, sl@0: ESbceimGetNumOfSupportedBlocks, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: pckgBuf)); sl@0: sl@0: HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint)); sl@0: TPtr8 ptr = buf->Des(); sl@0: User::LeaveIfError(iCustomCommand.CustomCommandSync( sl@0: iMessageHandler, sl@0: ESbceimGetSupportedBlocks, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: ptr)); sl@0: sl@0: PopulateArrayL(aSupportedNumOfBlocks, ptr, pckgBuf()); sl@0: CleanupStack::PopAndDestroy(buf); sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedNumOfSubbands sl@0: * Returns an array of supported subbands. sl@0: * Calls a subfunction which sends the appropriate custom command to its sl@0: * message handler. A subfunction is used to contain multiple leaving functions sl@0: * for a single trap. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedNumOfSubbands( sl@0: RArray& aSupportedNumOfSubbands) sl@0: { sl@0: TRAPD(status, GetSupportedNumOfSubbandsL(aSupportedNumOfSubbands)); sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedNumOfSubbandsL sl@0: * Returns an array of supported subbands. sl@0: * Sends the custom command for this function to its message handler. This sl@0: * requires two commands. The first is a request for the number of supported sl@0: * subbands. A buffer is allocated locally to hold this number of subbands that sl@0: * will be returned. A pointer to this buffer is sent with the next command, sl@0: * which is a request for the subbands. This buffer will be filled with the sl@0: * subband values. These values are then copied into the array provided to this sl@0: * function and the local buffer is deleted. sl@0: * (other items were commented in a header). sl@0: */ sl@0: void CSbcEncoderIntfcProxy::GetSupportedNumOfSubbandsL( sl@0: RArray& aSupportedNumOfSubbands) sl@0: { sl@0: aSupportedNumOfSubbands.Reset(); sl@0: sl@0: TPckgBuf pckgBuf; sl@0: User::LeaveIfError(iCustomCommand.CustomCommandSync( sl@0: iMessageHandler, sl@0: ESbceimGetNumOfSupportedNumOfSubbands, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: pckgBuf)); sl@0: sl@0: HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint)); sl@0: TPtr8 ptr = buf->Des(); sl@0: User::LeaveIfError(iCustomCommand.CustomCommandSync( sl@0: iMessageHandler, sl@0: ESbceimGetSupportedNumOfSubbands, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: ptr)); sl@0: sl@0: PopulateArrayL(aSupportedNumOfSubbands, ptr, pckgBuf()); sl@0: CleanupStack::PopAndDestroy(buf); sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedAllocationMethods sl@0: * Returns an array of supported allocation methods. sl@0: * Calls a subfunction which sends the appropriate custom command to its sl@0: * message handler. A subfunction is used to contain multiple leaving sl@0: * functions for a single trap. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedAllocationMethods( sl@0: RArray& sl@0: aSupportedAllocationMethods) sl@0: { sl@0: TRAPD(status, GetSupportedAllocationMethodsL(aSupportedAllocationMethods)); sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedAllocationMethodsL sl@0: * Returns an array of supported allocation methods. sl@0: * Sends the custom command for this function to its message handler. This sl@0: * requires two commands. The first is a request for the number of supported sl@0: * allocation methods. A buffer is allocated locally to hold this number of sl@0: * allocation methods that will be returned. A pointer to this buffer is sent sl@0: * with the next command which is a request for the allocation methods. This sl@0: * buffer will be filled with the allocation method values. These values are sl@0: * then copied into the array provided to this function and the local buffer sl@0: * is deleted. sl@0: * (other items were commented in a header). sl@0: */ sl@0: void CSbcEncoderIntfcProxy::GetSupportedAllocationMethodsL( sl@0: RArray& sl@0: aSupportedAllocationMethods) sl@0: { sl@0: aSupportedAllocationMethods.Reset(); sl@0: sl@0: TPckgBuf pckgBuf; sl@0: User::LeaveIfError(iCustomCommand.CustomCommandSync( sl@0: iMessageHandler, sl@0: ESbceimGetNumOfSupportedAllocationMethods, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: pckgBuf)); sl@0: sl@0: HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint)); sl@0: TPtr8 ptr = buf->Des(); sl@0: User::LeaveIfError(iCustomCommand.CustomCommandSync( sl@0: iMessageHandler, sl@0: ESbceimGetSupportedAllocationMethods, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: ptr)); sl@0: sl@0: RDesReadStream stream(ptr); sl@0: CleanupClosePushL(stream); sl@0: sl@0: for (TInt i = 0; i < pckgBuf(); i++) sl@0: { sl@0: aSupportedAllocationMethods.AppendL( sl@0: static_cast(stream.ReadUint32L())); sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(&stream); sl@0: CleanupStack::PopAndDestroy(buf); sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedBitpoolRange sl@0: * Returns supported bitpool range. sl@0: * Calls a subfunction which sends the appropriate custom command to its sl@0: * message handler. A subfunction is used to contain multiple leaving sl@0: * functions for a single trap. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedBitpoolRange( sl@0: TUint& aMinSupportedBitpoolSize, sl@0: TUint& aMaxSupportedBitpoolSize) sl@0: { sl@0: TRAPD(status, GetSupportedBitpoolRangeL(aMinSupportedBitpoolSize, sl@0: aMaxSupportedBitpoolSize)); sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSupportedBitpoolRangeL sl@0: * Returns an array of supported bitpool range. sl@0: * Sends the custom command for this function to its message handler with TUint sl@0: * type arguments that will be filled with the bitpool min and max values. sl@0: * (other items were commented in a header). sl@0: */ sl@0: void CSbcEncoderIntfcProxy::GetSupportedBitpoolRangeL( sl@0: TUint& aMinSupportedBitpoolSize, sl@0: TUint& aMaxSupportedBitpoolSize) sl@0: { sl@0: TSbcEncoderBitpoolRange bitPoolRange; sl@0: bitPoolRange.iMinSupportedBitpoolSize = 0; sl@0: bitPoolRange.iMaxSupportedBitpoolSize = 0; sl@0: sl@0: TPckgBuf pckgBuf(bitPoolRange); sl@0: User::LeaveIfError(iCustomCommand.CustomCommandSync( sl@0: iMessageHandler, sl@0: ESbceimGetSupportedBitpoolRange, sl@0: KNullDesC8, sl@0: KNullDesC8, sl@0: pckgBuf)); sl@0: sl@0: aMinSupportedBitpoolSize = pckgBuf().iMinSupportedBitpoolSize; sl@0: aMaxSupportedBitpoolSize = pckgBuf().iMaxSupportedBitpoolSize; sl@0: } sl@0: sl@0: /* sl@0: * CSbcEncoderIntfcProxy::ApplyConfig sl@0: * Commits encoder configuration settings configured by callas to Set() APIs. sl@0: * Sends the custom command for this function to its message handler. sl@0: * New settings will not take effect until ApplyConfig() is called. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::ApplyConfig() sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (!iHasBeenApplied) sl@0: { sl@0: if (!iSbcEncConf.iSamplingFrequencySet || sl@0: !iSbcEncConf.iChannelModeSet || sl@0: !iSbcEncConf.iNumOfSubbandsSet || sl@0: !iSbcEncConf.iNumOfBlocksSet || sl@0: !iSbcEncConf.iAllocationMethodSet || sl@0: !iSbcEncConf.iBitpoolSizeSet) sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: } sl@0: sl@0: if (status == KErrNone) sl@0: { sl@0: TSbcEncoderConfig sbcEncoderConfig; sl@0: sl@0: sbcEncoderConfig.iSamplingFrequency = iSbcEncConf.iSamplingFrequency; sl@0: sbcEncoderConfig.iChannelMode = iSbcEncConf.iChannelMode; sl@0: sbcEncoderConfig.iNumOfSubbands = iSbcEncConf.iNumOfSubbands; sl@0: sbcEncoderConfig.iNumOfBlocks = iSbcEncConf.iNumOfBlocks; sl@0: sbcEncoderConfig.iAllocationMethod = iSbcEncConf.iAllocationMethod; sl@0: sbcEncoderConfig.iBitpoolSize = iSbcEncConf.iBitpoolSize; sl@0: sl@0: TPckgBuf pckgBuf(sbcEncoderConfig); sl@0: status = iCustomCommand.CustomCommandSync(iMessageHandler, sl@0: ESbceimApplyConfig, sl@0: pckgBuf, sl@0: KNullDesC8); sl@0: if (status == KErrNone) sl@0: { sl@0: iSbcEncConfCurrent = iSbcEncConf; sl@0: iHasBeenApplied = ETrue; sl@0: } sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::SetSamplingFrequency sl@0: * Saves locally requested sampling frequency. sl@0: * Change does not apply to the encoder until ApplyConfig() is called. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C void CSbcEncoderIntfcProxy::SetSamplingFrequency( sl@0: TUint aSamplingFrequency) sl@0: { sl@0: iSbcEncConf.iSamplingFrequency = aSamplingFrequency; sl@0: iSbcEncConf.iSamplingFrequencySet = ETrue; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetSamplingFrequency sl@0: * Returns current sampling frequency commited by call to ApplyConfig(). sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetSamplingFrequency( sl@0: TUint& aSamplingFrequency) sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (iHasBeenApplied) sl@0: { sl@0: aSamplingFrequency = iSbcEncConfCurrent.iSamplingFrequency; sl@0: } sl@0: else sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::SetChannelMode sl@0: * Saves locally requested channel mode. sl@0: * Change does not apply to the encoder until ApplyConfig() is called. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C void CSbcEncoderIntfcProxy::SetChannelMode( sl@0: TSbcChannelMode aChannelMode) sl@0: { sl@0: iSbcEncConf.iChannelMode = aChannelMode; sl@0: iSbcEncConf.iChannelModeSet = ETrue; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetChannelMode sl@0: * Returns current channel mode commited by call to ApplyConfig(). sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetChannelMode( sl@0: TSbcChannelMode& aChannelMode) sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (iHasBeenApplied) sl@0: { sl@0: aChannelMode = iSbcEncConfCurrent.iChannelMode; sl@0: } sl@0: else sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::SetNumOfSubbands sl@0: * Saves locally requested number of subbands. sl@0: * Change does not apply to the encoder until ApplyConfig() is called. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C void CSbcEncoderIntfcProxy::SetNumOfSubbands(TUint aNumOfSubbands) sl@0: { sl@0: iSbcEncConf.iNumOfSubbands = aNumOfSubbands; sl@0: iSbcEncConf.iNumOfSubbandsSet = ETrue; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetNumOfSubbands sl@0: * Returns current number of subbands commited by call to ApplyConfig(). sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetNumOfSubbands(TUint& aNumOfSubbands) sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (iHasBeenApplied) sl@0: { sl@0: aNumOfSubbands = iSbcEncConfCurrent.iNumOfSubbands; sl@0: } sl@0: else sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::SetNumOfBlocks sl@0: * Saves locally requested number of blocks. sl@0: * Change does not apply to the encoder until ApplyConfig() is called. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C void CSbcEncoderIntfcProxy::SetNumOfBlocks(TUint aNumOfBlocks) sl@0: { sl@0: iSbcEncConf.iNumOfBlocks = aNumOfBlocks; sl@0: iSbcEncConf.iNumOfBlocksSet = ETrue; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetNumOfBlocks sl@0: * Returns current number of blocks commited by call to ApplyConfig(). sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetNumOfBlocks(TUint& aNumOfBlocks) sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (iHasBeenApplied) sl@0: { sl@0: aNumOfBlocks = iSbcEncConfCurrent.iNumOfBlocks; sl@0: } sl@0: else sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::SetAllocationMethod sl@0: * Saves locally requested allocation method. sl@0: * Change does not apply to the encoder until ApplyConfig() is called. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C void CSbcEncoderIntfcProxy::SetAllocationMethod( sl@0: TSbcAllocationMethod aAllocationMethod) sl@0: { sl@0: iSbcEncConf.iAllocationMethod = aAllocationMethod; sl@0: iSbcEncConf.iAllocationMethodSet = ETrue; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetAllocationMethod sl@0: * Returns current allocation method commited by call to ApplyConfig(). sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetAllocationMethod( sl@0: TSbcAllocationMethod& aAllocationMethod) sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (iHasBeenApplied) sl@0: { sl@0: aAllocationMethod = iSbcEncConfCurrent.iAllocationMethod; sl@0: } sl@0: else sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::SetBitpoolSize sl@0: * Saves locally requested bitpool range. sl@0: * Change does not apply to the encoder until ApplyConfig() is called. sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C void CSbcEncoderIntfcProxy::SetBitpoolSize(TUint aBitpoolSize) sl@0: { sl@0: iSbcEncConf.iBitpoolSize = aBitpoolSize; sl@0: iSbcEncConf.iBitpoolSizeSet = ETrue; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::GetBitpoolSize sl@0: * Returns current bitpool range commited by call to ApplyConfig(). sl@0: * (other items were commented in a header). sl@0: */ sl@0: EXPORT_C TInt CSbcEncoderIntfcProxy::GetBitpoolSize(TUint& aBitpoolSize) sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (iHasBeenApplied) sl@0: { sl@0: aBitpoolSize = iSbcEncConfCurrent.iBitpoolSize; sl@0: } sl@0: else sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * CSbcEncoderIntfcProxy::PopulateArrayL sl@0: * Utility method that reads stream from 8-bit descriptor, converts it sl@0: * to TUint data items and then copies them to the aArray. sl@0: * (other items were commented in a header). sl@0: */ sl@0: void CSbcEncoderIntfcProxy::PopulateArrayL(RArray& aArray, sl@0: TPtr8 aPtr, sl@0: TUint aCount) sl@0: { sl@0: RDesReadStream stream(aPtr); sl@0: CleanupClosePushL(stream); sl@0: sl@0: for (TInt i = 0; i < aCount; i++) sl@0: { sl@0: aArray.AppendL(stream.ReadUint32L()); sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(&stream); sl@0: } sl@0: sl@0: // ========================== OTHER EXPORTED FUNCTIONS ========================= sl@0: sl@0: // End of File