68 C_TRACE( ( _T( "DISIIf::DISIIf 0x%x>" ), this ) ); |
68 C_TRACE( ( _T( "DISIIf::DISIIf 0x%x>" ), this ) ); |
69 __ASSERT_CRITICAL;// From kern_priv.h published partner |
69 __ASSERT_CRITICAL;// From kern_priv.h published partner |
70 ASSERT_THREAD_CONTEXT_ALWAYS( ( EISIIfNotThreadContext | EDISIIfTraceId << KClassIdentifierShift ) ); |
70 ASSERT_THREAD_CONTEXT_ALWAYS( ( EISIIfNotThreadContext | EDISIIfTraceId << KClassIdentifierShift ) ); |
71 iKernelChannel = new DISIKernelChannel( aObjId ); |
71 iKernelChannel = new DISIKernelChannel( aObjId ); |
72 ASSERT_RESET_ALWAYS( iKernelChannel, ( EISIIfMemAllocFailure2 | EDISIIfTraceId << KClassIdentifierShift ) ); |
72 ASSERT_RESET_ALWAYS( iKernelChannel, ( EISIIfMemAllocFailure2 | EDISIIfTraceId << KClassIdentifierShift ) ); |
73 TAny* params[ KTwoParams ]; //TODO should probably take process identifier into this to identify binary |
73 TAny* params[ KTwoParams ]; // should probably take process identifier into this to identify binary |
74 params[ KFirstParam ] = reinterpret_cast<TAny*>( aUID ); |
74 params[ KFirstParam ] = reinterpret_cast<TAny*>( aUID ); |
75 params[ KSecondParam ] = reinterpret_cast<TAny*>( &aObjId ); |
75 params[ KSecondParam ] = reinterpret_cast<TAny*>( &aObjId ); |
76 // Get's the current thread's thread message. |
76 // Get's the current thread's thread message. |
77 TThreadMessage& m = Kern::Message(); |
77 TThreadMessage& m = Kern::Message(); |
78 m.iValue = EISIConnect; |
78 m.iValue = EISIConnect; |
87 C_TRACE( ( _T( "DISIIf::~DISIIf 0x%x>" ), this ) ); |
87 C_TRACE( ( _T( "DISIIf::~DISIIf 0x%x>" ), this ) ); |
88 // Get's the current thread's thread message. |
88 // Get's the current thread's thread message. |
89 TThreadMessage& m = Kern::Message(); |
89 TThreadMessage& m = Kern::Message(); |
90 m.iValue = EISIDisconnect; |
90 m.iValue = EISIDisconnect; |
91 m.iArg[ KFirstParam ] = NULL; |
91 m.iArg[ KFirstParam ] = NULL; |
92 // Other asserts in kernel channel. |
92 |
93 ASSERT_RESET_ALWAYS( ( KErrNone == iKernelChannel->HandleRequest( m ) ), ( EISIIfWrongResponseToRequest | EDISIIfTraceId << KClassIdentifierShift ) ); |
|
94 if( iKernelChannel ) |
93 if( iKernelChannel ) |
95 { |
94 { |
|
95 // Other asserts in kernel channel. |
|
96 ASSERT_RESET_ALWAYS( ( KErrNone == iKernelChannel->HandleRequest( m ) ), ( EISIIfWrongResponseToRequest | EDISIIfTraceId << KClassIdentifierShift ) ); |
96 delete iKernelChannel; |
97 delete iKernelChannel; |
97 iKernelChannel = NULL; |
98 iKernelChannel = NULL; |
98 } |
99 } |
|
100 |
99 C_TRACE( ( _T( "DISIIf::~DISIIf 0x%x<" ), this ) ); |
101 C_TRACE( ( _T( "DISIIf::~DISIIf 0x%x<" ), this ) ); |
100 } |
102 } |
101 |
103 |
102 TDes8& DISIIf::AllocateMsgBlock( const TUint16 aSize ) |
104 TDes8& DISIIf::AllocateMsgBlock( const TUint16 aSize ) |
103 { |
105 { |
117 return *temp; |
119 return *temp; |
118 } |
120 } |
119 |
121 |
120 void DISIIf::DeallocateMsgBlock( TDes8& aMsgBlock ) |
122 void DISIIf::DeallocateMsgBlock( TDes8& aMsgBlock ) |
121 { |
123 { |
122 C_TRACE( ( _T( "DISIIf::DeallocateMsgBlock 0x%x s %d>" ), this, &aMsgBlock ) ); |
124 C_TRACE( ( _T( "DISIIf::DeallocateMsgBlock 0x%x s 0x%x>" ), this, &aMsgBlock ) ); |
123 TAny* params[ KOneParam ]; |
125 TAny* params[ KOneParam ]; |
124 params[ KFirstParam ] = reinterpret_cast<TAny*>( &aMsgBlock ); |
126 params[ KFirstParam ] = reinterpret_cast<TAny*>( &aMsgBlock ); |
125 // Get's the current thread's thread message. |
127 // Get's the current thread's thread message. |
126 TThreadMessage& m = Kern::Message(); |
128 TThreadMessage& m = Kern::Message(); |
127 m.iValue = EISIDeallocateBlock; |
129 m.iValue = EISIDeallocateBlock; |
128 m.iArg[ KFirstParam ] = params; |
130 m.iArg[ KFirstParam ] = params; |
129 ASSERT_RESET_ALWAYS( ( KErrNone == iKernelChannel->HandleRequest( m ) ), ( EISIIfWrongResponseToRequest4 | EDISIIfTraceId << KClassIdentifierShift ) ); |
131 ASSERT_RESET_ALWAYS( ( KErrNone == iKernelChannel->HandleRequest( m ) ), ( EISIIfWrongResponseToRequest4 | EDISIIfTraceId << KClassIdentifierShift ) ); |
130 C_TRACE( ( _T( "DISIIf::DeallocateMsgBlock 0x%x s %d<" ), this, &aMsgBlock ) ); |
132 C_TRACE( ( _T( "DISIIf::DeallocateMsgBlock 0x%x s 0x%x<" ), this, &aMsgBlock ) ); |
131 } |
133 } |
132 |
134 |
133 void DISIIf::Receive( TRequestStatus& aRxStatus, TDes8*& aRxMsg, const TDfc& aRxCompletedDfc ) |
135 void DISIIf::Receive( TRequestStatus& aRxStatus, TDes8*& aRxMsg, const TDfc& aRxCompletedDfc ) |
134 { |
136 { |
135 C_TRACE( ( _T( "DISIIf::Receive 0x%x s %d b 0x%x d 0x%x>" ), this, &aRxStatus, &aRxMsg, &aRxCompletedDfc ) ); |
137 C_TRACE( ( _T( "DISIIf::Receive 0x%x %d 0x%x 0x%x>" ), this, &aRxStatus, &aRxMsg, &aRxCompletedDfc ) ); |
136 ASSERT_RESET_ALWAYS( !aRxMsg, ( EISIIfNotNullPtr | EDISIIfTraceId << KClassIdentifierShift ) ); |
138 ASSERT_RESET_ALWAYS( !aRxMsg, ( EISIIfNotNullPtr | EDISIIfTraceId << KClassIdentifierShift ) ); |
137 aRxStatus = KRequestPending; |
139 aRxStatus = KRequestPending; |
138 TAny* params[ KThreeParams ]; |
140 TAny* params[ KThreeParams ]; |
139 params[ KFirstParam ] = reinterpret_cast<TAny*>( &aRxStatus ); |
141 params[ KFirstParam ] = reinterpret_cast<TAny*>( &aRxStatus ); |
140 params[ KSecondParam ] = reinterpret_cast<TAny*>( &aRxMsg ); |
142 params[ KSecondParam ] = reinterpret_cast<TAny*>( &aRxMsg ); |
142 // Get's the current thread's thread message. |
144 // Get's the current thread's thread message. |
143 TThreadMessage& m = Kern::Message(); |
145 TThreadMessage& m = Kern::Message(); |
144 m.iValue = EISIAsyncReceive; |
146 m.iValue = EISIAsyncReceive; |
145 m.iArg[ KFirstParam ] = params; |
147 m.iArg[ KFirstParam ] = params; |
146 ASSERT_RESET_ALWAYS( ( KErrNone == iKernelChannel->HandleRequest( m ) ), ( EISIIfWrongResponseToRequest5 | EDISIIfTraceId << KClassIdentifierShift ) ); |
148 ASSERT_RESET_ALWAYS( ( KErrNone == iKernelChannel->HandleRequest( m ) ), ( EISIIfWrongResponseToRequest5 | EDISIIfTraceId << KClassIdentifierShift ) ); |
147 C_TRACE( ( _T( "DISIIf::Receive 0x%x s %d b 0x%x d 0x%x<" ), this, &aRxStatus, &aRxMsg, &aRxCompletedDfc ) ); |
149 C_TRACE( ( _T( "DISIIf::Receive 0x%x %d 0x%x 0x%x<" ), this, &aRxStatus, &aRxMsg, &aRxCompletedDfc ) ); |
148 } |
150 } |
149 void DISIIf::ReceiveCancel() |
151 void DISIIf::ReceiveCancel() |
150 { |
152 { |
151 C_TRACE( ( _T( "DISIIf::ReceiveCancel 0x%x>" ), this ) ); |
153 C_TRACE( ( _T( "DISIIf::ReceiveCancel 0x%x>" ), this ) ); |
152 TThreadMessage& m = Kern::Message(); |
154 TThreadMessage& m = Kern::Message(); |
166 } |
168 } |
167 TInt DISIIf::Send( const TDesC8& aTxMsg ) |
169 TInt DISIIf::Send( const TDesC8& aTxMsg ) |
168 { |
170 { |
169 C_TRACE( ( _T( "DISIIf::Send 0x%x m 0x%x>" ), this, &aTxMsg ) ); |
171 C_TRACE( ( _T( "DISIIf::Send 0x%x m 0x%x>" ), this, &aTxMsg ) ); |
170 TAny* params[ KOneParam ]; |
172 TAny* params[ KOneParam ]; |
171 params[ KFirstParam ] = reinterpret_cast<TAny*>( const_cast<TDesC8*>( &aTxMsg )); //TODO need const? |
173 params[ KFirstParam ] = reinterpret_cast<TAny*>( const_cast<TDesC8*>( &aTxMsg )); // need const? |
172 // Get's the current thread's thread message. |
174 // Get's the current thread's thread message. |
173 TThreadMessage& m = Kern::Message(); |
175 TThreadMessage& m = Kern::Message(); |
174 m.iValue = EISISend; |
176 m.iValue = EISISend; |
175 m.iArg[ KFirstParam ] = params; |
177 m.iArg[ KFirstParam ] = params; |
176 TInt retValue( iKernelChannel->HandleRequest( m ) ); |
178 TInt retValue( iKernelChannel->HandleRequest( m ) ); |