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: #include "gettimestampstestdevice.h" sl@0: #include "cidefine.h" sl@0: sl@0: /*****************************************************************************/ sl@0: // Implementation sl@0: sl@0: CMMFHwDevice* CGetTimestampsTestDevice::NewL() sl@0: { sl@0: CGetTimestampsTestDevice* self = new(ELeave) CGetTimestampsTestDevice(); 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: CGetTimestampsTestDevice::~CGetTimestampsTestDevice() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CGetTimestampsTestDevice::CGetTimestampsTestDevice() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: void CGetTimestampsTestDevice::ConstructL() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CGetTimestampsTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CGetTimestampsTestDevice::Stop() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CGetTimestampsTestDevice::Pause() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CGetTimestampsTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TAny* CGetTimestampsTestDevice::CustomInterface(TUid aInterfaceId) sl@0: { sl@0: MMMFGetTimestamps* 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 == KUidGetTimestamps) || // 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 CGetTimestampsTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CGetTimestampsTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CGetTimestampsTestDevice::SetConfig(TTaskConfig& /*aConfig*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CGetTimestampsTestDevice::StopAndDeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CGetTimestampsTestDevice::DeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CMMFSwCodec& CGetTimestampsTestDevice::Codec() sl@0: { sl@0: return *iCodec; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CGetTimestampsTestDevice::MmgtSetRecordSystemTimestampsEnabled(TBool aEnable) sl@0: { sl@0: TRAPD(err, DoWriteToFileL(aEnable)); sl@0: return err; sl@0: } sl@0: sl@0: TInt CGetTimestampsTestDevice::MmgtGetSystemTimestampForBuffer(const TTimeIntervalMicroSeconds& aBufferPosition, sl@0: TTime& aTimestamp) const sl@0: { sl@0: // Expected position is... sl@0: TTimeIntervalMicroSeconds expectedPos = TTimeIntervalMicroSeconds(KTimestampPosition); sl@0: if (aBufferPosition == expectedPos) sl@0: { sl@0: // ...found so return the expected value. sl@0: aTimestamp = KTimestampValue; sl@0: return KErrNone; sl@0: } sl@0: else sl@0: { sl@0: return KErrArgument; sl@0: } sl@0: } sl@0: sl@0: void CGetTimestampsTestDevice::DoWriteToFileL(TBool aEnable) sl@0: { 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(aEnable); sl@0: User::LeaveIfError(file.Write(outputBuf)); sl@0: CleanupStack::PopAndDestroy(2); // fs, file sl@0: }