sl@0: // Copyright (c) 2007-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: #include sl@0: sl@0: #include "playbackstatustestdevice.h" sl@0: #include "cidefine.h" sl@0: sl@0: /*****************************************************************************/ sl@0: // Implementation sl@0: sl@0: CMMFHwDevice* CPlaybackStatusTestDevice::NewL() sl@0: { sl@0: CPlaybackStatusTestDevice* self=new(ELeave) CPlaybackStatusTestDevice(); 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: CPlaybackStatusTestDevice::~CPlaybackStatusTestDevice() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CPlaybackStatusTestDevice::CPlaybackStatusTestDevice() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: void CPlaybackStatusTestDevice::ConstructL() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CPlaybackStatusTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CPlaybackStatusTestDevice::Stop() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CPlaybackStatusTestDevice::Pause() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CPlaybackStatusTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TAny* CPlaybackStatusTestDevice::CustomInterface(TUid aInterfaceId) sl@0: { sl@0: MMMFPlaybackStatus* interface = NULL; sl@0: sl@0: // DevSound initialisation requires something to be returned for both of sl@0: // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface sl@0: if ((aInterfaceId == KUidPlaybackStatus) || // This interface sl@0: (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) || sl@0: (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)) sl@0: { sl@0: interface = this; sl@0: } sl@0: sl@0: return interface; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CPlaybackStatusTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CPlaybackStatusTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CPlaybackStatusTestDevice::SetConfig(TTaskConfig& /*aConfig*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CPlaybackStatusTestDevice::StopAndDeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CPlaybackStatusTestDevice::DeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CMMFSwCodec& CPlaybackStatusTestDevice::Codec() sl@0: { sl@0: return *iCodec; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CPlaybackStatusTestDevice::MmpsGetPlaybackStatusInformation(TMMFPlaybackStatus& aStatus) sl@0: { sl@0: aStatus.aInputBytes = 999; sl@0: aStatus.aDecodedSamples = 999; sl@0: aStatus.aDecodedSamplesPlayed = 999; sl@0: aStatus.aSystemTime = 999; sl@0: aStatus.aTotalSamplesPlayed = 999; sl@0: sl@0: return KErrNone; sl@0: } sl@0: sl@0: TInt CPlaybackStatusTestDevice::MmpsRequestLossOfSyncNotification() sl@0: { sl@0: // Set a flag in a file that the test step can read... sl@0: TRAPD(err, WriteSyncNotificationToFileL(ETrue)); sl@0: sl@0: return err; sl@0: } sl@0: sl@0: TInt CPlaybackStatusTestDevice::MmpsCancelLossOfSyncNotification() sl@0: { sl@0: // Set a flag in a file that the test step can read... sl@0: TRAPD(err, WriteSyncNotificationToFileL(EFalse)); sl@0: return err; sl@0: } sl@0: sl@0: // aWriteRequest is set to ETrue when output to file should signify sl@0: // call from MmpsRequestLossOfSyncNotification(), otherwise set it to EFalse sl@0: // when called from MmpsCancelLossOfSyncNotification() sl@0: void CPlaybackStatusTestDevice::WriteSyncNotificationToFileL(TBool aWriteRequest) sl@0: { sl@0: // File handling sl@0: RFs fs; sl@0: CleanupClosePushL(fs); sl@0: User::LeaveIfError(fs.Connect()); sl@0: sl@0: RFile file; sl@0: CleanupClosePushL(file); sl@0: sl@0: // File doesn't yet exist sl@0: // It is the responsibility of the calling test function to delete the file after use sl@0: User::LeaveIfError(file.Create(fs, KCITestFileName, EFileWrite)); sl@0: TBuf8 outputBuf; sl@0: outputBuf.Num(aWriteRequest); sl@0: User::LeaveIfError(file.Write(outputBuf)); sl@0: CleanupStack::PopAndDestroy(2); // fs, file sl@0: }