|
1 /* |
|
2 * Copyright (c) 2003 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 "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: Apdu handling between WimServer and Scard |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "WimApduImpl.h" |
|
22 #include "WimConsts.h" // Error codes |
|
23 #include "WimDefs.h" |
|
24 #include "ScardBase.h" |
|
25 #include "ScardConnectionRequirement.h" |
|
26 #include "ScardComm.h" |
|
27 #include "ScardReaderQuery.h" |
|
28 #include "WimUtilityFuncs.h" |
|
29 #include "WimTrace.h" |
|
30 |
|
31 //APDU for retrieving response from WIM-card. |
|
32 TUint8 iResponseAPDU[] = {0x80, 0xc0, 0x00, 0x00, 0x00}; |
|
33 |
|
34 |
|
35 // ============================ MEMBER FUNCTIONS =============================== |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // C++ default constructor can NOT contain any code, that |
|
39 // might leave. |
|
40 // ----------------------------------------------------------------------------- |
|
41 CWimApdu::CWimApdu() : CActive( EPriorityStandard ) |
|
42 { |
|
43 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::CWimApdu | Begin")); |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CWimApdu::NewL |
|
48 // Two-phased constructor. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CWimApdu* CWimApdu::NewL() |
|
52 { |
|
53 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::NewL | Begin")); |
|
54 CWimApdu* self = new( ELeave ) CWimApdu(); |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL(); |
|
57 CleanupStack::Pop( self ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CWimApdu::ConstructL |
|
63 // Symbian 2nd phase constructor can leave. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 void CWimApdu::ConstructL() |
|
67 { |
|
68 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::ConstructL | Begin")); |
|
69 CActiveScheduler::Add( this ); |
|
70 iReaderComm = new( ELeave ) CArrayFixFlat<CScardComm*>( 1 ); |
|
71 //Reserve space for each possible reader. |
|
72 iReaderComm->SetReserveL( KMaxReaderCount ); |
|
73 iReaderNames = new( ELeave ) CArrayFixFlat<TScardReaderName>( 1 ); |
|
74 //Reserve space for each possible reader. |
|
75 iReaderNames->SetReserveL( KMaxReaderCount ); |
|
76 iServer = RScard::NewL(); |
|
77 iResponseBuffer = HBufC8::NewL( KMaxApduLen ); |
|
78 iWimScardListenerArray = new( ELeave ) CArrayPtrFlat<CWimScardListener>(1); |
|
79 } |
|
80 |
|
81 // Destructor |
|
82 CWimApdu::~CWimApdu() |
|
83 { |
|
84 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::~CWimApdu | Begin")); |
|
85 |
|
86 Cancel(); |
|
87 delete iResponseBuffer; |
|
88 delete iReaderNames; |
|
89 |
|
90 if ( iReaderComm ) |
|
91 { |
|
92 for ( TUint8 i( 0 ); i < iReaderComm->Count(); i++ ) |
|
93 { |
|
94 delete (*iReaderComm)[i]; |
|
95 (*iReaderComm)[i] = 0; |
|
96 } |
|
97 delete iReaderComm; |
|
98 } |
|
99 |
|
100 delete iServer; |
|
101 |
|
102 if ( iWimScardListenerArray ) |
|
103 { |
|
104 iWimScardListenerArray->ResetAndDestroy(); |
|
105 delete iWimScardListenerArray; |
|
106 } |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CWimApdu::RequestList |
|
111 // List readers and get cababilities of each card |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 TUint8 CWimApdu::RequestListL() |
|
115 { |
|
116 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::RequestListL | Begin")); |
|
117 CScardReaderQuery* query = NULL; //Class used to list resources |
|
118 //owned by Smart Card Server. |
|
119 CArrayFixFlat<TScardReaderName>* readerNames = NULL; |
|
120 CArrayFixFlat<TScardReaderName>* groupNames = NULL; |
|
121 TInt8 position = 0; |
|
122 TInt error; |
|
123 |
|
124 //Reset member data associated with query data. |
|
125 iReaderStatusLength = 0; |
|
126 iReaderStatusses.Delete( 0, KMaxReaderCount ); |
|
127 iReaderStatusses.Zero(); |
|
128 |
|
129 TUint8 i; |
|
130 for ( i = 0; i < iReaderComm->Count(); i++ ) |
|
131 { |
|
132 delete (*iReaderComm)[i]; |
|
133 (*iReaderComm)[i] = NULL; |
|
134 } |
|
135 iReaderComm->Delete( 0, iReaderComm->Count() ); |
|
136 iReaderNames->Delete( 0, iReaderNames->Count() ); |
|
137 |
|
138 TRAP( |
|
139 error, |
|
140 query = CScardReaderQuery::NewL(); |
|
141 readerNames = |
|
142 new( ELeave ) CArrayFixFlat<TScardReaderName>( KMaxReaderCount ); |
|
143 groupNames = |
|
144 new( ELeave ) CArrayFixFlat<TScardReaderName>( KMaxReaderCount ); |
|
145 query->ListGroupsL( groupNames ) |
|
146 ); |
|
147 |
|
148 if ( error ) |
|
149 { |
|
150 delete query; |
|
151 readerNames->Reset(); |
|
152 delete readerNames; |
|
153 groupNames->Reset(); |
|
154 delete groupNames; |
|
155 |
|
156 iResponseStatus = KWimApduNoMemory; |
|
157 |
|
158 //any return value <> 0 means error by WIMlib specs |
|
159 return KWimStatusIOError; |
|
160 } |
|
161 |
|
162 // Get readers from all groups and add them to readerNames. |
|
163 for ( i = 0; i < groupNames->Count(); i++ ) |
|
164 { |
|
165 //Get reader names from this group. |
|
166 TRAP( error, query->ListReadersL( readerNames, (*groupNames)[i] ) ); |
|
167 |
|
168 if ( error ) |
|
169 { |
|
170 delete query; |
|
171 readerNames->Reset(); |
|
172 delete readerNames; |
|
173 groupNames->Reset(); |
|
174 delete groupNames; |
|
175 |
|
176 iResponseStatus = KWimApduNoMemory; |
|
177 |
|
178 return KWimStatusIOError; |
|
179 } |
|
180 |
|
181 //Add all reader names found from this group to iReaderNames. |
|
182 for ( TInt8 k = 0; k < readerNames->Count(); k++ ) |
|
183 { |
|
184 //Should do something if maxreadernames == readerNames->Count()! |
|
185 TRAP( error, iReaderNames->AppendL( (*readerNames)[k] ) ); |
|
186 |
|
187 if ( error ) |
|
188 { |
|
189 delete query; |
|
190 readerNames->Reset(); |
|
191 delete readerNames; |
|
192 groupNames->Reset(); |
|
193 delete groupNames; |
|
194 |
|
195 iResponseStatus = KWimApduNoMemory; |
|
196 |
|
197 return KWimStatusIOError; |
|
198 } |
|
199 position++; |
|
200 } |
|
201 } |
|
202 |
|
203 //Create CScardComm object for each found reader. |
|
204 for ( TUint8 j = 0; j < iReaderNames->Count(); j++ ) |
|
205 { |
|
206 TBuf8<1> tempStatus; //Buffer used to hold 1 status byte. |
|
207 TScardConnectionRequirement rest; //Connection requirements used in |
|
208 //the creation of CScardComm object. |
|
209 TScardReaderName name; |
|
210 |
|
211 CScardComm* tempComm = NULL; |
|
212 //Set rest to explicit value (name of the current reader) and |
|
213 //create CScardComm according to these values. Also check that |
|
214 //the found reader name (name) is really what we were looking for |
|
215 //(is this needed?). If everything is ok, add created CScardComm |
|
216 //to iReaderComm, else NULL. |
|
217 iStatus = KRequestPending; |
|
218 TRAP( error, |
|
219 rest.SetExplicitL( (*iReaderNames)[j] ); |
|
220 tempComm = CScardComm::NewL( iServer, rest, name, iStatus ) |
|
221 ); |
|
222 |
|
223 SetActiveAndWait(); |
|
224 |
|
225 if ( error || iStatus.Int() != KErrNone || ( name != (*iReaderNames)[j] ) ) |
|
226 { |
|
227 iReaderComm->AppendL( NULL ); |
|
228 _WIMTRACE2(_L("WIM | WIMServer | CWimApdu::RequestListL | CScardComm::NewL leaved with %d"), error); |
|
229 |
|
230 delete tempComm; |
|
231 tempComm = NULL; |
|
232 delete query; |
|
233 readerNames->Reset(); |
|
234 delete readerNames; |
|
235 groupNames->Reset(); |
|
236 delete groupNames; |
|
237 |
|
238 User::Leave ( KErrHardwareNotAvailable ); |
|
239 } |
|
240 else //all ok. |
|
241 { |
|
242 TRAP( error, |
|
243 iReaderComm->AppendL( tempComm ) |
|
244 ); |
|
245 |
|
246 if ( error ) |
|
247 { |
|
248 delete tempComm; |
|
249 tempComm = NULL; |
|
250 iReaderComm->AppendL( NULL ); |
|
251 } |
|
252 else //all ok. |
|
253 { |
|
254 //Get capabilities of the card. With this value GetCapabilities |
|
255 //puts status to tempStatus. |
|
256 TRAP( error, |
|
257 (*iReaderComm)[j]->GetCapabilitiesL( KCardStatus, |
|
258 tempStatus ) ); |
|
259 _WIMTRACE3(_L("WIM | WIMServer | CWimApdu::RequestListL | GetCapabilitiesL error = %d, Card status = %d"), error, (TUint8)*tempStatus.Ptr()); |
|
260 _WIMTRACE2(_L("WIM|WIMServer|CWimApdu::RequestListL|tempStatus.Size() = %d"), tempStatus.Size()); |
|
261 |
|
262 if ( error == KErrNoMemory ) |
|
263 { |
|
264 delete query; |
|
265 readerNames->Reset(); |
|
266 delete readerNames; |
|
267 groupNames->Reset(); |
|
268 delete groupNames; |
|
269 |
|
270 iResponseStatus = KWimApduNoMemory; |
|
271 return ( TUint8 )KErrCouldNotConnect; |
|
272 } |
|
273 |
|
274 else if ( error == KErrNone && tempStatus.Size() && *tempStatus.Ptr() ) |
|
275 { |
|
276 iReaderStatusLength++; |
|
277 iReaderStatusses.Append( tempStatus ); |
|
278 _WIMTRACE(_L("WIM|WIMServer|CWimApdu::RequestListL|Reader status appended")); |
|
279 } //else if |
|
280 else |
|
281 { |
|
282 _WIMTRACE2(_L("WIM|WIMServer|CWimApdu::RequestListL|Leave with error %d"), error); |
|
283 User::Leave( error ); |
|
284 } |
|
285 } //else |
|
286 } //else |
|
287 } //for |
|
288 |
|
289 //Add Listeners to readers |
|
290 for ( TInt y = 0; y < iReaderNames->Count(); y++ ) |
|
291 { |
|
292 CWimScardListener* wimScardListener; |
|
293 TRAP( error, wimScardListener = CWimScardListener::NewL( iServer, |
|
294 ( TUint8 )y, iReaderNames->At( y ) ) ); |
|
295 iWimScardListenerArray->AppendL( wimScardListener ); |
|
296 } |
|
297 |
|
298 iResponseStatus = KWimApduOk; |
|
299 |
|
300 delete query; |
|
301 readerNames->Reset(); |
|
302 delete readerNames; |
|
303 groupNames->Reset(); |
|
304 delete groupNames; |
|
305 |
|
306 return KErrNone; |
|
307 } |
|
308 |
|
309 // ----------------------------------------------------------------------------- |
|
310 // CWimApdu::Open |
|
311 // Open connection to Scard |
|
312 // ----------------------------------------------------------------------------- |
|
313 // |
|
314 TUint8 CWimApdu::Open( TUint8 aUiReaderId ) |
|
315 { |
|
316 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::Open | Begin")); |
|
317 |
|
318 if ( !iServer ) //No Scard |
|
319 { |
|
320 TRAPD( error, iServer = RScard::NewL() ); |
|
321 |
|
322 if ( error != KErrNone ) |
|
323 { |
|
324 iResponseStatus = KWimApduTransmiossionError; |
|
325 return KWimStatusIOError; |
|
326 } |
|
327 } |
|
328 |
|
329 //If aUiReaderId is valid and connection to reader is not opened... |
|
330 if ( ( aUiReaderId < iReaderComm->Count() ) && |
|
331 ( (*iReaderComm)[aUiReaderId] == 0 ) ) |
|
332 { |
|
333 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::Open | Reader not opened")); |
|
334 //...open connection, try to find the reader with name |
|
335 //specified in iReaderNames. |
|
336 TScardConnectionRequirement rest; |
|
337 TScardReaderName name; |
|
338 iStatus = KRequestPending; |
|
339 |
|
340 TRAPD( error, |
|
341 rest.SetExplicitL( (*iReaderNames)[aUiReaderId] ); |
|
342 (*iReaderComm)[aUiReaderId] = |
|
343 CScardComm::NewL( iServer, rest, name, iStatus ) ); |
|
344 |
|
345 SetActiveAndWait(); |
|
346 |
|
347 _WIMTRACE3(_L("WIM | WIMServer | CWimApdu::Open | Error=%d, iStatus=%d"), |
|
348 error, iStatus.Int()); |
|
349 |
|
350 if ( error == KErrNone && iStatus.Int() == KErrNone ) |
|
351 {//Add listener to opened reader and append it to array. |
|
352 CWimScardListener* wimScardListener; |
|
353 TRAP( error, |
|
354 wimScardListener = CWimScardListener::NewL( iServer, |
|
355 aUiReaderId, |
|
356 name ); |
|
357 iWimScardListenerArray->AppendL( wimScardListener ); |
|
358 ); |
|
359 } |
|
360 |
|
361 if ( error == KErrNoMemory || iStatus.Int() == KErrNoMemory ) |
|
362 { |
|
363 iResponseStatus = KWimApduNoMemory; |
|
364 return ( TUint8 )KWimCardDriverInitError; |
|
365 } |
|
366 else if ( error || name != (*iReaderNames)[aUiReaderId] |
|
367 || iStatus.Int() != KErrNone ) |
|
368 { |
|
369 iResponseStatus = KWimApduTransmiossionError; |
|
370 return KWimStatusIOError; |
|
371 } |
|
372 else |
|
373 { |
|
374 iResponseStatus = KWimApduOk; |
|
375 return KWimStatusOK; //WIMSTA_OK; |
|
376 } |
|
377 } |
|
378 else |
|
379 { |
|
380 iResponseStatus = KWimApduOk; |
|
381 return KWimStatusOK; //WIMSTA_OK; |
|
382 } |
|
383 } |
|
384 |
|
385 // ----------------------------------------------------------------------------- |
|
386 // CWimApdu::Close |
|
387 // Close connection to card |
|
388 // ----------------------------------------------------------------------------- |
|
389 // |
|
390 TUint8 CWimApdu::Close( TUint8 aUiReaderId ) |
|
391 { |
|
392 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::Close | Begin")); |
|
393 |
|
394 if ( ( aUiReaderId < iReaderComm->Count() ) && |
|
395 ( (*iReaderComm)[aUiReaderId] != 0 ) ) |
|
396 { |
|
397 delete (*iReaderComm)[aUiReaderId]; |
|
398 (*iReaderComm)[aUiReaderId] = 0; |
|
399 } |
|
400 |
|
401 if ( iWimScardListenerArray->Count() > aUiReaderId ) |
|
402 { |
|
403 delete iWimScardListenerArray->At( aUiReaderId ); |
|
404 iWimScardListenerArray->Delete( aUiReaderId ); |
|
405 } |
|
406 iResponseStatus = KWimApduOk; |
|
407 return KWimStatusOK; //WIMSTA_OK; |
|
408 } |
|
409 |
|
410 // ----------------------------------------------------------------------------- |
|
411 // CWimApdu::SendAPDU |
|
412 // Send APDU to card |
|
413 // ----------------------------------------------------------------------------- |
|
414 // |
|
415 TUint8 CWimApdu::SendAPDU( |
|
416 TUint8 aUiReaderId, |
|
417 TUint8* aApdu, |
|
418 TUint16 aUiApduLength ) |
|
419 { |
|
420 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::SendAPDU | Begin")); |
|
421 //clean SW |
|
422 iResponseSW = 0; |
|
423 TPtr8 responsePtr = iResponseBuffer->Des(); |
|
424 //clean buffer |
|
425 responsePtr.Zero(); |
|
426 if ( ( aUiReaderId < iReaderComm->Count() ) && |
|
427 ( (*iReaderComm)[ aUiReaderId ] != 0 ) ) |
|
428 { |
|
429 iUiReaderId = aUiReaderId; |
|
430 |
|
431 iStatus = KRequestPending; |
|
432 //If apdu to be sent was ManageChannel, |
|
433 //use CScardComms ManageChannel function. |
|
434 if ( ( aUiApduLength >= 4 ) && ( aApdu[1] == KManageChannelIns ) ) |
|
435 { |
|
436 switch ( aApdu[2] ) |
|
437 { |
|
438 case KManageChannelParamOpen: |
|
439 { |
|
440 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::SendAPDU | OPEN CHANNEL")); |
|
441 //Last parameter is timeout. No timeout used. |
|
442 (*iReaderComm)[aUiReaderId]->ManageChannel( |
|
443 EOpenAnyChannel, aApdu[3], responsePtr, iStatus, 0 ); |
|
444 break; |
|
445 } |
|
446 case KManageChannelParamClose: |
|
447 { |
|
448 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::SendAPDU | CLOSE CHANNEL")); |
|
449 // Check whether state of the SIM/SWIM is OK |
|
450 if ( CWimUtilityFuncs::SimState() != KErrNone ) |
|
451 { |
|
452 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::SendAPDU | SIM not ready")); |
|
453 // SIM/SWIM not OK, just return KWimStatusOK to WimLib |
|
454 // so WimLib can continue properly |
|
455 return KWimStatusOK; |
|
456 } |
|
457 else // Card OK, close the opened channel |
|
458 { |
|
459 // Close channel with 5 second timeout |
|
460 (*iReaderComm)[aUiReaderId]->ManageChannel( |
|
461 ECloseChannel, |
|
462 aApdu[3], |
|
463 responsePtr, |
|
464 iStatus, |
|
465 KDefaulCloseChannelTimeout ); |
|
466 } |
|
467 break; |
|
468 } |
|
469 default: // APDU is not valid. |
|
470 { |
|
471 iResponseStatus = KWimApduFormatError; |
|
472 return KWimStatusOK; //WIMSTA_OK; |
|
473 //break; //unreachable |
|
474 } |
|
475 } |
|
476 } |
|
477 else |
|
478 { |
|
479 TPtrC8 commandAPDU( aApdu, aUiApduLength ); |
|
480 |
|
481 //Transmit APDU to card. |
|
482 (*iReaderComm)[aUiReaderId]->TransmitToCard( commandAPDU, |
|
483 responsePtr, iStatus, 0, (TUint8)( aApdu[0] & 0x0f ) ); |
|
484 |
|
485 } |
|
486 SetActiveAndWait(); // Wait APDU response |
|
487 |
|
488 if ( iStatus != KErrNone ) |
|
489 { |
|
490 iResponseStatus = KWimApduTransmiossionError; |
|
491 responsePtr.SetLength( 0 ); |
|
492 return KWimStatusIOError; |
|
493 } |
|
494 |
|
495 if ( responsePtr.Size() >= 2 ) //At least SW-bytes are needed (2 of'em). |
|
496 { |
|
497 //Response has to be retrieved. |
|
498 if ( responsePtr[responsePtr.Size() - 2] == 0x61 ) |
|
499 { |
|
500 iStatus = KRequestPending; |
|
501 iResponseAPDU[0] = aApdu[0]; |
|
502 iResponseAPDU[4] = responsePtr[responsePtr.Size() - 1]; |
|
503 TPtrC8 commandAPDU( iResponseAPDU, 5 ); |
|
504 |
|
505 //Transmit APDU to card. Timeout not used. |
|
506 (*iReaderComm)[aUiReaderId]->TransmitToCard( commandAPDU, |
|
507 responsePtr, iStatus, 0, (TUint8)( aApdu[0] & 0x0f ) ); |
|
508 |
|
509 SetActiveAndWait(); // Wait APDU response |
|
510 |
|
511 if ( iStatus != KErrNone ) |
|
512 { |
|
513 iResponseStatus = KWimApduTransmiossionError; |
|
514 responsePtr.SetLength( 0 ); |
|
515 return KWimStatusIOError; |
|
516 } |
|
517 |
|
518 //At least SW-bytes are needed (2 of them). |
|
519 else if ( responsePtr.Size() < 2 ) |
|
520 { |
|
521 iResponseStatus = KWimApduFormatError; |
|
522 responsePtr.SetLength( 0 ); |
|
523 return KWimStatusOK; |
|
524 } |
|
525 } |
|
526 iResponseStatus = KWimApduOk; |
|
527 iResponseSW = |
|
528 ( TUint16 )( ( responsePtr[responsePtr.Size() - 2] << 8 ) |
|
529 | ( responsePtr[responsePtr.Size() - 1] ) ); |
|
530 |
|
531 responsePtr.SetLength( responsePtr.Size() - 2 );//All but SW-bytes. |
|
532 return KWimStatusOK; |
|
533 } |
|
534 else |
|
535 { |
|
536 iResponseStatus = KWimApduFormatError; |
|
537 responsePtr.SetLength( 0 ); |
|
538 return KWimStatusOK; //WIMSTA_OK; |
|
539 } |
|
540 } |
|
541 else |
|
542 { |
|
543 //Not valid card. |
|
544 iResponseStatus = KWimApduReaderNotValid; |
|
545 responsePtr.SetLength( 0 ); |
|
546 return KWimStatusOK; //WIMSTA_OK; |
|
547 } |
|
548 } |
|
549 |
|
550 // ----------------------------------------------------------------------------- |
|
551 // CWimApdu::ResponseApdu |
|
552 // Return response APDU |
|
553 // ----------------------------------------------------------------------------- |
|
554 // |
|
555 TPtrC8 CWimApdu::ResponseApdu() const |
|
556 { |
|
557 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::ResponseApdu | Begin")); |
|
558 return iResponseBuffer->Des(); |
|
559 } |
|
560 |
|
561 // ----------------------------------------------------------------------------- |
|
562 // CWimApdu::ResponseSW |
|
563 // Return Response SW |
|
564 // ----------------------------------------------------------------------------- |
|
565 // |
|
566 TUint16 CWimApdu::ResponseSW() const |
|
567 { |
|
568 _WIMTRACE2(_L("WIM | WIMServer | CWimApdu::ResponseSW | iResponse = %04x"), |
|
569 iResponseSW ); |
|
570 return iResponseSW; |
|
571 } |
|
572 |
|
573 // ----------------------------------------------------------------------------- |
|
574 // CWimApdu::StatusList |
|
575 // Return reader statusses |
|
576 // ----------------------------------------------------------------------------- |
|
577 // |
|
578 const TBuf8<KMaxReaderCount>& CWimApdu::StatusList() const |
|
579 { |
|
580 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::StatusList | Begin")); |
|
581 return iReaderStatusses; |
|
582 } |
|
583 |
|
584 // ----------------------------------------------------------------------------- |
|
585 // CWimApdu::StatusListLength |
|
586 // Return status list length |
|
587 // ----------------------------------------------------------------------------- |
|
588 // |
|
589 TUint8 CWimApdu::StatusListLength() const |
|
590 { |
|
591 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::StatusListLength | Begin")); |
|
592 return iReaderStatusLength; |
|
593 } |
|
594 |
|
595 // ----------------------------------------------------------------------------- |
|
596 // CWimApdu::RunL |
|
597 // Stop ActiveSchedulerWait after APDU response |
|
598 // ----------------------------------------------------------------------------- |
|
599 // |
|
600 void CWimApdu::RunL() |
|
601 { |
|
602 _WIMTRACE2(_L("WIM | WIMServer | CWimApdu::RunL, status: %d"), iStatus.Int()); |
|
603 iWait.AsyncStop(); |
|
604 } |
|
605 |
|
606 // ----------------------------------------------------------------------------- |
|
607 // CWimApdu::DoCancel |
|
608 // Cancel asyncronous request |
|
609 // ----------------------------------------------------------------------------- |
|
610 // |
|
611 void CWimApdu::DoCancel() |
|
612 { |
|
613 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::DoCancel | Begin")); |
|
614 (*iReaderComm)[iUiReaderId]->CancelTransmit(); |
|
615 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::DoCancel | End")); |
|
616 } |
|
617 |
|
618 // ----------------------------------------------------------------------------- |
|
619 // CWimApdu::SetActiveAndWait |
|
620 // Wait until asynchronous call is completed |
|
621 // ----------------------------------------------------------------------------- |
|
622 // |
|
623 void CWimApdu::SetActiveAndWait() |
|
624 { |
|
625 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::SetActiveAndWait | Begin")); |
|
626 SetActive(); |
|
627 iWait.Start(); |
|
628 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::SetActiveAndWait | End")); |
|
629 } |
|
630 |
|
631 // ----------------------------------------------------------------------------- |
|
632 // CWimApdu::CancelApduSending |
|
633 // ----------------------------------------------------------------------------- |
|
634 // |
|
635 void CWimApdu::CancelApduSending() |
|
636 { |
|
637 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::CancelApduSending | Begin")); |
|
638 if( IsActive() ) |
|
639 { |
|
640 Cancel(); |
|
641 } |
|
642 _WIMTRACE(_L("WIM | WIMServer | CWimApdu::CancelApduSending | End")); |
|
643 } |
|
644 |
|
645 // End of File |