os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/playbackstatustestdevice.cpp
Update contrib.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include <mmf/server/mmfswcodecwrappercustominterfacesuids.hrh>
18 #include "playbackstatustestdevice.h"
21 /*****************************************************************************/
24 CMMFHwDevice* CPlaybackStatusTestDevice::NewL()
26 CPlaybackStatusTestDevice* self=new(ELeave) CPlaybackStatusTestDevice();
27 CleanupStack::PushL(self);
29 CleanupStack::Pop(self);
33 /*****************************************************************************/
34 CPlaybackStatusTestDevice::~CPlaybackStatusTestDevice()
38 /*****************************************************************************/
39 CPlaybackStatusTestDevice::CPlaybackStatusTestDevice()
43 /*****************************************************************************/
44 void CPlaybackStatusTestDevice::ConstructL()
48 /*****************************************************************************/
49 TInt CPlaybackStatusTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
54 /*****************************************************************************/
55 TInt CPlaybackStatusTestDevice::Stop()
60 /*****************************************************************************/
61 TInt CPlaybackStatusTestDevice::Pause()
66 /*****************************************************************************/
67 TInt CPlaybackStatusTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
72 /*****************************************************************************/
73 TAny* CPlaybackStatusTestDevice::CustomInterface(TUid aInterfaceId)
75 MMMFPlaybackStatus* interface = NULL;
77 // DevSound initialisation requires something to be returned for both of
78 // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface
79 if ((aInterfaceId == KUidPlaybackStatus) || // This interface
80 (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) ||
81 (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface))
89 /*****************************************************************************/
90 TInt CPlaybackStatusTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
95 /*****************************************************************************/
96 TInt CPlaybackStatusTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
101 /*****************************************************************************/
102 TInt CPlaybackStatusTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
107 /*****************************************************************************/
108 TInt CPlaybackStatusTestDevice::StopAndDeleteCodec()
113 /*****************************************************************************/
114 TInt CPlaybackStatusTestDevice::DeleteCodec()
119 /*****************************************************************************/
120 CMMFSwCodec& CPlaybackStatusTestDevice::Codec()
125 /*****************************************************************************/
126 TInt CPlaybackStatusTestDevice::MmpsGetPlaybackStatusInformation(TMMFPlaybackStatus& aStatus)
128 aStatus.aInputBytes = 999;
129 aStatus.aDecodedSamples = 999;
130 aStatus.aDecodedSamplesPlayed = 999;
131 aStatus.aSystemTime = 999;
132 aStatus.aTotalSamplesPlayed = 999;
137 TInt CPlaybackStatusTestDevice::MmpsRequestLossOfSyncNotification()
139 // Set a flag in a file that the test step can read...
140 TRAPD(err, WriteSyncNotificationToFileL(ETrue));
145 TInt CPlaybackStatusTestDevice::MmpsCancelLossOfSyncNotification()
147 // Set a flag in a file that the test step can read...
148 TRAPD(err, WriteSyncNotificationToFileL(EFalse));
152 // aWriteRequest is set to ETrue when output to file should signify
153 // call from MmpsRequestLossOfSyncNotification(), otherwise set it to EFalse
154 // when called from MmpsCancelLossOfSyncNotification()
155 void CPlaybackStatusTestDevice::WriteSyncNotificationToFileL(TBool aWriteRequest)
159 CleanupClosePushL(fs);
160 User::LeaveIfError(fs.Connect());
163 CleanupClosePushL(file);
165 // File doesn't yet exist
166 // It is the responsibility of the calling test function to delete the file after use
167 User::LeaveIfError(file.Create(fs, KCITestFileName, EFileWrite));
168 TBuf8<KMaxCITestFileDataLength> outputBuf;
169 outputBuf.Num(aWriteRequest);
170 User::LeaveIfError(file.Write(outputBuf));
171 CleanupStack::PopAndDestroy(2); // fs, file