|
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: For describing required Smart Card reader connections |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "ScardConnectionRequirement.h" |
|
22 #include "ScardServerBase.h" |
|
23 #include "ScardBase.h" |
|
24 #include "WimTrace.h" |
|
25 |
|
26 // ============================ MEMBER FUNCTIONS =============================== |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // TScardConnectionRequirement::TScardConnectionRequirement |
|
30 // C++ default constructor can NOT contain any code, that |
|
31 // might leave. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C TScardConnectionRequirement::TScardConnectionRequirement() |
|
35 : iExplicitReader( NULL ), |
|
36 iExcludedReader( NULL ), |
|
37 iATRBytes( NULL ), |
|
38 iAIDBytes( NULL ), |
|
39 iParameterCount( 0 ), |
|
40 iNewCards( EFalse ), |
|
41 iNewReaders( EFalse ) |
|
42 { |
|
43 _WIMTRACE(_L("WIM|Scard|TScardConnectionRequirement::TScardConnectionRequirement|Begin")); |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // TScardConnectionRequirement::SetExplicitL |
|
48 // Set explicit reader |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 EXPORT_C void TScardConnectionRequirement::SetExplicitL( |
|
52 TScardReaderName& aExplicitName ) |
|
53 { |
|
54 _WIMTRACE(_L("WIM|Scard|TScardConnectionRequirement::SetExplicitL|Begin")); |
|
55 __ASSERT_ALWAYS( iParameterCount < 2, User::Leave( KScErrFull ) ); |
|
56 __ASSERT_ALWAYS( !iExcludedReader, User::Leave( KErrNotSupported ) ); |
|
57 iExplicitReader = &aExplicitName; |
|
58 iParameterCount++; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // TScardConnectionRequirement::SetExcludedL |
|
63 // Set exluded reader |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 EXPORT_C void TScardConnectionRequirement::SetExcludedL( |
|
67 TScardReaderName& aExcludedName ) |
|
68 { |
|
69 _WIMTRACE(_L("WIM|Scard|TScardConnectionRequirement::SetExcludedL|Begin")); |
|
70 __ASSERT_ALWAYS( iParameterCount < 2, User::Leave( KScErrFull ) ); |
|
71 __ASSERT_ALWAYS( !iExplicitReader, User::Leave( KErrNotSupported ) ); |
|
72 iExcludedReader = &aExcludedName; |
|
73 iParameterCount++; |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // TScardConnectionRequirement::SetATRL |
|
78 // Set ATR bytes |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 EXPORT_C void TScardConnectionRequirement::SetATRL( TScardATR& aATR ) |
|
82 { |
|
83 _WIMTRACE(_L("WIM|Scard|TScardConnectionRequirement::SetATRL|Begin")); |
|
84 __ASSERT_ALWAYS( iParameterCount < 2, User::Leave( KScErrFull ) ); |
|
85 __ASSERT_ALWAYS( !(iAIDBytes), User::Leave( KErrNotSupported ) ); |
|
86 iATRBytes = &aATR; |
|
87 iParameterCount++; |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // TScardConnectionRequirement::SetAIDBytesL |
|
92 // Set AID bytes |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 EXPORT_C void TScardConnectionRequirement::SetAIDBytesL( TDesC8& aAID ) |
|
96 { |
|
97 _WIMTRACE(_L("WIM|Scard|TScardConnectionRequirement::SetAIDBytesL|Begin")); |
|
98 __ASSERT_ALWAYS( iParameterCount < 2, User::Leave( KScErrFull ) ); |
|
99 __ASSERT_ALWAYS( !(iATRBytes), User::Leave( KErrNotSupported ) ); |
|
100 iAIDBytes = &aAID; |
|
101 iParameterCount++; |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // TScardConnectionRequirement::ClearExplicitL |
|
106 // Clear explicit requirement |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 EXPORT_C void TScardConnectionRequirement::ClearExplicitL() |
|
110 { |
|
111 _WIMTRACE(_L("WIM|Scard|TScardConnectionRequirement::ClearExplicitL|Begin")); |
|
112 if ( !iExplicitReader ) |
|
113 { |
|
114 User::Leave( KScErrEmpty ); |
|
115 } |
|
116 if ( iParameterCount && iExplicitReader ) |
|
117 { |
|
118 iParameterCount--; |
|
119 } |
|
120 iExplicitReader = NULL; |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // TScardConnectionRequirement::ClearExcludedL |
|
125 // Clear exluded requirement |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 EXPORT_C void TScardConnectionRequirement::ClearExcludedL() |
|
129 { |
|
130 _WIMTRACE(_L("WIM|Scard|TScardConnectionRequirement::ClearExcludedL|Begin")); |
|
131 if ( !iExcludedReader ) |
|
132 { |
|
133 User::Leave( KScErrEmpty ); |
|
134 } |
|
135 |
|
136 if ( iParameterCount && iExcludedReader ) |
|
137 { |
|
138 iParameterCount--; |
|
139 } |
|
140 |
|
141 iExcludedReader = NULL; |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // TScardConnectionRequirement::ClearATRL |
|
146 // Clear ATR |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 EXPORT_C void TScardConnectionRequirement::ClearATRL() |
|
150 { |
|
151 _WIMTRACE(_L("WIM|Scard|TScardConnectionRequirement::ClearATRL|Begin")); |
|
152 if ( !iATRBytes ) |
|
153 { |
|
154 User::Leave( KScErrEmpty ); |
|
155 } |
|
156 if ( iParameterCount && iATRBytes ) |
|
157 { |
|
158 iParameterCount--; |
|
159 } |
|
160 iATRBytes = NULL; |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // TScardConnectionRequirement::ClearAIDBytesL |
|
165 // Clear AID bytes |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C void TScardConnectionRequirement::ClearAIDBytesL() |
|
169 { |
|
170 _WIMTRACE(_L("WIM|Scard|TScardConnectionRequirement::ClearAIDBytesL|Begin")); |
|
171 if ( !iAIDBytes ) |
|
172 { |
|
173 User::Leave( KScErrEmpty ); |
|
174 } |
|
175 if ( iParameterCount && iAIDBytes ) |
|
176 { |
|
177 iParameterCount--; |
|
178 } |
|
179 iAIDBytes = NULL; |
|
180 } |
|
181 |
|
182 // ----------------------------------------------------------------------------- |
|
183 // TScardConnectionRequirement::NewCardsOnly |
|
184 // Set New cards only flag |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 EXPORT_C void TScardConnectionRequirement::NewCardsOnly( const TBool aNewOnly ) |
|
188 { |
|
189 _WIMTRACE(_L("WIM|Scard|TScardConnectionRequirement::NewCardsOnly|Begin")); |
|
190 iNewCards = aNewOnly; |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // TScardConnectionRequirement::NewReadersOnly |
|
195 // Set new readers only flag |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 EXPORT_C void TScardConnectionRequirement::NewReadersOnly( const TBool aNewOnly ) |
|
199 { |
|
200 _WIMTRACE(_L("WIM|Scard|TScardConnectionRequirement::NewReadersOnly|Begin")); |
|
201 iNewReaders = aNewOnly; |
|
202 } |
|
203 |
|
204 // End of File |