253
|
1 |
// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
|
0
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "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 |
// @file testinterfacesettingbase.h
|
|
15 |
// @internalComponent
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
#include "testinterfacesettingbase.h"
|
|
20 |
#include "testinterfacebase.h"
|
|
21 |
#include "controltransferrequests.h"
|
253
|
22 |
#include "OstTraceDefinitions.h"
|
|
23 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
24 |
#include "testinterfacesettingbaseTraces.h"
|
|
25 |
#endif
|
0
|
26 |
|
|
27 |
|
|
28 |
namespace NUnitTesting_USBDI
|
|
29 |
{
|
|
30 |
|
|
31 |
CInterfaceSettingBase::CInterfaceSettingBase(const TDesC& aString)
|
|
32 |
: iHashEndpointFunction(EndpointNumberHash),
|
|
33 |
iIdRelEndpoint(EndpointIdentityRelationship),
|
|
34 |
iEndpoints(iHashEndpointFunction,iIdRelEndpoint)
|
|
35 |
{
|
253
|
36 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_CINTERFACESETTINGBASE_ENTRY, this );
|
0
|
37 |
// Set the name of this interface setting
|
|
38 |
iSettingString.Copy(aString);
|
|
39 |
iInterfaceInfo().iString = &iSettingString;
|
|
40 |
|
|
41 |
// Zero count the number of endpoints used for this setting
|
|
42 |
iInterfaceInfo().iTotalEndpointsUsed = 0;
|
253
|
43 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_CINTERFACESETTINGBASE_EXIT, this );
|
0
|
44 |
}
|
|
45 |
|
|
46 |
|
|
47 |
CInterfaceSettingBase::~CInterfaceSettingBase()
|
|
48 |
{
|
253
|
49 |
OstTraceFunctionEntry1( CINTERFACESETTINGBASE_CINTERFACESETTINGBASE_ENTRY_DUP01, this );
|
0
|
50 |
|
|
51 |
iEndpointReaders.ResetAndDestroy();
|
|
52 |
iEndpointWriters.ResetAndDestroy();
|
253
|
53 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_CINTERFACESETTINGBASE_EXIT_DUP01, this );
|
0
|
54 |
}
|
|
55 |
|
|
56 |
|
|
57 |
const TDesC& CInterfaceSettingBase::Name() const
|
|
58 |
{
|
253
|
59 |
OstTraceFunctionEntry1( CINTERFACESETTINGBASE_NAME_ENTRY, this );
|
|
60 |
OstTraceFunctionExitExt( CINTERFACESETTINGBASE_NAME_EXIT, this, ( TUint )&( iSettingString ) );
|
0
|
61 |
return iSettingString;
|
|
62 |
}
|
|
63 |
|
|
64 |
|
|
65 |
void CInterfaceSettingBase::SetClassCodeL(TUint8 aClassCode,TUint8 aSubClassCode,TUint8 aDeviceProtocol)
|
|
66 |
{
|
253
|
67 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_SETCLASSCODEL_ENTRY, this );
|
0
|
68 |
// Set class specific information
|
|
69 |
iInterfaceInfo().iClass = TUsbcClassInfo(aClassCode,aSubClassCode,aDeviceProtocol);
|
253
|
70 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_SETCLASSCODEL_EXIT, this );
|
0
|
71 |
}
|
|
72 |
|
|
73 |
|
|
74 |
TInt CInterfaceSettingBase::AddEndpoint(TEndpoint& aEndpoint)
|
|
75 |
{
|
253
|
76 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_ADDENDPOINT_ENTRY, this );
|
0
|
77 |
|
|
78 |
if(aEndpoint.iEndpointNumber == EEndpoint0)
|
|
79 |
{
|
253
|
80 |
OstTraceFunctionExitExt( CINTERFACESETTINGBASE_ADDENDPOINT_EXIT, this, KErrInUse );
|
0
|
81 |
return KErrInUse;
|
|
82 |
}
|
|
83 |
|
|
84 |
if(iEndpoints.Count() < KMaxEndpointsPerClient)
|
|
85 |
{
|
|
86 |
// Set EEndpoint1, EEndpoint2, EEndpoint3, EEndpoint4 or EEndpoint5
|
|
87 |
iInterfaceInfo().iEndpointData[iEndpoints.Count()] = aEndpoint.iEndpointInfo;
|
|
88 |
iEndpoints.Insert(aEndpoint.iEndpointNumber,aEndpoint);
|
|
89 |
|
|
90 |
// Update the total endpoints used on this interface
|
|
91 |
iInterfaceInfo().iTotalEndpointsUsed = iEndpoints.Count();
|
|
92 |
|
253
|
93 |
OstTraceFunctionExitExt( CINTERFACESETTINGBASE_ADDENDPOINT_EXIT_DUP01, this, KErrNone );
|
0
|
94 |
return KErrNone;
|
|
95 |
}
|
|
96 |
else
|
|
97 |
{
|
253
|
98 |
OstTraceFunctionExitExt( CINTERFACESETTINGBASE_ADDENDPOINT_EXIT_DUP02, this, KErrOverflow );
|
0
|
99 |
return KErrOverflow;
|
|
100 |
}
|
|
101 |
}
|
|
102 |
|
|
103 |
|
|
104 |
void CInterfaceSettingBase::CreateEndpointReaderL(RDevUsbcClient& aClientDriver,TUint aEndpoint)
|
|
105 |
{
|
253
|
106 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_CREATEENDPOINTREADERL_ENTRY, this );
|
0
|
107 |
// Create the reader for this endpoint and store in the container
|
|
108 |
CEndpointReader* epReader = new (ELeave) CEndpointReader(aClientDriver,
|
|
109 |
iEndpoints.Find(static_cast<TEndpointNumber>(aEndpoint))->iEndpointNumber);
|
|
110 |
CleanupStack::PushL(epReader);
|
|
111 |
iEndpointReaders.AppendL(epReader);
|
|
112 |
CleanupStack::Pop(epReader);
|
253
|
113 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_CREATEENDPOINTREADERL_EXIT, this );
|
0
|
114 |
}
|
|
115 |
|
|
116 |
|
|
117 |
void CInterfaceSettingBase::CreateEndpointWriterL(RDevUsbcClient& aClientDriver,TUint aEndpoint)
|
|
118 |
{
|
253
|
119 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_CREATEENDPOINTWRITERL_ENTRY, this );
|
0
|
120 |
// Create the writer for this endpoint and store in the container
|
|
121 |
CEndpointWriter* epWriter = new (ELeave) CEndpointWriter(aClientDriver,
|
|
122 |
iEndpoints.Find(static_cast<TEndpointNumber>(aEndpoint))->iEndpointNumber);
|
|
123 |
CleanupStack::PushL(epWriter);
|
|
124 |
iEndpointWriters.AppendL(epWriter);
|
|
125 |
CleanupStack::Pop(epWriter);
|
253
|
126 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_CREATEENDPOINTWRITERL_EXIT, this );
|
0
|
127 |
}
|
|
128 |
|
|
129 |
void CInterfaceSettingBase::WriteSpecifiedDataToEndpointL(const TDesC8& aData,TUint16 aEndpointNumber)
|
|
130 |
{
|
253
|
131 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_WRITESPECIFIEDDATATOENDPOINTL_ENTRY, this );
|
0
|
132 |
// Access the correct writer for the given endpoint
|
|
133 |
// and write the data to the host
|
|
134 |
iEndpointWriters[aEndpointNumber-1]->Write(aData, ETrue);
|
253
|
135 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_WRITESPECIFIEDDATATOENDPOINTL_EXIT, this );
|
0
|
136 |
}
|
|
137 |
|
|
138 |
void CInterfaceSettingBase::WriteSpecifiedDataToEndpointL(const TDesC8& aDataPattern, const TUint aNumBytes, TUint16 aEndpointNumber)
|
|
139 |
{
|
253
|
140 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_WRITESPECIFIEDDATATOENDPOINTL_ENTRY_DUP01, this );
|
0
|
141 |
// Access the correct writer for the given endpoint
|
|
142 |
// and write the data to the host
|
|
143 |
iEndpointWriters[aEndpointNumber-1]->WriteUsingPatternL(aDataPattern,aNumBytes,ETrue);
|
253
|
144 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_WRITESPECIFIEDDATATOENDPOINTL_EXIT_DUP01, this );
|
0
|
145 |
}
|
|
146 |
|
|
147 |
void CInterfaceSettingBase::RepeatedWriteSpecifiedDataToEndpointL(const TDesC8& aDataPattern, TUint aNumBytesPerWrite, TUint aTotalNumBytes, TUint16 aEndpointNumber)
|
|
148 |
{
|
253
|
149 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_REPEATEDWRITESPECIFIEDDATATOENDPOINTL_ENTRY, this );
|
0
|
150 |
// Access the correct writer for the given endpoint
|
|
151 |
// and write the data to the host
|
|
152 |
iEndpointWriters[aEndpointNumber-1]->WriteInPartsUsingPatternL(aDataPattern,aNumBytesPerWrite,aTotalNumBytes,ETrue);
|
253
|
153 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_REPEATEDWRITESPECIFIEDDATATOENDPOINTL_EXIT, this );
|
0
|
154 |
}
|
|
155 |
|
|
156 |
void CInterfaceSettingBase::WriteCachedEndpointDataToEndpointL(const TUint16 aReadEndpointNumber,TUint16 aWriteEndpointNumber)
|
|
157 |
{
|
253
|
158 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_WRITECACHEDENDPOINTDATATOENDPOINTL_ENTRY, this );
|
0
|
159 |
|
|
160 |
iEndpointWriters[aWriteEndpointNumber-1]->Write(iEndpointReaders[aReadEndpointNumber-1]->Buffer(), ETrue);
|
253
|
161 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_WRITECACHEDENDPOINTDATATOENDPOINTL_EXIT, this );
|
0
|
162 |
}
|
|
163 |
|
|
164 |
void CInterfaceSettingBase::CancelWriteDataToEndpointL(TUint16 aEndpointNumber)
|
|
165 |
{
|
253
|
166 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_CANCELWRITEDATATOENDPOINTL_ENTRY, this );
|
0
|
167 |
// Access the correct writer for the given endpoint
|
|
168 |
// and cancel any outstanding write. This will not of course work for 'synchronous' writes.
|
|
169 |
iEndpointWriters[aEndpointNumber-1]->Cancel();
|
253
|
170 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_CANCELWRITEDATATOENDPOINTL_EXIT, this );
|
0
|
171 |
}
|
|
172 |
|
|
173 |
void CInterfaceSettingBase::WriteSynchronousSpecifiedDataToEndpointL(const TDesC8& aDataPattern, const TUint aNumBytes, TUint16 aEndpointNumber)
|
|
174 |
{
|
253
|
175 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_WRITESYNCHRONOUSSPECIFIEDDATATOENDPOINTL_ENTRY, this );
|
0
|
176 |
// Access the correct writer for the given endpoint
|
|
177 |
// and write the data to the host
|
|
178 |
iEndpointWriters[aEndpointNumber-1]->WriteSynchronousUsingPatternL(aDataPattern,aNumBytes,ETrue);
|
253
|
179 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_WRITESYNCHRONOUSSPECIFIEDDATATOENDPOINTL_EXIT, this );
|
0
|
180 |
}
|
|
181 |
|
|
182 |
void CInterfaceSettingBase::WriteSynchronousSpecifiedDataToAndHaltEndpointL(const TDesC8& aDataPattern, const TUint aNumBytes, TUint16 aEndpointNumber)
|
|
183 |
{
|
253
|
184 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_WRITESYNCHRONOUSSPECIFIEDDATATOANDHALTENDPOINTL_ENTRY, this );
|
0
|
185 |
// Access the correct writer for the given endpoint
|
|
186 |
// and write the data to the host
|
|
187 |
iEndpointWriters[aEndpointNumber-1]->WriteSynchronousUsingPatternAndHaltL(aDataPattern,aNumBytes);
|
253
|
188 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_WRITESYNCHRONOUSSPECIFIEDDATATOANDHALTENDPOINTL_EXIT, this );
|
0
|
189 |
}
|
|
190 |
|
|
191 |
void CInterfaceSettingBase::WriteSynchronousCachedEndpointDataToEndpointL(const TUint16 aReadEndpointNumber,TUint16 aWriteEndpointNumber)
|
|
192 |
{
|
253
|
193 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_WRITESYNCHRONOUSCACHEDENDPOINTDATATOENDPOINTL_ENTRY, this );
|
0
|
194 |
|
|
195 |
//Attempt to write the complete cached buffer by starting at zero and choosing the max length posible
|
|
196 |
WriteSynchronousCachedEndpointDataToEndpointL(aReadEndpointNumber, aWriteEndpointNumber, 0, KMaxTInt);
|
253
|
197 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_WRITESYNCHRONOUSCACHEDENDPOINTDATATOENDPOINTL_EXIT, this );
|
0
|
198 |
}
|
|
199 |
|
|
200 |
void CInterfaceSettingBase::WriteSynchronousCachedEndpointDataToEndpointL(const TUint16 aReadEndpointNumber,TUint16 aWriteEndpointNumber, TUint aStartPoint, TUint aLength)
|
|
201 |
{
|
253
|
202 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_WRITESYNCHRONOUSCACHEDENDPOINTDATATOENDPOINTL_ENTRY_DUP01, this );
|
0
|
203 |
// Access the correct writer for the given endpoint
|
|
204 |
// Access the 'source' endpoint buffer. This contains data from that endpoint's last read.
|
|
205 |
// Write this data to the host using 'write' endpoint.
|
|
206 |
|
|
207 |
// Check data
|
|
208 |
TPtr8 dataPtr(iEndpointReaders[aReadEndpointNumber-1]->Buffer());
|
|
209 |
User::LeaveIfError(dataPtr.MaxLength() == 0);
|
|
210 |
if(aStartPoint+aLength>dataPtr.Length())
|
|
211 |
//allow use of excessive length to imply a write of all the rest of the buffer...
|
|
212 |
//..otherwise 'Mid' would panic!
|
|
213 |
{
|
|
214 |
aLength = dataPtr.Length() - aStartPoint;
|
|
215 |
}
|
|
216 |
|
|
217 |
// Do the 'Write'
|
|
218 |
// Note we need a synchronous 'Write' here
|
|
219 |
iEndpointWriters[aWriteEndpointNumber-1]->WriteSynchronous(iEndpointReaders[aReadEndpointNumber-1]->Buffer().Mid(aStartPoint, aLength), ETrue);
|
253
|
220 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_WRITESYNCHRONOUSCACHEDENDPOINTDATATOENDPOINTL_EXIT_DUP01, this );
|
0
|
221 |
}
|
|
222 |
|
|
223 |
TBool CInterfaceSettingBase::CachedEndpointResultL(const TUint16 aEndpointNumber)
|
|
224 |
{
|
253
|
225 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_CACHEDENDPOINTRESULTL_ENTRY, this );
|
0
|
226 |
// Access endpoint buffer containing data from the endpoint's last read
|
|
227 |
// and validate with the supplied data pattern
|
|
228 |
|
|
229 |
return iEndpointReaders[aEndpointNumber-1]->IsValid();
|
|
230 |
}
|
|
231 |
|
|
232 |
TInt CInterfaceSettingBase::NumBytesReadSoFarL(const TUint16 aEndpointNumber)
|
|
233 |
{
|
253
|
234 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_NUMBYTESREADSOFARL_ENTRY, this );
|
0
|
235 |
// Access endpoint buffer containing data from the endpoint's last read
|
|
236 |
// and validate with the supplied data pattern
|
|
237 |
|
|
238 |
return iEndpointReaders[aEndpointNumber-1]->NumBytesReadSoFar();
|
|
239 |
}
|
|
240 |
|
|
241 |
TInt CInterfaceSettingBase::NumBytesWrittenSoFarL(const TUint16 aEndpointNumber)
|
|
242 |
{
|
253
|
243 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_NUMBYTESWRITTENSOFARL_ENTRY, this );
|
0
|
244 |
// Access endpoint buffer containing data from the endpoint's last read
|
|
245 |
// and validate with the supplied data pattern
|
|
246 |
|
|
247 |
return iEndpointWriters[aEndpointNumber-1]->NumBytesWrittenSoFar();
|
|
248 |
}
|
|
249 |
|
|
250 |
TBool CInterfaceSettingBase::ValidateCachedEndpointDataL(const TDesC8& aDataPattern, const TUint aNumBytes, const TUint16 aEndpointNumber)
|
|
251 |
{
|
253
|
252 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_ENTRY, this );
|
0
|
253 |
// Access endpoint buffer containing data from the endpoint's last read
|
|
254 |
// and validate with the supplied data pattern
|
|
255 |
|
|
256 |
return ValidateCachedEndpointDataL(aDataPattern, 0, aNumBytes, aEndpointNumber);
|
|
257 |
}
|
|
258 |
|
|
259 |
TBool CInterfaceSettingBase::ValidateCachedEndpointDataL(const TDesC8& aDataPattern, const TUint aStartPoint, const TUint aNumBytes, const TUint16 aEndpointNumber)
|
|
260 |
{
|
253
|
261 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_ENTRY_DUP01, this );
|
0
|
262 |
__ASSERT_DEBUG(aDataPattern.Length()!=0, User::Panic(_L("Trying to validate with ZERO LENGTH STRING"), KErrArgument));
|
|
263 |
|
|
264 |
//Check data in endpoint buffer
|
|
265 |
TPtr8 dataToValidate(iEndpointReaders[aEndpointNumber-1]->Buffer());
|
|
266 |
User::LeaveIfError(dataToValidate.MaxLength() == 0);
|
|
267 |
|
|
268 |
TUint startPoint = aStartPoint%aDataPattern.Length();
|
|
269 |
TUint numStartBytes = (aDataPattern.Length() - startPoint)%aDataPattern.Length();
|
|
270 |
numStartBytes = aNumBytes<numStartBytes?aNumBytes:numStartBytes; //never test for more than aNumBytes
|
|
271 |
TUint fullRepeats = (aNumBytes-numStartBytes)/aDataPattern.Length();
|
|
272 |
TUint startEndPoint = (fullRepeats*aDataPattern.Length()) + numStartBytes;
|
|
273 |
TUint numEndBytes = aNumBytes - startEndPoint;//fullRepeats*aDataPattern.Length() - numStartBytes;
|
|
274 |
if(numStartBytes)
|
|
275 |
{
|
|
276 |
if(dataToValidate.Left(numStartBytes).Compare(aDataPattern.Mid(startPoint, numStartBytes)) != 0)
|
|
277 |
{
|
253
|
278 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL, "ROUND TRIP VALIDATION: Start Bytes Match Failure");
|
|
279 |
OstTrace1(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP01, "ROUND TRIP VALIDATION: numStartBytes = %d", numStartBytes);
|
|
280 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP02, "Start of sent data ...");
|
|
281 |
const TPtrC8& midDataPattern = aDataPattern.Mid(startPoint, numStartBytes);
|
|
282 |
OstTraceData(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP52, "", midDataPattern.Ptr(), midDataPattern.Length());
|
|
283 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP03, "\n");
|
|
284 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP04, "ROUND TRIP VALIDATION: Start of returned data ...");
|
|
285 |
const TPtrC8& leftDataToValidate = dataToValidate.Left(numStartBytes);
|
|
286 |
OstTraceData(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP54, "", leftDataToValidate.Ptr(), leftDataToValidate.Length());
|
|
287 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP05, "\n");
|
|
288 |
OstTraceFunctionExitExt( CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_EXIT, this, EFalse );
|
0
|
289 |
return EFalse;
|
|
290 |
}
|
|
291 |
}
|
|
292 |
if(numEndBytes)
|
|
293 |
{
|
|
294 |
if(dataToValidate.Mid(startEndPoint,numEndBytes).Compare(aDataPattern.Left(numEndBytes)) != 0)
|
|
295 |
{
|
253
|
296 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP06, "ROUND TRIP VALIDATION: End Bytes Match Failure");
|
|
297 |
OstTraceExt2(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP07, "ROUND TRIP VALIDATION: startEndPoint = %u, numEndBytes = %u", startEndPoint, numEndBytes);
|
|
298 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP08, "End of sent data ...");
|
|
299 |
const TPtrC8& leftDataPattern = aDataPattern.Left(numEndBytes);
|
|
300 |
OstTraceData(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP58, "", leftDataPattern.Ptr(), leftDataPattern.Length());
|
|
301 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP09, "\n");
|
|
302 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP10, "ROUND TRIP VALIDATION: End of returned data ...");
|
|
303 |
const TPtrC8& midDataToValidate = dataToValidate.Mid(startEndPoint,numEndBytes);
|
|
304 |
OstTraceData(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP60, "", midDataToValidate.Ptr(), midDataToValidate.Length());
|
|
305 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP11, "\n");
|
|
306 |
OstTraceFunctionExitExt( CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_EXIT_DUP01, this, EFalse );
|
0
|
307 |
return EFalse;
|
|
308 |
}
|
|
309 |
}
|
|
310 |
for(TInt i=0; i<fullRepeats; i++)
|
|
311 |
{
|
|
312 |
if(dataToValidate.Mid(numStartBytes + i*aDataPattern.Length(),aDataPattern.Length()).Compare(aDataPattern) != 0)
|
|
313 |
{
|
253
|
314 |
OstTrace1(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP12, "ROUND TRIP VALIDATION: Repeated Bytes Match Failure, Repeat %d",i);
|
|
315 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP13, "sent data middle block ...");
|
|
316 |
OstTraceData(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP53, "", aDataPattern.Ptr(), aDataPattern.Length());
|
|
317 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP14, "\n");
|
|
318 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP15, "ROUND TRIP VALIDATION: Middle block of returned data ...");
|
|
319 |
const TPtrC8& midDataToValidate = dataToValidate.Mid(numStartBytes + i*aDataPattern.Length(),aDataPattern.Length());
|
|
320 |
OstTraceData(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP55, "", midDataToValidate.Ptr(), midDataToValidate.Length());
|
|
321 |
OstTrace0(TRACE_NORMAL, CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_DUP16, "\n");
|
|
322 |
OstTraceFunctionExitExt( CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_EXIT_DUP02, this, EFalse );
|
0
|
323 |
return EFalse; //from 'for' loop
|
|
324 |
}
|
|
325 |
}
|
253
|
326 |
OstTraceFunctionExitExt( CINTERFACESETTINGBASE_VALIDATECACHEDENDPOINTDATAL_EXIT_DUP03, this, ETrue );
|
0
|
327 |
return ETrue;
|
|
328 |
}
|
|
329 |
|
|
330 |
|
|
331 |
void CInterfaceSettingBase::ReadDataFromEndpointL(TUint aNumBytes, TUint16 aEndpointNumber)
|
|
332 |
{
|
253
|
333 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_READDATAFROMENDPOINTL_ENTRY, this );
|
0
|
334 |
// Access the correct readerer for the given endpoint
|
|
335 |
// and prepare to read the data to be sent by the host
|
|
336 |
iEndpointReaders[aEndpointNumber-1]->ReadL(aNumBytes);
|
253
|
337 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_READDATAFROMENDPOINTL_EXIT, this );
|
0
|
338 |
}
|
|
339 |
|
|
340 |
void CInterfaceSettingBase::CancelAnyReadDataFromEndpointL(TUint16 aEndpointNumber)
|
|
341 |
{
|
253
|
342 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_CANCELANYREADDATAFROMENDPOINTL_ENTRY, this );
|
0
|
343 |
// Access the correct writer for the given endpoint
|
|
344 |
// and cancel any outstanding write. This will not of course work for 'synchronous' writes.
|
|
345 |
iEndpointReaders[aEndpointNumber-1]->Cancel();
|
253
|
346 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_CANCELANYREADDATAFROMENDPOINTL_EXIT, this );
|
0
|
347 |
}
|
|
348 |
|
|
349 |
void CInterfaceSettingBase::ReadDataFromAndHaltEndpointL(TUint aNumBytes, TUint16 aEndpointNumber)
|
|
350 |
{
|
253
|
351 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_READDATAFROMANDHALTENDPOINTL_ENTRY, this );
|
0
|
352 |
// Access the correct reader for the given endpoint
|
|
353 |
// and prepare to read the data to be sent by the host
|
|
354 |
iEndpointReaders[aEndpointNumber-1]->ReadAndHaltL(aNumBytes);
|
253
|
355 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_READDATAFROMANDHALTENDPOINTL_EXIT, this );
|
0
|
356 |
}
|
|
357 |
|
|
358 |
void CInterfaceSettingBase::RepeatedReadAndValidateFromEndpointL(const TDesC8& aDataPattern, TUint aNumBytesPerRead, TUint aTotalNumBytes, TUint16 aEndpointNumber)
|
|
359 |
{
|
253
|
360 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_REPEATEDREADANDVALIDATEFROMENDPOINTL_ENTRY, this );
|
0
|
361 |
// Access the correct reader for the given endpoint
|
|
362 |
// and prepare to read the data to be sent by the host
|
|
363 |
// using multiple 'Reads'
|
|
364 |
iEndpointReaders[aEndpointNumber-1]->RepeatedReadAndValidateL(aDataPattern, aNumBytesPerRead, aTotalNumBytes);
|
253
|
365 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_REPEATEDREADANDVALIDATEFROMENDPOINTL_EXIT, this );
|
0
|
366 |
}
|
|
367 |
|
|
368 |
void CInterfaceSettingBase::ReadDataUntilShortFromEndpointL(TUint aNumBytes, TUint16 aEndpointNumber)
|
|
369 |
{
|
253
|
370 |
OstTraceFunctionEntryExt( CINTERFACESETTINGBASE_READDATAUNTILSHORTFROMENDPOINTL_ENTRY, this );
|
0
|
371 |
// Access the correct reader for the given endpoint
|
|
372 |
// and prepare to read the data to be sent by the host
|
|
373 |
iEndpointReaders[aEndpointNumber-1]->ReadUntilShortL(aNumBytes);
|
253
|
374 |
OstTraceFunctionExit1( CINTERFACESETTINGBASE_READDATAUNTILSHORTFROMENDPOINTL_EXIT, this );
|
0
|
375 |
}
|
|
376 |
}
|
|
377 |
|
|
378 |
|