author | mikaruus |
Tue, 19 Oct 2010 13:16:20 +0300 | |
changeset 9 | 8486d82aef45 |
parent 5 | 8ccc39f9d787 |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* Copyright (c) 2007-2008 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 |
||
19 |
||
20 |
// INCLUDE FILES |
|
9 | 21 |
#include <e32svr.h> // For RDebug |
0 | 22 |
#include <tisi.h> |
23 |
#include <nsisi.h> // isi name |
|
24 |
#include <pipeisi.h> // isi pipe |
|
25 |
#include <pipe_sharedisi.h> |
|
26 |
||
27 |
#include "dpdef.h" // dataport definitions |
|
28 |
#include "dpdataport.h" // dataport main and c32 interface |
|
29 |
#include "dpmif.h" // message interface mif |
|
30 |
#include "dppif.h" // pipe interface pif |
|
31 |
#include "dpcommpep.h" // comm pep interface. interaction with mif |
|
32 |
#include "dplog.h" // dataport logging |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
33 |
#include "OstTraceDefinitions.h" |
0 | 34 |
#ifdef OST_TRACE_COMPILER_IN_USE |
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
35 |
#include "dpmifTraces.h" |
0 | 36 |
#endif |
37 |
||
38 |
||
39 |
// EXTERNAL DATA STRUCTURES |
|
40 |
// none |
|
41 |
||
42 |
// EXTERNAL FUNCTION PROTOTYPES |
|
43 |
// none |
|
44 |
||
45 |
// CONSTANTS |
|
46 |
#ifdef OST_TRACE_COMPILER_IN_USE |
|
47 |
const TUint8 KBufferForOSTTracing = 100; |
|
48 |
#endif |
|
49 |
||
50 |
// MACROS |
|
51 |
// none |
|
52 |
||
53 |
// LOCAL CONSTANTS AND MACROS |
|
54 |
// none |
|
55 |
||
56 |
// MODULE DATA STRUCTURES |
|
57 |
// none |
|
58 |
||
59 |
// LOCAL FUNCTION PROTOTYPES |
|
60 |
// none |
|
61 |
||
62 |
// ============================= LOCAL FUNCTIONS =============================== |
|
63 |
||
64 |
// Local function for printing ISI message in OST |
|
65 |
#ifdef OST_TRACE_COMPILER_IN_USE |
|
66 |
static void OstPrintIsiMessage( const TDesC8& aBuf ) |
|
67 |
{ |
|
68 |
_LIT( KTraceSpace, " " ); |
|
69 |
TInt length = aBuf.Length(); |
|
70 |
TBuf8<KBufferForOSTTracing> trace_msg; |
|
71 |
TUint counter = 1; |
|
72 |
TBool firstTime = ETrue; |
|
73 |
for ( TInt i = 0; i < length; i++ ) |
|
74 |
{ |
|
75 |
trace_msg.AppendNumFixedWidthUC( aBuf[i], EHex, 2 ); |
|
76 |
trace_msg.Append( KTraceSpace ); |
|
77 |
||
78 |
if ( ( counter > 24 ) || // 25 bytes / line |
|
79 |
( ( i + 1 ) == length ) ) // All bytes collected |
|
80 |
{ |
|
81 |
if ( ( firstTime ) && |
|
82 |
( ( i + 1 ) == length ) ) // All bytes collected and traced |
|
83 |
{ |
|
84 |
firstTime = EFalse; |
|
85 |
OstTraceExt1( TRACE_NORMAL, DUP_OSTPRINTISIMESSAGE, "CDpMif:: ==> [ %s]", trace_msg ); |
|
86 |
trace_msg.SetLength( 0 ); |
|
87 |
} |
|
88 |
else if ( firstTime ) // 1st line of the trace |
|
89 |
{ |
|
90 |
firstTime = EFalse; |
|
91 |
OstTraceExt1( TRACE_NORMAL, DUP1_OSTPRINTISIMESSAGE, "CDpMif:: ==> [ %s", trace_msg ); |
|
92 |
trace_msg.SetLength( 0 ); |
|
93 |
} |
|
94 |
else if ( ( i + 1 ) == length ) // The last line |
|
95 |
{ |
|
96 |
OstTraceExt1( TRACE_NORMAL, DUP2_OSTPRINTISIMESSAGE, "CDpMif:: ==> %s]", trace_msg ); |
|
97 |
trace_msg.SetLength( 0 ); |
|
98 |
} |
|
99 |
else // just print bytes |
|
100 |
{ |
|
101 |
OstTraceExt1( TRACE_NORMAL, DUP3_OSTPRINTISIMESSAGE, "CDpMif:: ==> %s", trace_msg ); |
|
102 |
trace_msg.SetLength( 0 ); |
|
103 |
} |
|
104 |
counter = 0; |
|
105 |
} |
|
106 |
counter++; |
|
107 |
} |
|
108 |
} |
|
109 |
||
110 |
#else // OST_TRACE_COMPILER_IN_USE |
|
111 |
||
112 |
#define OstPrintIsiMessage(x) |
|
113 |
||
114 |
#endif // OST_TRACE_COMPILER_IN_USE |
|
115 |
||
116 |
||
117 |
||
118 |
// ============================ MEMBER FUNCTIONS =============================== |
|
119 |
||
120 |
// --------------------------------------------------------- |
|
121 |
// CDpMif::NewL |
|
122 |
// Static constructor. |
|
123 |
// --------------------------------------------------------- |
|
124 |
CDpMif* CDpMif::NewL( |
|
125 |
CDpDataPort& aDataPort ) |
|
126 |
{ |
|
127 |
OstTrace0( TRACE_NORMAL, CDPMIF_NEWL, "CDpMif::NewL" ); |
|
128 |
LOGM(" CDpMif::NewL"); |
|
129 |
||
130 |
CDpMif* self = new ( ELeave ) CDpMif( aDataPort ); |
|
131 |
||
132 |
CleanupStack::PushL( self ); |
|
133 |
self->ConstructL(); |
|
134 |
CleanupStack::Pop( self ); |
|
135 |
||
136 |
return self; |
|
137 |
} |
|
138 |
||
139 |
// --------------------------------------------------------- |
|
140 |
// CDpMif::ConstructL |
|
141 |
// Symbian 2nd phase constructor. |
|
142 |
// --------------------------------------------------------- |
|
143 |
void CDpMif::ConstructL() |
|
144 |
{ |
|
145 |
OstTrace0( TRACE_NORMAL, CDPMIF_CONSTRUCTL, "CDpMif::ConstructL" ); |
|
146 |
LOGM(" CDpMif::ConstructL"); |
|
147 |
||
9 | 148 |
#ifdef PIPECAMP_DATAPORT_PNS_PEP_STATUS_IND_PHONET_ADDRESS_FROM_PNS_PEP_CTRL_REQ |
149 |
RDebug::Print( _L("PIPECAMP_DATAPORT_PNS_PEP_STATUS_IND_PHONET_ADDRESS_FROM_PNS_PEP_CTRL_REQ") ); |
|
150 |
#endif |
|
151 |
||
0 | 152 |
iMsgReceiveBuffer = HBufC8::NewL( ISI_HEADER_SIZE + KDpMaxMsgReceiveSize ); |
153 |
_LIT(KPanicStr, "Dataport - CDpMif::ConstructL"); |
|
154 |
__ASSERT_ALWAYS( iMsgReceiveBuffer, |
|
155 |
User::Panic( KPanicStr, KErrNoMemory ) ); |
|
156 |
iReceiveMessage.Set( iMsgReceiveBuffer->Des() ); |
|
157 |
iReceiveMessage.SetLength( 0 ); |
|
158 |
||
159 |
iMessageSendBuffer = HBufC8::NewL( ISI_HEADER_SIZE + KDpMaxMsgSendSize ); |
|
160 |
__ASSERT_ALWAYS( iMessageSendBuffer, |
|
161 |
User::Panic( KPanicStr, KErrNoMemory ) ); |
|
162 |
iSendMessage.Set( iMessageSendBuffer->Des() ); |
|
163 |
iSendMessage.SetLength( 0 ); |
|
164 |
} |
|
165 |
||
166 |
// --------------------------------------------------------- |
|
167 |
// CDpMif::CDpMif |
|
168 |
// C++ default constructor. |
|
169 |
// --------------------------------------------------------- |
|
170 |
CDpMif::CDpMif( |
|
171 |
CDpDataPort& aDataPort ) : |
|
172 |
CActive( KDpMifPriority ), |
|
173 |
iDataPort( aDataPort ), |
|
174 |
iPifDcs( iDataPort.Pif() ), |
|
175 |
iCommPep( iDataPort.CommPep() ), |
|
176 |
iMsgReceiveBuffer( NULL ), |
|
177 |
iReceiveMessage( NULL, 0 ), |
|
178 |
iMessageSendBuffer( NULL ), |
|
179 |
iSendMessage( NULL, 0 ) |
|
180 |
{ |
|
181 |
OstTrace0( TRACE_NORMAL, CDPMIF_CDPMIF, "CDpMif::CDpMif" ); |
|
182 |
LOGM(" CDpMif::CDpMif"); |
|
183 |
||
184 |
CActiveScheduler::Add( this ); |
|
185 |
} |
|
186 |
||
187 |
// --------------------------------------------------------- |
|
188 |
// CDpMif::~CDpMif |
|
189 |
// Destructor |
|
190 |
// --------------------------------------------------------- |
|
191 |
CDpMif::~CDpMif() |
|
192 |
{ |
|
193 |
OstTrace0( TRACE_NORMAL, DUP1_CDPMIF_CDPMIF, "CDpMif::~CDpMif" ); |
|
194 |
LOGM(" CDpMif::~CDpMif"); |
|
195 |
||
196 |
if ( iMsgReceiveBuffer ) |
|
197 |
{ |
|
198 |
delete iMsgReceiveBuffer; |
|
199 |
} |
|
200 |
//no else |
|
201 |
iMsgReceiveBuffer = NULL; |
|
202 |
iReceiveMessage.Set( NULL, 0, 0 ); |
|
203 |
||
204 |
if ( iMessageSendBuffer ) |
|
205 |
{ |
|
206 |
delete iMessageSendBuffer; |
|
207 |
} |
|
208 |
//no else |
|
209 |
iMessageSendBuffer = NULL; |
|
210 |
iSendMessage.Set( NULL, 0, 0 ); |
|
211 |
} |
|
212 |
||
213 |
// --------------------------------------------------------- |
|
214 |
// CDpMif::RunL |
|
215 |
// This method handles received message from Isc Api and |
|
216 |
// renews read from Isc Api. |
|
217 |
// --------------------------------------------------------- |
|
218 |
// |
|
219 |
void CDpMif::RunL() |
|
220 |
{ |
|
221 |
OstTrace0( TRACE_NORMAL, CDPMIF_RUNL, "CDpMif::RunL" ); |
|
222 |
LOGM1("CDpMif::RunL - Port %d", iDataPort.PortUnit() ); |
|
223 |
||
224 |
// we are always signaled from PhoNet ReceiveMessage |
|
225 |
if ( KErrNoMemory == iStatus.Int() ) |
|
226 |
{ |
|
227 |
LOGM(" ==> KErrNoMemory"); |
|
228 |
OstTrace0( TRACE_NORMAL, DUP1_CDPMIF_RUNL, "CDpMif:: ==> KErrNoMemory" ); |
|
229 |
||
230 |
// deallocate current message |
|
231 |
if ( iMsgReceiveBuffer ) |
|
232 |
{ |
|
233 |
delete iMsgReceiveBuffer; |
|
234 |
iMsgReceiveBuffer = NULL; |
|
235 |
iReceiveMessage.Set( NULL, 0, 0 ); |
|
236 |
} |
|
237 |
//no else |
|
238 |
||
239 |
// ISA Handle receive |
|
240 |
// Trying to allocate a new message |
|
241 |
iMsgReceiveBuffer = HBufC8::NewL( ISI_HEADER_SIZE + iLen ); |
|
242 |
_LIT( KPanicStr, "Dataport - CDpMif::RunL" ); |
|
243 |
__ASSERT_ALWAYS( iMsgReceiveBuffer, |
|
244 |
User::Panic( KPanicStr, KErrNoMemory ) ); |
|
245 |
iReceiveMessage.Set( iMsgReceiveBuffer->Des() ); |
|
246 |
iLen = 0; |
|
247 |
||
248 |
if ( !IsActive() ) |
|
249 |
{ |
|
250 |
iDataPort.ISAHandle().Receive( |
|
251 |
iStatus, iReceiveMessage, iLen ); |
|
252 |
||
253 |
SetActive(); |
|
254 |
} |
|
255 |
//no else |
|
256 |
} |
|
257 |
else |
|
258 |
{ |
|
259 |
OstTrace0( TRACE_NORMAL, DUP2_CDPMIF_RUNL, "CDpMif:: ==> ISI-message received" ); |
|
260 |
OstPrintIsiMessage( iReceiveMessage ); |
|
261 |
||
262 |
LOGM(" ==> ISI-message received"); |
|
263 |
LOGMESSAGE( iReceiveMessage ); |
|
264 |
||
265 |
TIsiReceiveC receivedMsg( iReceiveMessage ); |
|
266 |
||
267 |
TUint8 resource_id( receivedMsg.Get8bit( |
|
268 |
ISI_HEADER_OFFSET_RESOURCEID ) ); |
|
269 |
TUint8 message_id( receivedMsg.Get8bit( |
|
270 |
ISI_HEADER_OFFSET_MESSAGEID ) ); |
|
271 |
||
272 |
switch ( resource_id ) |
|
273 |
{ |
|
274 |
case PN_NAMESERVICE: |
|
275 |
{ |
|
276 |
switch ( message_id ) |
|
277 |
{ |
|
278 |
case PNS_NAME_ADD_RESP: |
|
279 |
{ |
|
280 |
LOG(" ==> PNS_NAME_ADD_RESP received"); |
|
281 |
OstTrace0( TRACE_NORMAL, DUP4_CDPMIF_RUNL, "CDpMif:: ==> PNS_NAME_ADD_RESP received" ); |
|
282 |
||
283 |
TUint8 reason( receivedMsg.Get8bit( ISI_HEADER_SIZE + |
|
284 |
PNS_NAME_ADD_RESP_OFFSET_REASON ) ); |
|
285 |
TInt error( KErrNone ); |
|
286 |
||
287 |
switch ( reason ) |
|
288 |
{ |
|
289 |
case PN_NAME_OK: |
|
290 |
{ |
|
291 |
LOG(" ==> PN_NAME_OK"); |
|
292 |
OstTrace0( TRACE_NORMAL, DUP5_CDPMIF_RUNL, "CDpMif:: ==> PN_NAME_OK" ); |
|
293 |
||
294 |
error = KErrNone; |
|
295 |
break; |
|
296 |
} |
|
297 |
default: |
|
298 |
{ |
|
299 |
LOG1(" ==> reason: %d", reason ); |
|
300 |
OstTraceExt1( TRACE_NORMAL, DUP6_CDPMIF_RUNL, "CDpMif:: ==> reason: %hhu", reason ); |
|
301 |
||
302 |
error = KErrGeneral; |
|
303 |
} |
|
304 |
} |
|
305 |
iDataPort.SignalPif( error ); |
|
306 |
break; |
|
307 |
} |
|
308 |
case PNS_NAME_REMOVE_RESP: |
|
309 |
{ |
|
310 |
LOG(" ==> PNS_NAME_REMOVE_RESP received"); |
|
311 |
OstTrace0( TRACE_NORMAL, DUP7_CDPMIF_RUNL, "CDpMif:: ==> PNS_NAME_REMOVE_RESP received" ); |
|
312 |
break; |
|
313 |
} |
|
314 |
default: |
|
315 |
{ |
|
316 |
LOG1(" ==> Unknown message received. ID: %d", |
|
317 |
message_id ); |
|
318 |
OstTraceExt1( TRACE_NORMAL, DUP8_CDPMIF_RUNL, "CDpMif:: ==> Unknown message received. ID: %hhu", message_id ); |
|
319 |
} |
|
320 |
} |
|
321 |
break; |
|
322 |
} |
|
323 |
case PN_PIPE: |
|
324 |
{ |
|
325 |
switch ( message_id ) |
|
326 |
{ |
|
327 |
case PNS_PEP_CTRL_REQ: |
|
328 |
{ |
|
329 |
LOG(" ==> PNS_PEP_CTRL_REQ received"); |
|
330 |
OstTrace0( TRACE_NORMAL, DUP9_CDPMIF_RUNL, "CDpMif:: ==> PNS_PEP_CTRL_REQ received" ); |
|
331 |
||
332 |
HandlePepCtrlReq( receivedMsg ); |
|
333 |
break; |
|
334 |
} |
|
335 |
case PNS_PEP_STATUS_IND: |
|
336 |
{ |
|
337 |
LOG(" ==> PNS_PEP_STATUS_IND received"); |
|
338 |
OstTrace0( TRACE_NORMAL, DUP10_CDPMIF_RUNL, "CDpMif:: ==> PNS_PEP_STATUS_IND received" ); |
|
339 |
||
340 |
HandlePepStatusInd( receivedMsg ); |
|
341 |
break; |
|
342 |
} |
|
343 |
default: |
|
344 |
{ |
|
345 |
LOG1(" ==> Unknown message received. ID: %d", |
|
346 |
message_id ); |
|
347 |
OstTraceExt1( TRACE_NORMAL, DUP11_CDPMIF_RUNL, "CDpMif:: ==> Unknown message received. ID: %hhu", message_id ); |
|
348 |
} |
|
349 |
} |
|
350 |
break; |
|
351 |
} |
|
352 |
default: |
|
353 |
{ |
|
354 |
LOG1(" ==> Unknown message received. ID: %d", message_id ); |
|
355 |
OstTraceExt1( TRACE_NORMAL, DUP12_CDPMIF_RUNL, "CDpMif:: ==> Unknown message received. ID: %hhu", message_id ); |
|
356 |
} |
|
357 |
} |
|
358 |
||
359 |
iReceiveMessage.Zero(); |
|
360 |
||
361 |
// Check if pipe is removed |
|
362 |
if ( PNS_NAME_REMOVE_RESP == message_id && |
|
363 |
CDpPif::EDpPipeDisconnected == iPifDcs.PipeState() ) |
|
364 |
{ |
|
365 |
// Check if DataPort is ready to be deleted |
|
366 |
if ( iDataPort.IsReadyToDestruct() ) |
|
367 |
{ |
|
368 |
iDataPort.DeleteDataPort(); |
|
369 |
} |
|
370 |
//no else |
|
371 |
} |
|
372 |
else |
|
373 |
{ |
|
374 |
// Renew read |
|
375 |
User::LeaveIfError( Read() ); |
|
376 |
} |
|
377 |
} |
|
378 |
} |
|
379 |
||
380 |
// --------------------------------------------------------- |
|
381 |
// CDpMif::RunError |
|
382 |
// Leave in RunL() is handled here. Error code is returned, |
|
383 |
// when internal error has occured. |
|
384 |
// --------------------------------------------------------- |
|
385 |
// |
|
386 |
TInt CDpMif::RunError( |
|
387 |
TInt aError ) |
|
388 |
{ |
|
389 |
OstTrace0( TRACE_NORMAL, CDPMIF_RUNERROR, "CDpMif::RunError" ); |
|
390 |
LOGM2("CDpMif::RunError - Port %d, error code: %d", |
|
391 |
iDataPort.PortUnit(), aError ); |
|
392 |
OstTraceExt2( TRACE_NORMAL, DUP1_CDPMIF_RUNERROR, "CDpMif:: Port: %u, error code: %d", iDataPort.PortUnit(), aError ); |
|
393 |
||
394 |
// Message was not necessarily freed, if leave happened. |
|
395 |
iReceiveMessage.Zero(); |
|
396 |
||
397 |
return aError; |
|
398 |
} |
|
399 |
||
400 |
// --------------------------------------------------------- |
|
401 |
// CDpMif::DoCancel |
|
402 |
// This method cancels Isc Api receive. |
|
403 |
// --------------------------------------------------------- |
|
404 |
// |
|
405 |
void CDpMif::DoCancel() |
|
406 |
{ |
|
407 |
OstTrace0( TRACE_NORMAL, CDPMIF_DOCANCEL, "CDpMif::DoCancel" ); |
|
408 |
LOGM(" CDpMif::DoCancel"); |
|
409 |
||
410 |
iDataPort.ISAHandle().ReceiveCancel(); |
|
411 |
} |
|
412 |
||
413 |
// --------------------------------------------------------- |
|
414 |
// CDpMif::Read |
|
415 |
// Makes a receive request to ISAHandle |
|
416 |
// --------------------------------------------------------- |
|
417 |
// |
|
418 |
TInt CDpMif::Read() |
|
419 |
{ |
|
420 |
OstTrace0( TRACE_NORMAL, CDPMIF_READ, "CDpMif::Read" ); |
|
421 |
OstTrace1( TRACE_NORMAL, DUP1_CDPMIF_READ, "CDpMif:: Port: %u", iDataPort.PortUnit() ); |
|
422 |
||
423 |
LOGM1("CDpMif::Read - Port %d", iDataPort.PortUnit() ); |
|
424 |
||
425 |
TInt ret( KErrNone ); |
|
426 |
||
427 |
// length of a message ptr indicates we are already reading |
|
428 |
if ( iReceiveMessage.Length() || IsActive() ) |
|
429 |
{ |
|
430 |
LOG(" CDpMif::Read, Fail - already reading"); |
|
431 |
OstTrace0( TRACE_NORMAL, DUP2_CDPMIF_READ, "CDpMif:: Fail - already reading" ); |
|
432 |
||
433 |
ret = KErrGeneral; |
|
434 |
} |
|
435 |
else |
|
436 |
{ |
|
437 |
// IscApi receive |
|
438 |
iDataPort.ISAHandle().Receive( |
|
439 |
iStatus, iReceiveMessage, iLen ); |
|
440 |
||
441 |
SetActive(); |
|
442 |
} |
|
443 |
||
444 |
return ret; |
|
445 |
} |
|
446 |
||
447 |
// --------------------------------------------------------- |
|
448 |
// CDpMif::HandlePepCtrlReq |
|
449 |
// Handles PepCtrlReq messages |
|
450 |
// --------------------------------------------------------- |
|
451 |
// |
|
452 |
void CDpMif::HandlePepCtrlReq( |
|
453 |
TIsiReceiveC& aIsiMessage ) |
|
454 |
{ |
|
455 |
OstTrace0( TRACE_NORMAL, CDPMIF_HANDLEPEPCTRLREQ, "CDpMif::HandlePepCtrlReq" ); |
|
456 |
LOGM(" CDpMif::HandlePepCtrlReq"); |
|
457 |
||
458 |
// Transaction id |
|
459 |
TUint8 transactionId( aIsiMessage.Get8bit( |
|
460 |
ISI_HEADER_OFFSET_TRANSID ) ); |
|
461 |
||
462 |
// Pipe Handle |
|
463 |
if ( PN_PIPE_INVALID_HANDLE == iPifDcs.PipeHandle() ) |
|
464 |
{ |
|
465 |
TUint8 pipeHandle( aIsiMessage.Get8bit( |
|
466 |
ISI_HEADER_SIZE + PNS_PEP_CTRL_REQ_OFFSET_PIPEHANDLE) ); |
|
467 |
iPifDcs.SetPipeHandle( pipeHandle ); |
|
468 |
} |
|
469 |
||
470 |
// PEP Type |
|
471 |
TUint8 pepType( aIsiMessage.Get8bit( |
|
472 |
ISI_HEADER_SIZE + PNS_PEP_CTRL_REQ_OFFSET_PEPTYPE ) ); |
|
473 |
// PEP Control ID |
|
474 |
TUint8 ctrlId( aIsiMessage.Get8bit( |
|
475 |
ISI_HEADER_SIZE + PNS_PEP_CTRL_REQ_OFFSET_PEPCTRLID ) ); |
|
476 |
// PEP Control Data |
|
477 |
TPtrC8 ctrlData; |
|
478 |
// Check if there is data (there is no data for all control id's) |
|
479 |
if ( ( ISI_HEADER_SIZE + SIZE_PNS_PEP_CTRL_REQ ) <= |
|
480 |
aIsiMessage.GetBuffer().Length() ) |
|
481 |
{ |
|
482 |
// Control Data length is 1 byte |
|
483 |
TInt ctrlDataLen( 1 ); |
|
484 |
ctrlData.Set( aIsiMessage.GetData( |
|
485 |
ISI_HEADER_SIZE + PNS_PEP_CTRL_REQ_OFFSET_PEPCTRLDATA, |
|
486 |
ctrlDataLen ) ); |
|
487 |
} |
|
488 |
// Get sender device |
|
489 |
TUint8 senderDevice( aIsiMessage.Get8bit( |
|
490 |
ISI_HEADER_OFFSET_SENDERDEVICE ) ); |
|
491 |
// Get sender object |
|
492 |
TUint8 senderObject( aIsiMessage.Get8bit( |
|
493 |
ISI_HEADER_OFFSET_SENDEROBJECT ) ); |
|
9 | 494 |
#ifdef PIPECAMP_DATAPORT_PNS_PEP_STATUS_IND_PHONET_ADDRESS_FROM_PNS_PEP_CTRL_REQ |
495 |
iPifDcs.SetPipeControllerDeviceIdentifier( senderDevice ); |
|
496 |
iPifDcs.SetPipeControllerObjectIdentifier( senderObject ); |
|
497 |
#endif |
|
0 | 498 |
// E32 return value |
499 |
TInt return_E32( KErrNone ); |
|
500 |
// PN_PIPE return value |
|
501 |
TInt ret( KErrNone ); |
|
502 |
||
503 |
switch ( pepType ) |
|
504 |
{ |
|
505 |
case PN_PEP_TYPE_COMM: |
|
506 |
case PN_PEP_TYPE_BT_ACC: |
|
507 |
{ |
|
508 |
// comm_pep handles ctrl_req |
|
509 |
// Something can go wrong in here. Leaving is not the best case in here. |
|
510 |
// We can send an response message with error value to NOS side and |
|
511 |
// hope for the best. |
|
512 |
return_E32 = iCommPep.HandlePepCtrlReq( ctrlId, ctrlData ); |
|
513 |
break; |
|
514 |
} |
|
515 |
||
516 |
default: // Not supported pepType |
|
517 |
{ |
|
518 |
LOG1(" ERROR - Unsupported pep type: %d", pepType ); |
|
519 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: ERROR - Unsupported pep type: %hhu", pepType ); |
|
520 |
||
521 |
return_E32 = KErrArgument; |
|
522 |
break; |
|
523 |
} |
|
524 |
} |
|
525 |
||
526 |
// do mapping from E32 error codes => PN_PIPE error codes |
|
527 |
switch ( return_E32 ) |
|
528 |
{ |
|
529 |
case KErrNone: |
|
530 |
{ |
|
531 |
ret = PN_PIPE_NO_ERROR; |
|
532 |
break; |
|
533 |
} |
|
534 |
case KErrNotSupported: |
|
535 |
{ |
|
536 |
// this error code should NOT be used according to specification |
|
537 |
LOG(" ERROR - Unsupported config (KErrNotSupported)"); |
|
538 |
OstTrace0( TRACE_NORMAL, DUP2_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: ERROR - Unsupported config (KErrNotSupported)" ); |
|
539 |
||
540 |
ret = PN_PIPE_ERR_NOT_SUPPORTED; |
|
541 |
break; |
|
542 |
} |
|
543 |
case KErrArgument: |
|
544 |
{ |
|
545 |
// this error code should NOT be used according to specification |
|
546 |
LOG(" ERROR - Invalid argument (KErrArgument)"); |
|
547 |
OstTrace0( TRACE_NORMAL, DUP3_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: ERROR - Invalid argument (KErrArgument)" ); |
|
548 |
||
549 |
ret = PN_PIPE_ERR_INVALID_PARAM; |
|
550 |
break; |
|
551 |
} |
|
552 |
case KErrGeneral: |
|
553 |
{ |
|
554 |
LOG(" ERROR - Invalid parameter (KErrGeneral)"); |
|
555 |
OstTrace0( TRACE_NORMAL, DUP4_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: ERROR - Invalid parameter (KErrGeneral)" ); |
|
556 |
||
557 |
ret = PN_PIPE_ERR_INVALID_CTRL_ID; |
|
558 |
break; |
|
559 |
} |
|
560 |
default: |
|
561 |
{ |
|
562 |
// this error code should NOT be used according to specification |
|
563 |
LOG1(" ERROR - Other error: %d", return_E32 ); |
|
564 |
OstTrace1( TRACE_NORMAL, DUP5_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: ERROR - Other error: %d", return_E32 ); |
|
565 |
||
566 |
ret = PN_PIPE_ERR_GENERAL; |
|
567 |
break; |
|
568 |
} |
|
569 |
} |
|
570 |
||
571 |
// Create PNS_PEP_CTRL_RESP response |
|
572 |
TBuf8<SIZE_PNS_PEP_CTRL_RESP> messageData; |
|
573 |
// Pipe Handle |
|
574 |
messageData.Append( iPifDcs.PipeHandle() ); |
|
575 |
// PEP Control ID |
|
576 |
messageData.Append( ctrlId ); |
|
577 |
// PEP Type |
|
578 |
messageData.Append( pepType ); |
|
579 |
// Error Code |
|
580 |
messageData.Append( static_cast<TUint8>( ret ) ); |
|
581 |
// Filler bytes |
|
582 |
messageData.Append( KDpPadding ); |
|
583 |
messageData.Append( KDpPadding ); |
|
584 |
||
585 |
// Send message, respond to sender |
|
586 |
return_E32 = SendMessage( |
|
587 |
senderDevice, |
|
588 |
senderObject, |
|
589 |
PN_PIPE, |
|
590 |
transactionId, |
|
591 |
PNS_PEP_CTRL_RESP, |
|
592 |
messageData ); |
|
593 |
||
594 |
LOG1(" <== PNS_PEP_CTRL_RESP resp sent, error code = %d", ret ); |
|
595 |
OstTrace1( TRACE_NORMAL, DUP6_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: <== PNS_PEP_CTRL_RESP resp sent, error code = %d", ret ); |
|
596 |
||
597 |
#if defined(_DEBUG) |
|
598 |
if (KErrNone != return_E32 ) |
|
599 |
{ |
|
600 |
LOG1(" Error isc api send %d", return_E32 ); |
|
601 |
OstTrace1( TRACE_NORMAL, DUP7_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: Error isc api send %d", return_E32 ); |
|
602 |
} |
|
603 |
//no else |
|
604 |
#endif |
|
605 |
||
606 |
} |
|
607 |
||
608 |
// --------------------------------------------------------- |
|
609 |
// CDpMif::HandlePepStatusInd |
|
610 |
// Handles PepStatusInd messages |
|
611 |
// --------------------------------------------------------- |
|
612 |
// |
|
613 |
TInt CDpMif::HandlePepStatusInd( |
|
614 |
TIsiReceiveC& aIsiMessage ) |
|
615 |
{ |
|
616 |
OstTrace0( TRACE_NORMAL, CDPMIF_HANDLEPEPSTATUSIND, "CDpMif::HandlePepStatusInd" ); |
|
617 |
LOGM(" CDpMif::HandlePepStatusInd"); |
|
618 |
||
619 |
// PEP Type |
|
620 |
TUint8 pepType( aIsiMessage.Get8bit( |
|
621 |
ISI_HEADER_SIZE + PNS_PEP_STATUS_IND_OFFSET_PEPTYPE ) ); |
|
622 |
// Indication ID |
|
623 |
TUint8 indId( aIsiMessage.Get8bit( |
|
624 |
ISI_HEADER_SIZE + PNS_PEP_STATUS_IND_OFFSET_INDICATIONID ) ); |
|
625 |
||
626 |
// Indication Data |
|
627 |
TPtrC8 indData; |
|
628 |
TInt ret( KErrNone ); |
|
629 |
||
630 |
if ( 15 < aIsiMessage.GetBuffer().Length() ) |
|
631 |
{ |
|
632 |
// Indication data length is 1 byte |
|
633 |
indData.Set( aIsiMessage.GetData( |
|
634 |
ISI_HEADER_SIZE + PNS_PEP_STATUS_IND_OFFSET_INDICATIONDATA, 1 ) ); |
|
635 |
} |
|
636 |
else |
|
637 |
{ |
|
638 |
ret = KErrGeneral; |
|
639 |
} |
|
640 |
||
641 |
if ( KErrNone == ret ) |
|
642 |
{ |
|
643 |
TInt result( KErrNone ); |
|
644 |
switch ( pepType ) |
|
645 |
{ |
|
646 |
case PN_PEP_TYPE_COMM: |
|
647 |
case PN_PEP_TYPE_BT_ACC: |
|
648 |
{ |
|
649 |
// comm_pep handles status_ind. |
|
650 |
// If dataport doesn't understand the status msg |
|
651 |
// it can't do nothing about it. |
|
652 |
result = iCommPep.HandlePepStatusInd( indId, indData ); |
|
653 |
break; |
|
654 |
} |
|
655 |
case PN_PEP_TYPE_COMMON: |
|
656 |
{ |
|
657 |
// DO NOTHING |
|
658 |
// This is handled in ISC |
|
659 |
break; |
|
660 |
} |
|
661 |
default: |
|
662 |
{ |
|
663 |
// Dataport doesn't support the PNS_PEP_STATUS pep type |
|
664 |
// Life's hard, can't do nothing. Don't need to leave |
|
665 |
// in release code. |
|
666 |
LOG1(" ERROR - Unsupported pep type: %d", result ); |
|
667 |
OstTrace1( TRACE_NORMAL, DUP1_CDPMIF_HANDLEPEPSTATUSIND, "CDpMif:: ERROR - Unsupported pep type: %d", result ); |
|
668 |
||
669 |
ret = KErrGeneral; |
|
670 |
} |
|
671 |
} |
|
672 |
||
673 |
if ( KErrNone == result ) |
|
674 |
{ |
|
675 |
LOG1(" CDpMif::HandlePepStatusInd: %d", result ); |
|
676 |
OstTrace1( TRACE_NORMAL, DUP2_CDPMIF_HANDLEPEPSTATUSIND, "CDpMif:: HandlePepStatusInd: %d", result ); |
|
677 |
} |
|
678 |
//no else |
|
679 |
} |
|
680 |
//no else |
|
681 |
||
682 |
return ret; |
|
683 |
} |
|
684 |
||
685 |
// --------------------------------------------------------- |
|
686 |
// CDpMif::SendNameAddReqL |
|
687 |
// This method sends name add request to Name Service. |
|
688 |
// --------------------------------------------------------- |
|
689 |
// |
|
690 |
void CDpMif::SendNameAddReqL( |
|
691 |
const TUint aUnit ) |
|
692 |
{ |
|
693 |
OstTrace0( TRACE_NORMAL, CDPMIF_SENDNAMEADDREQL, "CDpMif::SendNameAddReqL" ); |
|
694 |
LOGM(" CDpMif::SendNameAddReq"); |
|
695 |
||
696 |
__ASSERT_ALWAYS( aUnit <= KDataPortCommHighUnit, |
|
697 |
User::Leave( KErrNotSupported ) ); |
|
698 |
||
699 |
TBuf8<SIZE_PNS_NAME_ADD_REQ> messageData; |
|
700 |
||
701 |
// Add reserved bytes |
|
702 |
messageData.Append( KDpPadding ); |
|
703 |
messageData.Append( KDpPadding ); |
|
704 |
||
705 |
// Add 32bit name (Big-endian) |
|
706 |
switch ( aUnit ) |
|
707 |
{ |
|
708 |
case KDpCsdPort: |
|
709 |
case KDpPort6: |
|
710 |
{ |
|
711 |
messageData.Append( aUnit ); //name |
|
712 |
messageData.Append( PN_PEP_SUB_TYPE_SYMBIAN_INTERNAL ); //name |
|
713 |
messageData.Append( PN_PEP_TYPE_COMM ); //name |
|
714 |
messageData.Append( PN_PIPE ); //name |
|
715 |
break; |
|
716 |
} |
|
717 |
case KDpDialUpPort: |
|
718 |
case KDpPort4: |
|
719 |
case KDpPort5: |
|
720 |
{ |
|
721 |
messageData.Append( aUnit ); //name |
|
722 |
messageData.Append( KDpPadding ); //name |
|
723 |
messageData.Append( PN_PEP_TYPE_COMM ); //name |
|
724 |
messageData.Append( PN_PIPE ); //name |
|
725 |
break; |
|
726 |
} |
|
727 |
case KDpBtAccHfPort: |
|
728 |
{ |
|
729 |
messageData.Append( KDpPadding ); //name |
|
730 |
messageData.Append( PN_PEP_SUB_TYPE_BT_ACC_HF ); //name |
|
731 |
messageData.Append( PN_PEP_TYPE_BT_ACC ); //name |
|
732 |
messageData.Append( PN_PIPE ); //name |
|
733 |
break; |
|
734 |
} |
|
735 |
case KDpBtAccHsPort: |
|
736 |
{ |
|
737 |
messageData.Append( KDpPadding ); //name |
|
738 |
messageData.Append( PN_PEP_SUB_TYPE_BT_ACC_HS ); //name |
|
739 |
messageData.Append( PN_PEP_TYPE_BT_ACC ); //name |
|
740 |
messageData.Append( PN_PIPE ); //name |
|
741 |
break; |
|
742 |
} |
|
743 |
default: |
|
744 |
{ |
|
745 |
User::Leave( KErrGeneral ); |
|
746 |
} |
|
747 |
} |
|
748 |
||
749 |
// Add Device id |
|
750 |
messageData.Append( THIS_DEVICE ); |
|
751 |
||
752 |
// Create Object id |
|
753 |
TUint8 channelId( 0 ); |
|
754 |
||
755 |
switch ( aUnit ) |
|
756 |
{ |
|
757 |
case KDpCsdPort: |
|
758 |
{ |
|
759 |
channelId = EIscNokiaDataport1; |
|
760 |
break; |
|
761 |
} |
|
762 |
case KDpDialUpPort: |
|
763 |
{ |
|
764 |
channelId = EIscNokiaDataport2; |
|
765 |
break; |
|
766 |
} |
|
767 |
case KDpBtAccHfPort: |
|
768 |
case KDpBtAccHsPort: |
|
769 |
{ |
|
770 |
channelId = EIscNokiaBtAppl; |
|
771 |
break; |
|
772 |
} |
|
773 |
case KDpPort4: |
|
774 |
{ |
|
775 |
channelId = EIscNokiaDataport3; |
|
776 |
break; |
|
777 |
} |
|
778 |
case KDpPort5: |
|
779 |
{ |
|
780 |
channelId = EIscNokiaDataport4; |
|
781 |
break; |
|
782 |
} |
|
783 |
case KDpPort6: |
|
784 |
{ |
|
785 |
channelId = EIscNokiaDataport5; |
|
786 |
break; |
|
787 |
} |
|
788 |
default: |
|
789 |
{ |
|
790 |
//Do nothing |
|
791 |
break; |
|
792 |
} |
|
793 |
} |
|
794 |
||
795 |
TBuf8<2> data; |
|
796 |
TInt ret( iDataPort.ISAHandle().GetChannelInfo( channelId, data ) ); |
|
797 |
||
798 |
_LIT(KPanicStr, "Dataport::SendNameAddReqL"); |
|
799 |
__ASSERT_ALWAYS( KErrNone == ret, User::Panic( KPanicStr, 0 ) ); |
|
800 |
||
801 |
// Set obj id |
|
802 |
TUint16 obj( static_cast<TUint16>( |
|
803 |
( static_cast<TUint16>( data[0] ) << 8 ) + data[1] ) ); |
|
804 |
||
805 |
LOG1(" Dataport::SendNameAddReqL obj = 0x%x", obj ); |
|
806 |
OstTraceExt1( TRACE_NORMAL, DUP1_CDPMIF_SENDNAMEADDREQL, "CDpMif:: obj = 0x%hx", obj ); |
|
807 |
||
808 |
// Add Object id |
|
809 |
messageData.Append( obj ); |
|
810 |
// Add Record flags |
|
9 | 811 |
messageData.Append( PN_NAME_UNDEF/**PN_NAME_CLEARED**/ ); |
0 | 812 |
//fill |
813 |
messageData.Append( KDpPadding ); |
|
814 |
||
815 |
#if defined(_DEBUG) |
|
816 |
ret = |
|
817 |
#endif |
|
818 |
SendMessage( |
|
819 |
PN_NAMESERVICE, |
|
820 |
iDataPort.CreateTransactionId(), |
|
821 |
PNS_NAME_ADD_REQ, |
|
822 |
messageData ); |
|
823 |
||
824 |
LOG1(" <== PNS_NAME_ADD_REQ req sent, obj id: %x", obj ); |
|
825 |
OstTraceExt1( TRACE_NORMAL, DUP2_CDPMIF_SENDNAMEADDREQL, "CDpMif:: <== PNS_NAME_ADD_REQ req sent, obj id: %hx", obj ); |
|
826 |
||
827 |
#if defined(_DEBUG) |
|
828 |
if (KErrNone != ret ) |
|
829 |
{ |
|
830 |
LOG1(" Error isc api send %d", ret ); |
|
831 |
OstTrace1( TRACE_NORMAL, DUP3_CDPMIF_SENDNAMEADDREQL, "CDpMif:: Error isc api send %d", ret ); |
|
832 |
} |
|
833 |
//no else |
|
834 |
#endif |
|
835 |
} |
|
836 |
||
837 |
// --------------------------------------------------------- |
|
838 |
// CDpMif::SendNameRemoveReqL |
|
839 |
// This method sends name remove request to Name Service. |
|
840 |
// --------------------------------------------------------- |
|
841 |
// |
|
842 |
void CDpMif::SendNameRemoveReqL( |
|
843 |
const TUint aUnit ) |
|
844 |
{ |
|
845 |
OstTrace0( TRACE_NORMAL, CDPMIF_SENDNAMEREMOVEREQL, "CDpMif::SendNameRemoveReqL" ); |
|
846 |
LOGM(" CDpMif::SendNameRemoveReq"); |
|
847 |
||
848 |
TBuf8<SIZE_PNS_NAME_REMOVE_REQ> messageData; |
|
849 |
||
850 |
// Add reserved bytes |
|
851 |
messageData.Append( KDpPadding ); |
|
852 |
messageData.Append( KDpPadding ); |
|
853 |
||
854 |
// Add 32bit name (Big-endian) |
|
855 |
switch ( aUnit ) |
|
856 |
{ |
|
857 |
case KDpCsdPort: |
|
858 |
case KDpPort6: |
|
859 |
{ |
|
860 |
messageData.Append( aUnit ); //name |
|
861 |
messageData.Append( PN_PEP_SUB_TYPE_SYMBIAN_INTERNAL ); //name |
|
862 |
messageData.Append( PN_PEP_TYPE_COMM ); //name |
|
863 |
messageData.Append( PN_PIPE ); //name |
|
864 |
break; |
|
865 |
} |
|
866 |
case KDpDialUpPort: |
|
867 |
case KDpPort4: |
|
868 |
case KDpPort5: |
|
869 |
{ |
|
870 |
messageData.Append( aUnit ); //name |
|
871 |
messageData.Append( KDpPadding ); //name |
|
872 |
messageData.Append( PN_PEP_TYPE_COMM ); //name |
|
873 |
messageData.Append( PN_PIPE ); //name |
|
874 |
break; |
|
875 |
} |
|
876 |
case KDpBtAccHfPort: |
|
877 |
{ |
|
878 |
messageData.Append( KDpPadding ); //name |
|
879 |
messageData.Append( PN_PEP_SUB_TYPE_BT_ACC_HF ); //name |
|
880 |
messageData.Append( PN_PEP_TYPE_BT_ACC ); //name |
|
881 |
messageData.Append( PN_PIPE ); //name |
|
882 |
break; |
|
883 |
} |
|
884 |
case KDpBtAccHsPort: |
|
885 |
{ |
|
886 |
messageData.Append( KDpPadding ); //name |
|
887 |
messageData.Append( PN_PEP_SUB_TYPE_BT_ACC_HS ); //name |
|
888 |
messageData.Append( PN_PEP_TYPE_BT_ACC ); //name |
|
889 |
messageData.Append( PN_PIPE ); //name |
|
890 |
break; |
|
891 |
} |
|
892 |
default: |
|
893 |
{ |
|
894 |
User::Leave( KErrGeneral ); |
|
895 |
} |
|
896 |
} |
|
897 |
||
898 |
#if defined(_DEBUG) |
|
899 |
TInt ret = |
|
900 |
#endif |
|
901 |
SendMessage( |
|
902 |
PN_NAMESERVICE, |
|
903 |
iDataPort.CreateTransactionId(), |
|
904 |
PNS_NAME_REMOVE_REQ, |
|
905 |
messageData ); |
|
906 |
||
907 |
LOG(" <== PNS_NAME_REMOVE_REQ req sent"); |
|
908 |
OstTrace0( TRACE_NORMAL, DUP1_CDPMIF_SENDNAMEREMOVEREQL, "CDpMif:: <== PNS_NAME_REMOVE_REQ req sent" ); |
|
909 |
||
910 |
#if defined(_DEBUG) |
|
911 |
if ( KErrNone != ret ) |
|
912 |
{ |
|
913 |
LOG1("Error isc api send %d", ret ); |
|
914 |
OstTrace1( TRACE_NORMAL, DUP2_CDPMIF_SENDNAMEREMOVEREQL, "CDpMif:: Error isc api send %d", ret ); |
|
915 |
} |
|
916 |
//no else |
|
917 |
#endif |
|
918 |
} |
|
919 |
||
920 |
// --------------------------------------------------------- |
|
921 |
// CDpMif::SendMessage |
|
922 |
// Send ISI message, given resource, transaction id, |
|
923 |
// message id and message. |
|
924 |
// (other items were commented in a header). |
|
925 |
// --------------------------------------------------------- |
|
926 |
// |
|
927 |
TInt CDpMif::SendMessage( |
|
928 |
TUint8 aResource, |
|
929 |
TUint8 aTransactionId, |
|
930 |
TUint8 aMessageId, |
|
931 |
const TDesC8& aMessage ) |
|
932 |
{ |
|
933 |
OstTrace0( TRACE_NORMAL, CDPMIF_SENDMESSAGE, "CDpMif::SendMessage" ); |
|
934 |
OstTrace1( TRACE_NORMAL, DUP2_CDPMIF_SENDMESSAGE, "CDpMif:: Port: %u", iDataPort.PortUnit() ); |
|
935 |
OstTraceExt1( TRACE_NORMAL, DUP3_CDPMIF_SENDMESSAGE, "CDpMif:: ==> resource: 0x%hhx", aResource ); |
|
936 |
OstTraceExt1( TRACE_NORMAL, DUP4_CDPMIF_SENDMESSAGE, "CDpMif:: ==> tra id: 0x%hhx", aTransactionId ); |
|
937 |
OstTraceExt1( TRACE_NORMAL, DUP5_CDPMIF_SENDMESSAGE, "CDpMif:: ==> msg id: 0x%hhx", aMessageId ); |
|
938 |
||
939 |
LOGM1(" CDpMif::SendMessage - Port %d", iDataPort.PortUnit() ); |
|
940 |
LOGM1(" ==> resource: 0x%x", aResource ); |
|
941 |
LOGM1(" ==> tra id: 0x%x", aTransactionId ); |
|
942 |
LOGM1(" ==> msg id: 0x%x", aMessageId ); |
|
943 |
||
944 |
// We shall use send buffer |
|
945 |
iSendMessage.Zero(); |
|
946 |
TIsiSend msg( iSendMessage ); |
|
947 |
msg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, aResource ); |
|
948 |
msg.Set8bit( ISI_HEADER_OFFSET_TRANSID, aTransactionId ); |
|
949 |
msg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, aMessageId ); |
|
950 |
// Copy message data (+2 => after msgid and traid) |
|
951 |
msg.CopyData( ISI_HEADER_SIZE + 2, aMessage ); |
|
952 |
||
953 |
// Add paddings |
|
954 |
while ( iSendMessage.Length() % 4 ) |
|
955 |
{ |
|
956 |
iSendMessage.Append( 0x00 ); |
|
957 |
} |
|
958 |
OstTrace1( TRACE_NORMAL, DUP6_CDPMIF_SENDMESSAGE, "CDpMif:: ==> message length: %d", iSendMessage.Length() ); |
|
959 |
OstPrintIsiMessage( iSendMessage ); |
|
960 |
||
961 |
LOGM1(" ==> message length: %d", iSendMessage.Length() ); |
|
962 |
LOGMESSAGE( iSendMessage ); |
|
963 |
||
964 |
return iDataPort.ISAHandle().Send( msg.Complete() ); |
|
965 |
} |
|
966 |
||
967 |
// --------------------------------------------------------- |
|
968 |
// CDpMif::SendMessage |
|
969 |
// Send ISI message, given receiver device, receiver object, |
|
970 |
// resource, transaction id, message id and message. |
|
971 |
// (other items were commented in a header). |
|
972 |
// --------------------------------------------------------- |
|
973 |
// |
|
974 |
TInt CDpMif::SendMessage( |
|
975 |
TUint8 aRecDevice, |
|
976 |
TUint8 aRecObject, |
|
977 |
TUint8 aResource, |
|
978 |
TUint8 aTransactionId, |
|
979 |
TUint8 aMessageId, |
|
980 |
const TDesC8& aMessage ) |
|
981 |
{ |
|
982 |
OstTrace0( TRACE_NORMAL, DUP1_CDPMIF_SENDMESSAGE, "CDpMif::SendMessage" ); |
|
983 |
OstTrace1( TRACE_NORMAL, DUP15_CDPMIF_SENDMESSAGE, "CDpMif:: Port: %u", iDataPort.PortUnit() ); |
|
984 |
OstTraceExt1( TRACE_NORMAL, DUP14_CDPMIF_SENDMESSAGE, "CDpMif:: ==> receiver dev.: 0x%hhx", aRecDevice ); |
|
985 |
OstTraceExt1( TRACE_NORMAL, DUP13_CDPMIF_SENDMESSAGE, "CDpMif:: ==> receiver obj.: 0x%hhx", aRecObject ); |
|
986 |
OstTraceExt1( TRACE_NORMAL, DUP12_CDPMIF_SENDMESSAGE, "CDpMif:: ==> resource: 0x%hhx", aResource ); |
|
987 |
OstTraceExt1( TRACE_NORMAL, DUP11_CDPMIF_SENDMESSAGE, "CDpMif:: ==> tra id: 0x%hhx", aTransactionId ); |
|
988 |
OstTraceExt1( TRACE_NORMAL, DUP10_CDPMIF_SENDMESSAGE, "CDpMif:: ==> msg id: 0x%hhx", aMessageId ); |
|
989 |
||
990 |
LOGM1(" CDpMif::SendMessage - Port %d", iDataPort.PortUnit() ); |
|
991 |
LOGM1(" ==> receiver dev.: 0x%x", aRecDevice ); |
|
992 |
LOGM1(" ==> receiver obj.: 0x%x", aRecObject ); |
|
993 |
LOGM1(" ==> resource: 0x%x", aResource ); |
|
994 |
LOGM1(" ==> tra id: 0x%x", aTransactionId ); |
|
995 |
LOGM1(" ==> msg id: 0x%x", aMessageId ); |
|
996 |
||
997 |
// We shall use send buffer |
|
998 |
iSendMessage.Zero(); |
|
999 |
TIsiSend msg( iSendMessage ); |
|
1000 |
msg.Set8bit( ISI_HEADER_OFFSET_RECEIVERDEVICE, aRecDevice ); |
|
1001 |
msg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, aResource ); |
|
1002 |
msg.Set8bit( ISI_HEADER_OFFSET_RECEIVEROBJECT, aRecObject ); |
|
1003 |
msg.Set8bit( ISI_HEADER_OFFSET_TRANSID, aTransactionId ); |
|
1004 |
msg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, aMessageId ); |
|
1005 |
// Copy message data (+2 => after msgid and traid) |
|
1006 |
msg.CopyData( ISI_HEADER_SIZE + 2, aMessage ); |
|
1007 |
||
1008 |
// Add paddings |
|
1009 |
while ( iSendMessage.Length() % 4 ) |
|
1010 |
{ |
|
1011 |
iSendMessage.Append( 0x00 ); |
|
1012 |
} |
|
1013 |
||
1014 |
OstTrace1( TRACE_NORMAL, DUP8_CDPMIF_SENDMESSAGE, "CDpMif:: ==> message length: %d", iSendMessage.Length() ); |
|
1015 |
OstPrintIsiMessage( iSendMessage ); |
|
1016 |
||
1017 |
LOGM1(" ==> message length: %d", iSendMessage.Length() ); |
|
1018 |
LOGMESSAGE( iSendMessage ); |
|
1019 |
||
1020 |
return iDataPort.ISAHandle().Send( msg.Complete() ); |
|
1021 |
} |
|
1022 |
||
1023 |
// ================= OTHER EXPORTED FUNCTIONS ============== |
|
1024 |
// none |
|
1025 |
||
1026 |
// End of File |