30 #include "cgmrcommandhandler.h" |
30 #include "cgmrcommandhandler.h" |
31 #include "cgmicommandhandler.h" |
31 #include "cgmicommandhandler.h" |
32 #include "cmgwcommandhandler.h" |
32 #include "cmgwcommandhandler.h" |
33 #include "cmgdcommandhandler.h" |
33 #include "cmgdcommandhandler.h" |
34 #include "telephonywrapper.h" |
34 #include "telephonywrapper.h" |
|
35 #include "cgmmcommandhandler.h" |
|
36 #include "scpbrcommandhandler.h" |
|
37 #include "scpbwcommandhandler.h" |
35 #endif |
38 #endif |
36 |
39 |
37 |
40 |
38 #include "atmisccmdpluginconsts.h" |
41 #include "atmisccmdpluginconsts.h" |
39 #include "cmserror.h" |
42 #include "cmserror.h" |
40 #include "debug.h" |
43 #include "debug.h" |
41 |
44 |
42 #include <exterror.h> // Additional RMobilePhone error code |
45 #include <exterror.h> // Additional RMobilePhone error code |
|
46 #include <etelmmerr.h> // ETelMM error code |
|
47 #include <gsmerror.h> // GSM error code |
43 |
48 |
44 // +CME error code |
49 // +CME error code |
45 _LIT8(KCMEMemoryFailure, "+CME ERROR: 23\r\n"); // Memory failure.\r\n |
50 _LIT8(KCMEMemoryFailure, "+CME ERROR: 23\r\n"); // Memory failure.\r\n |
46 _LIT8(KCMEIncorrectPassword, "+CME ERROR: 16\r\n"); // Incorrect password.\r\n |
51 _LIT8(KCMEIncorrectPassword, "+CME ERROR: 16\r\n"); // Incorrect password.\r\n |
47 _LIT8(KCMEPUKRequired, "+CME ERROR: 12\r\n"); // PUK required.\r\n |
52 _LIT8(KCMEPUKRequired, "+CME ERROR: 12\r\n"); // PUK required.\r\n |
48 _LIT8(KCMENotAllowed, "+CME ERROR: 3\r\n"); // Operation not allowed.\r\n |
53 _LIT8(KCMENotAllowed, "+CME ERROR: 3\r\n"); // Operation not allowed.\r\n |
49 _LIT8(KCMEPhoneError, "+CME ERROR: 0\r\n"); // Phone failure.\r\n |
54 _LIT8(KCMEPhoneError, "+CME ERROR: 0\r\n"); // Phone failure.\r\n |
50 _LIT8(KCMEPhoneUnknown, "+CME ERROR: 100\r\n"); // unknown error |
55 _LIT8(KCMEPhoneUnknown, "+CME ERROR: 100\r\n"); // unknown error |
|
56 _LIT8(KCMESimNotInserted, "+CME ERROR: 10\r\n"); // SIM not inserted |
|
57 _LIT8(KCMEMemoryFull, "+CME ERROR: 20\r\n"); // Memory full |
|
58 _LIT8(KCMEInvalidIndex, "+CME ERROR: 21\r\n"); // Invalid index |
|
59 _LIT8(KCMENotFound, "+CME ERROR: 22\r\n"); // Not found |
|
60 _LIT8(KCMEDialStringTooLong, "+CME ERROR: 26\r\n"); // Dial string too long |
|
61 _LIT8(KCMETextStringTooLong, "+CME ERROR: 24\r\n"); // Text string too long |
|
62 _LIT8(KCMEInvalidCharacters, "+CME ERROR: 27\r\n"); // Invalid characters in dial string |
|
63 |
|
64 |
51 |
65 |
52 const TInt KErrorReplyLength = 9; // CR+LF+"ERROR"+CR+LF |
66 const TInt KErrorReplyLength = 9; // CR+LF+"ERROR"+CR+LF |
53 const TInt KEditorReplyLength = 4; // CR+LF+'>'+' ' |
67 const TInt KEditorReplyLength = 4; // CR+LF+'>'+' ' |
54 |
68 |
55 CATMiscCmdPlugin* CATMiscCmdPlugin::NewL() |
69 CATMiscCmdPlugin* CATMiscCmdPlugin::NewL() |
108 iCGSNHandler = CCGSNCommandHandler::NewL(this, iCommandParser, iPhone); |
125 iCGSNHandler = CCGSNCommandHandler::NewL(this, iCommandParser, iPhone); |
109 iCGMRHandler = CCGMRCommandHandler::NewL(this, iCommandParser, iPhone); |
126 iCGMRHandler = CCGMRCommandHandler::NewL(this, iCommandParser, iPhone); |
110 iCGMIHandler = CCGMICommandHandler::NewL(this, iCommandParser, iPhone); |
127 iCGMIHandler = CCGMICommandHandler::NewL(this, iCommandParser, iPhone); |
111 iCMGWHandler = CCMGWCommandHandler::NewL(this, iCommandParser, iPhone); |
128 iCMGWHandler = CCMGWCommandHandler::NewL(this, iCommandParser, iPhone); |
112 iCMGDHandler = CCMGDCommandHandler::NewL(this, iCommandParser, iPhone); |
129 iCMGDHandler = CCMGDCommandHandler::NewL(this, iCommandParser, iPhone); |
|
130 iCGMMHandler = CCGMMCommandHandler::NewL(this, iCommandParser, iPhone); |
|
131 iSCPBRHandler = CSCPBRCommandHandler::NewL(this, iCommandParser, iPhone); |
|
132 iSCPBWHandler = CSCPBWCommandHandler::NewL(this, iCommandParser, iPhone); |
|
133 |
113 |
134 |
114 // Get telephony information - Model, IMEI, Manufacturer |
135 // Get telephony information - Model, IMEI, Manufacturer |
115 CTelephonyWrapper* telephonyWrapper = CTelephonyWrapper::NewL(); |
136 CTelephonyWrapper* telephonyWrapper = CTelephonyWrapper::NewL(); |
116 TInt result = telephonyWrapper->SynchronousGetPhoneId(); |
137 TInt result = telephonyWrapper->SynchronousGetPhoneId(); |
117 |
138 |
118 if (KErrNone == result) |
139 if (KErrNone == result) |
119 { |
140 { |
120 static_cast<CHVERCommandHandler*>(iHVERHandler)->SetHWVersion(telephonyWrapper->GetPhoneModel()); |
141 static_cast<CHVERCommandHandler*>(iHVERHandler)->SetHWVersion(telephonyWrapper->GetPhoneModel()); |
121 static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetSerialNum(telephonyWrapper->GetPhoneSerialNum()); |
142 static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetSerialNum(telephonyWrapper->GetPhoneSerialNum()); |
122 static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetManufacturer(telephonyWrapper->GetPhoneManufacturer()); |
143 static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetManufacturer(telephonyWrapper->GetPhoneManufacturer()); |
|
144 static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetManufacturer(telephonyWrapper->GetPhoneManufacturer()); |
|
145 static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetModelID(telephonyWrapper->GetPhoneModel()); |
123 } |
146 } |
124 else // The result is used to determine whether to display CME error or not |
147 else // The result is used to determine whether to display CME error or not |
125 { |
148 { |
126 static_cast<CHVERCommandHandler*>(iHVERHandler)->SetTelephonyError(result); |
149 static_cast<CHVERCommandHandler*>(iHVERHandler)->SetTelephonyError(result); |
127 static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetTelephonyError(result); |
150 static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetTelephonyError(result); |
128 static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetTelephonyError(result); |
151 static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetTelephonyError(result); |
|
152 static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetTelephonyError(result); |
129 } |
153 } |
130 delete telephonyWrapper; |
154 delete telephonyWrapper; |
131 #endif |
155 #endif |
132 |
156 |
133 TRACE_FUNC_EXIT |
157 TRACE_FUNC_EXIT |
206 case (TAtCommandParser::ECmdAtHver): |
230 case (TAtCommandParser::ECmdAtHver): |
207 { |
231 { |
208 iCurrentHandler = iHVERHandler; |
232 iCurrentHandler = iHVERHandler; |
209 break; |
233 break; |
210 } |
234 } |
211 case (TAtCommandParser::ECmdAtCgsn): |
235 case (TAtCommandParser::ECmdAtCgsn): // intentional fall through |
|
236 case (TAtCommandParser::ECmdAtGsn): |
|
237 case (TAtCommandParser::ECmdAtI1): |
212 { |
238 { |
213 iCurrentHandler = iCGSNHandler; |
239 iCurrentHandler = iCGSNHandler; |
214 break; |
240 break; |
215 } |
241 } |
216 case (TAtCommandParser::ECmdAtCgmr): |
242 case (TAtCommandParser::ECmdAtCgmr): // intentional fall through |
|
243 case (TAtCommandParser::ECmdAtGmr): |
|
244 case (TAtCommandParser::ECmdAtI2): |
|
245 case (TAtCommandParser::ECmdAtI4): |
217 { |
246 { |
218 iCurrentHandler = iCGMRHandler; |
247 iCurrentHandler = iCGMRHandler; |
219 break; |
248 break; |
220 } |
249 } |
221 case (TAtCommandParser::ECmdAtCgmi): |
250 case (TAtCommandParser::ECmdAtCgmi): // intentional fall through |
|
251 case (TAtCommandParser::ECmdAtGmi): |
|
252 case (TAtCommandParser::ECmdAtI): |
|
253 case (TAtCommandParser::ECmdAtI0): |
222 { |
254 { |
223 iCurrentHandler = iCGMIHandler; |
255 iCurrentHandler = iCGMIHandler; |
224 break; |
256 break; |
225 } |
257 } |
226 case (TAtCommandParser::ECmdAtCmgw): |
258 case (TAtCommandParser::ECmdAtCmgw): |
234 break; |
266 break; |
235 } |
267 } |
236 case (TAtCommandParser::ECmdAtCmgf): |
268 case (TAtCommandParser::ECmdAtCmgf): |
237 { |
269 { |
238 iCurrentHandler = NULL; |
270 iCurrentHandler = NULL; |
|
271 break; |
|
272 } |
|
273 case (TAtCommandParser::ECmdAtCgmm): // intentional fall through |
|
274 case (TAtCommandParser::ECmdAtGmm): |
|
275 case (TAtCommandParser::ECmdAtI3): |
|
276 { |
|
277 iCurrentHandler = iCGMMHandler; |
|
278 break; |
|
279 } |
|
280 case (TAtCommandParser::ECmdAtScpbr): |
|
281 { |
|
282 iCurrentHandler = iSCPBRHandler; |
|
283 break; |
|
284 } |
|
285 case (TAtCommandParser::ECmdAtScpbw): |
|
286 { |
|
287 iCurrentHandler = iSCPBWHandler; |
239 break; |
288 break; |
240 } |
289 } |
241 #endif |
290 #endif |
242 case (TAtCommandParser::EUnknown): |
291 case (TAtCommandParser::EUnknown): |
243 default: |
292 default: |
628 // Memory failure |
677 // Memory failure |
629 response.Append(KCMEMemoryFailure); |
678 response.Append(KCMEMemoryFailure); |
630 break; |
679 break; |
631 } |
680 } |
632 case KErrUnknown: |
681 case KErrUnknown: |
|
682 case KErrGsmSimServAnrFull: |
633 { |
683 { |
634 // unknown error |
684 // unknown error |
635 response.Append(KCMEPhoneUnknown); |
685 response.Append(KCMEPhoneUnknown); |
|
686 break; |
|
687 } |
|
688 case KErrNotFound: |
|
689 { |
|
690 response.Append(KCMENotFound); |
|
691 break; |
|
692 } |
|
693 case KErrInUse: |
|
694 case KErrGsmMMServiceOptionTemporaryOutOfOrder: |
|
695 { |
|
696 // SIM not inserted |
|
697 response.Append(KCMESimNotInserted); |
|
698 break; |
|
699 } |
|
700 case KErrArgument: |
|
701 case KErrGsm0707InvalidIndex: |
|
702 case KErrGsm0707NotFound: |
|
703 { |
|
704 // Invalid index |
|
705 response.Append(KCMEInvalidIndex); |
|
706 break; |
|
707 } |
|
708 case KErrGsm0707TextStringTooLong: |
|
709 { |
|
710 // Text string too long |
|
711 response.Append(KCMETextStringTooLong); |
|
712 break; |
|
713 } |
|
714 case KErrGsm0707DialStringTooLong: |
|
715 { |
|
716 // Dial string too long |
|
717 response.Append(KCMEDialStringTooLong); |
|
718 break; |
|
719 } |
|
720 case KErrGsmCCUnassignedNumber: |
|
721 case KErrGsm0707InvalidCharsInDialString: |
|
722 { |
|
723 // Invalid characters in dial string |
|
724 response.Append(KCMEInvalidCharacters); |
|
725 break; |
|
726 } |
|
727 case KErrMMEtelMaxReached: |
|
728 { |
|
729 // Memory full |
|
730 response.Append(KCMEMemoryFull); |
636 break; |
731 break; |
637 } |
732 } |
638 default: |
733 default: |
639 { |
734 { |
640 response.Append(KCMEPhoneError); |
735 response.Append(KCMEPhoneError); |