0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
#include "cusbpnusbreceiver.h"
|
|
20 |
#include "cusbpnisasender.h" // For sending messages to ISA
|
|
21 |
#include "cusbpnpacket.h" // For packet buffers
|
|
22 |
#include "usbpndefinitions.h" // For constants
|
|
23 |
#include "usbpntrace.h" // For tracing
|
|
24 |
|
|
25 |
#include "osttracedefinitions.h"
|
|
26 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
27 |
#include "cusbpnusbreceiverTraces.h"
|
|
28 |
#endif
|
|
29 |
|
|
30 |
#include <d32usbc.h> // For RDevUsbcClient
|
|
31 |
#include <pn_const.h> // For header size
|
|
32 |
#include <phonetisi.h> // For Phonet definitions
|
|
33 |
|
|
34 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
35 |
#include <test_serverisi.h> // For APE Test Server message ID
|
|
36 |
#include <iscnokiadefinitions.h> // For APE Test Server channel ID
|
|
37 |
#endif /* NCP_COMMON_BRIDGE_FAMILY */
|
|
38 |
|
|
39 |
// EXTERNAL DATA STRUCTURES
|
|
40 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
41 |
// CONSTANTS
|
|
42 |
// MACROS
|
|
43 |
// LOCAL CONSTANTS AND MACROS
|
|
44 |
// MODULE DATA STRUCTURES
|
|
45 |
// LOCAL FUNCTION PROTOTYPES
|
|
46 |
// FORWARD DECLARATIONS
|
|
47 |
|
|
48 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
49 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
50 |
|
|
51 |
// -----------------------------------------------------------------------------
|
|
52 |
// CUsbPnUsbReceiver::CUsbPnUsbReceiver
|
|
53 |
// C++ default constructor can NOT contain any code, that
|
|
54 |
// might leave.
|
|
55 |
// -----------------------------------------------------------------------------
|
|
56 |
//
|
|
57 |
CUsbPnUsbReceiver::CUsbPnUsbReceiver( RDevUsbcClient& aLdd )
|
|
58 |
:CActive( CActive::EPriorityStandard )
|
|
59 |
, iLdd( aLdd )
|
|
60 |
, iRecvPtr(0,0)
|
|
61 |
, iStorage(0)
|
|
62 |
{
|
|
63 |
OstTrace1( TRACE_NORMAL, CUSBPNUSBRECEIVER_CUSBPNUSBRECEIVER_ENTRY, "CUsbPnUsbReceiver::CUsbPnUsbReceiver;aLdd=%x", ( TUint )&( aLdd ) );
|
|
64 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::CUsbPnUsbReceiver( aLdd:0x%x )" ), &aLdd ) );
|
|
65 |
|
|
66 |
CActiveScheduler::Add(this);
|
|
67 |
|
|
68 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_CUSBPNUSBRECEIVER_EXIT, "CUsbPnUsbReceiver::CUsbPnUsbReceiver - return" );
|
|
69 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::CUsbPnUsbReceiver() - return" ) ) );
|
|
70 |
}
|
|
71 |
|
|
72 |
// -----------------------------------------------------------------------------
|
|
73 |
// CUsbPnUsbReceiver::ConstructL
|
|
74 |
// Symbian 2nd phase constructor can leave.
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
void CUsbPnUsbReceiver::ConstructL( RIscApi& aIscApi )
|
|
78 |
{
|
|
79 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_CONSTRUCTL_ENTRY, "CUsbPnUsbReceiver::ConstructL" );
|
|
80 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructL()" ) ) );
|
|
81 |
|
|
82 |
iIsaSender = CUsbPnIsaSender::NewL( *this, aIscApi );
|
|
83 |
|
|
84 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_CONSTRUCTL_EXIT, "CUsbPnUsbReceiver::ConstructL - return void" );
|
|
85 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructL() - return void" ) ) );
|
|
86 |
}
|
|
87 |
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
// CUsbPnUsbReceiver::NewL
|
|
90 |
// Two-phased constructor.
|
|
91 |
// -----------------------------------------------------------------------------
|
|
92 |
//
|
|
93 |
CUsbPnUsbReceiver* CUsbPnUsbReceiver::NewL( RDevUsbcClient& aLdd, RIscApi& aIscApi )
|
|
94 |
{
|
|
95 |
OstTraceExt2( TRACE_NORMAL, CUSBPNUSBRECEIVER_NEWL_ENTRY, "CUsbPnUsbReceiver::NewL;aLdd=%x;aIscApi=%x", ( TUint )&( aLdd ), ( TUint )&( aIscApi ) );
|
|
96 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::NewL( aLdd:0x%x, aIscApi:0x%x )" ), &aLdd, &aIscApi ) );
|
|
97 |
|
|
98 |
CUsbPnUsbReceiver* self = new( ELeave ) CUsbPnUsbReceiver( aLdd );
|
|
99 |
|
|
100 |
CleanupStack::PushL( self );
|
|
101 |
self->ConstructL( aIscApi );
|
|
102 |
CleanupStack::Pop( self );
|
|
103 |
|
|
104 |
OstTrace1( TRACE_NORMAL, CUSBPNUSBRECEIVER_NEWL_EXIT, "CUsbPnUsbReceiver::NewL - return;self=%x", self );
|
|
105 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::NewL() - return 0x%x" ), self ) );
|
|
106 |
return self;
|
|
107 |
}
|
|
108 |
|
|
109 |
|
|
110 |
// Destructor
|
|
111 |
CUsbPnUsbReceiver::~CUsbPnUsbReceiver()
|
|
112 |
{
|
|
113 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_CUSBPNUSBRECEIVER_DESTRUCTOR_ENTRY, "CUsbPnUsbReceiver::~CUsbPnUsbReceiver" );
|
|
114 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::~CUsbPnUsbReceiver()" ) ) );
|
|
115 |
|
|
116 |
Cancel();
|
|
117 |
if( iIsaSender )
|
|
118 |
{
|
|
119 |
delete iIsaSender;
|
|
120 |
}
|
|
121 |
|
|
122 |
iPacket = 0;
|
|
123 |
|
|
124 |
if( iStorage )
|
|
125 |
{
|
|
126 |
delete iStorage;
|
|
127 |
}
|
|
128 |
iStorage = NULL;
|
|
129 |
|
|
130 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_CUSBPNUSBRECEIVER_DESTRUCTOR_EXIT, "CUsbPnUsbReceiver::~CUsbPnUsbReceiver - return" );
|
|
131 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::~CUsbPnUsbReceiver() - return" ) ) );
|
|
132 |
}
|
|
133 |
|
|
134 |
|
|
135 |
// -----------------------------------------------------------------------------
|
|
136 |
// CUsbPnUsbReceiver::DoCancel
|
|
137 |
// ?implementation_description
|
|
138 |
// (other items were commented in a header).
|
|
139 |
// -----------------------------------------------------------------------------
|
|
140 |
//
|
|
141 |
void CUsbPnUsbReceiver::DoCancel( )
|
|
142 |
{
|
|
143 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_DOCANCEL_ENTRY, "CUsbPnUsbReceiver::DoCancel" );
|
|
144 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::DoCancel()" ) ) );
|
|
145 |
|
|
146 |
iLdd.ReadCancel( EEndpoint2 );
|
|
147 |
TRAPD(err, iPacket->ReleaseL());
|
|
148 |
|
|
149 |
OstTrace1( TRACE_NORMAL, CUSBPNUSBRECEIVER_DOCANCEL, "CUsbPnUsbReceiver::DoCancel - err=%d", err );
|
|
150 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::DoCancel() - err=%d" ), err ) );
|
|
151 |
|
|
152 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_DOCANCEL_EXIT, "CUsbPnUsbReceiver::DoCancel - return void" );
|
|
153 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::DoCancel() - return void" ) ) );
|
|
154 |
}
|
|
155 |
|
|
156 |
// -----------------------------------------------------------------------------
|
|
157 |
// CUsbPnUsbReceiver::RunL
|
|
158 |
// ?implementation_description
|
|
159 |
// (other items were commented in a header).
|
|
160 |
// -----------------------------------------------------------------------------
|
|
161 |
//
|
|
162 |
void CUsbPnUsbReceiver::RunL( )
|
|
163 |
{
|
|
164 |
OstTrace1( TRACE_API, CUSBPNUSBRECEIVER_RUNL_ENTRY, "CUsbPnUsbReceiver::RunL;iStatus:%d", iStatus.Int() );
|
|
165 |
A_TRACE( ( _T( "CUsbPnUsbReceiver::RunL() iStatus:%d" ), iStatus.Int() ) );
|
|
166 |
|
|
167 |
User::LeaveIfError( iStatus.Int() );
|
|
168 |
ConstructMessageL();
|
|
169 |
if( iMessageComplete )
|
|
170 |
{
|
|
171 |
iIsaSender->Send( *iPacket );
|
|
172 |
iMessageComplete = EFalse;
|
|
173 |
iByteCount = 0;
|
|
174 |
iMessageLength = 0;
|
|
175 |
|
|
176 |
// Start fresh receive
|
|
177 |
Receive( ETrue );
|
|
178 |
}
|
|
179 |
|
|
180 |
OstTrace0( TRACE_API, CUSBPNUSBRECEIVER_RUNL_EXIT, "CUsbPnUsbReceiver::RunL - return void" );
|
|
181 |
A_TRACE( ( _T( "CUsbPnUsbReceiver::RunL() - return void" ) ) );
|
|
182 |
}
|
|
183 |
|
|
184 |
// -----------------------------------------------------------------------------
|
|
185 |
// CUsbPnUsbReceiver::RunError
|
|
186 |
// ?implementation_description
|
|
187 |
// (other items were commented in a header).
|
|
188 |
// -----------------------------------------------------------------------------
|
|
189 |
//
|
|
190 |
TInt CUsbPnUsbReceiver::RunError( TInt aError )
|
|
191 |
{
|
|
192 |
OstTrace1( TRACE_API, CUSBPNUSBRECEIVER_RUNERROR_ENTRY, "CUsbPnUsbReceiver::RunError;aError=%d", aError );
|
|
193 |
A_TRACE( ( _T( "CUsbPnUsbReceiver::RunError(aError:%d)" ), aError ) );
|
|
194 |
|
|
195 |
switch( aError )
|
|
196 |
{
|
|
197 |
case KErrUsbDriverBase:
|
|
198 |
case KErrUsbInterfaceNotReady:
|
|
199 |
case KErrUsbEpNotInInterface:
|
|
200 |
case KErrUsbEpBadDirection:
|
|
201 |
case KErrUsbTransferSize:
|
|
202 |
case KErrUsbDeviceNotConfigured:
|
|
203 |
case KErrUsbBadEndpoint:
|
|
204 |
case KErrUsbDeviceClosing:
|
|
205 |
case KErrUsbInterfaceChange:
|
|
206 |
case KErrUsbCableDetached:
|
|
207 |
case KErrUsbDeviceBusReset:
|
|
208 |
case KErrUsbEpNotReady:
|
|
209 |
{
|
|
210 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RUNERROR, "CUsbPnUsbReceiver::RunError - Cable detached!" );
|
|
211 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::RunError - Cable detached!" )));
|
|
212 |
aError = KErrNone;
|
|
213 |
break;
|
|
214 |
}
|
|
215 |
default:
|
|
216 |
{
|
|
217 |
TRACE_ASSERT_ALWAYS; // Log the errorcase.
|
|
218 |
aError = KErrNone; // Ignore error..
|
|
219 |
break;
|
|
220 |
}
|
|
221 |
}
|
|
222 |
|
|
223 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RUNERROR_EXIT, "CUsbPnUsbReceiver::RunError - return" );
|
|
224 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::RunL() - return" ) ) );
|
|
225 |
return aError;
|
|
226 |
}
|
|
227 |
|
|
228 |
// -----------------------------------------------------------------------------
|
|
229 |
// CUsbPnUsbReceiver::Receive
|
|
230 |
// ?implementation_description
|
|
231 |
// (other items were commented in a header).
|
|
232 |
// -----------------------------------------------------------------------------
|
|
233 |
//
|
|
234 |
void CUsbPnUsbReceiver::Receive( TBool /*aForward*/ )
|
|
235 |
{
|
|
236 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RECEIVE_ENTRY, "CUsbPnUsbReceiver::Receive" );
|
|
237 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::Receive()" )) );
|
|
238 |
|
|
239 |
// iEnumerated flag is controlled by CUsbPnInterface. ETrue when altset1. EFalse if altset0 or cable disconnected.
|
|
240 |
if( iEnumerated )
|
|
241 |
{
|
|
242 |
if(!IsActive())
|
|
243 |
{
|
|
244 |
TRAPD( err, iPacket = &iIsaSender->PacketL() );
|
|
245 |
if(!err)
|
|
246 |
{
|
|
247 |
iRecvPtr.Set( iPacket->Buffer().Des() );
|
|
248 |
iLdd.ReadUntilShort( iStatus, EEndpoint2, iRecvPtr );
|
|
249 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RECEIVE, "CUsbPnUsbReceiver::Receive - Receiving" );
|
|
250 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::Receive - Receiving" )) );
|
|
251 |
SetActive();
|
|
252 |
}
|
|
253 |
else
|
|
254 |
{
|
|
255 |
// No free packets so receiving not activated until sender
|
|
256 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RECEIVE_DUP1, "CUsbPnUsbReceiver::Receive - Sender tells when to continue" );
|
|
257 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::Receive - Sender tells when to continue" )) );
|
|
258 |
}
|
|
259 |
}
|
|
260 |
}
|
|
261 |
|
|
262 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RECEIVE_EXIT, "CUsbPnUsbReceiver::Receive - return void" );
|
|
263 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::Receive() - return void" ) ) );
|
|
264 |
}
|
|
265 |
|
|
266 |
// -----------------------------------------------------------------------------
|
|
267 |
// CUsbPnUsbReceiver::IsaSender
|
|
268 |
// ?implementation_description
|
|
269 |
// (other items were commented in a header).
|
|
270 |
// -----------------------------------------------------------------------------
|
|
271 |
//
|
|
272 |
MUsbPnControlObserver* CUsbPnUsbReceiver::IsaSender()
|
|
273 |
{
|
|
274 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_ISASENDER_ENTRY, "CUsbPnUsbReceiver::IsaSender" );
|
|
275 |
OstTrace1( TRACE_NORMAL, CUSBPNUSBRECEIVER_ISASENDER_EXIT, "CUsbPnUsbReceiver::IsaSender - return;MUsbPnControlObserver*=%x", (MUsbPnControlObserver*)iIsaSender );
|
|
276 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::IsaSender()")));
|
|
277 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::IsaSender() - return MUsbPnControlObserver*: 0x%x"), (MUsbPnControlObserver*)iIsaSender ));
|
|
278 |
|
|
279 |
return (MUsbPnControlObserver*)iIsaSender;
|
|
280 |
}
|
|
281 |
// -----------------------------------------------------------------------------
|
|
282 |
// CUsbPnUsbReceiver::SetEnumerated
|
|
283 |
// ?implementation_description
|
|
284 |
// (other items were commented in a header).
|
|
285 |
// -----------------------------------------------------------------------------
|
|
286 |
//
|
|
287 |
void CUsbPnUsbReceiver::SetEnumerated( TBool aState )
|
|
288 |
{
|
|
289 |
OstTrace1( TRACE_NORMAL, CUSBPNUSBRECEIVER_SETENUMERATED_ENTRY, "CUsbPnUsbReceiver::SetEnumerated;aState=%d", aState );
|
|
290 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::SetEnumerated( aState:%d)"), aState));
|
|
291 |
|
|
292 |
iEnumerated = aState;
|
|
293 |
|
|
294 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_SETENUMERATED_EXIT, "CUsbPnUsbReceiver::SetEnumerated - return void" );
|
|
295 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::SetEnumerated() - return void")));
|
|
296 |
}
|
|
297 |
|
|
298 |
// -----------------------------------------------------------------------------
|
|
299 |
// CUsbPnUsbReceiver::ConstructMessage
|
|
300 |
// Messages larger than max packet size must be constructed from multiple packets
|
|
301 |
// (other items were commented in a header).
|
|
302 |
// -----------------------------------------------------------------------------
|
|
303 |
//
|
|
304 |
void CUsbPnUsbReceiver::ConstructMessageL()
|
|
305 |
{
|
|
306 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_ENTRY, "CUsbPnUsbReceiver::ConstructMessageL" );
|
|
307 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage()" ) ) );
|
|
308 |
|
|
309 |
TUint packetLength( iPacket->Buffer().Length() );
|
|
310 |
OstTrace1( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL, "CUsbPnUsbReceiver::ConstructMessageL;packetLength=%d", packetLength );
|
|
311 |
E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - packetLength:%d" ), packetLength ) );
|
|
312 |
|
|
313 |
// New message
|
|
314 |
if( iByteCount == 0 )
|
|
315 |
{
|
|
316 |
TUint16 lsb(iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1]);
|
|
317 |
TUint16 msb(iRecvPtr[ISI_HEADER_OFFSET_LENGTH]);
|
|
318 |
|
|
319 |
iMessageLength = (lsb | (msb<<8));
|
|
320 |
|
|
321 |
OstTrace1( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP1, "CUsbPnUsbReceiver::ConstructMessageL;iMessageLength=%d", iMessageLength );
|
|
322 |
E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - iMessageLength:%d" ), iMessageLength ) );
|
|
323 |
if( iMessageLength >= 4 )
|
|
324 |
{
|
|
325 |
iByteCount = packetLength;
|
|
326 |
|
|
327 |
OstTrace1( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP2, "CUsbPnUsbReceiver::ConstructMessageLNew message;Received:%d", iByteCount );
|
|
328 |
E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - New message. Received:%d"), iByteCount));
|
|
329 |
|
|
330 |
if( ( PN_HEADER_SIZE + iMessageLength ) > packetLength )
|
|
331 |
{
|
|
332 |
// realloc
|
|
333 |
OstTrace0( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP3, "CUsbPnUsbReceiver::ConstructMessageL - partial message. Receive more" );
|
|
334 |
E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - partial message. Receive more")));
|
|
335 |
|
|
336 |
// Alloc temporary buffer to store data
|
|
337 |
iStorage = HBufC8::NewL( iMessageLength + PN_HEADER_SIZE );
|
|
338 |
TPtr8 tmp( iStorage->Des() );
|
|
339 |
tmp.Append( iPacket->Buffer() );
|
|
340 |
}
|
|
341 |
}
|
|
342 |
}
|
|
343 |
|
|
344 |
// Appending to previous message
|
|
345 |
else
|
|
346 |
{
|
|
347 |
iByteCount = iByteCount + packetLength;
|
|
348 |
OstTrace1( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP4, "CUsbPnUsbReceiver::ConstructMessageL - Append to previous part;iByteCount:%d", iByteCount );
|
|
349 |
E_TRACE((_T("CUsbPnUsbReceiver::ConstructMessage - Append to previous part. iByteCount:%d"), iByteCount));
|
|
350 |
TPtr8 tmp( iStorage->Des() );
|
|
351 |
tmp.Append( iPacket->Buffer() );
|
|
352 |
}
|
|
353 |
|
|
354 |
// Ready to be sent?
|
|
355 |
if( iByteCount == iMessageLength + PN_HEADER_SIZE )
|
|
356 |
{
|
|
357 |
OstTrace0( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP5, "CUsbPnUsbReceiver::ConstructMessageL - message complete" );
|
|
358 |
E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - message complete")));
|
|
359 |
|
|
360 |
if( iByteCount > KPnPacketSize )
|
|
361 |
{
|
|
362 |
// Realloc iPacket's buffer with needed length
|
|
363 |
OstTrace0( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP6, "CUsbPnUsbReceiver::ConstructMessageL - realloc for whole message" );
|
|
364 |
E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - realloc for whole message")));
|
|
365 |
iPacket->ReallocBufferL( iMessageLength + PN_HEADER_SIZE );
|
|
366 |
iRecvPtr.Set( iPacket->Buffer().Des() );
|
|
367 |
iRecvPtr.Append( *iStorage );
|
|
368 |
delete iStorage;
|
|
369 |
iStorage = NULL;
|
|
370 |
}
|
|
371 |
|
|
372 |
// Converts the endianess of message length
|
|
373 |
TUint8 tmp4(iRecvPtr[ISI_HEADER_OFFSET_LENGTH]);
|
|
374 |
TUint8 tmp5(iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1]);
|
|
375 |
iRecvPtr[ISI_HEADER_OFFSET_LENGTH] = tmp5;
|
|
376 |
iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1] = tmp4;
|
|
377 |
|
|
378 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
379 |
// Message directly to APE Test Server. Rare labeling case for optimized performance
|
|
380 |
if( (iRecvPtr[ISI_HEADER_OFFSET_RESOURCEID] == PN_EPOC_TEST) &&
|
|
381 |
(iRecvPtr[ISI_HEADER_OFFSET_MESSAGEID] == TS_SOS_FILE_WRITE_REQ ) )
|
|
382 |
{
|
|
383 |
OstTrace0( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP7, "CUsbPnUsbReceiver::ConstructMessageL - Message to APE Test Server" );
|
|
384 |
E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - Message to APE Test Server")));
|
|
385 |
|
|
386 |
// Set Receiver device
|
|
387 |
//TUint8 recvDev = iRecvPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] & 0x03;
|
|
388 |
//iRecvPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] = (recvDev | (PN_DEV_SOS & 0xFC));
|
|
389 |
|
|
390 |
iRecvPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] = PN_DEV_SOS;
|
|
391 |
|
|
392 |
// Set Receiver Object ID
|
|
393 |
TUint8 objIdHighBits = (EIscNokiaTest >> 8) & 0x03;
|
|
394 |
TUint8 objIdLowBits = (EIscNokiaTest & 0x00ff);
|
|
395 |
|
|
396 |
TUint8 receiverDevice( (iRecvPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] ) & 0xFC );
|
|
397 |
|
|
398 |
receiverDevice = (receiverDevice | objIdHighBits);
|
|
399 |
iRecvPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] = receiverDevice;
|
|
400 |
|
|
401 |
iRecvPtr[ISI_HEADER_OFFSET_RECEIVEROBJECT] = objIdLowBits;
|
|
402 |
}
|
|
403 |
#endif /* NCP_COMMON_BRIDGE_FAMILY */
|
|
404 |
|
|
405 |
iMessageComplete = ETrue;
|
|
406 |
}
|
|
407 |
else
|
|
408 |
{
|
|
409 |
// Empty packet buffer and receive next packet to it.
|
|
410 |
iPacket->ReleaseL();
|
|
411 |
iRecvPtr.Set( iPacket->Buffer().Des() );
|
|
412 |
iLdd.ReadUntilShort( iStatus, EEndpoint2, iRecvPtr );
|
|
413 |
OstTrace0( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP8, "CUsbPnUsbReceiver::ConstructMessageL - Receiving" );
|
|
414 |
E_TRACE((_T("CUsbPnUsbReceiver::ConstructMessage - Receiving")));
|
|
415 |
SetActive();
|
|
416 |
}
|
|
417 |
|
|
418 |
OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_EXIT, "CUsbPnUsbReceiver::ConstructMessageL - return void" );
|
|
419 |
C_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage() - return void" ) ) );
|
|
420 |
}
|
|
421 |
|
|
422 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
|
423 |
|
|
424 |
// End of File
|
|
425 |
|