os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/playbackstatustestdevice.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/playbackstatustestdevice.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,172 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <mmf/server/mmfswcodecwrappercustominterfacesuids.hrh>
1.20 +
1.21 +#include "playbackstatustestdevice.h"
1.22 +#include "cidefine.h"
1.23 +
1.24 +/*****************************************************************************/
1.25 +// Implementation
1.26 +
1.27 +CMMFHwDevice* CPlaybackStatusTestDevice::NewL()
1.28 + {
1.29 + CPlaybackStatusTestDevice* self=new(ELeave) CPlaybackStatusTestDevice();
1.30 + CleanupStack::PushL(self);
1.31 + self->ConstructL();
1.32 + CleanupStack::Pop(self);
1.33 + return self;
1.34 + }
1.35 +
1.36 +/*****************************************************************************/
1.37 +CPlaybackStatusTestDevice::~CPlaybackStatusTestDevice()
1.38 + {
1.39 + }
1.40 +
1.41 +/*****************************************************************************/
1.42 +CPlaybackStatusTestDevice::CPlaybackStatusTestDevice()
1.43 + {
1.44 + }
1.45 +
1.46 +/*****************************************************************************/
1.47 +void CPlaybackStatusTestDevice::ConstructL()
1.48 + {
1.49 + }
1.50 +
1.51 +/*****************************************************************************/
1.52 +TInt CPlaybackStatusTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
1.53 + {
1.54 + return 0;
1.55 + }
1.56 +
1.57 +/*****************************************************************************/
1.58 +TInt CPlaybackStatusTestDevice::Stop()
1.59 + {
1.60 + return 0;
1.61 + }
1.62 +
1.63 +/*****************************************************************************/
1.64 +TInt CPlaybackStatusTestDevice::Pause()
1.65 + {
1.66 + return 0;
1.67 + }
1.68 +
1.69 +/*****************************************************************************/
1.70 +TInt CPlaybackStatusTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
1.71 + {
1.72 + return 0;
1.73 + }
1.74 +
1.75 +/*****************************************************************************/
1.76 +TAny* CPlaybackStatusTestDevice::CustomInterface(TUid aInterfaceId)
1.77 + {
1.78 + MMMFPlaybackStatus* interface = NULL;
1.79 +
1.80 + // DevSound initialisation requires something to be returned for both of
1.81 + // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface
1.82 + if ((aInterfaceId == KUidPlaybackStatus) || // This interface
1.83 + (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) ||
1.84 + (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface))
1.85 + {
1.86 + interface = this;
1.87 + }
1.88 +
1.89 + return interface;
1.90 + }
1.91 +
1.92 +/*****************************************************************************/
1.93 +TInt CPlaybackStatusTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
1.94 + {
1.95 + return 0;
1.96 + }
1.97 +
1.98 +/*****************************************************************************/
1.99 +TInt CPlaybackStatusTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
1.100 + {
1.101 + return 0;
1.102 + }
1.103 +
1.104 +/*****************************************************************************/
1.105 +TInt CPlaybackStatusTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
1.106 + {
1.107 + return 0;
1.108 + }
1.109 +
1.110 +/*****************************************************************************/
1.111 +TInt CPlaybackStatusTestDevice::StopAndDeleteCodec()
1.112 + {
1.113 + return 0;
1.114 + }
1.115 +
1.116 +/*****************************************************************************/
1.117 +TInt CPlaybackStatusTestDevice::DeleteCodec()
1.118 + {
1.119 + return 0;
1.120 + }
1.121 +
1.122 +/*****************************************************************************/
1.123 +CMMFSwCodec& CPlaybackStatusTestDevice::Codec()
1.124 + {
1.125 + return *iCodec;
1.126 + }
1.127 +
1.128 +/*****************************************************************************/
1.129 +TInt CPlaybackStatusTestDevice::MmpsGetPlaybackStatusInformation(TMMFPlaybackStatus& aStatus)
1.130 + {
1.131 + aStatus.aInputBytes = 999;
1.132 + aStatus.aDecodedSamples = 999;
1.133 + aStatus.aDecodedSamplesPlayed = 999;
1.134 + aStatus.aSystemTime = 999;
1.135 + aStatus.aTotalSamplesPlayed = 999;
1.136 +
1.137 + return KErrNone;
1.138 + }
1.139 +
1.140 +TInt CPlaybackStatusTestDevice::MmpsRequestLossOfSyncNotification()
1.141 + {
1.142 + // Set a flag in a file that the test step can read...
1.143 + TRAPD(err, WriteSyncNotificationToFileL(ETrue));
1.144 +
1.145 + return err;
1.146 + }
1.147 +
1.148 +TInt CPlaybackStatusTestDevice::MmpsCancelLossOfSyncNotification()
1.149 + {
1.150 + // Set a flag in a file that the test step can read...
1.151 + TRAPD(err, WriteSyncNotificationToFileL(EFalse));
1.152 + return err;
1.153 + }
1.154 +
1.155 +// aWriteRequest is set to ETrue when output to file should signify
1.156 +// call from MmpsRequestLossOfSyncNotification(), otherwise set it to EFalse
1.157 +// when called from MmpsCancelLossOfSyncNotification()
1.158 +void CPlaybackStatusTestDevice::WriteSyncNotificationToFileL(TBool aWriteRequest)
1.159 + {
1.160 + // File handling
1.161 + RFs fs;
1.162 + CleanupClosePushL(fs);
1.163 + User::LeaveIfError(fs.Connect());
1.164 +
1.165 + RFile file;
1.166 + CleanupClosePushL(file);
1.167 +
1.168 + // File doesn't yet exist
1.169 + // It is the responsibility of the calling test function to delete the file after use
1.170 + User::LeaveIfError(file.Create(fs, KCITestFileName, EFileWrite));
1.171 + TBuf8<KMaxCITestFileDataLength> outputBuf;
1.172 + outputBuf.Num(aWriteRequest);
1.173 + User::LeaveIfError(file.Write(outputBuf));
1.174 + CleanupStack::PopAndDestroy(2); // fs, file
1.175 + }