|
1 /* |
|
2 * Copyright (c) 2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cstscardappmanager.h" |
|
21 #include "cstsselectfile.h" |
|
22 #include "cstsrespapdu.h" |
|
23 #include "cstsapduexchanger.h" |
|
24 |
|
25 namespace java |
|
26 { |
|
27 namespace satsa |
|
28 { |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CSTSCardAppManager::CSTSCardAppManager |
|
34 // C++ default constructor can NOT contain any code, that |
|
35 // might leave. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CSTSCardAppManager::CSTSCardAppManager(CSTSApduExchanger* aApduExchanger) |
|
39 { |
|
40 iApduExchanger = aApduExchanger; |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CSTSCardAppManager::ConstructL |
|
45 // Symbian 2nd phase constructor can leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CSTSCardAppManager::ConstructL(const TDesC8& aAID) |
|
49 { |
|
50 iSelectFileApdu = CSTSSelectFile::NewL(aAID, |
|
51 CSTSSelectFile::ESTSAIDActivation, CSTSApdu::ESTSUICC); |
|
52 |
|
53 iRespApdu = CSTSRespApdu::NewL(0xFF, CSTSApdu::ESTSUICC); //maximum size |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CSTSCardAppManager::NewL |
|
58 // Two-phased constructor. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CSTSCardAppManager* CSTSCardAppManager::NewL(CSTSApduExchanger* aApduExchanger, |
|
62 const TDesC8& aAID) |
|
63 { |
|
64 CSTSCardAppManager* self = new(ELeave) CSTSCardAppManager(aApduExchanger); |
|
65 |
|
66 CleanupStack::PushL(self); |
|
67 self->ConstructL(aAID); |
|
68 |
|
69 CleanupStack::Pop(self); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // Destructor |
|
74 CSTSCardAppManager::~CSTSCardAppManager() |
|
75 { |
|
76 delete iSelectFileApdu; |
|
77 delete iRespApdu; |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CSTSCardAppManager::SelectApplication |
|
82 // |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 TInt CSTSCardAppManager::SelectApplication() |
|
86 { |
|
87 iSelectFileApdu->SetApduType(CSTSSelectFile::ESTSAIDActivation); |
|
88 return DoExchange(); |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CSTSCardAppManager::DeselectApplication |
|
93 // |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 TInt CSTSCardAppManager::DeselectApplication() |
|
97 { |
|
98 return KErrNone; |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CSTSCardAppManager::DoExchange |
|
103 // |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 TInt CSTSCardAppManager::DoExchange() |
|
107 { |
|
108 TInt err = iApduExchanger->ExchangeApdu(*iSelectFileApdu, *iRespApdu); |
|
109 if (err == KErrNone) |
|
110 { |
|
111 if (!iRespApdu->IsNormalEnding()) |
|
112 { |
|
113 err = KErrGeneral; |
|
114 } |
|
115 } |
|
116 return err; |
|
117 } |
|
118 |
|
119 } // namespace satsa |
|
120 } // namespace java |
|
121 // End of File |
|
122 |