0
|
1 |
// Copyright (c) 2003-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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
// Test system includes
|
|
17 |
#include "TSU_MMF_SWCDWRAP_HwDevObserver.h"
|
|
18 |
#include <mmf/server/mmfswcodecwrappercustominterfacesuids.hrh>
|
|
19 |
|
|
20 |
void Panic()
|
|
21 |
{
|
|
22 |
_LIT(KMMF_SWCDWRAP_UnitTestPanic, "TSU_MMF_SWCDWRAP");
|
|
23 |
User::Panic(KMMF_SWCDWRAP_UnitTestPanic, 0);
|
|
24 |
}
|
|
25 |
|
|
26 |
CTestMMFHwDeviceObserver::CTestMMFHwDeviceObserver(CMMFHwDevice* aHwDevice) : iError(KErrNone)
|
|
27 |
{
|
|
28 |
iHwDevice = aHwDevice;
|
|
29 |
}
|
|
30 |
|
|
31 |
CTestMMFHwDeviceObserver::~CTestMMFHwDeviceObserver()
|
|
32 |
{
|
|
33 |
iFileServerSession.Close();
|
|
34 |
}
|
|
35 |
|
|
36 |
|
|
37 |
TInt CTestMMFHwDeviceObserver::FillThisHwBuffer(CMMFBuffer& /*aHwDataBuffer*/)
|
|
38 |
{
|
|
39 |
#ifndef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER //Adapter loads the drivers
|
|
40 |
Panic(); //should never get called
|
|
41 |
#endif
|
|
42 |
return KErrNone;
|
|
43 |
}
|
|
44 |
|
|
45 |
|
|
46 |
TInt CTestMMFHwDeviceObserver::EmptyThisHwBuffer(CMMFBuffer& /*aHwDataBuffer*/)
|
|
47 |
{
|
|
48 |
Panic(); //should never get called
|
|
49 |
return KErrNone;
|
|
50 |
}
|
|
51 |
|
|
52 |
|
|
53 |
TInt CTestMMFHwDeviceObserver::MsgFromHwDevice(TUid aMessageType, const TDesC8& /*aMsg*/)
|
|
54 |
{
|
|
55 |
if (aMessageType.iUid != KMmfHwDeviceObserverUpdateBytesPlayed)
|
|
56 |
{
|
|
57 |
Panic(); //should never get called
|
|
58 |
}
|
|
59 |
return KErrNone;
|
|
60 |
}
|
|
61 |
|
|
62 |
|
|
63 |
void CTestMMFHwDeviceObserver::Stopped()
|
|
64 |
{
|
|
65 |
Panic(); //should never get called
|
|
66 |
}
|
|
67 |
|
|
68 |
|
|
69 |
void CTestMMFHwDeviceObserver::Error(TInt aError)
|
|
70 |
{
|
|
71 |
if (!iError)
|
|
72 |
iError = aError; //log error in observer error
|
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
void CTestMMFHwDeviceObserver::StopActiveScheduler()
|
|
77 |
{
|
|
78 |
CActiveScheduler* activeScheduler;
|
|
79 |
activeScheduler = CActiveScheduler::Current();
|
|
80 |
activeScheduler->Stop();
|
|
81 |
}
|
|
82 |
|
|
83 |
|
|
84 |
void CTestMMFHwDeviceObserver::FileReadComplete(TInt /*aError*/)
|
|
85 |
{
|
|
86 |
Panic(); //should never get called
|
|
87 |
}
|
|
88 |
|
|
89 |
|
|
90 |
void CTestMMFHwDeviceObserver::FileWriteComplete(TInt /*aError*/)
|
|
91 |
{
|
|
92 |
Panic(); //should never get called
|
|
93 |
}
|
|
94 |
|
|
95 |
|
|
96 |
TInt CTestMMFHwDeviceObserver::ErrorStatus()
|
|
97 |
{
|
|
98 |
return iError;
|
|
99 |
}
|
|
100 |
|
|
101 |
|
|
102 |
TUint CTestMMFHwDeviceObserver::NumberOfBuffersObserved()
|
|
103 |
{
|
|
104 |
return iCurrentBufferNumber;
|
|
105 |
}
|
|
106 |
|
|
107 |
|
|
108 |
TInt CTestMMFHwDeviceObserver::CTestFileReader::Read(CMMFDataBuffer& aBuffer)
|
|
109 |
{
|
|
110 |
iDataBuffer = &aBuffer;
|
|
111 |
iFile.Read(iPosition, iDataBuffer->Data(), iStatus);
|
|
112 |
if (!IsActive())
|
|
113 |
{
|
|
114 |
SetActive();
|
|
115 |
}
|
|
116 |
return KErrNone;
|
|
117 |
}
|
|
118 |
|
|
119 |
void CTestMMFHwDeviceObserver::CTestFileReader::RunL()
|
|
120 |
{
|
|
121 |
iPosition+=iDataBuffer->BufferSize();
|
|
122 |
iParent->FileReadComplete(iStatus.Int());
|
|
123 |
}
|
|
124 |
|
|
125 |
void CTestMMFHwDeviceObserver::CTestFileReader::DoCancel()
|
|
126 |
{
|
|
127 |
}
|
|
128 |
|
|
129 |
|
|
130 |
TInt CTestMMFHwDeviceObserver::CTestFileWriter::Write(CMMFDataBuffer& aBuffer)
|
|
131 |
{
|
|
132 |
iDataBuffer = &aBuffer;
|
|
133 |
iFile.Write(iPosition, iDataBuffer->Data(), iStatus);
|
|
134 |
SetActive();
|
|
135 |
return KErrNone;
|
|
136 |
}
|
|
137 |
|
|
138 |
|
|
139 |
void CTestMMFHwDeviceObserver::CTestFileWriter::RunL()
|
|
140 |
{
|
|
141 |
iPosition+=iDataBuffer->BufferSize();
|
|
142 |
iParent->FileWriteComplete(iStatus.Int());
|
|
143 |
}
|
|
144 |
|
|
145 |
void CTestMMFHwDeviceObserver::CTestFileWriter::DoCancel()
|
|
146 |
{
|
|
147 |
}
|
|
148 |
|
|
149 |
|
|
150 |
|