24
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// This file contains the definition for the ETelMM sub-session
|
|
15 |
// RMobileSmartCardEap, which allows access to EAP supporting UICC
|
|
16 |
// applications and all their functionality.
|
|
17 |
// (See specification: ETSI TS 102 310 v6.2.0)
|
|
18 |
//
|
|
19 |
//
|
|
20 |
|
|
21 |
/**
|
|
22 |
@file
|
|
23 |
*/
|
|
24 |
|
|
25 |
// From core API
|
|
26 |
#include <etelext.h>
|
|
27 |
|
|
28 |
// Multimode header files
|
|
29 |
#include <etelmm.h>
|
|
30 |
#include "mm_hold.h"
|
|
31 |
#include "mmretrieve.h"
|
|
32 |
|
|
33 |
//
|
|
34 |
//
|
|
35 |
// RMobileSmartCardEap
|
|
36 |
//
|
|
37 |
//
|
|
38 |
|
|
39 |
/**
|
|
40 |
Default empty constructor, and is present only to support virtual
|
|
41 |
function table export.
|
|
42 |
|
|
43 |
@publishedPartner
|
|
44 |
@released
|
|
45 |
*/
|
|
46 |
EXPORT_C RMobileSmartCardEap::RMobileSmartCardEap()
|
|
47 |
: iMmPtrHolder(NULL), iOwnsEapMethodLock(EFalse)
|
|
48 |
{
|
|
49 |
}
|
|
50 |
|
|
51 |
/**
|
|
52 |
This function opens a RMobileSmartCardEap sub-session from RMobilePhone
|
|
53 |
that will refer to the application referenced by aAID. It will be
|
|
54 |
assumed that the application exists and contains a DF_EAP for the
|
|
55 |
aEapType specified. The client must call
|
|
56 |
RMobileSmartCardEap::InitialiseEapMethod() to ensure correct
|
|
57 |
functionality of this sub-session.
|
|
58 |
|
|
59 |
@param aPhone The RMobilePhone sub-session relative to which this
|
|
60 |
sub-session will open.
|
|
61 |
@param aAId The UICC Application ID, which should be of one that has
|
|
62 |
EAP support.
|
|
63 |
@param aEapType The EAP method type that this sub-session will use
|
|
64 |
under the aAID application.
|
|
65 |
|
|
66 |
@return KErrNone if successful, otherwise a system-wide error code.
|
|
67 |
@see RMobileSmartCardEap::InitialiseEapMethod()
|
|
68 |
|
|
69 |
@capability None
|
|
70 |
|
|
71 |
@publishedPartner
|
|
72 |
@released
|
|
73 |
*/
|
|
74 |
EXPORT_C TInt RMobileSmartCardEap::Open(RMobilePhone& aPhone, const RMobilePhone::TAID& aAID, const TEapType& aEapType)
|
|
75 |
{
|
|
76 |
RSessionBase* session = &aPhone.SessionHandle();
|
|
77 |
__ASSERT_ALWAYS(session != NULL, PanicClient(EEtelPanicNullHandle));
|
|
78 |
TInt subSessionHandle = aPhone.SubSessionHandle();
|
|
79 |
__ASSERT_ALWAYS(subSessionHandle != NULL, PanicClient(EEtelPanicNullHandle));
|
|
80 |
|
|
81 |
TRAPD(ret, ConstructL());
|
|
82 |
if (ret != KErrNone)
|
|
83 |
{
|
|
84 |
Destruct();
|
|
85 |
return ret;
|
|
86 |
}
|
|
87 |
|
|
88 |
// Appending the application ID and Eap Type to the name of the
|
|
89 |
// subsession; plus two one-byte delimeters indicating lengths.
|
|
90 |
// See var appIdbuf for why KAIDSize is multiplied by 2.
|
|
91 |
TBufC<SCEAP_SSN_LENGTH + RMobilePhone::KAIDSize*2 +
|
|
92 |
KEapTypeSize + 2> nameBuf(KETelSmartCardEapSession); // 2 for delimeters
|
|
93 |
TPtr name(nameBuf.Des());
|
|
94 |
|
|
95 |
// the length of the AID as a Sept ASCII character
|
|
96 |
TChar lengthAIDChar = SeptChar(aAID.Length());
|
|
97 |
|
|
98 |
// the value of the AID
|
|
99 |
// converted to a 16-bit string representation. Multiply by 2,
|
|
100 |
// since each AID byte is represented as two sem-octects.
|
|
101 |
TBufC<2*RMobilePhone::KAIDSize> appIdbuf;
|
|
102 |
TPtr appIdPtr(appIdbuf.Des());
|
|
103 |
ConvertBinToText(aAID, appIdPtr);
|
|
104 |
|
|
105 |
// the length of the EapType
|
|
106 |
TInt lengthEapType = aEapType.Length();
|
|
107 |
TChar charEapType = SeptChar(lengthEapType);
|
|
108 |
|
|
109 |
// the value of the EapType (converted to 16-bit)
|
|
110 |
TBufC<KEapTypeSize> eapTypeBuf;
|
|
111 |
TPtr eapTypePtr(eapTypeBuf.Des());
|
|
112 |
eapTypePtr.Copy(aEapType);
|
|
113 |
|
|
114 |
// appending...
|
|
115 |
name.Append(lengthAIDChar);
|
|
116 |
name.Append(appIdPtr);
|
|
117 |
name.Append(charEapType);
|
|
118 |
name.Append(eapTypePtr);
|
|
119 |
|
|
120 |
TIpcArgs args(&name, TIpcArgs::ENothing, subSessionHandle);
|
|
121 |
SetSessionHandle(*session);
|
|
122 |
ret = CreateSubSession(*session, EEtelOpenFromSubSession, args);
|
|
123 |
|
|
124 |
if (ret != KErrNone)
|
|
125 |
{
|
|
126 |
Destruct();
|
|
127 |
}
|
|
128 |
|
|
129 |
return ret;
|
|
130 |
}
|
|
131 |
|
|
132 |
/**
|
|
133 |
This function member closes a RMobileSmartCardEap sub-session. The
|
|
134 |
Close() request also attempts to release this instance's lock on the
|
|
135 |
<AID,EAPType> (DF_EAP).
|
|
136 |
|
|
137 |
@panic Panics the client with ETel Panic EEtelPanicHandleNotClosed, if
|
|
138 |
this instance owns the lock on the DF_EAP but could not release
|
|
139 |
some resource to allow other instances to gain access.
|
|
140 |
(However, it should be noted that the TSY can take control of
|
|
141 |
DF_EAP access in the event that a client dies in such a manner.)
|
|
142 |
@see RMobileSmartCardEap::ReleaseEapMethod()
|
|
143 |
|
|
144 |
@capability None
|
|
145 |
|
|
146 |
@publishedPartner
|
|
147 |
@released
|
|
148 |
*/
|
|
149 |
EXPORT_C void RMobileSmartCardEap::Close()
|
|
150 |
{
|
|
151 |
if (iOwnsEapMethodLock)
|
|
152 |
{
|
|
153 |
TInt err = ReleaseEapMethod();
|
|
154 |
if (err != KErrNone)
|
|
155 |
{
|
|
156 |
PanicClient(EEtelPanicHandleNotClosed);
|
|
157 |
}
|
|
158 |
}
|
|
159 |
|
|
160 |
CloseSubSession(EEtelClose);
|
|
161 |
Destruct();
|
|
162 |
}
|
|
163 |
|
|
164 |
/**
|
|
165 |
Initialises access to the DF_EAP. This will ensure the aAID and
|
|
166 |
aEapType given in the RMobileSmartCardEap::Open() exist and are
|
|
167 |
accessible. If for any reason the sub-session is inaccessible, the
|
|
168 |
client can request a notification for state changes using
|
|
169 |
RMobileSmartCardEap::NotifyEapMethodAccessStatusChange().
|
|
170 |
|
|
171 |
@param aReqStatus Returns the result code after the asynchronous call
|
|
172 |
completes. Successful completion is only achieved
|
|
173 |
when the client is the first to request
|
|
174 |
initialisation on this sub-session.
|
|
175 |
KErrInUse will be returned if another
|
|
176 |
RMobileSmartCardEap instance successfully achieved
|
|
177 |
initialisation first.
|
|
178 |
Any other error code returned as request completion,
|
|
179 |
suggests another problem in the system and the client
|
|
180 |
must call RMobileSmartCardEap::Close() or
|
|
181 |
RMobileSmartCardEap::ReleaseEapMethod() at some
|
|
182 |
point, to allow other clients to use this same
|
|
183 |
<AID,EapType> sub-session.
|
|
184 |
@see RMobileSmartCardEap::Open()
|
|
185 |
@see RMobileSmartCardEap::NotifyEapMethodAccessStatusChange()
|
|
186 |
|
|
187 |
@capability ReadDeviceData
|
|
188 |
@capability NetworkControl
|
|
189 |
|
|
190 |
@publishedPartner
|
|
191 |
@released
|
|
192 |
*/
|
|
193 |
EXPORT_C void RMobileSmartCardEap::InitialiseEapMethod(TRequestStatus& aReqStatus)
|
|
194 |
{
|
|
195 |
__ASSERT_ALWAYS(iMmPtrHolder != NULL, PanicClient(EEtelPanicNullHandle));
|
|
196 |
|
|
197 |
if (!iOwnsEapMethodLock)
|
|
198 |
{
|
|
199 |
TInt ret = KErrNone;
|
|
200 |
|
|
201 |
TInt semHandle = SendReceive(EEtelGlobalKernelObjectHandle);
|
|
202 |
|
|
203 |
if(semHandle > 0)
|
|
204 |
{
|
|
205 |
ret = iSemaphore.SetReturnedHandle(semHandle); // although this will take an error as handle, best to specify our own explicit KErrBadHandle in the following else.
|
|
206 |
}
|
|
207 |
else
|
|
208 |
{
|
|
209 |
ret = KErrBadHandle;
|
|
210 |
}
|
|
211 |
|
|
212 |
if (ret != KErrNone)
|
|
213 |
{
|
|
214 |
TRequestStatus* status1 = &aReqStatus;
|
|
215 |
User::RequestComplete(status1, ret);
|
|
216 |
return;
|
|
217 |
}
|
|
218 |
|
|
219 |
ret = iSemaphore.Wait(10);
|
|
220 |
if (ret == KErrTimedOut)
|
|
221 |
{
|
|
222 |
TRequestStatus* status2 = &aReqStatus;
|
|
223 |
User::RequestComplete(status2, KErrInUse);
|
|
224 |
return;
|
|
225 |
}
|
|
226 |
else if (ret != KErrNone)
|
|
227 |
{
|
|
228 |
TRequestStatus* status3 = &aReqStatus;
|
|
229 |
User::RequestComplete(status3, ret);
|
|
230 |
return;
|
|
231 |
}
|
|
232 |
|
|
233 |
iOwnsEapMethodLock = ETrue;
|
|
234 |
}
|
|
235 |
|
|
236 |
RThread ownerThread;
|
|
237 |
TThreadId ownerThreadId = ownerThread.Id();
|
|
238 |
|
|
239 |
iMmPtrHolder->iOwnerThreadId = ownerThreadId;
|
|
240 |
TPtrC8& ptr1 = iMmPtrHolder->SetC(CMobileSmartCardEapPtrHolder::ESlot1InitialiseEapMethod, iMmPtrHolder->iOwnerThreadId);
|
|
241 |
|
|
242 |
Set(EMobileSmartCardEapInitialiseEapMethod, aReqStatus, ptr1);
|
|
243 |
}
|
|
244 |
|
|
245 |
/**
|
|
246 |
Delayed construction of heap stored data members.
|
|
247 |
|
|
248 |
@leave KErrNoMemory Heap memory allocation failure for
|
|
249 |
CMobileSmartCardEapPtrHolder object.
|
|
250 |
|
|
251 |
@publishedPartner
|
|
252 |
@released
|
|
253 |
*/
|
|
254 |
EXPORT_C void RMobileSmartCardEap::ConstructL()
|
|
255 |
{
|
|
256 |
__ASSERT_ALWAYS(iMmPtrHolder == NULL, PanicClient(EEtelPanicHandleNotClosed));
|
|
257 |
iMmPtrHolder = CMobileSmartCardEapPtrHolder::NewL(CMobileSmartCardEapPtrHolder::EMaxNumberSmartCardEapPtrSlots,
|
|
258 |
CMobileSmartCardEapPtrHolder::EMaxNumberSmartCardEapPtrCSlots);
|
|
259 |
}
|
|
260 |
|
|
261 |
/**
|
|
262 |
Called internally when RMobileSmartCardEap instance is no longer
|
|
263 |
required, to ensure clean up of data members from memory.
|
|
264 |
|
|
265 |
@publishedPartner
|
|
266 |
@released
|
|
267 |
*/
|
|
268 |
EXPORT_C void RMobileSmartCardEap::Destruct()
|
|
269 |
{
|
|
270 |
delete iMmPtrHolder;
|
|
271 |
iMmPtrHolder = NULL;
|
|
272 |
ResetSessionHandle();
|
|
273 |
}
|
|
274 |
|
|
275 |
/**
|
|
276 |
Default constructor, initialising version number of this data
|
|
277 |
structure.
|
|
278 |
|
|
279 |
@see TMultimodeEtelV6Api
|
|
280 |
|
|
281 |
@publishedPartner
|
|
282 |
@released
|
|
283 |
*/
|
|
284 |
EXPORT_C RMobileSmartCardEap::TEapUserIdentityV6::TEapUserIdentityV6()
|
|
285 |
{
|
|
286 |
iExtensionId = KEtelExtMultimodeV6;
|
|
287 |
}
|
|
288 |
|
|
289 |
/**
|
|
290 |
Default constructor, initialising version number of this data
|
|
291 |
structure.
|
|
292 |
|
|
293 |
@see TMultimodeEtelV6Api
|
|
294 |
|
|
295 |
@publishedPartner
|
|
296 |
@released
|
|
297 |
*/
|
|
298 |
EXPORT_C RMobileSmartCardEap::TEapKeyV6::TEapKeyV6()
|
|
299 |
{
|
|
300 |
iExtensionId = KEtelExtMultimodeV6;
|
|
301 |
}
|
|
302 |
|
|
303 |
/**
|
|
304 |
This method allows the client to retrieve the user identity data to be
|
|
305 |
used for an EAP based authentication. The client will specify which
|
|
306 |
identity type they want to read by setting the aRequestIdType parameter
|
|
307 |
to the appropriate enumeration value. The user Id data is returned as
|
|
308 |
a packaged instance of TEapUserIdentityV6 within the aUserId.
|
|
309 |
|
|
310 |
An example base band functionality that would be used to service this
|
|
311 |
request is the +CEPR (see section 8.48 of 3GPP TS 27.007 v6.8.0) AT-
|
|
312 |
command, which returns "identity" and "pseudonym" as two of its defined
|
|
313 |
values.
|
|
314 |
|
|
315 |
EF_PUId and EF_Ps hold these identities (specified in sections 7.3 and
|
|
316 |
7.4, respectively, of ETSI TS 102.310 v6.2.0).
|
|
317 |
|
|
318 |
@param aReqStatus Returns the result code after the asynchronous call
|
|
319 |
completes.
|
|
320 |
@param aRequestIdType Used to request the specific identity the client
|
|
321 |
wishes to retrieve.
|
|
322 |
@param aUserId On completion, will be populated with the user identity
|
|
323 |
requested by the client.
|
|
324 |
|
|
325 |
@capability ReadDeviceData
|
|
326 |
|
|
327 |
@publishedPartner
|
|
328 |
@released
|
|
329 |
*/
|
|
330 |
EXPORT_C void RMobileSmartCardEap::GetUserIdentity(TRequestStatus& aReqStatus, const TEapUserIdType aRequestedIdType, TDes8& aUserId)
|
|
331 |
{
|
|
332 |
__ASSERT_ALWAYS(iMmPtrHolder != NULL, PanicClient(EEtelPanicNullHandle));
|
|
333 |
|
|
334 |
if (iSemaphore.Handle() == 0)
|
|
335 |
{
|
|
336 |
TRequestStatus* status1 = &aReqStatus;
|
|
337 |
User::RequestComplete(status1, KErrBadHandle);
|
|
338 |
return;
|
|
339 |
}
|
|
340 |
|
|
341 |
if (!iOwnsEapMethodLock)
|
|
342 |
{
|
|
343 |
TRequestStatus* status2 = &aReqStatus;
|
|
344 |
User::RequestComplete(status2, KErrInUse);
|
|
345 |
return;
|
|
346 |
}
|
|
347 |
|
|
348 |
iMmPtrHolder->iEapUserIdType = aRequestedIdType;
|
|
349 |
TPtrC8& ptr1 = iMmPtrHolder->SetC(CMobileSmartCardEapPtrHolder::ESlot1GetUserId, iMmPtrHolder->iEapUserIdType);
|
|
350 |
|
|
351 |
SetAndGet(EMobileSmartCardEapGetUserIdentity, aReqStatus, ptr1, aUserId);
|
|
352 |
}
|
|
353 |
|
|
354 |
/**
|
|
355 |
The authentication status is obtained from the EAP supporting UICC
|
|
356 |
application's EF_EAPSTATUS. It specifies the current state of
|
|
357 |
authentication in the DF_EAP.
|
|
358 |
|
|
359 |
@param aReqStatus Returns the result code after the asynchronous call
|
|
360 |
completes.
|
|
361 |
@param aAuthStatus On request completion, will store the current
|
|
362 |
authentication status of the DF_EAP.
|
|
363 |
|
|
364 |
@capability ReadDeviceData
|
|
365 |
|
|
366 |
@publishedPartner
|
|
367 |
@released
|
|
368 |
*/
|
|
369 |
EXPORT_C void RMobileSmartCardEap::GetAuthenticationStatus(TRequestStatus& aReqStatus, TEapAuthStatus& aAuthStatus)
|
|
370 |
{
|
|
371 |
__ASSERT_ALWAYS(iMmPtrHolder != NULL, PanicClient(EEtelPanicNullHandle));
|
|
372 |
|
|
373 |
if (iSemaphore.Handle() == 0)
|
|
374 |
{
|
|
375 |
TRequestStatus* status1 = &aReqStatus;
|
|
376 |
User::RequestComplete(status1, KErrBadHandle);
|
|
377 |
return;
|
|
378 |
}
|
|
379 |
|
|
380 |
if (!iOwnsEapMethodLock)
|
|
381 |
{
|
|
382 |
TRequestStatus* status2 = &aReqStatus;
|
|
383 |
User::RequestComplete(status2, KErrInUse);
|
|
384 |
return;
|
|
385 |
}
|
|
386 |
|
|
387 |
TPtr8& ptr1 = iMmPtrHolder->Set(CMobileSmartCardEapPtrHolder::ESlot1GetAuthStatus, aAuthStatus);
|
|
388 |
|
|
389 |
Get(EMobileSmartCardEapGetAuthenticationStatus, aReqStatus, ptr1);
|
|
390 |
}
|
|
391 |
|
|
392 |
/**
|
|
393 |
Retrieves the generated key stored in EF_EAPKEYS of the DF_EAP (see
|
|
394 |
section 7.1 of ETSI TS 102.310 v6.2.0).
|
|
395 |
|
|
396 |
@param aReqStatus Returns the result code after the asynchronous call
|
|
397 |
completes.
|
|
398 |
@param aRequestedKey Used to specify which of the keys the client is
|
|
399 |
requesting.
|
|
400 |
@param aKey Populated with the requested key on request completion.
|
|
401 |
|
|
402 |
@capability ReadDeviceData
|
|
403 |
|
|
404 |
@publishedPartner
|
|
405 |
@released
|
|
406 |
*/
|
|
407 |
EXPORT_C void RMobileSmartCardEap::GetEapKey(TRequestStatus& aReqStatus, const TEapKeyTag aRequestedKey, TDes8& aKey)
|
|
408 |
{
|
|
409 |
__ASSERT_ALWAYS(iMmPtrHolder != NULL, PanicClient(EEtelPanicNullHandle));
|
|
410 |
|
|
411 |
if (iSemaphore.Handle() == 0)
|
|
412 |
{
|
|
413 |
TRequestStatus* status1 = &aReqStatus;
|
|
414 |
User::RequestComplete(status1, KErrBadHandle);
|
|
415 |
return;
|
|
416 |
}
|
|
417 |
|
|
418 |
if (!iOwnsEapMethodLock)
|
|
419 |
{
|
|
420 |
TRequestStatus* status2 = &aReqStatus;
|
|
421 |
User::RequestComplete(status2, KErrInUse);
|
|
422 |
return;
|
|
423 |
}
|
|
424 |
|
|
425 |
iMmPtrHolder->iReqEapKeyTag = aRequestedKey;
|
|
426 |
TPtrC8& ptr1 = iMmPtrHolder->SetC(CMobileSmartCardEapPtrHolder::ESlot1GetEapKey, iMmPtrHolder->iReqEapKeyTag);
|
|
427 |
|
|
428 |
SetAndGet(EMobileSmartCardEapGetEapKey, aReqStatus, ptr1, aKey);
|
|
429 |
}
|
|
430 |
|
|
431 |
/**
|
|
432 |
Relinquishes ownership of the DF_EAP, to allow other clients to use it.
|
|
433 |
Although the request completes relatively quickly, it will set the
|
|
434 |
server's process running to attempt a deactivate on the sub-session's
|
|
435 |
corresponding application. The deactivate will allow future clients to
|
|
436 |
initialise the application, which should reset all its DF_EAP states.
|
|
437 |
|
|
438 |
The initial state change of the sub-session will be
|
|
439 |
EEapMethodUnableToInitialise, as the request completes without waiting
|
|
440 |
for the application's deactivation. After the sub-session is able to
|
|
441 |
deactivate the app, the state will change to EEapMethodAvailable.
|
|
442 |
|
|
443 |
The server will make a decision on deactivating the application based
|
|
444 |
on whether there are other sub-session open to the same application
|
|
445 |
(but different EAP types/ DF_EAP). Only when the application is no
|
|
446 |
longer in use, that the server will deactivate it.
|
|
447 |
|
|
448 |
Notifications can be posted using
|
|
449 |
RMobileSmartCardEap::NotifyEapMethodAccessStatusChange() to observe
|
|
450 |
such state changes.
|
|
451 |
|
|
452 |
@return If an error is returned, this object will maintain lock on the
|
|
453 |
UICC application's DF_EAP.
|
|
454 |
@see RMobileSmartCardEap::NotifyEapMethodAccessStatusChange()
|
|
455 |
|
|
456 |
@capability ReadDeviceData
|
|
457 |
|
|
458 |
@publishedPartner
|
|
459 |
@released
|
|
460 |
*/
|
|
461 |
EXPORT_C TInt RMobileSmartCardEap::ReleaseEapMethod()
|
|
462 |
{
|
|
463 |
if (iSemaphore.Handle() == 0)
|
|
464 |
{
|
|
465 |
return KErrBadHandle;
|
|
466 |
}
|
|
467 |
|
|
468 |
if (!iOwnsEapMethodLock)
|
|
469 |
{
|
|
470 |
return KErrInUse;
|
|
471 |
}
|
|
472 |
|
|
473 |
TInt ret = Blank(EMobileSmartCardEapReleaseEapMethod);
|
|
474 |
|
|
475 |
if (ret == KErrNone)
|
|
476 |
{
|
|
477 |
iSemaphore.Signal();
|
|
478 |
iOwnsEapMethodLock = EFalse;
|
|
479 |
}
|
|
480 |
|
|
481 |
return ret;
|
|
482 |
}
|
|
483 |
|
|
484 |
/**
|
|
485 |
Synchronous request to get the current status of the DF_EAP. This
|
|
486 |
state value is held by the platform to ensure exclusive access to a
|
|
487 |
DF_EAP; it is NOT a state of any Smart Card Application file.
|
|
488 |
|
|
489 |
@param aEapMethodStatus Returns the sub-session's current value of
|
|
490 |
RMobileSmartCardEap::TEapMethodAccessStatus.
|
|
491 |
|
|
492 |
@capability ReadDeviceData
|
|
493 |
|
|
494 |
@publishedPartner
|
|
495 |
@released
|
|
496 |
*/
|
|
497 |
EXPORT_C TInt RMobileSmartCardEap::GetEapMethodAccessStatus(TEapMethodAccessStatus& aEapMethodStatus)
|
|
498 |
{
|
|
499 |
TPckg<TEapMethodAccessStatus> ptr1(aEapMethodStatus);
|
|
500 |
return Get(EMobileSmartCardEapGetEapMethodAccessStatus, ptr1);
|
|
501 |
}
|
|
502 |
|
|
503 |
/**
|
|
504 |
Notifies the client when the EAP method's (DF_EAP's) access status
|
|
505 |
changes.
|
|
506 |
|
|
507 |
The status begins as EEapMethodAvailable when the DF_EAP is first used;
|
|
508 |
before RMobileSmartCardEap::InitialiseEapMethod() is called by the
|
|
509 |
client. EEapMethodInUseApplicationActive state is given after the
|
|
510 |
first client initialises... various cases cause transformations to
|
|
511 |
states EEapMethodUnableToInitialise or
|
|
512 |
EEapMethodInUseApplicationInactive.
|
|
513 |
|
|
514 |
@param aReqStatus Returns the result code after the asynchronous call
|
|
515 |
completes.
|
|
516 |
@param aEapMethodStatus Returns the
|
|
517 |
RMobileSmartCardEap::TEapMethodAccessStatus
|
|
518 |
value when the status changes on this sub-
|
|
519 |
session.
|
|
520 |
@see RMobileSmartCardEap::InitialiseEapMethod()
|
|
521 |
@see RMobileSmartCardEap::GetEapMethodAccessStatus()
|
|
522 |
@see RMobileSmartCardEap::ReleaseEapMethod()
|
|
523 |
|
|
524 |
@capability ReadDeviceData
|
|
525 |
|
|
526 |
@publishedPartner
|
|
527 |
@released
|
|
528 |
*/
|
|
529 |
EXPORT_C void RMobileSmartCardEap::NotifyEapMethodAccessStatusChange(TRequestStatus& aReqStatus, TEapMethodAccessStatus& aEapMethodStatus)
|
|
530 |
{
|
|
531 |
__ASSERT_ALWAYS(iMmPtrHolder != NULL, PanicClient(EEtelPanicNullHandle));
|
|
532 |
|
|
533 |
TPtr8& ptr1 = iMmPtrHolder->Set(CMobileSmartCardEapPtrHolder::ESlot1NotifyEapMethodAccess, aEapMethodStatus);
|
|
534 |
|
|
535 |
Get(EMobileSmartCardEapNotifyEapMethodAccessStatusChange, aReqStatus, ptr1);
|
|
536 |
}
|
|
537 |
|
|
538 |
/**
|
|
539 |
Returns whether this RMobileSmartCardEap instance has ownership of its
|
|
540 |
corresponding DF_EAP.
|
|
541 |
|
|
542 |
@return ETrue only if this instance of RMobileSmartCardEap was the
|
|
543 |
first to call RMobileSmartCardEap::InitialiseEapMethod()
|
|
544 |
successfully.
|
|
545 |
@see RMobileSmartCardEap::InitialiseEapMethod()
|
|
546 |
@see RMobileSmartCardEap::Open()
|
|
547 |
|
|
548 |
@capability None
|
|
549 |
|
|
550 |
@publishedPartner
|
|
551 |
@released
|
|
552 |
*/
|
|
553 |
EXPORT_C TBool RMobileSmartCardEap::IsEapMethodOwner() const
|
|
554 |
{
|
|
555 |
return iOwnsEapMethodLock;
|
|
556 |
}
|
|
557 |
|
|
558 |
|
|
559 |
// helpers //
|
|
560 |
|
|
561 |
/**
|
|
562 |
Returns the character that corresponds to the value of its parameter
|
|
563 |
(base 17!).
|
|
564 |
|
|
565 |
@param aDigit an integer between 0 and 16.
|
|
566 |
@return A TChar representing one of '0' to '9' or 'A' to 'G'.
|
|
567 |
|
|
568 |
@internalComponent
|
|
569 |
@released
|
|
570 |
*/
|
|
571 |
TChar RMobileSmartCardEap::SeptChar(TInt aDigit)
|
|
572 |
{
|
|
573 |
TChar ret(0);
|
|
574 |
if ((aDigit < 0) || (aDigit > 16))
|
|
575 |
{
|
|
576 |
PanicClient(EEtelPanicHandleNotOpen);
|
|
577 |
}
|
|
578 |
else
|
|
579 |
{
|
|
580 |
if (aDigit < 10)
|
|
581 |
{
|
|
582 |
ret = aDigit + (TUint)'0';
|
|
583 |
}
|
|
584 |
else
|
|
585 |
{
|
|
586 |
ret = aDigit - 10 + (TUint)'A';
|
|
587 |
}
|
|
588 |
}
|
|
589 |
return ret;
|
|
590 |
}
|
|
591 |
|
|
592 |
/**
|
|
593 |
This function is used by RMobileSmartCardEap::Open() to convert the
|
|
594 |
TAID (which is binary data) to a string that can be passed through
|
|
595 |
ETel. The conversion changes the binary data to a string of
|
|
596 |
hexadecimal semi-octets.
|
|
597 |
|
|
598 |
@param aBinData Buffer containing the binary data to be converted.
|
|
599 |
@param aText Buffer will contain the text representation of aBinData on
|
|
600 |
return.
|
|
601 |
|
|
602 |
@see RMobileSmartCardEap::Open()
|
|
603 |
*/
|
|
604 |
void RMobileSmartCardEap::ConvertBinToText(const TDesC8& aBinData, TDes& aText)
|
|
605 |
{
|
|
606 |
TInt binLength = aBinData.Length();
|
|
607 |
|
|
608 |
for (TInt pos = 0; pos < binLength; pos++)
|
|
609 |
{
|
|
610 |
_LIT(format, "%02X");
|
|
611 |
aText.AppendFormat(format, aBinData[pos]);
|
|
612 |
}
|
|
613 |
}
|