comparison g23m-aci/aci/ati_err.c @ 0:75a11d740a02

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