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