|
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: Main smard card object |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "ScardClsv.h" |
|
21 #include "Scard.h" |
|
22 #include "WimTrace.h" |
|
23 |
|
24 // CONSTANTS |
|
25 const TUint KDefaultMessageSlots = 4; |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // RSCard::RScard |
|
31 // C++ default constructor can NOT contain any code, that |
|
32 // might leave. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 RScard::RScard() |
|
36 { |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // RScard::ConstructL |
|
41 // Symbian 2nd phase constructor can leave. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 void RScard::ConstructL() |
|
45 { |
|
46 _WIMTRACE(_L("WIM|Scard|CScard::ConstructL|Begin")); |
|
47 TInt error = StartThread(); |
|
48 if ( error == KErrNone ) |
|
49 { |
|
50 error = CreateSession( KScardServerName, |
|
51 Version(), |
|
52 KDefaultMessageSlots ); |
|
53 } |
|
54 |
|
55 if ( error ) |
|
56 { |
|
57 User::Leave( error ); |
|
58 } |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // RScard::NewL |
|
63 // Two-phased constructor. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 EXPORT_C RScard* RScard::NewL() |
|
67 { |
|
68 _WIMTRACE(_L("WIM|Scard|RScard::NewL|Begin")); |
|
69 RScard* self = new( ELeave ) RScard; |
|
70 CleanupStack::PushL( self ); |
|
71 self->ConstructL(); |
|
72 CleanupStack::Pop( self ); |
|
73 return self; |
|
74 } |
|
75 |
|
76 // Destructor |
|
77 EXPORT_C RScard::~RScard() |
|
78 { |
|
79 _WIMTRACE(_L("WIM|Scard|RScard::~CScard|Begin")); |
|
80 TIpcArgs args( TIpcArgs::ENothing ); |
|
81 SendReceive( EScardServerCloseSession, args ); |
|
82 RHandleBase::Close(); |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // RScard::Version |
|
87 // Returns version of the Scard Server |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 TVersion RScard::Version() const |
|
91 { |
|
92 _WIMTRACE(_L("WIM|Scard|RScard::Version|Begin")); |
|
93 return ( TVersion( KScardServMajorVersionNumber, |
|
94 KScardServMinorVersionNumber, KScardServBuildVersionNumber ) ); |
|
95 } |
|
96 |
|
97 // End of File |