sl@0: /* sl@0: * Copyright (c) 2005-2009 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: sl@0: * sl@0: */ sl@0: sl@0: /** sl@0: @test sl@0: @internalComponent sl@0: sl@0: This contains CT_MdaDevSoundData sl@0: */ sl@0: sl@0: // User includes sl@0: #include "t_mdadevsounddata.h" sl@0: #include "t_sounddriverserver.h" sl@0: sl@0: /*@{*/ sl@0: /// Parameters sl@0: sl@0: _LIT(KSoundFormatsSupportedObject, "SoundFormatsSupportedObject"); sl@0: _LIT(KCurrentSoundFormatObject, "CurrentSoundFormatObject"); sl@0: sl@0: _LIT(KUUnit, "unit"); sl@0: _LIT(KUUnitEnum, "UnitEnum"); sl@0: _LIT(KUToFile, "to_file"); sl@0: _LIT(KUBlockSize, "block_size"); sl@0: _LIT(KUVersion, "version"); sl@0: sl@0: _LIT(KUFromFile, "from_file"); sl@0: _LIT(KUDataSize, "data_size"); sl@0: _LIT(KUVolumeExpected, "volume_expected"); sl@0: _LIT(KUVolume, "volume"); sl@0: _LIT(KUBytesPlayed, "bytes_played"); sl@0: _LIT(KUCancel, "cancel"); sl@0: _LIT(KUFlush, "flush"); sl@0: sl@0: _LIT(KUSoundLevel, "sound_level"); sl@0: _LIT(KUSoundLevelExpected, "sound_level_expected"); sl@0: sl@0: _LIT(KUFileToDelete, "file_to_delete"); sl@0: sl@0: _LIT(KLDDName, "ldd"); sl@0: _LIT(KPDDName, "pdd"); sl@0: sl@0: sl@0: sl@0: /*@{*/ sl@0: /// Commands sl@0: _LIT(KCmdUtilityDeleteFile, "utilityDeleteFile"); sl@0: sl@0: _LIT(KCmdRecordData, "RecordData"); sl@0: _LIT(KCmdCancelRecordData, "CancelRecordData"); sl@0: _LIT(KCmdFlushRecordBuffer, "FlushRecordBuffer"); sl@0: _LIT(KCmdRecordLevel, "RecordLevel"); sl@0: _LIT(KCmdSetRecordLevel, "SetRecordLevel"); sl@0: _LIT(KCmdNotifyRecordError, "NotifyRecordError"); sl@0: _LIT(KCmdCancelNotifyRecordError, "CancelNotifyRecordError"); sl@0: sl@0: _LIT(KCmdPlayVolume, "PlayVolume"); sl@0: _LIT(KCmdSetPlayVolume, "SetPlayVolume"); sl@0: _LIT(KCmdPlayData, "PlayData"); sl@0: _LIT(KCmdCancelPlayData, "CancelPlayData"); sl@0: _LIT(KCmdFlushPlayBuffer, "FlushPlayBuffer"); sl@0: _LIT(KCmdNotifyPlayError, "NotifyPlayError"); sl@0: _LIT(KCmdCancelNotifyPlayError, "CancelNotifyPlayError"); sl@0: sl@0: _LIT(KCmdBytesPlayed, "BytesPlayed"); sl@0: _LIT(KCmdResetBytesPlayed, "ResetBytesPlayed"); sl@0: _LIT(KCmdPausePlayBuffer, "PausePlayBuffer"); sl@0: _LIT(KCmdResumePlaying, "ResumePlaying"); sl@0: sl@0: _LIT(KCmdPlayFormatsSupported, "PlayFormatsSupported"); sl@0: _LIT(KCmdGetPlayFormat, "GetPlayFormat"); sl@0: _LIT(KCmdSetPlayFormat, "SetPlayFormat"); sl@0: _LIT(KCmdRecordFormatsSupported, "RecordFormatsSupported"); sl@0: _LIT(KCmdGetRecordFormat, "GetRecordFormat"); sl@0: _LIT(KCmdSetRecordFormat, "SetRecordFormat"); sl@0: sl@0: _LIT(KCmdNew, "new"); sl@0: _LIT(KCmdOpen, "Open"); sl@0: _LIT(KCmdClose, "Close"); sl@0: _LIT(KCmdDestructor, "~"); sl@0: _LIT(KCmdIsMdaSound, "IsMdaSound"); sl@0: _LIT(KCmdVersionRequired, "VersionRequired"); sl@0: /*@}*/ sl@0: sl@0: /** sl@0: * Two phase constructor sl@0: */ sl@0: CT_MdaDevSoundData* CT_MdaDevSoundData::NewL(RMdaDevSound* aServerStore) sl@0: { sl@0: CT_MdaDevSoundData* ret = new (ELeave) CT_MdaDevSoundData(aServerStore); sl@0: CleanupStack::PushL(ret); sl@0: ret->ConstructL(); sl@0: CleanupStack::Pop(ret); sl@0: return ret; sl@0: } sl@0: sl@0: /** sl@0: * Protected constructor. First phase construction sl@0: */ sl@0: CT_MdaDevSoundData::CT_MdaDevSoundData(RMdaDevSound* aServerStore) sl@0: :iServerStore(aServerStore) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: * Protected constructor. Second phase construction sl@0: */ sl@0: void CT_MdaDevSoundData::ConstructL() sl@0: { sl@0: } sl@0: sl@0: /** sl@0: * Destructor. sl@0: */ sl@0: CT_MdaDevSoundData::~CT_MdaDevSoundData() sl@0: { sl@0: DoCleanup(); sl@0: sl@0: iNotifyPlayError.ResetAndDestroy(); sl@0: iNotifyRecordError.ResetAndDestroy(); sl@0: iPlay.ResetAndDestroy(); sl@0: iRecord.ResetAndDestroy(); sl@0: } sl@0: sl@0: /** sl@0: * Contains cleanup implementation sl@0: */ sl@0: void CT_MdaDevSoundData::DoCleanup() sl@0: { sl@0: if(iMdaDevSound) sl@0: { sl@0: INFO_PRINTF1(_L("Deleting current RMdaDevSound")); sl@0: delete iMdaDevSound; sl@0: iMdaDevSound = NULL; sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Return a pointer to the object that the data wraps sl@0: * sl@0: * @return pointer to the object that the data wraps sl@0: */ sl@0: TAny* CT_MdaDevSoundData::GetObject() sl@0: { sl@0: return iMdaDevSound; sl@0: } sl@0: sl@0: /** sl@0: * Set the wrapped data object with new value sl@0: */ sl@0: void CT_MdaDevSoundData::SetObjectL( TAny* aAny ) sl@0: { sl@0: DoCleanup(); sl@0: iMdaDevSound = static_cast ( aAny ); sl@0: *iServerStore = *iMdaDevSound; sl@0: } sl@0: sl@0: /** sl@0: * Clear the wrapped data object pointer w/o de-initialization sl@0: */ sl@0: void CT_MdaDevSoundData::DisownObjectL() sl@0: { sl@0: iMdaDevSound = NULL; sl@0: iServerStore->SetHandle(KNullHandle); sl@0: } sl@0: sl@0: /** sl@0: * Return static cleanup function sl@0: */ sl@0: inline TCleanupOperation CT_MdaDevSoundData::CleanupOperation() sl@0: { sl@0: return CleanupOperation; sl@0: } sl@0: sl@0: /** sl@0: * Static cleanup function sl@0: */ sl@0: void CT_MdaDevSoundData::CleanupOperation( TAny* aAny ) sl@0: { sl@0: RMdaDevSound* sound = static_cast ( aAny ); sl@0: delete sound; sl@0: } sl@0: sl@0: /** sl@0: * Process a command read from the ini file sl@0: * sl@0: * @param aCommand the command to process sl@0: * @param aSection the entry in the ini file requiring the command to be processed sl@0: * sl@0: * @return ETrue if the command is processed sl@0: */ sl@0: TBool CT_MdaDevSoundData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex) sl@0: { sl@0: TBool ret=ETrue; sl@0: if (aCommand == KCmdNew) sl@0: { sl@0: DoCmdNewL(); sl@0: } sl@0: else if (aCommand == KCmdClose) sl@0: { sl@0: DoCmdClose(); sl@0: } sl@0: else if (aCommand == KCmdDestructor) sl@0: { sl@0: DoCmdDestructor(); sl@0: } sl@0: else if (aCommand == KCmdOpen) sl@0: { sl@0: DoCmdOpen(aSection); sl@0: } sl@0: else if (aCommand == KCmdIsMdaSound) sl@0: { sl@0: DoCmdIsMdaSound(); sl@0: } sl@0: else if (aCommand == KCmdVersionRequired) sl@0: { sl@0: DoCmdVersionRequired(aSection); sl@0: } sl@0: else if (aCommand == KCmdPlayFormatsSupported) sl@0: { sl@0: DoCmdPlayFormatsSupportedL(aSection); sl@0: } sl@0: else if (aCommand == KCmdGetPlayFormat) sl@0: { sl@0: DoCmdGetPlayFormatL(aSection); sl@0: } sl@0: else if (aCommand == KCmdSetPlayFormat) sl@0: { sl@0: DoCmdSetPlayFormatL(aSection); sl@0: } sl@0: else if (aCommand == KCmdRecordFormatsSupported) sl@0: { sl@0: DoCmdRecordFormatsSupportedL(aSection); sl@0: } sl@0: else if (aCommand == KCmdGetRecordFormat) sl@0: { sl@0: DoCmdGetRecordFormatL(aSection); sl@0: } sl@0: else if (aCommand == KCmdSetRecordFormat) sl@0: { sl@0: DoCmdSetRecordFormatL(aSection); sl@0: } sl@0: else if (aCommand == KCmdPlayVolume) sl@0: { sl@0: DoCmdPlayVolume(aSection); sl@0: } sl@0: else if (aCommand == KCmdSetPlayVolume) sl@0: { sl@0: DoCmdSetPlayVolume(aSection); sl@0: } sl@0: else if (aCommand == KCmdPlayData) sl@0: { sl@0: DoCmdPlayDataL(aSection, aAsyncErrorIndex); sl@0: } sl@0: else if (aCommand == KCmdCancelPlayData) sl@0: { sl@0: DoCmdCancelPlayData(); sl@0: } sl@0: else if (aCommand == KCmdFlushPlayBuffer) sl@0: { sl@0: DoCmdFlushPlayBuffer(); sl@0: } sl@0: else if (aCommand == KCmdFlushPlayBuffer) sl@0: { sl@0: DoCmdNotifyPlayErrorL(aAsyncErrorIndex); sl@0: } sl@0: else if (aCommand == KCmdFlushPlayBuffer) sl@0: { sl@0: DoCmdCancelNotifyPlayError(); sl@0: } sl@0: else if (aCommand == KCmdNotifyPlayError) sl@0: { sl@0: DoCmdNotifyPlayErrorL(aAsyncErrorIndex); sl@0: } sl@0: else if (aCommand == KCmdCancelNotifyPlayError) sl@0: { sl@0: DoCmdCancelNotifyPlayError(); sl@0: } sl@0: else if (aCommand == KCmdBytesPlayed) sl@0: { sl@0: DoCmdBytesPlayed(aSection); sl@0: } sl@0: else if (aCommand == KCmdResetBytesPlayed) sl@0: { sl@0: DoCmdResetBytesPlayed(); sl@0: } sl@0: else if (aCommand == KCmdPausePlayBuffer) sl@0: { sl@0: DoCmdPausePlayBuffer(); sl@0: } sl@0: else if (aCommand == KCmdResumePlaying) sl@0: { sl@0: DoCmdResumePlaying(); sl@0: } sl@0: else if (aCommand == KCmdRecordData) sl@0: { sl@0: DoCmdRecordDataL(aSection, aAsyncErrorIndex); sl@0: } sl@0: else if (aCommand == KCmdCancelRecordData) sl@0: { sl@0: DoCmdCancelRecordData(); sl@0: } sl@0: else if (aCommand == KCmdFlushRecordBuffer) sl@0: { sl@0: DoCmdFlushRecordBuffer(); sl@0: } sl@0: else if (aCommand == KCmdRecordLevel) sl@0: { sl@0: DoCmdRecordLevel(aSection); sl@0: } sl@0: else if (aCommand == KCmdSetRecordLevel) sl@0: { sl@0: DoCmdSetRecordLevel(aSection); sl@0: } sl@0: else if (aCommand == KCmdNotifyRecordError) sl@0: { sl@0: DoCmdNotifyRecordErrorL(aAsyncErrorIndex); sl@0: } sl@0: else if (aCommand == KCmdCancelNotifyRecordError) sl@0: { sl@0: DoCmdCancelNotifyRecordError(); sl@0: } sl@0: else if (aCommand == KCmdUtilityDeleteFile) sl@0: { sl@0: DoCmdUtilityDeleteFileL(aSection); sl@0: } sl@0: else sl@0: { sl@0: ret=CDataWrapperBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex); sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: /** sl@0: * Creates new RMdaDevSound class instance sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdNewL() sl@0: { sl@0: INFO_PRINTF1(_L("Create new RMdaDevSound class instance")); sl@0: sl@0: //Deletes previous RMdaDevsound class instance if it was already created. sl@0: DoCleanup(); sl@0: sl@0: // do create sl@0: TRAPD(err, iMdaDevSound = new (ELeave) RMdaDevSound()); sl@0: if ( err!=KErrNone ) sl@0: { sl@0: ERR_PRINTF2(_L("new error %d"), err); sl@0: SetError( err ); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Close RMdaDevSound handle sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdClose() sl@0: { sl@0: INFO_PRINTF1(_L("Closing RMdaDevSound")); sl@0: iServerStore->SetHandle(KNullHandle); sl@0: iMdaDevSound->Close(); sl@0: } sl@0: sl@0: /** sl@0: * Destroy RMdaDevSound the object sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdDestructor() sl@0: { sl@0: INFO_PRINTF1(_L("Destroying the RMdaDevSound object")); sl@0: //close RMdaDevSound first sl@0: iServerStore->SetHandle(KNullHandle); sl@0: iMdaDevSound->Close(); sl@0: DoCleanup(); sl@0: } sl@0: sl@0: /** sl@0: * Connects a client to the sound driver server sl@0: * sl@0: * @param aSection section name which contains unit sl@0: * KUUnit - unit to open sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave no sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdOpen(const TDesC& aSection) sl@0: { sl@0: //Loading device drivers sl@0: TPtrC lddName; sl@0: TPtrC pddName; sl@0: if(GET_OPTIONAL_STRING_PARAMETER(KLDDName(), aSection, lddName) && sl@0: GET_OPTIONAL_STRING_PARAMETER(KPDDName(), aSection, pddName)) sl@0: { sl@0: TInt err = TSoundUtil::LoadSoundDrivers(lddName, pddName); sl@0: if( (err != KErrNone) && (err != KErrAlreadyExists )) sl@0: { sl@0: ERR_PRINTF4(_L("Open() -> LoadSoundDrivers(%S, %S) error %d"), &lddName, &pddName, err); sl@0: SetError( err ); sl@0: } sl@0: } sl@0: //Finish Loading device drivers sl@0: sl@0: TInt unit = KNullUnit; sl@0: TPtrC unitName; sl@0: if (GET_OPTIONAL_STRING_PARAMETER(KUUnit(), aSection, unitName)) sl@0: { sl@0: GetHexFromConfig(KUUnitEnum(), unitName, unit ); sl@0: } sl@0: TInt err = iMdaDevSound->Open(unit); sl@0: *iServerStore = *iMdaDevSound; sl@0: INFO_PRINTF2(_L("Call Open(unit = %d)"), unit); sl@0: sl@0: if ( err!=KErrNone ) sl@0: { sl@0: ERR_PRINTF2(_L("Open() error %d"), err); sl@0: SetError( err ); sl@0: } sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: * Checks if driver is MdaSound sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdIsMdaSound() sl@0: { sl@0: INFO_PRINTF1(_L("CT_MdaDevSoundData::DoCmdIsMdaSound Called")); sl@0: sl@0: TInt err = iMdaDevSound->IsMdaSound(); sl@0: if(err!=KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("IsMdaSound() error %d"), err); sl@0: SetError(err); sl@0: } sl@0: sl@0: } sl@0: sl@0: /** sl@0: * Checks driver version required sl@0: * sl@0: * @param aSection section name with expected version sl@0: * KUVersion - version expected sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave no sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdVersionRequired(const TDesC& aSection) sl@0: { sl@0: INFO_PRINTF1(_L("CT_MdaDevSoundData::VersionRequired Called")); sl@0: sl@0: TVersion version = iMdaDevSound->VersionRequired(); sl@0: TPtrC versionNameFromSystem = version.Name(); sl@0: TPtrC versionName; sl@0: if(GET_MANDATORY_STRING_PARAMETER(KUVersion(), aSection, versionName)) sl@0: { sl@0: if(versionNameFromSystem != versionName) sl@0: { sl@0: ERR_PRINTF1(_L("iMdaDevSound->VersionRequired() != expected")); sl@0: ERR_PRINTF3(_L("version.Name()=%S, expected=%S"), &versionNameFromSystem, &versionName); sl@0: SetBlockResult(EFail); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("iMdaDevSound->VersionRequired() == expected")); sl@0: } sl@0: } sl@0: sl@0: } sl@0: sl@0: /** sl@0: * Gets PlayFormatsSupported sl@0: * sl@0: * @param aSection Section name which contains SoundFormatsSupported sl@0: * object name sl@0: * KSoundFormatsSupportedObject - SoundFormatsSupported sl@0: * object name sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave System wide error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdPlayFormatsSupportedL(const TDesC& aSection) sl@0: { sl@0: INFO_PRINTF1(_L("Getting PlayFormatsSupported!")); sl@0: sl@0: TPtrC objectName; sl@0: if (GET_MANDATORY_STRING_PARAMETER(KSoundFormatsSupportedObject, aSection, objectName)) sl@0: { sl@0: RMdaDevSound::TSoundFormatsSupported* soundFormat = static_cast(GetDataObjectL(objectName)); sl@0: RMdaDevSound::TSoundFormatsSupportedBuf soundFormatsSupportedBuf(*soundFormat); sl@0: iMdaDevSound->PlayFormatsSupported(soundFormatsSupportedBuf); sl@0: *soundFormat = soundFormatsSupportedBuf(); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Gets current PlayFormat sl@0: * sl@0: * @param aSection Section name which contains CurrentSoundFormat sl@0: * object name sl@0: * KCurrentSoundFormatObject - CurrentSoundFormat sl@0: * object name sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave System wide error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdGetPlayFormatL(const TDesC& aSection) sl@0: { sl@0: INFO_PRINTF1(_L("Getting PlayFormat!")); sl@0: sl@0: TPtrC objectName; sl@0: if (GET_MANDATORY_STRING_PARAMETER(KCurrentSoundFormatObject, aSection, objectName)) sl@0: { sl@0: RMdaDevSound::TCurrentSoundFormat* soundFormat = static_cast(GetDataObjectL(objectName)); sl@0: RMdaDevSound::TCurrentSoundFormatBuf currentSoundFormatBuf(*soundFormat); sl@0: iMdaDevSound->GetPlayFormat(currentSoundFormatBuf); sl@0: *soundFormat = currentSoundFormatBuf(); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Sets current PlayFormat sl@0: * sl@0: * @param aSection Section name which contains CurrentSoundFormat sl@0: * object name sl@0: * KCurrentSoundFormatObject - CurrentSoundFormat sl@0: * object name sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave System wide error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdSetPlayFormatL(const TDesC& aSection) sl@0: { sl@0: INFO_PRINTF1(_L("Setting PlayFormat!")); sl@0: sl@0: TPtrC objectName; sl@0: if (GET_MANDATORY_STRING_PARAMETER(KCurrentSoundFormatObject, aSection, objectName)) sl@0: { sl@0: RMdaDevSound::TCurrentSoundFormat* soundFormat = static_cast(GetDataObjectL(objectName)); sl@0: RMdaDevSound::TCurrentSoundFormatBuf currentSoundFormatBuf(*soundFormat); sl@0: TInt err = iMdaDevSound->SetPlayFormat(currentSoundFormatBuf); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("error in SetPlayFormatL %d"), err); sl@0: SetError( err ); sl@0: } sl@0: else sl@0: { sl@0: *soundFormat = currentSoundFormatBuf(); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Gets RecordFormatsSupported sl@0: * sl@0: * @param aSection Section name which contains SoundFormatsSupported sl@0: * object name sl@0: * KSoundFormatsSupportedObject - SoundFormatsSupported sl@0: * object name sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave System wide error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdRecordFormatsSupportedL(const TDesC& aSection) sl@0: { sl@0: INFO_PRINTF1(_L("Getting RecordFormatsSupported!")); sl@0: sl@0: TPtrC objectName; sl@0: if (GET_MANDATORY_STRING_PARAMETER(KSoundFormatsSupportedObject, aSection, objectName)) sl@0: { sl@0: RMdaDevSound::TSoundFormatsSupported* soundFormat = static_cast(GetDataObjectL(objectName)); sl@0: RMdaDevSound::TSoundFormatsSupportedBuf soundFormatsSupportedBuf(*soundFormat); sl@0: iMdaDevSound->RecordFormatsSupported(soundFormatsSupportedBuf); sl@0: *soundFormat = soundFormatsSupportedBuf(); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Gets current RecordFormat sl@0: * sl@0: * @param aSection Section name which contains CurrentSoundFormat sl@0: * object name sl@0: * KCurrentSoundFormatObject - CurrentSoundFormat sl@0: * object name sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave System wide error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdGetRecordFormatL(const TDesC& aSection) sl@0: { sl@0: INFO_PRINTF1(_L("Getting RecordFormat!")); sl@0: sl@0: TPtrC objectName; sl@0: if (GET_MANDATORY_STRING_PARAMETER(KCurrentSoundFormatObject, aSection, objectName)) sl@0: { sl@0: RMdaDevSound::TCurrentSoundFormat* soundFormat = static_cast(GetDataObjectL(objectName)); sl@0: RMdaDevSound::TCurrentSoundFormatBuf currentSoundFormatBuf(*soundFormat); sl@0: iMdaDevSound->GetRecordFormat(currentSoundFormatBuf); sl@0: *soundFormat = currentSoundFormatBuf(); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Sets current RecordFormat sl@0: * sl@0: * @param aSection Section name which contains CurrentSoundFormat sl@0: * object name sl@0: * KCurrentSoundFormatObject - CurrentSoundFormat sl@0: * object name sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave System wide error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdSetRecordFormatL(const TDesC& aSection) sl@0: { sl@0: INFO_PRINTF1(_L("Setting RecordFormat!")); sl@0: sl@0: TPtrC objectName; sl@0: if (GET_MANDATORY_STRING_PARAMETER(KCurrentSoundFormatObject, aSection, objectName)) sl@0: { sl@0: RMdaDevSound::TCurrentSoundFormat* soundFormat = static_cast(GetDataObjectL(objectName)); sl@0: RMdaDevSound::TCurrentSoundFormatBuf currentSoundFormatBuf(*soundFormat); sl@0: TInt err = iMdaDevSound->SetRecordFormat(currentSoundFormatBuf); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("error in SetRecordFormatL %d"), err); sl@0: SetError( err ); sl@0: } sl@0: else sl@0: { sl@0: *soundFormat = currentSoundFormatBuf(); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Gets current PlayVolume sl@0: * sl@0: * @param aSection Section name which contains expected value sl@0: * KUVolumeExpected - expected volume level sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave no sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdPlayVolume(const TDesC& aSection) sl@0: { sl@0: TInt volume = 0; sl@0: INFO_PRINTF2(_L("calling PlayVolume(), value before execution = %d"), volume); sl@0: volume = iMdaDevSound->PlayVolume(); sl@0: sl@0: TInt expected; sl@0: if (GET_OPTIONAL_INT_PARAMETER(KUVolumeExpected(), aSection, expected)) sl@0: { sl@0: if(volume != expected) sl@0: { sl@0: ERR_PRINTF3(_L("Expected result != volume, expected = %d, volume = %d"), sl@0: expected, volume); sl@0: SetBlockResult(EFail); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("volume = %d"), volume); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("volume = %d"), volume); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Sets current PlayVolume sl@0: * sl@0: * @param aSection Section name which contains value to set sl@0: * KUVolume - volume to set sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave no sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdSetPlayVolume(const TDesC& aSection) sl@0: { sl@0: TInt volume = 0; sl@0: INFO_PRINTF2(_L("calling SetPlayVolume(), value before execution = %d"), volume); sl@0: if (GET_OPTIONAL_INT_PARAMETER(KUVolume(), aSection, volume)) sl@0: { sl@0: iMdaDevSound->SetPlayVolume(volume); sl@0: INFO_PRINTF2(_L("after execution value = %d"), volume); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("volume after execution = %d"), volume); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Play audio from file. DoCmdPlayDataL is asynchronous function sl@0: * sl@0: * @param aSection Section name which can contain values to set sl@0: * KUDataSize - data size, sl@0: * KUFromFile - file name to play, sl@0: * KUBlockSize - block size sl@0: * sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave System wide error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdPlayDataL(const TDesC& aSection, sl@0: const TInt aAsyncErrorIndex) sl@0: { sl@0: INFO_PRINTF1(_L("calling PlayData()")); sl@0: sl@0: CT_SoundActiveCallback* active = CT_SoundActiveCallback::NewL(*this); sl@0: iPlay.Append(active); sl@0: sl@0: active->iSoundData = new(ELeave) TSoundUtil::RAudioBuffer(); sl@0: TSoundUtil::RAudioBuffer* soundData = active->iSoundData; sl@0: sl@0: TInt dataSize = TSoundUtil::KAudioBufferMaxSize; sl@0: GET_OPTIONAL_INT_PARAMETER(KUDataSize, aSection, dataSize); sl@0: soundData->Close(); sl@0: soundData->CreateL(dataSize); sl@0: sl@0: TPtrC fileName; sl@0: TInt err = KErrNone; sl@0: if (GET_OPTIONAL_STRING_PARAMETER(KUFromFile, aSection, fileName)) sl@0: { sl@0: err = soundData->LoadAudioDataL(fileName); sl@0: if (err) sl@0: { sl@0: SetBlockResult(EFail); sl@0: ERR_PRINTF2(_L("Audio file loading failed with error code %d"), err); sl@0: } sl@0: } sl@0: sl@0: if (!err) sl@0: { sl@0: active->SetSection(aSection); sl@0: IncOutstanding(); sl@0: sl@0: TInt blockSize = TSoundUtil::KDefaultBlockSize; sl@0: GET_OPTIONAL_INT_PARAMETER(KUBlockSize, aSection, blockSize); sl@0: blockSize = Min(blockSize, soundData->Length()); sl@0: active->iBufferBlock.Set(&soundData->operator[](0), blockSize, blockSize); sl@0: iMdaDevSound->PlayData(active->iStatus, active->iBufferBlock); sl@0: active->Activate(aAsyncErrorIndex); sl@0: TBool stopPlay = EFalse; sl@0: if (GET_OPTIONAL_BOOL_PARAMETER(KUCancel, aSection, stopPlay)) sl@0: { sl@0: if ( stopPlay ) sl@0: { sl@0: iMdaDevSound->CancelPlayData(); sl@0: INFO_PRINTF1(_L("CancelPlayData() executed")); sl@0: } sl@0: } sl@0: if (GET_OPTIONAL_BOOL_PARAMETER(KUFlush, aSection, stopPlay)) sl@0: { sl@0: if ( stopPlay ) sl@0: { sl@0: iMdaDevSound->FlushPlayBuffer(); sl@0: INFO_PRINTF1(_L("FlushPlayBuffer() executed")); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Cancel playing sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdCancelPlayData() sl@0: { sl@0: INFO_PRINTF1(_L("calling CancelPlayData()")); sl@0: sl@0: if (iPlay.Count() > 0) sl@0: { sl@0: INFO_PRINTF2(_L("CancelPlayData called on active object with iStatus == %d"), sl@0: iPlay[iPlay.Count() - 1]->iStatus.Int()); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("No active objects found")); sl@0: } sl@0: sl@0: iMdaDevSound->CancelPlayData(); sl@0: } sl@0: sl@0: /** sl@0: * Flush play buffer sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdFlushPlayBuffer() sl@0: { sl@0: INFO_PRINTF1(_L("calling FlushPlayBuffer()")); sl@0: sl@0: if (iPlay.Count() > 0) sl@0: { sl@0: INFO_PRINTF2(_L("FLushPlayBuffer called on active object with iStatus == %d"), sl@0: iPlay[iPlay.Count() - 1]->iStatus.Int()); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("No active objects found")); sl@0: } sl@0: sl@0: iMdaDevSound->FlushPlayBuffer(); sl@0: } sl@0: sl@0: /** sl@0: * Asynchronous function that starts notifying play error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdNotifyPlayErrorL(const TInt aAsyncErrorIndex) sl@0: { sl@0: INFO_PRINTF1(_L("calling NotifyPlayError()")); sl@0: sl@0: CActiveCallback* active = CActiveCallback::NewL(*this); sl@0: iNotifyPlayError.Append(active); sl@0: iMdaDevSound->NotifyPlayError(active->iStatus); sl@0: sl@0: //acitvate callback object sl@0: active->Activate(aAsyncErrorIndex); sl@0: IncOutstanding(); sl@0: } sl@0: sl@0: /** sl@0: * Cancel notifying play error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdCancelNotifyPlayError() sl@0: { sl@0: INFO_PRINTF1(_L("calling CancelNotifyPlayError()")); sl@0: sl@0: iMdaDevSound->CancelNotifyPlayError(); sl@0: } sl@0: sl@0: /** sl@0: * Gets bytes played sl@0: * sl@0: * @param aSection Section name which can contain expected value sl@0: * KUBytesPlayed - bytes played sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave no sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdBytesPlayed(const TDesC& aSection) sl@0: { sl@0: INFO_PRINTF1(_L("calling BytesPlayed()")); sl@0: sl@0: TInt bytesPlayed = iMdaDevSound->BytesPlayed(); sl@0: INFO_PRINTF2(_L("Bytes played: %d"), bytesPlayed); sl@0: sl@0: TInt expected = 0; sl@0: if (GET_OPTIONAL_INT_PARAMETER(KUBytesPlayed, aSection, expected)) sl@0: { sl@0: if (expected != bytesPlayed) sl@0: { sl@0: ERR_PRINTF3(_L("Bytes played %d != %d expected"), bytesPlayed, expected); sl@0: SetBlockResult(EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Resets bytes played sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdResetBytesPlayed() sl@0: { sl@0: INFO_PRINTF1(_L("calling ResetBytesPlayed()")); sl@0: sl@0: iMdaDevSound->ResetBytesPlayed(); sl@0: } sl@0: sl@0: /** sl@0: * Pause playing sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdPausePlayBuffer() sl@0: { sl@0: INFO_PRINTF1(_L("calling PausePlayBuffer()")); sl@0: sl@0: iMdaDevSound->PausePlayBuffer(); sl@0: } sl@0: sl@0: /** sl@0: * Resume playing sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdResumePlaying() sl@0: { sl@0: INFO_PRINTF1(_L("calling ResumePlaying()")); sl@0: sl@0: iMdaDevSound->ResumePlaying(); sl@0: } sl@0: sl@0: /** sl@0: * DoCmdRecordDataL is asynchronous function to record audio. sl@0: * sl@0: * @param aSection Section name which can contain value to set sl@0: * KUDataSize - data size to record, sl@0: * KUToFile - file to record audio, sl@0: * KUBlockSize - block size sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave System wide error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdRecordDataL(const TDesC& aSection, const TInt aAsyncErrorIndex) sl@0: { sl@0: INFO_PRINTF1(_L("calling RecordData()")); sl@0: sl@0: CT_SoundActiveCallback* active = CT_SoundActiveCallback::NewL(*this); sl@0: iRecord.Append(active); sl@0: sl@0: active->iSoundData = new(ELeave) TSoundUtil::RAudioBuffer(); sl@0: TSoundUtil::RAudioBuffer* soundData = active->iSoundData; sl@0: sl@0: TInt dataSize = TSoundUtil::KAudioBufferMaxSize; sl@0: GET_OPTIONAL_INT_PARAMETER(KUDataSize, aSection, dataSize); sl@0: soundData->Close(); sl@0: soundData->CreateL(dataSize); sl@0: soundData->SetLength(dataSize); sl@0: sl@0: TInt blockSize = TSoundUtil::KDefaultBlockSize; sl@0: GET_OPTIONAL_INT_PARAMETER(KUBlockSize, aSection, blockSize); sl@0: active->iBufferBlock.Set(&soundData->operator[](0), 0, Min(blockSize, soundData->Length())); sl@0: iMdaDevSound->RecordData(active->iStatus, active->iBufferBlock); sl@0: sl@0: active->SetSection(aSection); sl@0: IncOutstanding(); sl@0: active->Activate(aAsyncErrorIndex); sl@0: TBool stopRecord = EFalse; sl@0: if (GET_OPTIONAL_BOOL_PARAMETER(KUCancel, aSection, stopRecord)) sl@0: { sl@0: if ( stopRecord ) sl@0: { sl@0: iMdaDevSound->CancelPlayData(); sl@0: INFO_PRINTF1(_L("CancelRecordData() executed")); sl@0: } sl@0: } sl@0: if (GET_OPTIONAL_BOOL_PARAMETER(KUFlush, aSection, stopRecord)) sl@0: { sl@0: if ( stopRecord ) sl@0: { sl@0: iMdaDevSound->FlushRecordBuffer(); sl@0: INFO_PRINTF1(_L("FlushRecordBuffer() executed")); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Cancels recording in progress sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdCancelRecordData() sl@0: { sl@0: INFO_PRINTF1(_L("calling CancelRecordData()")); sl@0: sl@0: if (iRecord.Count() > 0) sl@0: { sl@0: INFO_PRINTF2(_L("CancelRecordData called on active object with iStatus == %d"), sl@0: iRecord[iRecord.Count() - 1]->iStatus.Int()); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("No active objects found")); sl@0: } sl@0: sl@0: iMdaDevSound->CancelRecordData(); sl@0: } sl@0: sl@0: /** sl@0: * Flushes record buffer sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdFlushRecordBuffer() sl@0: { sl@0: INFO_PRINTF1(_L("calling FlushRecordBuffer()")); sl@0: sl@0: if (iRecord.Count() > 0) sl@0: { sl@0: INFO_PRINTF2(_L("FlushRecordBuffer called on active object with iStatus == %d"), sl@0: iRecord[iRecord.Count() - 1]->iStatus.Int()); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("No active objects found")); sl@0: } sl@0: sl@0: iMdaDevSound->FlushRecordBuffer(); sl@0: } sl@0: sl@0: /** sl@0: * Gets record volume level sl@0: * sl@0: * @param aSection Section name which can contain expected value sl@0: * KUSoundLevelExpected - expected sound level sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave no sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdRecordLevel(const TDesC& aSection) sl@0: { sl@0: TInt level = 0; sl@0: INFO_PRINTF1(_L("calling RecordLevel()")); sl@0: level = iMdaDevSound->RecordLevel(); sl@0: sl@0: TInt expected; sl@0: if (GET_OPTIONAL_INT_PARAMETER(KUSoundLevelExpected(), aSection, expected)) sl@0: { sl@0: if(level != expected) sl@0: { sl@0: ERR_PRINTF3(_L("Expected result != level, expected = %d, level = %d"), sl@0: expected, level); sl@0: SetBlockResult(EFail); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("level = %d"), level); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("level = %d"), level); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Sets record volume level sl@0: * sl@0: * @param aSection Section name which can contain value to set sl@0: * KUSoundLevel - sound level to set sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave no sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdSetRecordLevel(const TDesC& aSection) sl@0: { sl@0: TInt level = 0; sl@0: INFO_PRINTF2(_L("calling SetRecordLevel(), level before execution = %d"), level); sl@0: sl@0: if(GET_OPTIONAL_INT_PARAMETER(KUSoundLevel, aSection, level)) sl@0: { sl@0: iMdaDevSound->SetRecordLevel(level); sl@0: INFO_PRINTF2(_L("after execution level = %d"), level); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("level after execution = %d"), level); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * DoCmdNotifyRecordErrorL is asynchronous function that starts notifying recording sl@0: * error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdNotifyRecordErrorL(const TInt aAsyncErrorIndex) sl@0: { sl@0: INFO_PRINTF1(_L("calling NotifyRecordError()")); sl@0: sl@0: CActiveCallback* active = CActiveCallback::NewL(*this); sl@0: iNotifyRecordError.Append(active); sl@0: sl@0: iMdaDevSound->NotifyRecordError(active->iStatus); sl@0: sl@0: //acitvate callback object sl@0: active->Activate(aAsyncErrorIndex); sl@0: IncOutstanding(); sl@0: } sl@0: sl@0: /** sl@0: * Cancels notifying recording error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdCancelNotifyRecordError() sl@0: { sl@0: INFO_PRINTF1(_L("calling CancelNotifyRecordError()")); sl@0: sl@0: iMdaDevSound->CancelNotifyRecordError(); sl@0: } sl@0: sl@0: /** sl@0: * Deletes file specified sl@0: * sl@0: * @param aSection Section name which contains file name to delete sl@0: * KUFileToDelete - File to delete sl@0: * sl@0: * @return void sl@0: * sl@0: * @leave System wide error sl@0: */ sl@0: void CT_MdaDevSoundData::DoCmdUtilityDeleteFileL(const TDesC& aSection) sl@0: { sl@0: INFO_PRINTF1(_L("DoCmdUtilityDeleteFileL called!")); sl@0: sl@0: TPtrC file; sl@0: if (GET_MANDATORY_STRING_PARAMETER(KUFileToDelete, aSection, file)) sl@0: { sl@0: TInt err; sl@0: err = TSoundUtil::DeleteFileL(file); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Deleting file failed with error code %d"), err); sl@0: SetBlockResult(EFail); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("File deleted successfully")); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Handle asynchronous events here sl@0: */ sl@0: void CT_MdaDevSoundData::RunL(CActive* aActive, TInt aIndex) sl@0: { sl@0: INFO_PRINTF1(_L("CT_MdaDevSoundData::RunL Called")); sl@0: TBool foundActiveObject = EFalse; sl@0: TInt index=0; sl@0: TInt count=0; sl@0: TBool completed=ETrue; sl@0: sl@0: // See if it is in iNotifyPlayError sl@0: count=iNotifyPlayError.Count(); sl@0: for( index=0; (indexiSoundData; sl@0: sl@0: iPlay[index]->iDataPosition += iPlay[index]->iBufferBlock.Length(); sl@0: INFO_PRINTF3(_L("Played %d bytes, %d bytes played total"), iPlay[index]->iBufferBlock.Length(), sl@0: iPlay[index]->iDataPosition); sl@0: sl@0: if ( ( iPlay[index]->iDataPosition >= soundData->Length() ) || aActive->iStatus.Int() ) sl@0: { sl@0: iPlay.Remove(index); sl@0: } sl@0: else sl@0: { sl@0: TInt blockSize = TSoundUtil::KDefaultBlockSize; sl@0: GET_OPTIONAL_INT_PARAMETER(KUBlockSize, *(iPlay[index]->iSection), blockSize); sl@0: blockSize = Min(blockSize, soundData->Length() - iPlay[index]->iDataPosition); sl@0: iPlay[index]->iBufferBlock.Set(&soundData->operator[](iPlay[index]->iDataPosition), blockSize, blockSize); sl@0: iMdaDevSound->PlayData(iPlay[index]->iStatus, iPlay[index]->iBufferBlock); sl@0: iPlay[index]->Activate(aIndex); sl@0: completed = EFalse; sl@0: } sl@0: } sl@0: } sl@0: sl@0: // See if it is in iRecord sl@0: count=iRecord.Count(); sl@0: for( index=0; (indexiDataPosition += iRecord[index]->iBufferBlock.Length(); sl@0: INFO_PRINTF3(_L("Stored %d bytes, %d bytes total"), sl@0: iRecord[index]->iBufferBlock.Length(), sl@0: iRecord[index]->iDataPosition); sl@0: sl@0: TSoundUtil::RAudioBuffer* buffer = iRecord[index]->iSoundData; sl@0: sl@0: TInt err = aActive->iStatus.Int(); sl@0: if( err == KErrNone ) sl@0: { sl@0: if(iRecord[index]->iDataPosition >= buffer->Length() || sl@0: iRecord[index]->iBufferBlock.Length() == 0) sl@0: { sl@0: TPtrC fileName; sl@0: if(GET_OPTIONAL_STRING_PARAMETER(KUToFile, *(iRecord[index]->iSection), fileName)) sl@0: { sl@0: TInt err; sl@0: err = buffer->SaveAudioDataL(fileName); sl@0: if (err) sl@0: { sl@0: SetBlockResult(EFail); sl@0: ERR_PRINTF2(_L("Saving to file failed with error code %d"), err); sl@0: } sl@0: } sl@0: iRecord.Remove(index); sl@0: } sl@0: else sl@0: { sl@0: TInt blockSize = TSoundUtil::KDefaultBlockSize; sl@0: //if specified in INI file get block size sl@0: GET_OPTIONAL_INT_PARAMETER(KUBlockSize, *(iRecord[index]->iSection), blockSize); sl@0: iRecord[index]->iBufferBlock.Set(&buffer->operator[](iRecord[index]->iDataPosition), 0, Min(blockSize, buffer->Length() - iRecord[index]->iDataPosition)); sl@0: iMdaDevSound->RecordData(iRecord[index]->iStatus, iRecord[index]->iBufferBlock); sl@0: iRecord[index]->Activate(aIndex); sl@0: completed = EFalse; sl@0: } sl@0: }//err == KErrNone sl@0: else sl@0: { sl@0: iRecord.Remove(index); sl@0: } sl@0: }//aActive == iRecord[index] sl@0: }//for sl@0: sl@0: if( foundActiveObject ) sl@0: { sl@0: if ( completed ) sl@0: { sl@0: if (aActive) sl@0: { sl@0: TInt err = aActive->iStatus.Int(); sl@0: if( err != KErrNone ) sl@0: { sl@0: ERR_PRINTF2(_L("RunL Error %d"), err); sl@0: SetAsyncError( aIndex, err ); sl@0: } sl@0: } sl@0: sl@0: // Reset the outstanding request state sl@0: delete aActive; sl@0: DecOutstanding(); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF1(_L("An unchecked active object completed")); sl@0: SetBlockResult(EFail); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Cancels asynchronous events sl@0: */ sl@0: void CT_MdaDevSoundData::DoCancel(CActive* aActive, TInt aIndex) sl@0: { sl@0: TBool foundActiveObject = EFalse; sl@0: sl@0: TInt index=0; sl@0: TInt count=0; sl@0: sl@0: // See if it is in iNotifyPlayError sl@0: count=iNotifyPlayError.Count(); sl@0: for( index=0; (indexiStatus.Int(); sl@0: if( err != KErrNone ) sl@0: { sl@0: ERR_PRINTF2(_L("DoCancel Error %d"), err); sl@0: SetAsyncError( aIndex, err ); sl@0: } sl@0: } sl@0: sl@0: // Reset the outstanding request state sl@0: delete aActive; sl@0: DecOutstanding(); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF1(_L("An unchecked active object canceled")); sl@0: SetBlockResult(EFail); sl@0: } sl@0: }