16 // |
16 // |
17 |
17 |
18 #include "cpincommandhandler.h" |
18 #include "cpincommandhandler.h" |
19 |
19 |
20 #include <mmretrieve.h> // define AO wrapper |
20 #include <mmretrieve.h> // define AO wrapper |
21 #include <exterror.h> // Additional RMobilePhone error code |
21 #include <EXTERROR.H> // Additional RMobilePhone error code |
22 |
22 |
23 #include "debug.h" |
23 #include "debug.h" |
24 |
24 |
25 CCPINCommandHandler* CCPINCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) |
25 CCPINCommandHandler* CCPINCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) |
26 { |
26 { |
80 } |
80 } |
81 |
81 |
82 TRACE_FUNC_EXIT |
82 TRACE_FUNC_EXIT |
83 } |
83 } |
84 |
84 |
85 void CCPINCommandHandler::HandleCommandCancel() |
|
86 { |
|
87 TRACE_FUNC_ENTRY |
|
88 Cancel(); |
|
89 TRACE_FUNC_EXIT |
|
90 } |
|
91 |
|
92 void CCPINCommandHandler::ChangePassword() |
85 void CCPINCommandHandler::ChangePassword() |
93 { |
86 { |
94 TRACE_FUNC_ENTRY |
87 TRACE_FUNC_ENTRY |
95 TRequestStatus status; |
88 TPtrC8 pukCode8; |
96 |
89 TPtrC8 pinCode8; |
|
90 |
97 // Get parameters from AT command |
91 // Get parameters from AT command |
98 TInt ret1; |
92 TInt ret1 = iATCmdParser.NextTextParam(pukCode8); |
99 TInt ret2; |
93 TInt ret2 = iATCmdParser.NextTextParam(pinCode8); |
100 TPtrC8 pukCode8 = iATCmdParser.NextTextParam(ret1); |
94 |
101 TPtrC8 pinCode8 = iATCmdParser.NextTextParam(ret2); |
|
102 if(ret1 != KErrNone || ret2 != KErrNone |
95 if(ret1 != KErrNone || ret2 != KErrNone |
103 || iATCmdParser.NextParam().Compare(KNullDesC8) != 0) |
96 || iATCmdParser.NextParam().Length() != 0) |
104 { |
97 { |
105 iCallback->CreateReplyAndComplete( EReplyTypeError); |
98 iCallback->CreateReplyAndComplete( EReplyTypeError); |
106 TRACE_FUNC_EXIT |
99 } |
107 return; |
100 else |
108 } |
101 { |
109 |
102 RMobilePhone::TMobilePassword pukCode; |
110 RMobilePhone::TMobilePassword pukCode; |
103 RMobilePhone::TMobilePassword pinCode; |
111 RMobilePhone::TMobilePassword pinCode; |
104 pukCode.Copy(pukCode8); |
112 pukCode.Copy(pukCode8); |
105 pinCode.Copy(pinCode8); |
113 pinCode.Copy(pinCode8); |
106 iPhone.VerifySecurityCode(iStatus, RMobilePhone::ESecurityCodePuk1, pinCode, pukCode); |
114 iPhone.VerifySecurityCode(iStatus, RMobilePhone::ESecurityCodePuk1, pinCode, pukCode); |
107 // re-use the AO for VerifySecurityCode |
115 // re-use the AO for VerifySecurityCode |
108 iPendingEvent = EMobilePhoneVerifySecurityCode; |
116 iPendingEvent = EMobilePhoneVerifySecurityCode; |
109 SetActive(); |
117 SetActive(); |
110 } |
118 |
111 |
119 TRACE_FUNC_EXIT |
112 TRACE_FUNC_EXIT |
120 return; |
|
121 } |
113 } |
122 |
114 |
123 void CCPINCommandHandler::RunL() |
115 void CCPINCommandHandler::RunL() |
124 { |
116 { |
125 TRACE_FUNC_ENTRY |
117 TRACE_FUNC_ENTRY |
126 |
|
127 if( iPendingEvent == EMobilePhoneGetLockInfo) |
118 if( iPendingEvent == EMobilePhoneGetLockInfo) |
128 { // after calling GetLockInfo |
119 { // after calling GetLockInfo |
129 HandleGetLockInfo(); |
120 HandleGetLockInfo(); |
130 } |
121 } |
131 else |
122 else |