35 EP2PUserChannelWrongRequest3, |
36 EP2PUserChannelWrongRequest3, |
36 EP2PUserChannelWrongRequest4, |
37 EP2PUserChannelWrongRequest4, |
37 EP2PUserChannelWrongRequest5, |
38 EP2PUserChannelWrongRequest5, |
38 EP2PUserChannelWrongRequest6, |
39 EP2PUserChannelWrongRequest6, |
39 EP2PUserChannelWrongRequest7, |
40 EP2PUserChannelWrongRequest7, |
|
41 EP2PUserChannelWrongRequest8, |
40 EP2PUserChannelWrongParam, |
42 EP2PUserChannelWrongParam, |
41 EP2PUserChannelWrongParam2, |
43 EP2PUserChannelWrongParam2, |
42 EP2PUserChannelProtocolIdNotSpecified, |
44 EP2PUserChannelProtocolIdNotSpecified, |
43 EP2PUserChannelOverTheArrayLimits, |
45 EP2PUserChannelOverTheArrayLimits, |
44 EP2PUserChannelDesWriteFailed, |
46 EP2PUserChannelDesWriteFailed, |
306 TAny* a1, |
308 TAny* a1, |
307 TAny* //a2 |
309 TAny* //a2 |
308 ) |
310 ) |
309 { |
311 { |
310 |
312 |
311 C_TRACE( ( _T( "DP2PUserChannel::Request 0x%x 0x%x %d 0x%x>" ), this, iShP2PProtocolId, aReqNo, a1 ) ); |
313 C_TRACE( ( _T( "DP2PUserChannel::Request 0x%x 0x%x 0x%x 0x%x>" ), this, iShP2PProtocolId, aReqNo, a1 ) ); |
312 // Programmer errors. |
314 // Programmer errors. |
313 ASSERT_RESET_ALWAYS( aReqNo >= ( TInt ) EMinRequestId, ( EP2PUserChannelWrongRequest3 | EDP2PUserChannelTraceId << KClassIdentifierShift ) ); |
315 ASSERT_RESET_ALWAYS( aReqNo >= ( TInt ) EMinRequestId, ( EP2PUserChannelWrongRequest3 | EDP2PUserChannelTraceId << KClassIdentifierShift | KExtraInfoShift << (TUint8)aReqNo ) ); |
314 ASSERT_RESET_ALWAYS( ( aReqNo <= EP2PLastAsyncRequest || aReqNo == KMaxTInt ), ( EP2PUserChannelWrongRequest4 | EDP2PUserChannelTraceId << KClassIdentifierShift ) ); |
316 ASSERT_RESET_ALWAYS( ( aReqNo <= EP2PLastAsyncRequest || aReqNo == KMaxTInt ), ( EP2PUserChannelWrongRequest4 | EDP2PUserChannelTraceId << KClassIdentifierShift | KExtraInfoShift << (TUint8)aReqNo ) ); |
315 // Wrong API usage e.g. called function when interface is not open so panic the client thread. |
317 |
316 ASSERT_PANIC_USER_THREAD_ALWAYS( ( iShP2PProtocolId < EP2PAmountOfProtocols || EP2PAsyncOpen == aReqNo ), iThread, ( EP2PUserChannelWrongParam2 | EDP2PUserChannelTraceId << KClassIdentifierShift ) ); |
318 if ( iShP2PProtocolId < EP2PAmountOfProtocols ) |
|
319 { |
|
320 // normal activity |
|
321 } |
|
322 else if ( iShP2PProtocolId > EP2PAmountOfProtocols ) // Open ongoing, not completed |
|
323 { |
|
324 ASSERT_PANIC_USER_THREAD_ALWAYS( ( aReqNo == EP2PAsyncOpen || |
|
325 ( aReqNo == KMaxTInt && (TInt)a1 == EP2PAsyncOpen ) || // cancel open |
|
326 aReqNo == EP2PClose ), |
|
327 iThread, ( EP2PUserChannelWrongParam2 | EDP2PUserChannelTraceId << KClassIdentifierShift | KExtraInfoShift << (TUint8)aReqNo ) ); |
|
328 } |
|
329 else |
|
330 { |
|
331 // Not possible to come here |
|
332 ASSERT_RESET_ALWAYS( 0, ( EP2PUserChannelWrongRequest8 | EDP2PUserChannelTraceId << KClassIdentifierShift | KExtraInfoShift << (TUint8)aReqNo ) ); |
|
333 } |
|
334 |
317 TInt result( KErrNotFound ); |
335 TInt result( KErrNotFound ); |
318 // All request go in kernel context and with ::DoControl call. |
336 // All request go in kernel context and with ::DoControl call. |
319 TThreadMessage& m=Kern::Message(); |
337 TThreadMessage& m=Kern::Message(); |
320 m.iValue = aReqNo; |
338 m.iValue = aReqNo; |
321 m.iArg[ KFirstParam ] = a1; |
339 m.iArg[ KFirstParam ] = a1; |
640 { |
658 { |
641 // Just complete with cancel |
659 // Just complete with cancel |
642 C_TRACE( ( _T( "DP2PUserChannel::DoCancel 0x%x 0x%x EP2PAsyncOpen" ), this, iShP2PProtocolId ) ); |
660 C_TRACE( ( _T( "DP2PUserChannel::DoCancel 0x%x 0x%x EP2PAsyncOpen" ), this, iShP2PProtocolId ) ); |
643 TInt err( Kern::MutexWait( *iShP2PProtocolIdMutex ) ); |
661 TInt err( Kern::MutexWait( *iShP2PProtocolIdMutex ) ); |
644 ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EP2PUserChannelMutexWaitFailed4 | EDP2PUserChannelTraceId << KClassIdentifierShift ) ); |
662 ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EP2PUserChannelMutexWaitFailed4 | EDP2PUserChannelTraceId << KClassIdentifierShift ) ); |
645 Close( ~iShP2PProtocolId ); |
663 TUint8 protocolId = ( iShP2PProtocolId > EP2PAmountOfProtocols ) ? ~iShP2PProtocolId : iShP2PProtocolId; |
|
664 Close( protocolId ); |
|
665 |
646 Kern::MutexSignal( *iShP2PProtocolIdMutex ); |
666 Kern::MutexSignal( *iShP2PProtocolIdMutex ); |
647 break; |
667 break; |
648 } |
668 } |
649 default: |
669 default: |
650 { |
670 { |