FreeCalypso > hg > fc-tourmaline
comparison src/g23m-aci/aci/ati_err.c @ 1:fa8dc04885d8
src/g23m-*: import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:25:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:4e78acac3d88 | 1:fa8dc04885d8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-F&D (8411) | |
4 | Modul : ATI | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : AT Command Interpreter: Error handling. | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 /*********************************/ | |
22 /* General Error Handling in ACI */ | |
23 /*********************************/ | |
24 | |
25 #ifndef ATI_ERR_C | |
26 #define ATI_ERR_C | |
27 | |
28 #undef DUMMY_ATI_STRINGS | |
29 | |
30 #include "aci_all.h" | |
31 | |
32 #include "aci_cmh.h" | |
33 #include "ati_cmd.h" | |
34 #include "aci_io.h" | |
35 #include "aci_cmd.h" | |
36 #include "l4_tim.h" | |
37 | |
38 #include "aci.h" | |
39 #include "aci_mem.h" | |
40 | |
41 #include "aci_lst.h" | |
42 #include "ati_int.h" | |
43 | |
44 #ifdef FF_ATI_BAT | |
45 | |
46 #include "typedefs.h" | |
47 #include "gdd.h" | |
48 #include "bat.h" | |
49 | |
50 #include "ati_bat.h" | |
51 | |
52 #endif /*FF_ATI_BAT*/ | |
53 | |
54 LOCAL CHAR *AT_Fail_Error(void); | |
55 | |
56 EXTERN T_ACI_ERR_DESC aciErrDesc; | |
57 | |
58 LOCAL CHAR ErrBuff[MAX_CMD_LEN]; | |
59 | |
60 typedef struct | |
61 { | |
62 CHAR *msg; | |
63 CHAR *nmb; | |
64 AtErrCode code; | |
65 } AtErrTable; | |
66 | |
67 LOCAL const AtErrTable tabAtError[]= | |
68 { | |
69 "OK", "0", atOk, | |
70 "CONNECT", "1", atConnect, | |
71 "RING", "2", atRing, | |
72 "NO CARRIER", "3", atNoCarrier, | |
73 "NO DIALTONE", "6", atNoDialtone, | |
74 "BUSY", "7", atBusy, | |
75 "NO ANSWER", "8", atNoAnswer, | |
76 "CONNECT 9600","15", atConnect1, | |
77 /* this has to be the last entry */ | |
78 "ERROR", "4", atError | |
79 }; | |
80 | |
81 GLOBAL CHAR *disable_or_numeric(const CHAR* key,LONG e) /* e is actually enum...*/ | |
82 { | |
83 UBYTE srcId = srcId_cb; | |
84 | |
85 if(ati_user_output_cfg[srcId].CMEE_stat EQ CMEE_MOD_Disable) | |
86 { | |
87 cmdAtError(atError); | |
88 } | |
89 else if(ati_user_output_cfg[srcId].CMEE_stat EQ CMEE_MOD_Numeric) | |
90 { | |
91 sprintf(cmdErrStr,"%s ERROR: %d",key,e); | |
92 } | |
93 return cmdErrStr; | |
94 } | |
95 | |
96 | |
97 /* | |
98 +--------------------------------------------------------------------+ | |
99 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
100 | STATE : code ROUTINE : cmdExtError | | |
101 +--------------------------------------------------------------------+ | |
102 | |
103 PURPOSE : handle extended errors | |
104 | |
105 */ | |
106 | |
107 LOCAL const struct T_ATI_EXT_ERR /* error code - error message mapping */ | |
108 { | |
109 const CHAR* msg; /* error message */ | |
110 const T_ACI_EXT_ERR code; /* error code */ | |
111 const ULONG displ_code; /* error code to be display */ | |
112 } | |
113 | |
114 err[] = | |
115 { | |
116 "parameter not allowed", EXT_ERR_Parameter, EXT_ERR_Parameter, | |
117 "data corrupted", EXT_ERR_DataCorrupt, EXT_ERR_DataCorrupt, | |
118 "internal error", EXT_ERR_Internal, EXT_ERR_Internal, | |
119 "call table full", EXT_ERR_CallTabFull, EXT_ERR_CallTabFull, | |
120 "service table full", EXT_ERR_SrvTabFull, EXT_ERR_SrvTabFull, | |
121 "call not found", EXT_ERR_CallNotFound, EXT_ERR_CallNotFound, | |
122 "no data-call supported", EXT_ERR_NoDataCallSup, EXT_ERR_NoDataCallSup, | |
123 "one call on hold", EXT_ERR_OneCallOnHold, EXT_ERR_OneCallOnHold, | |
124 "hold call not supported for this type", EXT_ERR_CallTypeNoHold, EXT_ERR_CallTypeNoHold, | |
125 "number not allowed by FDN", EXT_ERR_FdnCheck, EXT_ERR_FdnCheck, | |
126 "number not allowed by BDN", EXT_ERR_BdnCheck, EXT_ERR_BdnCheck, | |
127 "parallel USSD not supported", EXT_ERR_ParallelUSSD, EXT_ERR_ParallelUSSD, | |
128 "fax minimum speed condition", EXT_ERR_FaxMinSpeedCond, EXT_ERR_FaxMinSpeedCond, | |
129 "conflict with command details", EXT_ERR_CmdDetailsSAT, EXT_ERR_CmdDetailsSAT, | |
130 "IMEI illegal", EXT_ERR_IMEICheck, EXT_ERR_IMEICheck, | |
131 "not allowed by ALS-Lock", EXT_ERR_AlsLock, EXT_ERR_AlsLock, | |
132 #ifdef REL99 | |
133 "Last failed message not present", EXT_ERR_FailedMsgNotPresent,EXT_ERR_FailedMsgNotPresent, | |
134 #endif | |
135 #if defined FF_EOTD | |
136 "Command not supported", EXT_ERR_LCS_CmdNotSup, 0, | |
137 "Command not recognised/out of range", EXT_ERR_LCS_CmdNotRec, 1, | |
138 "LCS Client ID not recognised/out of range", EXT_ERR_LCS_CLPSClientNotRec, 2, | |
139 "Interval attribute out of range", EXT_ERR_LCS_IntervalNotSup, 3, | |
140 "Repeat attribute not supported/ out of range", EXT_ERR_LCS_RepeatNotSup, 4, | |
141 "Send request type not recognised / out of range", EXT_ERR_LCS_SendReqTyNotRec, 2, | |
142 "User confirmation request type not recognised / out of range", EXT_ERR_LCS_UsConfReqTyNotRec, 3, | |
143 "LCS Client ID not recognised/out of range", EXT_ERR_LCS_CLSRClientIdNotRec, 4, | |
144 "Circuit switched call number out of range", EXT_ERR_LCS_CSCallNumNotSup, 5, | |
145 #endif /* FF_EOTD */ | |
146 | |
147 #ifdef SIM_PERS | |
148 "BlockedNetwork lock - PIN required", EXT_ERR_BlockedNetworkPersPinReq, EXT_ERR_BlockedNetworkPersPinReq, | |
149 "BlockedNetwork lock - PUK required", EXT_ERR_BlockedNetworkPersPukReq, EXT_ERR_BlockedNetworkPersPukReq, | |
150 "Busy Error", EXT_ERR_Busy, EXT_ERR_Busy, /* Penalty timer is running */ | |
151 "MEPD not present", EXT_ERR_NoMEPD, EXT_ERR_NoMEPD, /* Penalty timer is running */ | |
152 #endif | |
153 | |
154 "error unknown", EXT_ERR_Unknown, EXT_ERR_Unknown, | |
155 /* this has to be the last entry */ | |
156 "other error", EXT_ERR_NotPresent, 0xFFFFFFFF | |
157 }; | |
158 | |
159 GLOBAL CHAR *cmdExtError (T_ACI_EXT_ERR e) | |
160 { | |
161 SHORT idx=0; | |
162 T_ACI_ERR_DESC aed; | |
163 UBYTE srcId = srcId_cb; | |
164 | |
165 if ( e EQ EXT_ERR_NotPresent ) | |
166 { | |
167 if (((aed = qAT_ErrDesc()) >> 16) EQ ACI_ERR_CLASS_Ext) | |
168 { | |
169 e = (T_ACI_EXT_ERR)(aed & 0xFFFF); | |
170 } | |
171 else | |
172 { | |
173 e = EXT_ERR_Unknown; | |
174 } | |
175 } | |
176 *ErrBuff = '\0'; | |
177 cmdErrStr = ErrBuff; | |
178 | |
179 if (ati_user_output_cfg[srcId].CMEE_stat EQ CMEE_MOD_Verbose OR | |
180 ati_user_output_cfg[srcId].CMEE_stat EQ CMEE_MOD_Numeric) | |
181 { | |
182 /* search the array for the index of the notified failure */ | |
183 while ( err[idx].code NEQ EXT_ERR_NotPresent AND | |
184 err[idx].code NEQ e ) | |
185 { | |
186 idx++; | |
187 } | |
188 } | |
189 else /* Catch some Extended Error Codes and map them to more suitable codes */ | |
190 { | |
191 switch (e) | |
192 { | |
193 case EXT_ERR_CallTabFull: | |
194 case EXT_ERR_FdnCheck: | |
195 case EXT_ERR_BdnCheck: | |
196 return(cmdAtError(atNoCarrier)); | |
197 } | |
198 } | |
199 if (ati_user_output_cfg[srcId].CMEE_stat EQ CMEE_MOD_Verbose) | |
200 { | |
201 strcat(cmdErrStr,"+EXT ERROR: "); | |
202 strcat( cmdErrStr, err[idx].msg ); | |
203 } | |
204 return(disable_or_numeric("+EXT", err[idx].displ_code)); | |
205 } | |
206 | |
207 /* | |
208 +--------------------------------------------------------------------+ | |
209 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
210 | STATE : code ROUTINE : cmdCmeError | | |
211 +--------------------------------------------------------------------+ | |
212 | |
213 PURPOSE : handle Mobile Equipment Errors | |
214 | |
215 */ | |
216 #ifdef GPRS | |
217 #define GPRS_ERR(a,b) a,b, | |
218 #else | |
219 #define GPRS_ERR(a,b) | |
220 #endif /* GPRS */ | |
221 | |
222 LOCAL const struct T_ATI_CME_ERR /* error code - error message mapping */ | |
223 { | |
224 const CHAR* msg; /* error message */ | |
225 const T_ACI_CME_ERR code; /* error code */ | |
226 } | |
227 error[] = | |
228 { | |
229 "phone failure", CME_ERR_PhoneFail, | |
230 "no connection to phone", CME_ERR_NoConnect, | |
231 "phone-adaptor link reserved", CME_ERR_LinkRes, | |
232 "operation not allowed", CME_ERR_OpNotAllow, | |
233 "operation not supported", CME_ERR_OpNotSupp, | |
234 "PH-SIM PIN required", CME_ERR_PhSimPinReq, | |
235 "SIM not inserted", CME_ERR_SimNotIns, | |
236 "SIM PIN required", CME_ERR_SimPinReq, | |
237 "SIM PUK required", CME_ERR_SimPukReq, | |
238 "SIM failure", CME_ERR_SimFail, | |
239 "SIM busy", CME_ERR_SimBusy, | |
240 "SIM wrong", CME_ERR_SimWrong, | |
241 "incorrect password", CME_ERR_WrongPasswd, | |
242 "SIM PIN2 required", CME_ERR_SimPin2Req, | |
243 "SIM PUK2 required", CME_ERR_SimPuk2Req, | |
244 "memory full", CME_ERR_MemFull, | |
245 "invalid index", CME_ERR_InvIdx, | |
246 "not found", CME_ERR_NotFound, | |
247 "memory failure", CME_ERR_MemFail, | |
248 "text string too long", CME_ERR_TxtToLong, | |
249 "invalid characters in text string", CME_ERR_InvalidTxtChar, | |
250 "dial string too long", CME_ERR_DialToLong, | |
251 "invalid characters in dial string", CME_ERR_InvDialChar, | |
252 "no network service", CME_ERR_NoServ, | |
253 "network timeout", CME_ERR_Timeout, | |
254 "network not allowed - emergency calls only", CME_ERR_LimServ, | |
255 "Network lock - PIN required", CME_ERR_NetworkPersPinReq, /* PIN to change network personalisation required */ | |
256 "Network lock - PUK required", CME_ERR_NetworkPersPukReq, /* network personalisation PUK is required */ | |
257 "Subnetwork lock - PIN required", CME_ERR_NetworkSubsetPersPinReq, /* keycode to change nw subset personalisation required */ | |
258 "Subnetwork lock - PUK required", CME_ERR_NetworkSubsetPersPukReq, /* network subset personalisation PUK is required */ | |
259 "Provider lock - PIN required", CME_ERR_ProviderPersPinReq, /* keycode to change service provider personal. required */ | |
260 "Provider lock - PUK required", CME_ERR_ProviderPersPukReq, /* service provider personalisation PUK is required */ | |
261 "Corporate lock - PIN required", CME_ERR_CorporatePersPinReq, /* keycode to change corporate personalisation required */ | |
262 "Corporate lock - PUK required", CME_ERR_CorporatePersPukReq, /* corporate personalisation PUK is required */ | |
263 "unknown", CME_ERR_Unknown, /* ATTENTION! If you insert new entries before CME_ERR_Unknown, remember to increase NBR_CME_NORM_ERR */ | |
264 GPRS_ERR("illegal MS", CME_ERR_GPRSBadMs) | |
265 GPRS_ERR("illegal ME", CME_ERR_GPRSBadMe) | |
266 GPRS_ERR("GPRS service not allowed", CME_ERR_GPRSNoService) | |
267 GPRS_ERR("PLMN not allowed", CME_ERR_GPRSBadPlmn) | |
268 GPRS_ERR("Location not allowed", CME_ERR_GPRSBadLoc) | |
269 GPRS_ERR("Roaming not allowed in Location Area", CME_ERR_GPRSNoRoam) | |
270 GPRS_ERR("GPRS service option not supported", CME_ERR_GPRSSerOptNsup) | |
271 GPRS_ERR("requested service option not subscribed",CME_ERR_GPRSSerOptNsub) | |
272 GPRS_ERR("service option temporarily out of order",CME_ERR_GPRSSerOptOOO) | |
273 GPRS_ERR("unspecified GPRS error", CME_ERR_GPRSUnspec) | |
274 GPRS_ERR("PDP authorisation error", CME_ERR_GPRSPdpAuth) | |
275 GPRS_ERR("invalid module class", CME_ERR_GPRSBadModClass) | |
276 "failed to abort", CME_ERR_FailedToAbort, | |
277 "ACM reset needed", CME_ERR_AcmResetNeeded, | |
278 "sim extension memory full", CME_ERR_SimNoExtAvail, | |
279 "sim reset needed", CME_ERR_SimResetNeeded, | |
280 "Aborted by Network", CME_ERR_AbortedByNetwork, | |
281 /* this has to be the last entry */ | |
282 "other error", CME_ERR_NotPresent | |
283 }; | |
284 | |
285 GLOBAL CHAR *cmdCmeError (T_ACI_CME_ERR e) | |
286 { | |
287 SHORT idx=0; | |
288 T_ACI_ERR_DESC aed; | |
289 UBYTE srcId = srcId_cb; | |
290 | |
291 *ErrBuff = '\0'; /* initialization */ | |
292 cmdErrStr = ErrBuff; | |
293 | |
294 if ( e EQ CME_ERR_NotPresent ) | |
295 { | |
296 if (((aed = qAT_ErrDesc()) >> 16) EQ ACI_ERR_CLASS_Cme) | |
297 { | |
298 e = (T_ACI_CME_ERR)(aed & 0xFFFF); | |
299 } | |
300 else | |
301 { | |
302 e = CME_ERR_Unknown; | |
303 } | |
304 } | |
305 else if( e EQ CME_ERR_Unknown ) | |
306 { | |
307 return(AT_Fail_Error()); | |
308 } | |
309 | |
310 if (ati_user_output_cfg[srcId].CMEE_stat EQ CMEE_MOD_Verbose) | |
311 { | |
312 strcat(cmdErrStr,"+CME ERROR: "); | |
313 | |
314 /* search for the description of the notified error */ | |
315 while ( error[idx].code NEQ CME_ERR_NotPresent AND | |
316 error[idx].code NEQ e ) | |
317 { | |
318 idx++; | |
319 } | |
320 strcat( cmdErrStr, error[idx].msg ); | |
321 } | |
322 return(disable_or_numeric("+CME",e)); | |
323 } | |
324 | |
325 | |
326 /* | |
327 +--------------------------------------------------------------------+ | |
328 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
329 | STATE : code ROUTINE : cmdCmsError | | |
330 +--------------------------------------------------------------------+ | |
331 | |
332 PURPOSE : handle Short Message Errors | |
333 | |
334 */ | |
335 | |
336 LOCAL const struct T_ATI_CMS_ERR /* error code - error message mapping */ | |
337 { | |
338 const CHAR* msg; /* error message */ | |
339 const T_ACI_CMS_ERR code; /* error code */ | |
340 } | |
341 cms_err[] = | |
342 { | |
343 "unassigned (unallocated) number", CMS_ERR_UnAllocNum, | |
344 "operator determined barring", CMS_ERR_OpDetermBarr, | |
345 "call barred", CMS_ERR_CallBarr, | |
346 "short message transfer rejected", CMS_ERR_TransReject, | |
347 "destination out of service", CMS_ERR_DestOutOfServ, | |
348 "unidentified subscriber", CMS_ERR_UnidentSubsc, | |
349 "facility rejected", CMS_ERR_FacReject, | |
350 "unknown subscriber", CMS_ERR_UnKnownSubsc, | |
351 "network out of order", CMS_ERR_NetOutOfOrder, | |
352 "temporary failure", CMS_ERR_TempFail, | |
353 "congestion", CMS_ERR_Congestion, | |
354 "resources unavailable, unspecified", CMS_ERR_ResUnAvail, | |
355 "requested facility not subscribed", CMS_ERR_FacNotSubscr, | |
356 "requested facility not implemented", CMS_ERR_FacNotImpl, | |
357 "invalid short message transfer ref. value", CMS_ERR_TransRefInval, | |
358 "semantically incorrect message", CMS_ERR_InValSM, | |
359 "invalid mandatory information", CMS_ERR_InValManInfo, | |
360 "message type non-existent or not implemented", CMS_ERR_MsgTypNotExist, | |
361 "message not compatible with SM protocol state", CMS_ERR_MsgNotCompatible, | |
362 "information element non-existent or not impl.", CMS_ERR_InfoElemNotImpl, | |
363 "protocol error, unspecified", CMS_ERR_ProtErr, | |
364 "interworking, unspecified", CMS_ERR_InterWrkUnSpec, | |
365 "telematic interworking not supported", CMS_ERR_TlmtkNotSup, | |
366 "short message type 0 not supported", CMS_ERR_SM0NotSup, | |
367 "cannot replace short message", CMS_ERR_CantReplceSM, | |
368 "unspecified TP-PID error", CMS_ERR_UnSpecPIDErr, | |
369 "data coding scheme (alphabet) not supported", CMS_ERR_DcsNotSup, | |
370 "message class not supported", CMS_ERR_MsgClassNotSup, | |
371 "unspecified TP-DCS error", CMS_ERR_UnSpecTpDcs, | |
372 "command cannot be actioned", CMS_ERR_CmdNotAct, | |
373 "command unsupported", CMS_ERR_CmdUnSup, | |
374 "unspecified TP-Command error", CMS_ERR_UnSpecTpCmd, | |
375 "TPDU not supported", CMS_ERR_TpduUnSup, | |
376 "SC busy", CMS_ERR_ScBsy, | |
377 "no SC subscription", CMS_ERR_NoScSubsc, | |
378 "SC system failure", CMS_ERR_ScSysFail, | |
379 "invalid SME address", CMS_ERR_InValSme, | |
380 "destination SME barred", CMS_ERR_DestSmeBarr, | |
381 "SM rejected-duplicate SM", CMS_ERR_SmRejctDuplSm, | |
382 "TP-VPF not supported", CMS_ERR_SmTPVPFNotSup, | |
383 "TP-VP not supported", CMS_ERR_SmTPVPNotSup, | |
384 "SIM SMS storage full", CMS_ERR_SimSmsStorFull, | |
385 "no SMS storage capability in SIM", CMS_ERR_NoStorInSim, | |
386 "error in MS", CMS_ERR_ErrInMs, | |
387 "memory capacity exceeded", CMS_ERR_MemCabExcee, | |
388 "unspecified error cause", CMS_ERR_UnSpecErr, | |
389 "ME failure", CMS_ERR_MeFail, | |
390 "SMS service of ME reserved", CMS_ERR_ServRes, | |
391 "operation not allowed", CMS_ERR_OpNotAllowed, | |
392 "operation not supported", CMS_ERR_OpNotSup, | |
393 "invalid PDU mode parameter", CMS_ERR_InValPduMod, | |
394 "invalid text mode parameter", CMS_ERR_InValTxtMod, | |
395 "SIM not inserted", CMS_ERR_SimNotIns, | |
396 "SIM PIN required", CMS_ERR_SimPinReq, | |
397 "PH-SIM PIN required", CMS_ERR_PhSimPinReq, | |
398 "SIM failure", CMS_ERR_SimFail, | |
399 "SIM busy", CMS_ERR_SimBsy, | |
400 "SIM wrong", CMS_ERR_SimWrong, | |
401 "SIM PUK required", CMS_ERR_SimPukReq, | |
402 "SIM PIN2 required", CMS_ERR_SimPin2Req, | |
403 "SIM PUK2 required", CMS_ERR_SimPuk2Req, | |
404 "memory failure", CMS_ERR_MemFail, | |
405 "invalid memory index", CMS_ERR_InValMemIdx, | |
406 "memory full", CMS_ERR_MemFull, | |
407 "SMSC address unknown", CMS_ERR_SmscAdrUnKnown, | |
408 "no network service", CMS_ERR_NoNetServ, | |
409 "network timeout", CMS_ERR_NetTimeOut, | |
410 "no +CNMA acknowledegment expected", CMS_ERR_NoCnmaAckExpect, | |
411 "unknown error", CMS_ERR_UnknownErr, | |
412 "failed to abort", CMS_ERR_FailedToAbort, | |
413 /* this must be the last entry */ | |
414 "other error", CMS_ERR_NotPresent | |
415 }; | |
416 | |
417 #define NBR_CMS_ERR 69 | |
418 #define MAX_CMS_LTH 60 | |
419 | |
420 GLOBAL char* cmdCmsError ( T_ACI_CMS_ERR e ) | |
421 { | |
422 int i = 0; | |
423 T_ACI_ERR_DESC aed; | |
424 UBYTE srcId = srcId_cb; | |
425 | |
426 if ( e EQ CMS_ERR_NotPresent ) | |
427 { | |
428 if (((aed = qAT_ErrDesc()) >> 16) EQ ACI_ERR_CLASS_Cms) | |
429 { | |
430 e = (T_ACI_CMS_ERR)(aed & 0xFFFF); | |
431 } | |
432 else /* no SMS error code */ | |
433 { | |
434 e = CMS_ERR_UnknownErr; | |
435 } | |
436 } | |
437 | |
438 { | |
439 *ErrBuff = '\0'; /* build message */ | |
440 cmdErrStr = ErrBuff; | |
441 | |
442 if ( ati_user_output_cfg[srcId].CMEE_stat EQ CMEE_MOD_Verbose ) | |
443 { | |
444 strcat( cmdErrStr, "+CMS ERROR: " ); | |
445 | |
446 while ( cms_err[i].code NEQ CMS_ERR_NotPresent AND | |
447 cms_err[i].code NEQ e ) | |
448 { | |
449 i++; | |
450 } | |
451 strcat( cmdErrStr, cms_err[i].msg ); | |
452 } | |
453 else if ( ati_user_output_cfg[srcId].CMEE_stat EQ CMEE_MOD_Disable ) | |
454 { | |
455 strcat ( cmdErrStr, "ERROR" ); | |
456 } | |
457 else if ( ati_user_output_cfg[srcId].CMEE_stat EQ CMEE_MOD_Numeric ) | |
458 { | |
459 sprintf ( cmdErrStr, "+CMS ERROR: %d", e ); | |
460 } | |
461 } | |
462 return cmdErrStr; | |
463 } | |
464 | |
465 | |
466 /* | |
467 +--------------------------------------------------------------------+ | |
468 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
469 | STATE : code ROUTINE : atPlusCEER | | |
470 +--------------------------------------------------------------------+ | |
471 | |
472 PURPOSE : Extented error report | |
473 */ | |
474 | |
475 typedef struct | |
476 { | |
477 char * desc; | |
478 T_ACI_CEER rpt; | |
479 } CEER_TABLE; | |
480 | |
481 /* Defined by standards CEER cause description table */ | |
482 const CEER_TABLE StdCEERDesc[]= | |
483 { | |
484 {"unassigned number", CEER_Unassign }, | |
485 {"no route to destination", CEER_NoRoute }, | |
486 {"channel unacceptable", CEER_ChanUnaccept }, | |
487 {"operator determined barring", CEER_Barred }, | |
488 {"normal call clearing", CEER_CallClear }, | |
489 {"user busy", CEER_UserBusy }, | |
490 {"no user responding", CEER_NoResponse }, | |
491 {"user alerting, no answer", CEER_AlertNoAnswer }, | |
492 {"call rejected", CEER_CallReject }, | |
493 {"number changed", CEER_NumChanged }, | |
494 {"non selected user clearing", CEER_UserClear }, | |
495 {"destination out of order", CEER_DestOutOfOrder }, | |
496 {"invalid number format", CEER_NumFormat }, | |
497 {"facility rejected", CEER_FacilityReject }, | |
498 {"response to status enquiry", CEER_StatusEnquiry }, | |
499 {"normal, unspecified", CEER_Unspecified }, | |
500 {"no channel available", CEER_NoChanAvail }, | |
501 {"network out of order", CEER_NetworkOutOfOrder }, | |
502 {"temporary failure", CEER_TempFailure }, | |
503 {"switching equipment congestion", CEER_SwitchCongest }, | |
504 {"access information discarded", CEER_InfoDiscard }, | |
505 {"requested channel unavailable", CEER_ReqChanUnavail }, | |
506 {"recources unavailable", CEER_ResourceUnavail }, | |
507 {"quality of service unavailable", CEER_QOS_Unavail }, | |
508 {"requested facility unsubscribed", CEER_FAC_Unsubscr }, | |
509 {"incoming calls barred within CUG", CEER_BarredInCUG }, | |
510 {"bearer capability not authorized", CEER_BearerCapNotAuth }, | |
511 {"bearer capability not available", CEER_BearerCapUnavail }, | |
512 {"service not available", CEER_ServUnavail }, | |
513 {"bearer service not implemented", CEER_BearerNotImpl }, | |
514 {"ACM reached ACM maximum", CEER_ACM_Max }, | |
515 {"facility not implemented", CEER_FAC_NotImpl }, | |
516 {"only restricted bearer cap. avail.", CEER_RestrictBearerCap }, | |
517 {"service not implemented", CEER_ServNotImpl }, | |
518 {"invalid TI", CEER_InvalidTI }, | |
519 {"no member of CUG", CEER_UserNotInCUG }, | |
520 {"incompatible destination", CEER_IncompatDest }, | |
521 {"invalid transit network selection", CEER_InvalidTransNet }, | |
522 {"incorrect message", CEER_IncorrMsg }, | |
523 {"invalid mandatory information", CEER_InvalidMandInfo }, | |
524 {"message type not implemented", CEER_MsgTypeNotImpl }, | |
525 {"message type incompatible", CEER_MsgTypeIncomp }, | |
526 {"info element not implemented", CEER_InfoElemNotImpl }, | |
527 {"conditional info element error", CEER_CondInfoElem }, | |
528 {"message incompatible", CEER_MsgIncomp }, | |
529 {"recovery on time expiry", CEER_Timer }, | |
530 {"protocol error", CEER_Protocol }, | |
531 {"interworking error", CEER_Interworking }, | |
532 {"bearer service not available", CEER_ReqBearerServNotAvail }, | |
533 {"no TI available", CEER_NoTransIdAvail }, | |
534 {"timer 303 expiry", CEER_Timer303 }, | |
535 {"establishment failure", CEER_EstabFail }, | |
536 {"no error", CEER_NoError }, | |
537 {"operation failed", CEER_Failed }, | |
538 {"timeout", CEER_Timeout }, | |
539 {"bearer service not compatible", CEER_BearerServNotCompat }, | |
540 #ifdef GPRS | |
541 {"unsuccessful GPRS attach", CEER_FailedGPRSAttach }, | |
542 {"unsuccessful PDP context activation",CEER_FailedGPRSContextAct }, | |
543 {"GPRS detach", CEER_GPRSDetach }, | |
544 {"GPRS PDP context deactivation", CEER_GPRSDeactivation }, | |
545 #endif /* GPRS */ | |
546 /* these have to be the last entries */ | |
547 {"no error", CEER_NotPresent }, | |
548 /* last entry for at+ceer */ | |
549 { NULL, CEER_NotPresent} | |
550 }; | |
551 | |
552 /* Proprietary ACI CEER cause description table */ | |
553 const CEER_TABLE pACI_CEERDesc[]= | |
554 { | |
555 {"ACM reached ACM maximum", (T_ACI_CEER)P_CEER_ACMMaxReachedOrExceeded }, | |
556 {"number not in FDN list", (T_ACI_CEER) P_CEER_InvalidFDN }, | |
557 /* these have to be the last entries */ | |
558 {"no error", CEER_NotPresent }, | |
559 /* last entry for at+ceer */ | |
560 { NULL, CEER_NotPresent} | |
561 }; | |
562 | |
563 /* Proprietary MM CEER cause description table */ | |
564 const CEER_TABLE pMM_CEERDesc[]= | |
565 { | |
566 {"IMSI not present in HLR", (T_ACI_CEER)P_MM_CEER_IMSINotInHLR}, | |
567 {"no service", (T_ACI_CEER)P_MM_CEER_NoService }, | |
568 /* these have to be the last entries */ | |
569 {"no error", CEER_NotPresent }, | |
570 /* last entry for at+ceer */ | |
571 { NULL, CEER_NotPresent} | |
572 }; | |
573 | |
574 /* Proprietary SS CEER cause description table */ | |
575 const CEER_TABLE pSS_CEERDesc[]= | |
576 { | |
577 {"Unknown Subscriber", (T_ACI_CEER)P_SS_CEER_UnknownSubscriber }, | |
578 {"Illegal Subscriber", (T_ACI_CEER)P_SS_CEER_IllegalSubscriber }, | |
579 {"Bearer service not provisioned", (T_ACI_CEER)P_SS_CEER_BearerSvcNotProv }, | |
580 {"Teleservice not provisioned", (T_ACI_CEER)P_SS_CEER_TeleSvcNotProv }, | |
581 {"Illegal Equipment", (T_ACI_CEER)P_SS_CEER_IllegalEquipment }, | |
582 {"Call barred", (T_ACI_CEER)P_SS_CEER_CallBarred }, | |
583 {"Illegal supplementary service operation", (T_ACI_CEER)P_SS_CEER_IllegalSSOperation }, | |
584 {"SS error status", (T_ACI_CEER)P_SS_CEER_SSerrStatus }, | |
585 {"SS not available", (T_ACI_CEER)P_SS_CEER_SSNotAvail }, | |
586 {"SS subscript violation", (T_ACI_CEER)P_SS_CEER_SSSubsViolation }, | |
587 {"SS incompatible", (T_ACI_CEER)P_SS_CEER_SSIncomp }, | |
588 {"Facility not supported", (T_ACI_CEER)P_SS_CEER_FacNotSupported }, | |
589 {"Absent subscriber", (T_ACI_CEER)P_SS_CEER_AbsentSubs }, | |
590 {"System failure", (T_ACI_CEER)P_SS_CEER_SystenFail }, | |
591 {"Data Missing", (T_ACI_CEER)P_SS_CEER_DataMissing }, | |
592 {"Unexpected Data Value", (T_ACI_CEER)P_SS_CEER_UnexpectData }, | |
593 {"Password registration failure", (T_ACI_CEER)P_SS_CEER_PwdRegFail }, | |
594 {"Negative password check", (T_ACI_CEER)P_SS_CEER_NegPwdCheck}, | |
595 {"Number of password attempts violation", (T_ACI_CEER)P_SS_CEER_NumPwdViolation }, | |
596 {"Unknown alphabet", (T_ACI_CEER)P_SS_CEER_UnknownAlpha }, | |
597 {"Unstructured supplementary service data busy", (T_ACI_CEER)P_SS_CEER_UssdBusy }, | |
598 {"Number of multiparty participants exceeded", (T_ACI_CEER)P_SS_CEER_MaxNumMptyExceed }, | |
599 {"Resource not available", (T_ACI_CEER)P_SS_CEER_ResourceNotAvail }, | |
600 | |
601 /* these have to be the last entries */ | |
602 {"no error", CEER_NotPresent }, | |
603 /* last entry for at+ceer */ | |
604 { NULL, CEER_NotPresent} | |
605 }; | |
606 #define MAX_CEER_DESC_LTH (50) | |
607 #define MAX_CEER_VAL_LTH (11) | |
608 | |
609 GLOBAL void getCeerDesc(USHORT cause, char *desc) | |
610 { | |
611 SHORT idx; | |
612 int val; | |
613 | |
614 TRACE_FUNCTION("getCeerDesc()"); | |
615 | |
616 memset(desc,0,MAX_CEER_DESC_LTH); | |
617 | |
618 if ( GET_CAUSE_DEFBY(cause) EQ DEFBY_STD ) | |
619 { | |
620 TRACE_EVENT_P1("Cause: %d, defined by standard", cause); | |
621 val = GET_CAUSE_VALUE(cause); | |
622 | |
623 if ( val EQ NOT_PRESENT_8BIT ) | |
624 { | |
625 val = CEER_NotPresent; | |
626 } | |
627 TRACE_EVENT("Get desc from Standard CEER desc table"); | |
628 for( idx = 0; StdCEERDesc[idx].desc NEQ NULL; idx++ ) | |
629 { | |
630 if ( StdCEERDesc[idx].rpt EQ val ) | |
631 { | |
632 memcpy(desc, StdCEERDesc[idx].desc, strlen(StdCEERDesc[idx].desc) ); | |
633 return; | |
634 } | |
635 } | |
636 } | |
637 | |
638 if ( GET_CAUSE_DEFBY(cause) EQ DEFBY_CONDAT ) | |
639 { | |
640 if ( GET_CAUSE_ORIGIN_ENTITY(cause) EQ MNCC_ACI_ORIGINATING_ENTITY ) | |
641 { | |
642 TRACE_EVENT_P1("Cause: %d, is ACI proprietary", cause); | |
643 val = GET_CAUSE_VALUE(cause); | |
644 | |
645 if ( val EQ NOT_PRESENT_8BIT ) | |
646 { | |
647 val = P_CEER_NotPresent; | |
648 } | |
649 TRACE_EVENT("Get desc from proprietary ACI CEER desc table"); | |
650 for( idx = 0; pACI_CEERDesc[idx].desc NEQ NULL; idx++ ) | |
651 { | |
652 if ( pACI_CEERDesc[idx].rpt EQ val ) | |
653 { | |
654 memcpy(desc, pACI_CEERDesc[idx].desc, strlen(pACI_CEERDesc[idx].desc) ); | |
655 return; | |
656 } | |
657 } | |
658 } | |
659 else if ( GET_CAUSE_ORIGIN_ENTITY(cause) EQ MM_ORIGINATING_ENTITY ) | |
660 { | |
661 TRACE_EVENT_P1("Cause: %d, is MM proprietary", cause); | |
662 val = GET_CAUSE_VALUE(cause); | |
663 | |
664 if ( val EQ NOT_PRESENT_8BIT ) | |
665 { | |
666 val = P_MM_CEER_NotPresent; | |
667 } | |
668 TRACE_EVENT("Get desc from proprietary MM CEER desc table"); | |
669 for( idx = 0; pMM_CEERDesc[idx].desc NEQ NULL; idx++ ) | |
670 { | |
671 if ( pMM_CEERDesc[idx].rpt EQ val ) | |
672 { | |
673 memcpy(desc, pMM_CEERDesc[idx].desc, strlen(pMM_CEERDesc[idx].desc) ); | |
674 return; | |
675 } | |
676 } | |
677 } | |
678 else if ( GET_CAUSE_ORIGIN_ENTITY(cause) EQ SS_ORIGINATING_ENTITY ) | |
679 { | |
680 TRACE_EVENT_P1("Cause: %d, is SS proprietary", cause); | |
681 val = GET_CAUSE_VALUE(cause); | |
682 | |
683 if ( val EQ NOT_PRESENT_8BIT ) | |
684 { | |
685 val = P_SS_CEER_NotPresent; | |
686 } | |
687 TRACE_EVENT("Get desc from proprietary SS CEER desc table"); | |
688 for( idx = 0; pSS_CEERDesc[idx].desc NEQ NULL; idx++ ) | |
689 { | |
690 if ( pSS_CEERDesc[idx].rpt EQ val ) | |
691 { | |
692 memcpy(desc, pSS_CEERDesc[idx].desc, strlen(pSS_CEERDesc[idx].desc) ); | |
693 return; | |
694 } | |
695 } | |
696 } | |
697 } | |
698 } | |
699 | |
700 | |
701 GLOBAL T_ATI_RSLT atPlusCEER(char *cl, UBYTE srcId) | |
702 { | |
703 TRACE_FUNCTION("atPlusCEER()"); | |
704 | |
705 #ifdef FF_ATI_BAT | |
706 { | |
707 T_BAT_cmd_send cmd; | |
708 T_BAT_no_parameter dummy; | |
709 | |
710 cmd.ctrl_params=BAT_CMD_SET_PLUS_CEER; | |
711 dummy.bat_dummy = 0xFF; | |
712 cmd.params.ptr_set_plus_ceer = &dummy; | |
713 bat_send(ati_bat_get_client(srcId), &cmd); | |
714 return(ATI_EXCT); | |
715 } | |
716 #else /* no FF_ATI_BAT */ | |
717 { | |
718 char desc[MAX_CEER_DESC_LTH]; | |
719 T_ACI_RETURN ret; | |
720 USHORT cause; | |
721 | |
722 ret=qAT_PlusCEER( (T_ACI_CMD_SRC)srcId, &cause ); | |
723 if (ret EQ AT_CMPL) | |
724 { | |
725 /* check if description text is available*/ | |
726 getCeerDesc(cause, desc); | |
727 | |
728 if ( desc[0] EQ 0 ) | |
729 { | |
730 /* no description text is available */ | |
731 sprintf( g_sa, "+CEER: %d,%d,%d,%d", | |
732 GET_CAUSE_DEFBY(cause), GET_CAUSE_ORIGSIDE(cause), | |
733 GET_CAUSE_ORIGIN_ENTITY(cause), GET_CAUSE_VALUE(cause)); | |
734 } | |
735 else | |
736 { | |
737 /* description text is available */ | |
738 sprintf( g_sa, "+CEER: %d,%d,%d,%d,%s", | |
739 GET_CAUSE_DEFBY(cause), GET_CAUSE_ORIGSIDE(cause), | |
740 GET_CAUSE_ORIGIN_ENTITY(cause), GET_CAUSE_VALUE(cause), | |
741 desc ); | |
742 } | |
743 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
744 return ATI_CMPL; | |
745 } | |
746 else | |
747 { | |
748 cmdAtError(atError); | |
749 return ATI_FAIL; | |
750 } | |
751 } | |
752 #endif /* no FF_ATI_BAT */ | |
753 } | |
754 | |
755 /* | |
756 +--------------------------------------------------------------------+ | |
757 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
758 | STATE : code ROUTINE : atPercentCSSD | | |
759 +--------------------------------------------------------------------+ | |
760 | |
761 PURPOSE : Supplementary Service Diagnostic | |
762 */ | |
763 | |
764 GLOBAL T_ATI_RSLT atPercentCSSD(char *cl, UBYTE srcId) | |
765 { | |
766 T_ACI_RETURN ret; | |
767 UBYTE ss_diag; | |
768 CHAR *me = "%CSSD: "; | |
769 | |
770 TRACE_FUNCTION("atPercentCSSD()"); | |
771 | |
772 ret = qAT_PercentCSSD( (T_ACI_CMD_SRC)srcId, &ss_diag); | |
773 | |
774 if (ret EQ AT_CMPL) | |
775 { | |
776 sprintf( g_sa, "%s%d", me, ss_diag ); | |
777 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
778 return ATI_CMPL; | |
779 } | |
780 else | |
781 { | |
782 cmdAtError(atError); | |
783 return ATI_FAIL; | |
784 } | |
785 | |
786 } | |
787 | |
788 /* | |
789 +--------------------------------------------------------------------+ | |
790 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
791 | STATE : code ROUTINE : cmdCeerError | | |
792 +--------------------------------------------------------------------+ | |
793 | |
794 PURPOSE : handle CEER Errors | |
795 | |
796 */ | |
797 | |
798 GLOBAL CHAR *cmdCeerError(USHORT cause) | |
799 { | |
800 T_ACI_ERR_DESC aed; | |
801 char desc[MAX_CEER_DESC_LTH]; | |
802 UBYTE srcId = srcId_cb; | |
803 | |
804 *ErrBuff = '\0'; /* build message */ | |
805 cmdErrStr = ErrBuff; | |
806 | |
807 if ( GET_CAUSE_VALUE(cause) EQ NOT_PRESENT_8BIT ) | |
808 { | |
809 if (((aed = qAT_ErrDesc()) >> 16) EQ ACI_ERR_CLASS_Ceer) | |
810 cause = (T_ACI_CEER)(aed & 0xFFFF); | |
811 else | |
812 cause = CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, MNCC_ACI_ORIGINATING_ENTITY, | |
813 CEER_NoError); | |
814 } | |
815 if (ati_user_output_cfg[srcId].CMEE_stat EQ CMEE_MOD_Verbose) | |
816 { | |
817 sprintf(cmdErrStr, "+CEER ERROR: %d,%d,%d,%d,", | |
818 GET_CAUSE_DEFBY(cause), GET_CAUSE_ORIGSIDE(cause), | |
819 GET_CAUSE_ORIGIN_ENTITY(cause), GET_CAUSE_VALUE(cause)); | |
820 | |
821 getCeerDesc(cause, desc); | |
822 | |
823 if ( desc[0] NEQ 0 ) | |
824 { | |
825 strcat( cmdErrStr, desc); | |
826 } | |
827 | |
828 } | |
829 return(disable_or_numeric("+CEER",cause)); | |
830 } | |
831 | |
832 /* | |
833 +--------------------------------------------------------------------+ | |
834 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
835 | STATE : code ROUTINE : cmdAtError | | |
836 +--------------------------------------------------------------------+ | |
837 | |
838 PURPOSE : handle standard AT Errors | |
839 | |
840 */ | |
841 | |
842 GLOBAL CHAR *cmdAtError (AtErrCode e) | |
843 { | |
844 SHORT idx=0; | |
845 | |
846 *ErrBuff = '\0'; | |
847 cmdErrStr = ErrBuff; | |
848 | |
849 /* search for the description of the notified error */ | |
850 while ( tabAtError[idx].code NEQ atError AND | |
851 tabAtError[idx].code NEQ e ) | |
852 { | |
853 idx++; | |
854 } | |
855 sprintf(cmdErrStr,(at.s1415.atV) ? tabAtError[idx].msg : tabAtError[idx].nmb); | |
856 return cmdErrStr; | |
857 } | |
858 | |
859 /* | |
860 +--------------------------------------------------------------------+ | |
861 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
862 | STATE : code ROUTINE : AT_FailError | | |
863 +--------------------------------------------------------------------+ | |
864 | |
865 PURPOSE : General handling of errors (either CME CMS CEER or EXT errors) | |
866 when function returns AT_FAIL | |
867 | |
868 */ | |
869 #define ACI_GET_ERR_CLASS() ((aciErrDesc & 0xFFFF0000) >> 16) | |
870 #define ACI_GET_ERR_VALUE() (aciErrDesc & 0x0000FFFF) | |
871 #define ACI_RESET_ERR_DESC() (aciErrDesc = 0xFFFFFFFF) | |
872 #define ACI_VALID_ERR_DESC() (aciErrDesc NEQ 0xFFFFFFFF) | |
873 | |
874 LOCAL CHAR *AT_Fail_Error(void) | |
875 { | |
876 T_ACI_ERR_CLASS err_class; | |
877 | |
878 if ( ACI_VALID_ERR_DESC() ) | |
879 { | |
880 err_class = (T_ACI_ERR_CLASS)ACI_GET_ERR_CLASS(); | |
881 switch(err_class) | |
882 { | |
883 case(ACI_ERR_CLASS_NotPresent): | |
884 break; | |
885 case(ACI_ERR_CLASS_Cme): | |
886 { | |
887 T_ACI_CME_ERR l_err; | |
888 | |
889 l_err = (T_ACI_CME_ERR)ACI_GET_ERR_VALUE(); | |
890 ACI_RESET_ERR_DESC(); /* needs to be reinitialized */ | |
891 return(cmdCmeError (l_err)); | |
892 } | |
893 case(ACI_ERR_CLASS_Cms): | |
894 { | |
895 T_ACI_CMS_ERR l_err; | |
896 | |
897 l_err = (T_ACI_CMS_ERR)ACI_GET_ERR_VALUE(); | |
898 ACI_RESET_ERR_DESC(); /* needs to be reinitialized */ | |
899 return(cmdCmsError (l_err)); | |
900 } | |
901 case(ACI_ERR_CLASS_Ceer): | |
902 { | |
903 T_ACI_CEER l_err; | |
904 | |
905 l_err = (T_ACI_CEER)ACI_GET_ERR_VALUE(); | |
906 ACI_RESET_ERR_DESC(); /* needs to be reinitialized */ | |
907 /* return(cmdCeerError((USHORT)err)); */ | |
908 return(cmdCeerError(l_err)); | |
909 } | |
910 case(ACI_ERR_CLASS_Ext): | |
911 { | |
912 T_ACI_EXT_ERR l_err; | |
913 | |
914 l_err = (T_ACI_EXT_ERR)ACI_GET_ERR_VALUE(); | |
915 ACI_RESET_ERR_DESC(); /* needs to be reinitialized */ | |
916 return(cmdExtError (l_err)); | |
917 } | |
918 default: | |
919 break; | |
920 } | |
921 } | |
922 *ErrBuff = '\0'; | |
923 cmdErrStr = ErrBuff; | |
924 | |
925 return (cmdCmeError(CME_ERR_NotPresent)); | |
926 } | |
927 | |
928 #endif /* ATI_ERR_C */ |