|
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 |
|
21 #include "cstspinapdu.h" |
|
22 |
|
23 namespace java |
|
24 { |
|
25 namespace satsa |
|
26 { |
|
27 |
|
28 // CONSTANTS |
|
29 //PIN related constants according to standard ETSI TS 102 221 |
|
30 const TUint8 KSTSINSVerifyPIN = 0x20; |
|
31 const TUint8 KSTSINSChangePIN = 0x24; |
|
32 const TUint8 KSTSINSDisablePIN = 0x26; |
|
33 const TUint8 KSTSINSEnablePIN = 0x28; |
|
34 const TUint8 KSTSINSUnblockPIN = 0x2C; |
|
35 |
|
36 // ============================ MEMBER FUNCTIONS =============================== |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CSTSPinApdu::CSTSPinApdu |
|
40 // C++ default constructor can NOT contain any code, that |
|
41 // might leave. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 CSTSPinApdu::CSTSPinApdu() |
|
45 { |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CSTSPinApdu::NewLC |
|
50 // Two-phased constructor. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 CSTSPinApdu* CSTSPinApdu::NewLC(TSTSPinApduType aType, TUint8 aP2, |
|
54 CSTSApdu::TSTSApduStandard aStandard) |
|
55 { |
|
56 CSTSPinApdu* self = new(ELeave) CSTSPinApdu(); |
|
57 CleanupStack::PushL(self); |
|
58 self->ConstructL(aType, aP2, aStandard); |
|
59 return self; |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CSTSPinApdu::NewL |
|
64 // Two-phased constructor. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CSTSPinApdu* CSTSPinApdu::NewL(TSTSPinApduType aType, TUint8 aP2, |
|
68 CSTSApdu::TSTSApduStandard aStandard) |
|
69 { |
|
70 CSTSPinApdu* self = CSTSPinApdu::NewLC(aType, aP2, aStandard); |
|
71 CleanupStack::Pop(self); |
|
72 |
|
73 return self; |
|
74 } |
|
75 |
|
76 // Destructor |
|
77 CSTSPinApdu::~CSTSPinApdu() |
|
78 { |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CSTSPinApdu::ConstructL |
|
83 // |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 void CSTSPinApdu::ConstructL(TSTSPinApduType aType, TUint8 aP2, |
|
87 CSTSApdu::TSTSApduStandard aStandard) |
|
88 { |
|
89 iApduData = CSTSApdu::NewL(KSTSApduMandatoryHeaderLen, aStandard); |
|
90 iApduData->ApduPtr().FillZ(KSTSApduMandatoryHeaderLen); |
|
91 |
|
92 SetApduByte(KSTSCLABasicUMTS, ESTSCLA); |
|
93 SetPinINS(aType); |
|
94 SetApduByte(0x00, ESTSP1); //empty in all cases |
|
95 SetApduByte(aP2, ESTSP2); |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CSTSPinApdu::SetPinINS |
|
100 // |
|
101 // (other items were commented in a header). |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CSTSPinApdu::SetPinINS(TSTSPinApduType aType) |
|
105 { |
|
106 |
|
107 switch (aType) |
|
108 { |
|
109 case ESTSVerifyPin: |
|
110 { |
|
111 SetApduByte(KSTSINSVerifyPIN, ESTSINS); |
|
112 break; |
|
113 } |
|
114 case ESTSChangePin: |
|
115 { |
|
116 SetApduByte(KSTSINSChangePIN, ESTSINS); |
|
117 break; |
|
118 } |
|
119 case ESTSDisablePin: |
|
120 { |
|
121 SetApduByte(KSTSINSDisablePIN, ESTSINS); |
|
122 break; |
|
123 } |
|
124 case ESTSEnablePin: |
|
125 { |
|
126 SetApduByte(KSTSINSEnablePIN, ESTSINS); |
|
127 break; |
|
128 } |
|
129 case ESTSUnblockPin: |
|
130 { |
|
131 SetApduByte(KSTSINSUnblockPIN, ESTSINS); |
|
132 break; |
|
133 } |
|
134 default: |
|
135 { |
|
136 break; |
|
137 } |
|
138 } |
|
139 } |
|
140 |
|
141 } // namespace satsa |
|
142 } // namespace java |
|
143 // End of File |