FreeCalypso > hg > tcs211-fcmodem
comparison g23m/condat/ms/src/aci/cmh_f.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-PS (6147) | |
4 | Modul : CMH_F | |
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 : This module defines global functions of the command | |
18 | handler. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef CMH_F_C | |
23 #define CMH_F_C | |
24 #endif | |
25 | |
26 #include "aci_all.h" | |
27 | |
28 /*==== INCLUDES ===================================================*/ | |
29 | |
30 #include "aci_cmh.h" | |
31 #include "cphs.h" | |
32 #include "aci_cphs.h" | |
33 #include "ati_cmd.h" | |
34 #include "aci_cmd.h" | |
35 #include "ksd.h" | |
36 #include "l4_tim.h" | |
37 | |
38 #include "aci_io.h" | |
39 | |
40 #ifdef FAX_AND_DATA | |
41 #include "aci_fd.h" | |
42 #endif | |
43 | |
44 #ifdef DTI | |
45 #include "dti.h" /* functionality of the dti library */ | |
46 #include "dti_conn_mng.h" | |
47 #endif | |
48 #include "psa.h" | |
49 #include "psa_mm.h" | |
50 #include "psa_sim.h" | |
51 #include "psa_cc.h" | |
52 #include "psa_sms.h" | |
53 #include "psa_ss.h" | |
54 #include "cmh.h" | |
55 #include "cmh_mm.h" | |
56 #include "cmh_sim.h" | |
57 #include "cmh_cc.h" | |
58 #include "cmh_sms.h" | |
59 #include "cmh_ss.h" | |
60 | |
61 #include "aci.h" | |
62 #include "phb.h" | |
63 #include "aci_lst.h" | |
64 #include "conc_sms.h" | |
65 | |
66 | |
67 #ifdef FAX_AND_DATA | |
68 #include "psa_ra.h" | |
69 #include "cmh_ra.h" | |
70 #include "psa_l2r.h" | |
71 #include "cmh_l2r.h" | |
72 #include "psa_tra.h" | |
73 | |
74 #ifdef FF_FAX | |
75 #include "psa_t30.h" | |
76 #include "cmh_t30.h" | |
77 #endif /* FF_FAX */ | |
78 | |
79 #endif /* FAX_AND_DATA */ | |
80 | |
81 #ifdef GPRS | |
82 #include "gaci.h" | |
83 #include "gaci_cmh.h" | |
84 #include "pcm.h" | |
85 #include "psa_gmm.h" | |
86 #include "cmh_gmm.h" | |
87 #include "psa_sm.h" | |
88 #include "cmh_sm.h" | |
89 #include "psa_gppp.h" | |
90 #include "cmh_gppp.h" | |
91 | |
92 #endif /* GPRS */ | |
93 | |
94 #ifdef _CONC_TESTING_ | |
95 #include "aci_mfw.h" | |
96 #endif | |
97 | |
98 #ifdef UART | |
99 #include "psa_uart.h" | |
100 #include "cmh_uart.h" | |
101 #endif | |
102 | |
103 #ifdef FF_PSI | |
104 #include "psa_psi.h" | |
105 #include "cmh_psi.h" | |
106 #endif /*FF_PSI*/ | |
107 | |
108 | |
109 #include "rx.h" | |
110 | |
111 #ifndef _SIMULATION_ | |
112 #include "ffs/ffs.h" | |
113 #include "ffs_coat.h" | |
114 #endif | |
115 | |
116 /*==== CONSTANTS ==================================================*/ | |
117 | |
118 /*==== GLOBALS ====================================================*/ | |
119 #ifdef FF_ATI | |
120 EXTERN T_CIEV_SIGNAL_BUFFER asCievSignalBuf; | |
121 EXTERN T_CIEV_SMSFULL_BUFFER asCievSmsFullBuf; | |
122 #endif /* FF_ATI */ | |
123 | |
124 /*==== TYPES ======================================================*/ | |
125 | |
126 | |
127 /*==== EXPORT =====================================================*/ | |
128 /* MACRO CB_VC() for call-backs used by the voice stack */ | |
129 #ifdef FF_BAT | |
130 | |
131 #ifdef FF_ATI | |
132 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
133 #define CB_VC( cbNam ){rAT_##cbNam,rCI_##cbNam,rBAT_##cbNam} | |
134 #define CB_VC_EXT( cbNam ){rAT_##cbNam##_Ext,rCI_##cbNam,rBAT_##cbNam} | |
135 #else | |
136 #define CB_VC( cbNam ){0,rCI_##cbNam,rBAT_##cbNam} /* ACI only */ | |
137 #ifdef _CONC_TESTING_ /* for _CONC_TESTING for ACI-only */ | |
138 #define CB_VC_EXT( cbNam ){rAT_##cbNam##_Ext,rCI_##cbNam,rBAT_##cbNam} | |
139 #else | |
140 #define CB_VC_EXT( cbNam ){0,rCI_##cbNam,rBAT_##cbNam} | |
141 #endif | |
142 #endif | |
143 #else | |
144 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
145 #define CB_VC( cbNam ){rAT_##cbNam,0,rBAT_##cbNam} | |
146 #define CB_VC_EXT( cbNam ){rAT_##cbNam##_Ext,0,rBAT_##cbNam} | |
147 #else | |
148 #define CB_VC( cbNam ){0,0,0} | |
149 #define CB_EXT( cbNam ){0,0,0} | |
150 #endif | |
151 #endif | |
152 | |
153 /* MACRO CB_FD() for call-backs used by the F&D stack */ | |
154 #ifdef FAX_AND_DATA | |
155 #define CB_FD( cbNam ){0,rCI_##cbNam,rBAT_##cbNam} | |
156 #else | |
157 #define CB_FD( cbNam ){0,0,0} | |
158 #endif | |
159 | |
160 /* MACRO CB_ST() for call-backs used by SIM toolkit */ | |
161 #ifdef SIM_TOOLKIT | |
162 #ifdef FF_ATI | |
163 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
164 #define CB_ST( cbNam ){rAT_##cbNam,rCI_##cbNam,rBAT_##cbNam} | |
165 #else | |
166 #define CB_ST( cbNam ){0,rCI_##cbNam,rBAT_##cbNam} | |
167 #endif | |
168 #else | |
169 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
170 #define CB_ST( cbNam ){rAT_##cbNam,0,rBAT_##cbNam} | |
171 #else | |
172 #define CB_ST( cbNam ){0,0,0} | |
173 #endif | |
174 #endif | |
175 #else | |
176 #define CB_ST( cbNam ){0,0,0} | |
177 #endif | |
178 | |
179 /* MACRO CB_GP() for call-backs used by GPRS */ | |
180 #ifdef GPRS | |
181 #ifdef FF_ATI | |
182 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
183 #define CB_GP( cbNam ){rAT_##cbNam,rCI_##cbNam,rBAT_##cbNam} | |
184 #else | |
185 #define CB_GP( cbNam ){0,rCI_##cbNam,rBAT_##cbNam} | |
186 #endif | |
187 #else | |
188 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
189 #define CB_GP( cbNam ){rAT_##cbNam,0,rBAT_##cbNam} | |
190 #else | |
191 #define CB_GP( cbNam ){0,0,0} | |
192 #endif | |
193 #endif | |
194 #else | |
195 #define CB_GP( cbNam ){0,0,0} | |
196 #endif /* GPRS */ | |
197 | |
198 #else | |
199 | |
200 #ifdef FF_ATI | |
201 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
202 #define CB_VC( cbNam ){rAT_##cbNam,rCI_##cbNam} | |
203 #define CB_VC_EXT( cbNam ){rAT_##cbNam##_Ext,rCI_##cbNam} | |
204 #else | |
205 #define CB_VC( cbNam ){0,rCI_##cbNam} | |
206 #ifdef _CONC_TESTING_ /* for _CONC_TESTING for ACI-only */ | |
207 #define CB_VC_EXT( cbNam ){rAT_##cbNam##_Ext,rCI_##cbNam} | |
208 #else | |
209 #define CB_VC_EXT( cbNam ){0,rCI_##cbNam} | |
210 #endif | |
211 #endif | |
212 #else | |
213 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
214 #define CB_VC( cbNam ){rAT_##cbNam,0} | |
215 #define CB_VC_EXT( cbNam ){rAT_##cbNam##_Ext,0} | |
216 #else | |
217 #define CB_VC( cbNam ){0,0} | |
218 #define CB_EXT( cbNam ){0,0} | |
219 #endif | |
220 #endif | |
221 | |
222 /* MACRO CB_FD() for call-backs used by the F&D stack */ | |
223 #ifdef FAX_AND_DATA | |
224 #define CB_FD( cbNam ){0,rCI_##cbNam} | |
225 #else | |
226 #define CB_FD( cbNam ){0,0} | |
227 #endif | |
228 | |
229 /* MACRO CB_ST() for call-backs used by SIM toolkit */ | |
230 #ifdef SIM_TOOLKIT | |
231 #ifdef FF_ATI | |
232 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
233 #define CB_ST( cbNam ){rAT_##cbNam,rCI_##cbNam} | |
234 #else | |
235 #define CB_ST( cbNam ){0,rCI_##cbNam} | |
236 #endif | |
237 #else | |
238 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
239 #define CB_ST( cbNam ){rAT_##cbNam,0} | |
240 #else | |
241 #define CB_ST( cbNam ){0,0} | |
242 #endif | |
243 #endif | |
244 #else | |
245 #define CB_ST( cbNam ){0,0} | |
246 #endif | |
247 | |
248 /* MACRO CB_GP() for call-backs used by GPRS */ | |
249 #ifdef GPRS | |
250 #ifdef FF_ATI | |
251 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
252 #define CB_GP( cbNam ){rAT_##cbNam,rCI_##cbNam} | |
253 #else | |
254 #define CB_GP( cbNam ){0,rCI_##cbNam} | |
255 #endif | |
256 #else | |
257 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
258 #define CB_GP( cbNam ){rAT_##cbNam,0} | |
259 #else | |
260 #define CB_GP( cbNam ){0,0} | |
261 #endif | |
262 #endif | |
263 #else | |
264 #define CB_GP( cbNam ) | |
265 #endif /* GPRS */ | |
266 | |
267 #endif /* FF_BAT */ | |
268 | |
269 /* call back jump table */ | |
270 GLOBAL const T_VOID_FUNC RATJmpTbl[RAT_MAX][CMD_MODE_MAX] = | |
271 { | |
272 CB_VC( OK ), /* RAT_OK */ | |
273 CB_VC( CONNECT ), /* RAT_CONNECT */ | |
274 CB_VC( PlusCME ), /* RAT_CME */ | |
275 CB_VC( NO_CARRIER ), /* RAT_NO_CARRIER */ | |
276 CB_VC( PlusCRING ), /* RAT_CRING */ | |
277 CB_FD( PlusDR ), /* RAT_DR */ | |
278 CB_FD( PlusCR ), /* RAT_CR */ | |
279 CB_VC( PlusCPIN ), /* RAT_CPIN */ | |
280 CB_VC( PlusCOPS ), /* RAT_COPS */ | |
281 CB_VC( PlusCREG ), /* RAT_CREG */ | |
282 CB_VC( PlusCCWA ), /* RAT_CCWA */ | |
283 CB_VC( PlusCLIP ), /* RAT_CLIP */ | |
284 CB_VC( PlusCDIP ), /* RAT_CDIP */ | |
285 CB_VC( PlusCOLP ), /* RAT_COLP */ | |
286 CB_VC( PlusCRING_OFF ), /* RAT_CRING_OFF */ | |
287 | |
288 #if defined (FF_FAX) AND defined (DTI) | |
289 CB_FD( PlusFCO ), /* RAT_FCO */ | |
290 CB_FD( PlusFIS ), /* RAT_FIS */ | |
291 CB_FD( PlusFTI ), /* RAT_FTI */ | |
292 CB_FD( PlusFCS ), /* RAT_FCS */ | |
293 CB_FD( PlusFCI ), /* RAT_FCI */ | |
294 #endif /* FF_FAX */ | |
295 | |
296 CB_VC( PlusCMS ), /* RAT_CMS */ | |
297 CB_VC( PlusCSMS ), /* RAT_CSMS */ | |
298 CB_VC( PlusCMGS ), /* RAT_CMGS */ | |
299 CB_VC( PlusCMSS ), /* RAT_CMSS */ | |
300 CB_VC( PlusCMGW ), /* RAT_CMGW */ | |
301 CB_VC( PlusCDS ), /* RAT_CDS */ | |
302 CB_VC( PlusCMGC ), /* RAT_CMGC */ | |
303 CB_VC( PlusCMGD ), /* RAT_CMGD */ | |
304 CB_VC( PlusCMGR ), /* RAT_CMGR */ | |
305 CB_VC( PlusCMGL ), /* RAT_CMGL */ | |
306 #ifdef _CONC_TESTING_ | |
307 CB_VC_EXT( PlusCMTI ), /* RAT_CMTI */ | |
308 CB_VC_EXT( PlusCMT ), /* RAT_CMT */ | |
309 #else | |
310 CB_VC( PlusCMTI ), /* RAT_CMTI */ | |
311 CB_VC( PlusCMT ), /* RAT_CMT */ | |
312 #endif | |
313 CB_VC( PlusCBM ), /* RAT_CBM */ | |
314 CB_VC( PlusCPMS ), /* RAT_CPMS */ | |
315 | |
316 #if defined (FF_FAX) AND defined (DTI) | |
317 | |
318 CB_FD( PlusFHT ), /* RAT_FHT */ | |
319 CB_FD( PlusFHR ), /* RAT_FHR */ | |
320 CB_FD( PlusFSA ), /* RAT_FSA */ | |
321 CB_FD( PlusFPA ), /* RAT_FPA */ | |
322 CB_FD( PlusFPW ), /* RAT_FPW */ | |
323 CB_FD( PlusFET ), /* RAT_FET */ | |
324 CB_FD( PlusFVO ), /* RAT_FVO */ | |
325 CB_FD( PlusFPO ), /* RAT_FPO */ | |
326 CB_FD( PlusFPI ), /* RAT_FPI */ | |
327 CB_FD( PlusFNF ), /* RAT_FNF */ | |
328 CB_FD( PlusFNS ), /* RAT_FNS */ | |
329 CB_FD( PlusFNC ), /* RAT_FNC */ | |
330 CB_FD( PlusFHS ), /* RAT_FHS */ | |
331 CB_FD( PlusFPS ), /* RAT_FPS */ | |
332 CB_FD( PlusFTC ), /* RAT_FTC */ | |
333 #endif /* FF_FAX */ | |
334 | |
335 CB_FD( PlusILRR ), /* RAT_ILRR */ | |
336 CB_VC( BUSY ), /* RAT_BUSY */ | |
337 CB_VC( NO_ANSWER ), /* RAT_NO_ANSWER */ | |
338 CB_VC( PercentSIMREM ), /* RAT_SIMREM */ | |
339 CB_VC( PlusCLIR ), /* RAT_CLIR */ | |
340 CB_VC( PercentCOLR ), /* RAT_COLR */ | |
341 CB_VC( PlusCSSI ), /* RAT_CSSI */ | |
342 CB_VC( PlusCSSU ), /* RAT_CSSU */ | |
343 CB_VC( PlusCUSD ), /* RAT_CUSD */ | |
344 CB_VC( PlusCCFC ), /* RAT_CCFC */ | |
345 CB_VC( PlusCLCK ), /* RAT_CLCK */ | |
346 CB_VC( PlusCIMI ), /* RAT_CIMI */ | |
347 CB_ST( PercentSATI ), /* RAT_SATI */ | |
348 CB_ST( PercentSATE ), /* RAT_SATE */ | |
349 CB_VC( PercentKSIR ), /* RAT_KSIR */ | |
350 CB_VC( PercentCPI ), /* RAT_CPI */ | |
351 CB_VC( PercentCTYI ), /* RAT_CTYI */ | |
352 CB_VC( PlusCNUM ), /* RAT_CNUM */ | |
353 CB_VC( PlusCPOL ), /* RAT_CPOL */ | |
354 CB_VC( PlusCCCM ), /* RAT_CCCM */ | |
355 CB_VC( PercentCTV ), /* RAT_CTV */ | |
356 CB_ST( PercentSATN ), /* RAT_SATN */ | |
357 CB_ST( PercentSATA ), /* RAT_SATA */ | |
358 CB_VC( sms_ready), /* RAT_SMS_READY */ | |
359 CB_VC( phb_status), /* RAT_PHB_STATUS */ | |
360 CB_VC( PercentSIMINS ), /* RAT_SIMINS */ | |
361 CB_VC( PlusCRSM ), /* RAT_CRSM */ | |
362 CB_VC( PlusCSIM ), /* RAT_CSIM */ | |
363 CB_VC( PercentCCBS ), /* RAT_CCBS */ | |
364 CB_VC( PlusCCWV ), /* RAT_CCWV */ | |
365 CB_VC( PercentCNAP ), /* RAT_CNAP */ | |
366 CB_VC( SignalSMS ), /* RAT_SIG_SMS */ | |
367 CB_VC( PlusCLAN ), /* RAT_CLAN */ | |
368 CB_VC( PlusCLAE ), /* RAT_CLAE */ | |
369 CB_VC( PercentCSQ ), /* RAT_CSQ */ | |
370 CB_VC( PercentALS ), /* RAT_ALS */ | |
371 | |
372 CB_VC( PlusCTZV ), /* RAT_CTZR */ | |
373 CB_VC( PercentCREG ), /* RAT_P_CREG */ | |
374 | |
375 | |
376 #ifdef GPRS | |
377 | |
378 CB_GP( PlusCGACT ), /* RAT_CGACT */ | |
379 CB_GP( PlusCGDATA ), /* RAT_CGDATA */ | |
380 CB_GP( PlusCGANS ), /* RAT_CGANS */ | |
381 CB_GP( PlusCGEREP ), /* RAT_CGEREP */ | |
382 CB_GP( PlusCGREG ), /* RAT_CGREG */ | |
383 CB_GP( changedQOS ), /* RAT_QOS_MOD */ | |
384 CB_GP( PercentSNCNT ), /* RAT_SNCNT */ | |
385 CB_GP( PercentCGREG ), /* RAT_P_CGREG */ | |
386 CB_GP( PercentCGEV ), /* RAT_P_CGEV */ | |
387 #endif /* GPRS */ | |
388 | |
389 #ifdef FF_EM_MODE | |
390 CB_VC( PercentEM ), /* RAT_EM */ | |
391 CB_VC( PercentEMET ), /* RAT_EMET */ | |
392 CB_VC( PercentEMETS ), /* RAT_EMETS */ | |
393 #endif /* FF_EM_MODE */ | |
394 | |
395 #ifdef FF_CPHS | |
396 CB_VC( PercentCPNUMS ), /* RAT_CPNUMS */ | |
397 CB_VC( PercentCPVWI ), /* RAT_CPVWI */ | |
398 CB_VC( PercentCPROAM ), /* RAT_CPROAM */ | |
399 #endif /* FF_CPHS */ | |
400 CB_VC( PlusCIEV ), /* RAT_CIEV */ | |
401 CB_VC( PercentRDL ), /* RAT_RDL */ | |
402 CB_VC( PercentRDLB ), /* RAT_RDLB */ | |
403 CB_VC( PercentCCCN ), /* RAT_CCCN */ | |
404 CB_VC( PercentCSSN ), /* RAT_CSSN */ | |
405 | |
406 | |
407 CB_VC( PercentCSTAT ), /* RAT_CSTAT */ | |
408 | |
409 | |
410 | |
411 CB_VC( Z ), /* RAT_Z */ | |
412 | |
413 | |
414 CB_VC( PercentCPRSM ), /* RAT_CPRSM */ | |
415 | |
416 CB_VC( PercentCTZV ), /*RAT_P_CTZV*/ | |
417 CB_VC( PercentCPRI ), /*RAT_P_CPRI*/ | |
418 CB_VC( PercentSIMEF ), /*RAT_P_SIMEF*/ | |
419 | |
420 CB_VC( PercentCNIV ), /*RAT_P_CNIV*/ | |
421 | |
422 CB_VC( PercentCOPS ), /* RAT_P_COPS */ | |
423 CB_VC( PercentCMGR ), /* RAT_P_CMGR */ | |
424 CB_VC( PercentCMGL ) /* RAT_P_CMGL */ | |
425 | |
426 }; | |
427 | |
428 /*==== VARIABLES ==================================================*/ | |
429 /* needed for function percentCSTAT_indication() */ | |
430 static UBYTE percentCSTAT_stateField; | |
431 | |
432 LOCAL T_ACI_CMD_MODE aci_cmd_src_mode[CMD_SRC_MAX]; | |
433 | |
434 /*==== FUNCTIONS ==================================================*/ | |
435 | |
436 /* | |
437 +-------------------------------------------------------------------+ | |
438 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
439 | ROUTINE : cmh_Init | | |
440 +-------------------------------------------------------------------+ | |
441 | |
442 PURPOSE : initialize the command handler. | |
443 | |
444 */ | |
445 | |
446 | |
447 GLOBAL void cmh_Init ( void ) | |
448 { | |
449 T_ACI_CMD_SRC index; | |
450 | |
451 TRACE_FUNCTION ("cmh_Init()"); | |
452 | |
453 mmEntStat.curCmd = AT_CMD_NONE; | |
454 mmEntStat.entOwn = OWN_NONE; | |
455 simEntStat.curCmd = AT_CMD_NONE; | |
456 simEntStat.entOwn = OWN_NONE; | |
457 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
458 smsShrdPrm.smsEntStat.entOwn = OWN_NONE; | |
459 | |
460 #ifdef UART | |
461 for (index=CMD_SRC_LCL; index<CMD_SRC_MAX; index++) | |
462 { | |
463 uartEntcurCmd[index] = AT_CMD_NONE; | |
464 } | |
465 | |
466 uartShrdPrm.dtr_behaviour = DTR_BEHAVIOUR_Ignore; | |
467 uartShrdPrm.dtr_clearcall = FALSE; | |
468 cmhUART_init_ipr_params(); | |
469 #endif | |
470 | |
471 #ifdef FF_PSI | |
472 psiShrdPrm.dtr_behaviour = DTR_BEHAVIOUR_Ignore; | |
473 psiShrdPrm.dtr_clearcall = FALSE; | |
474 #endif /*FF_PSI*/ | |
475 | |
476 | |
477 #ifdef FAX_AND_DATA | |
478 #ifdef FF_FAX | |
479 t30EntStat.curCmd = AT_CMD_NONE; | |
480 t30EntStat.entOwn = OWN_NONE; | |
481 #endif | |
482 | |
483 l2rEntStat.curCmd = AT_CMD_NONE; | |
484 l2rEntStat.entOwn = OWN_NONE; | |
485 raEntStat.curCmd = AT_CMD_NONE; | |
486 raEntStat.entOwn = OWN_NONE; | |
487 #endif | |
488 | |
489 #ifndef _SIMULATION_ | |
490 /* Read status of ALSlock */ | |
491 if (FFS_fread ("/gsm/com/ALSlock",&ALSlock,sizeof(ALSlock)) NEQ sizeof(ALSlock)) | |
492 /* if failed, reset to default */ | |
493 ALSlock = ALS_MOD_NOTPRESENT; | |
494 else if (ALSlock NEQ ALS_MOD_SPEECH AND ALSlock NEQ ALS_MOD_AUX_SPEECH) | |
495 /* if unknown value was stored */ | |
496 ALSlock = ALS_MOD_NOTPRESENT; | |
497 #else | |
498 ALSlock = ALS_MOD_NOTPRESENT; | |
499 #endif | |
500 | |
501 #ifdef GPRS | |
502 gaci_init(); | |
503 #endif | |
504 | |
505 #ifdef FF_ATI | |
506 for( index=0; index < CIEV_BUF_SIZE; index++ ) | |
507 { | |
508 | |
509 asCievSignalBuf.asBufferValues[index] = CIND_SIGNAL_INDICATOR_INVALID; | |
510 asCievSmsFullBuf.asBufferValues[index] = CIND_SMSFULL_INDICATOR_INVALID; | |
511 | |
512 } | |
513 | |
514 asCievSignalBuf.uiLastIndex = 0; | |
515 asCievSmsFullBuf.uiLastIndex = 0; | |
516 #endif /* FF_ATI */ | |
517 | |
518 rx_Init(NULL); /* reset the signal strength callback */ | |
519 | |
520 for(percentCSTAT_stateField = 0,index = 0; | |
521 index < STATE_MSG_MAX_ENTITIES; index++) | |
522 { | |
523 percentCSTAT_stateField |= 1U << index; | |
524 } | |
525 | |
526 } | |
527 | |
528 /* | |
529 +-------------------------------------------------------------------+ | |
530 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
531 | ROUTINE : cmh_Reset | | |
532 +-------------------------------------------------------------------+ | |
533 | |
534 PURPOSE : Reset the command handler to defaults. | |
535 */ | |
536 | |
537 /* MACRO: initializer for command parameter */ | |
538 #define INIT_PARM( entity, dest, def )\ | |
539 {cmhPrm[srcId].entity##CmdPrm.dest = def;} | |
540 | |
541 #ifdef FAX_AND_DATA | |
542 #define INIT_PARM_FND( entity, dest, def )\ | |
543 {fnd_cmhPrm[srcId].entity##CmdPrm.dest = def;} | |
544 #endif /* FAX_AND_DATA */ | |
545 | |
546 GLOBAL void cmh_Reset ( T_ACI_CMD_SRC srcId, BOOL atz ) | |
547 { | |
548 UINT uiCount; | |
549 | |
550 TRACE_EVENT_P1("Parameters reset for source: %d", srcId); | |
551 | |
552 /* set default parms for command parameters */ | |
553 | |
554 INIT_PARM( cc, CLIRmode, CLIR_MOD_Subscript ); | |
555 INIT_PARM( cc, DCDmode, DCD_DISABLE_AFTER_CALL ); | |
556 INIT_PARM( cc, CSTAtoa.ton, TON_Unknown ); | |
557 INIT_PARM( cc, CSTAtoa.npi, NPI_IsdnTelephony ); /* according to GSM 07.07 description of AT+CSTA */ | |
558 INIT_PARM( cc, CSTAdef, TRUE ); | |
559 INIT_PARM( cc, CHLDmode, CHLD_MOD_NotPresent ); | |
560 INIT_PARM( cc, CCUGidx, CCUG_IDX_0 ); | |
561 INIT_PARM( cc, CCUGinfo, CCUG_INFO_No ); | |
562 INIT_PARM( cc, CCUGmode, CCUG_MOD_DisableTmp ); | |
563 INIT_PARM( cc, mltyCncFlg, 0 ); | |
564 INIT_PARM( cc, mltyDscFlg, 0 ); | |
565 | |
566 /* Check if ALS is locked to a line */ | |
567 if (ALSlock EQ ALS_MOD_NOTPRESENT) | |
568 { | |
569 INIT_PARM( cc, ALSmode, ALS_MOD_SPEECH ); /* Use Default line */ | |
570 } | |
571 else | |
572 { | |
573 INIT_PARM( cc, ALSmode, ALSlock ); /* Lock to specific line */ | |
574 } | |
575 | |
576 INIT_PARM( cc, CTTYmode, CTTY_MOD_Disable ); | |
577 | |
578 INIT_PARM( cc, CSCNcc_mode.CcCSCNModeState, CC_CSCN_MOD_STATE_INVALID ); /* initialize the shared params for %CSCN */ | |
579 INIT_PARM( cc, CSCNcc_mode.CcCSCNModeDirection, CC_CSCN_MOD_DIR_INVALID ); | |
580 | |
581 | |
582 INIT_PARM( mm, COPSfrmt, COPS_FRMT_Long ); | |
583 INIT_PARM( mm, NRGsrvMode, NRG_SVMD_Full ); | |
584 INIT_PARM( mm, NRGregMode, NRG_RGMD_Auto ); | |
585 INIT_PARM( mm, NRGoprFrmt, NRG_FRMT_Long ); | |
586 INIT_PARM( mm, CTZRMode, CTZR_MODE_OFF ); | |
587 INIT_PARM( mm, CSQworkStat, CSQ_Disable ); | |
588 | |
589 INIT_PARM( mm, sIndicationParam.sMmCINDSettings.sCindSignalParam, CIND_SIGNAL_INDICATOR_INVALID ); /* initialize the shared params for %CIND */ | |
590 INIT_PARM( mm, sIndicationParam.sMmCINDSettings.sCindSmsFullParam, CIND_SMSFULL_INDICATOR_INVALID ); | |
591 INIT_PARM( mm, sIndicationParam.sMmCMERSettings.sCmerModeParam, CMER_MODE_INVALID ); | |
592 INIT_PARM( mm, sIndicationParam.sMmCMERSettings.sCmerIndParam, CMER_INDICATOR_INVALID ); | |
593 INIT_PARM( mm, sIndicationParam.sMmCMERSettings.sCmerBfrParam, CMER_BFR_INVALID ); | |
594 | |
595 | |
596 | |
597 /* initalize SS password */ | |
598 /* INIT_PARM( ss, CXXXpwd[0], 0x0 ); */ | |
599 strcpy((CHAR *)cmhPrm[srcId].ssCmdPrm.CXXXpwd,"FFFF"); | |
600 INIT_PARM( ss, CXXXnewPwd[0],0x0 ); | |
601 INIT_PARM( ss, mltyTrnFlg, 0 ); | |
602 | |
603 INIT_PARM( ss, CSCNss_mode.SsCSCNModeState, SS_CSCN_MOD_STATE_INVALID ); /* initialize the shared params for %CSCN */ | |
604 INIT_PARM( ss, CSCNss_mode.SsCSCNModeDirection, SS_CSCN_MOD_DIR_INVALID ); | |
605 | |
606 if (!atz) | |
607 INIT_PARM( sim, CNUMActRec, 1 ); | |
608 | |
609 INIT_PARM( sim, CPOLfrmt, CPOL_FRMT_Numeric ); | |
610 INIT_PARM( sim, CPOLact, CPOL_ACT_None ); | |
611 INIT_PARM( sim, CPOLidx, NOT_PRESENT_8BIT ); | |
612 INIT_PARM( sim, CPOLidx2, NOT_PRESENT_8BIT ); | |
613 INIT_PARM( sim, CPOLmode, CPOL_MOD_NotPresent ); | |
614 | |
615 INIT_PARM( phb, cmhStor, PB_STOR_Ad ); | |
616 INIT_PARM( phb, phbStor, ADN ); | |
617 INIT_PARM( phb, fndRec, 0 ); | |
618 INIT_PARM( phb, wrtRec, 0 ); | |
619 INIT_PARM( phb, curCmd, AT_CMD_NONE ); | |
620 | |
621 #ifdef FAX_AND_DATA | |
622 INIT_PARM_FND( l2r, CRLPiws, L2R_K_IWF_MS_DEF ); | |
623 INIT_PARM_FND( l2r, CRLPmws, L2R_K_MS_IWF_DEF ); | |
624 INIT_PARM_FND( l2r, CRLPt1, L2R_T1_DEF ); | |
625 INIT_PARM_FND( l2r, CRLPn2, L2R_N2_DEF ); | |
626 INIT_PARM_FND( l2r, DSdir, L2R_P0_DEF ); | |
627 INIT_PARM_FND( l2r, DScomp, DS_COMP_DoNotDisc ); | |
628 INIT_PARM_FND( l2r, DSmaxDict, L2R_P1_DEF ); | |
629 INIT_PARM_FND( l2r, DSmaxStr, L2R_P2_DEF ); | |
630 | |
631 #ifdef FF_FAX | |
632 cmhT30_InitFAXPrms( srcId ); | |
633 cmhT30_RstNgtPrms(); | |
634 #endif /* FF_FAX */ | |
635 #endif /* FAX_AND_DATA */ | |
636 | |
637 /* only if ATZ */ | |
638 if(atz) | |
639 { | |
640 psaCC_init_mtcbearer(); | |
641 } | |
642 | |
643 #ifdef FF_ATI | |
644 for( uiCount=0; uiCount < CIEV_BUF_SIZE; uiCount++ ) | |
645 { | |
646 asCievSignalBuf.asBufferValues[uiCount] = CIND_SIGNAL_INDICATOR_INVALID; | |
647 asCievSmsFullBuf.asBufferValues[uiCount] = CIND_SMSFULL_INDICATOR_INVALID; | |
648 } | |
649 asCievSignalBuf.uiLastIndex = 0; | |
650 asCievSmsFullBuf.uiLastIndex = 0; | |
651 #endif /* FF_ATI */ | |
652 rx_Init(NULL); /* reset the signal strength callback */ | |
653 } | |
654 | |
655 /* | |
656 +-------------------------------------------------------------------+ | |
657 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
658 | ROUTINE : cmh_IsVldCmdSrc | | |
659 +-------------------------------------------------------------------+ | |
660 | |
661 PURPOSE : check for a valid command source. | |
662 | |
663 */ | |
664 | |
665 GLOBAL BOOL cmh_IsVldCmdSrc ( T_ACI_CMD_SRC srcId ) | |
666 { | |
667 if( srcId > CMD_SRC_NONE AND srcId < CMD_SRC_MAX ) | |
668 | |
669 return TRUE; | |
670 | |
671 return( FALSE ); | |
672 } | |
673 | |
674 /* | |
675 +-------------------------------------------------------------------+ | |
676 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
677 | ROUTINE : qAT_ErrDesc | | |
678 +-------------------------------------------------------------------+ | |
679 | |
680 PURPOSE : query error description of last error. | |
681 | |
682 */ | |
683 | |
684 GLOBAL T_ACI_ERR_DESC qAT_ErrDesc ( void ) | |
685 { | |
686 return( aciErrDesc ); | |
687 } | |
688 | |
689 /* | |
690 +-------------------------------------------------------------------+ | |
691 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
692 | ROUTINE : sAT_end_ussd | | |
693 +-------------------------------------------------------------------+ | |
694 | |
695 PURPOSE : Give the user the opportunity to end at any time a USSD transaction. | |
696 */ | |
697 | |
698 GLOBAL T_ACI_RETURN sAT_end_ussd ( T_ACI_CMD_SRC srcId ) | |
699 { | |
700 UBYTE srcBuf; /* buffers current source of command */ | |
701 SHORT sId; | |
702 | |
703 TRACE_FUNCTION("sAT_end_ussd( )"); | |
704 | |
705 sId = psaSS_stbFindActSrv( NO_ENTRY ); | |
706 | |
707 if( sId NEQ NO_ENTRY ) | |
708 { | |
709 if(ssShrdPrm.stb[sId].ussd_operation) | |
710 { | |
711 psaSS_EndTrns(sId); | |
712 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE; | |
713 ssShrdPrm.stb[sId].ussd_operation = FALSE; /* probably not really necessary */ | |
714 return(AT_CMPL); | |
715 } | |
716 if(ssShrdPrm.stb[sId].curCmd EQ KSD_CMD_USSD OR | |
717 ssShrdPrm.stb[sId].curCmd EQ AT_CMD_CUSD) | |
718 { | |
719 srcBuf = ssShrdPrm.stb[sId].srvOwn; | |
720 psaSS_EndTrns(sId); | |
721 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE; | |
722 ssShrdPrm.stb[sId].ussd_operation = FALSE; /* probably not really necessary */ | |
723 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE; | |
724 if( srcBuf NEQ srcId ) | |
725 { | |
726 R_AT( RAT_CME, srcBuf ) | |
727 ( ssShrdPrm.stb[sId].curCmd, CME_ERR_Unknown ); | |
728 } | |
729 return( AT_CMPL ); | |
730 } | |
731 } | |
732 return( AT_FAIL ); | |
733 | |
734 } | |
735 | |
736 | |
737 /* | |
738 +-------------------------------------------------------------------+ | |
739 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
740 | ROUTINE : sAT_Abort | | |
741 +-------------------------------------------------------------------+ | |
742 | |
743 PURPOSE : abort command execution for passed command. | |
744 | |
745 */ | |
746 | |
747 GLOBAL T_ACI_RETURN sAT_Abort ( T_ACI_CMD_SRC srcId, | |
748 T_ACI_AT_CMD cmd ) | |
749 { | |
750 UBYTE idx; /* holds call table index */ | |
751 UBYTE srcBuf; /* buffers current source of command */ | |
752 BOOL doneFlg = FALSE; /* flags that an action was done */ | |
753 USHORT nsapi_set = 0; /* for deactivation of context if activation | |
754 command is aborted */ | |
755 SHORT ret_val = -1; /* Return value used when AT+COPS is aborted */ | |
756 TRACE_FUNCTION ("sAT_Abort()"); | |
757 /* | |
758 *------------------------------------------------------------------- | |
759 * determine if command is abortable | |
760 *------------------------------------------------------------------- | |
761 */ | |
762 switch( cmd ) | |
763 { | |
764 /* | |
765 *--------------------------------------------------------------- | |
766 * for SIM related commands | |
767 *--------------------------------------------------------------- | |
768 */ | |
769 case( AT_CMD_CFUN ): /* +CFUN command id */ | |
770 case( AT_CMD_BAND ): /* %BAND command id */ | |
771 case( AT_CMD_CPIN ): /* +CPIN command id */ | |
772 if( simEntStat.curCmd EQ cmd ) | |
773 { | |
774 TRACE_EVENT("Command abortion for CFUN/CPIN"); | |
775 if( simEntStat.entOwn NEQ srcId ) | |
776 { | |
777 R_AT( RAT_CME, simEntStat.entOwn ) | |
778 ( cmd, CME_ERR_Unknown ); | |
779 } | |
780 simEntStat.entOwn = OWN_NONE; | |
781 simEntStat.curCmd = AT_CMD_NONE; | |
782 return( AT_CMPL ); | |
783 } | |
784 else if( mmEntStat.curCmd EQ cmd ) /* can happen with AT%band */ | |
785 { | |
786 TRACE_EVENT("Command abortion for %%BAND"); | |
787 if( mmEntStat.entOwn NEQ srcId ) | |
788 { | |
789 R_AT( RAT_CME, simEntStat.entOwn ) | |
790 ( cmd, CME_ERR_Unknown ); | |
791 } | |
792 mmEntStat.entOwn = OWN_NONE; | |
793 mmEntStat.curCmd = AT_CMD_NONE; | |
794 return( AT_CMPL ); | |
795 } | |
796 break; | |
797 | |
798 /* | |
799 *--------------------------------------------------------------- | |
800 * for phone book related commands | |
801 *--------------------------------------------------------------- | |
802 */ | |
803 case( AT_CMD_CPBW ): | |
804 if (cmhPrm[srcId].phbCmdPrm.curCmd EQ AT_CMD_CPBW) | |
805 { | |
806 cmhPrm[srcId].phbCmdPrm.curCmd = AT_CMD_NONE; | |
807 return (AT_CMPL); | |
808 } | |
809 break; | |
810 | |
811 /* | |
812 *--------------------------------------------------------------- | |
813 * for MM related commands | |
814 *--------------------------------------------------------------- | |
815 */ | |
816 case( AT_CMD_COPS ): /* +COPS command id */ | |
817 case( AT_CMD_P_COPS ): /* %COPS command id */ | |
818 case( AT_CMD_NRG ): /* %NRG command id */ | |
819 if( mmEntStat.curCmd EQ cmd ) | |
820 { | |
821 TRACE_EVENT("Command abortion for COPS/NRG"); | |
822 if( mmEntStat.entOwn NEQ srcId ) | |
823 { | |
824 R_AT( RAT_CME, mmEntStat.entOwn ) | |
825 ( cmd, CME_ERR_Unknown ); | |
826 } | |
827 if( (cmd EQ AT_CMD_COPS) OR (cmd EQ AT_CMD_P_COPS) ) | |
828 { | |
829 mmShrdPrm.regMode = mmShrdPrm.regModeBeforeAbort; /* AT_CMD_COPS aborted, restore regMode and COPSmode */ | |
830 mmShrdPrm.COPSmode = mmShrdPrm.COPSmodeBeforeAbort; | |
831 | |
832 switch (mmShrdPrm.COPSmode) | |
833 { | |
834 case COPS_MOD_Dereg: | |
835 #if defined (GPRS) AND defined (DTI) | |
836 mmShrdPrm.nrgCs = GMMREG_DT_COMB; | |
837 ret_val = psaG_MM_CMD_DEREG ( mmShrdPrm.nrgCs ); | |
838 #else | |
839 mmShrdPrm.nrgCs = CS_SIM_REM; | |
840 ret_val = psaMM_DeRegistrate(); | |
841 #endif | |
842 break; | |
843 | |
844 case COPS_MOD_Auto: | |
845 #if defined (GPRS) AND defined (DTI) | |
846 ret_val = psaG_MM_CMD_REG (); /* register to network */ | |
847 #else | |
848 ret_val = psaMM_Registrate(); /* register to network */ | |
849 #endif | |
850 break; | |
851 | |
852 case COPS_MOD_Man: | |
853 if( mmShrdPrm.usedPLMN.v_plmn EQ VLD_PLMN ) | |
854 { | |
855 mmShrdPrm.slctPLMN = mmShrdPrm.usedPLMN; | |
856 } | |
857 else | |
858 { | |
859 mmShrdPrm.slctPLMN.v_plmn = VLD_PLMN; | |
860 cmhMM_CnvrtINT2PLMN( 0xFFF, | |
861 0xFFF, | |
862 mmShrdPrm.slctPLMN.mcc, | |
863 mmShrdPrm.slctPLMN.mnc ); | |
864 } | |
865 | |
866 #if defined (GPRS) AND defined (DTI) | |
867 ret_val = psaG_MM_CMD_NET_SEL(); /* register to network */ | |
868 #else | |
869 ret_val = psaMM_NetSel(); /* register to network */ | |
870 #endif | |
871 break; | |
872 | |
873 case COPS_MOD_Both: | |
874 if (mmShrdPrm.regMode EQ MODE_AUTO) | |
875 { | |
876 mmShrdPrm.regModeAutoBack = FALSE; | |
877 #if defined (GPRS) AND defined (DTI) | |
878 ret_val = psaG_MM_CMD_REG (); /* register to network */ | |
879 #else | |
880 ret_val = psaMM_Registrate(); /* register to network */ | |
881 #endif | |
882 } | |
883 else | |
884 { | |
885 mmShrdPrm.regModeAutoBack = TRUE; | |
886 if( mmShrdPrm.usedPLMN.v_plmn EQ VLD_PLMN ) | |
887 { | |
888 mmShrdPrm.slctPLMN = mmShrdPrm.usedPLMN; | |
889 } | |
890 else | |
891 { | |
892 mmShrdPrm.slctPLMN.v_plmn = VLD_PLMN; | |
893 cmhMM_CnvrtINT2PLMN( 0xFFF, | |
894 0xFFF, | |
895 mmShrdPrm.slctPLMN.mcc, | |
896 mmShrdPrm.slctPLMN.mnc ); | |
897 } | |
898 } | |
899 #if defined (GPRS) AND defined (DTI) | |
900 ret_val = psaG_MM_CMD_NET_SEL(); /* register to network */ | |
901 #else | |
902 ret_val = psaMM_NetSel(); /* register to network */ | |
903 #endif | |
904 break; | |
905 } /* end of switch case */ | |
906 | |
907 if (ret_val < 0) | |
908 { | |
909 TRACE_EVENT( "FATAL RETURN in sAT_Abort()" ); | |
910 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
911 } | |
912 } /* end of AT_CMD_COPS */ | |
913 | |
914 mmEntStat.entOwn = OWN_NONE; | |
915 mmEntStat.curCmd = AT_CMD_NONE; | |
916 return( AT_CMPL ); | |
917 } | |
918 break; | |
919 | |
920 /* | |
921 *--------------------------------------------------------------- | |
922 * for CC related commands | |
923 *--------------------------------------------------------------- | |
924 */ | |
925 case( AT_CMD_D ): /* D command id */ | |
926 | |
927 for (idx = 0; idx < MAX_CALL_NR; idx++) | |
928 { | |
929 if (ccShrdPrm.ctb[idx] NEQ NULL) | |
930 { | |
931 if ((psaCC_ctb(idx)->curCmd EQ cmd AND | |
932 (psaCC_ctb(idx)->calStat EQ CS_ACT_REQ OR | |
933 psaCC_ctb(idx)->calStat EQ CS_DSC_REQ)) | |
934 OR | |
935 (psaCC_ctb(idx)->calStat EQ CS_ACT AND | |
936 (cmhCC_getcalltype(idx) NEQ VOICE_CALL))) | |
937 { | |
938 doneFlg = TRUE; | |
939 srcBuf = psaCC_ctb(idx)->curSrc; | |
940 | |
941 cmhCC_tstAndUnflagCall( idx, &cmhPrm[srcBuf].ccCmdPrm.mltyCncFlg ); | |
942 cmhCC_flagCall ( idx, &cmhPrm[srcId ].ccCmdPrm.mltyDscFlg ); | |
943 | |
944 psaCC_ctb(idx)->curCmd = AT_CMD_ABRT; | |
945 psaCC_ctb(idx)->curSrc = srcId; | |
946 psaCC_ctb(idx)->nrmCs = MNCC_CAUSE_CALL_CLEAR; | |
947 | |
948 psaCC_ClearCall (idx); | |
949 | |
950 if( srcBuf NEQ srcId ) | |
951 { | |
952 R_AT( RAT_NO_CARRIER, srcBuf ) ( AT_CMD_D, idx+1 ); | |
953 } | |
954 } | |
955 } | |
956 } | |
957 if( doneFlg EQ TRUE) | |
958 return( AT_EXCT ); | |
959 | |
960 for( idx = 0; idx < MAX_CALL_NR; idx++ ) | |
961 { | |
962 if (ccShrdPrm.ctb[idx] NEQ NULL AND | |
963 psaCC_ctb(idx)->curCmd EQ cmd AND | |
964 psaCC_ctb(idx)->calStat EQ CS_MDF_REQ) | |
965 { | |
966 srcBuf = psaCC_ctb(idx)->curSrc; | |
967 | |
968 cmhCC_tstAndUnflagCall( idx, &cmhPrm[srcBuf].ccCmdPrm.mltyCncFlg ); | |
969 | |
970 psaCC_ctb(idx)->curCmd = AT_CMD_NONE; | |
971 psaCC_ctb(idx)->curSrc = CMD_SRC_NONE; | |
972 doneFlg = TRUE; | |
973 } | |
974 } | |
975 if( doneFlg ) | |
976 { | |
977 if( /*lint -e(644)*/srcBuf NEQ srcId ) | |
978 { | |
979 R_AT( RAT_CME, srcBuf ) | |
980 ( AT_CMD_D, CME_ERR_Unknown ); | |
981 } | |
982 return( AT_CMPL ); | |
983 } | |
984 | |
985 for( idx = 0; idx < MAX_SS_NR; idx++ ) | |
986 { | |
987 if( (ssShrdPrm.stb[idx].curCmd EQ KSD_CMD_CB OR | |
988 ssShrdPrm.stb[idx].curCmd EQ KSD_CMD_CF OR | |
989 ssShrdPrm.stb[idx].curCmd EQ KSD_CMD_CW OR | |
990 ssShrdPrm.stb[idx].curCmd EQ KSD_CMD_CL OR | |
991 ssShrdPrm.stb[idx].curCmd EQ KSD_CMD_PWD OR | |
992 ssShrdPrm.stb[idx].curCmd EQ KSD_CMD_USSD )) | |
993 { | |
994 srcBuf = ssShrdPrm.stb[idx].srvOwn; | |
995 /* PATCH LE 26.06.00 */ | |
996 /* End transaction in SS */ | |
997 psaSS_EndTrns(idx); | |
998 /* END PATCH LE 26.06.00 */ | |
999 ssShrdPrm.stb[idx].ntryUsdFlg = FALSE; | |
1000 ssShrdPrm.stb[idx].curCmd = AT_CMD_NONE; | |
1001 doneFlg = TRUE; | |
1002 } | |
1003 } | |
1004 if( doneFlg ) | |
1005 { | |
1006 if( srcBuf NEQ srcId ) | |
1007 { | |
1008 R_AT( RAT_CME, srcBuf ) | |
1009 ( AT_CMD_D, CME_ERR_Unknown ); | |
1010 } | |
1011 return( AT_CMPL ); | |
1012 } | |
1013 break; | |
1014 | |
1015 case( AT_CMD_A ): /* A command id */ | |
1016 | |
1017 for( idx = 0; idx < MAX_CALL_NR; idx++ ) | |
1018 { | |
1019 if (ccShrdPrm.ctb[idx] NEQ NULL) | |
1020 { | |
1021 if (psaCC_ctb(idx)->curCmd EQ cmd AND | |
1022 (psaCC_ctb(idx)->calStat EQ CS_ACT_REQ OR | |
1023 psaCC_ctb(idx)->calStat EQ CS_CPL_REQ OR | |
1024 psaCC_ctb(idx)->calStat EQ CS_DSC_REQ)) | |
1025 { | |
1026 doneFlg = TRUE; | |
1027 srcBuf = psaCC_ctb(idx)->curSrc; | |
1028 | |
1029 cmhCC_tstAndUnflagCall( idx, &cmhPrm[srcBuf].ccCmdPrm.mltyCncFlg ); | |
1030 cmhCC_flagCall ( idx, &cmhPrm[srcId ].ccCmdPrm.mltyDscFlg ); | |
1031 | |
1032 psaCC_ctb(idx)->curCmd = AT_CMD_ABRT; | |
1033 psaCC_ctb(idx)->curSrc = srcId; | |
1034 psaCC_ctb(idx)->nrmCs = MNCC_CAUSE_CALL_CLEAR; | |
1035 | |
1036 psaCC_ClearCall (idx); | |
1037 | |
1038 if( srcBuf NEQ srcId ) | |
1039 { | |
1040 R_AT( RAT_NO_CARRIER, srcBuf ) ( AT_CMD_A, idx+1 ); | |
1041 } | |
1042 } | |
1043 } | |
1044 } | |
1045 if( doneFlg ) | |
1046 return( AT_EXCT ); | |
1047 | |
1048 for( idx = 0; idx < MAX_CALL_NR; idx++ ) | |
1049 { | |
1050 if (ccShrdPrm.ctb[idx] NEQ NULL AND | |
1051 psaCC_ctb(idx)->curCmd EQ cmd AND | |
1052 psaCC_ctb(idx)->calStat EQ CS_MDF_REQ) | |
1053 { | |
1054 srcBuf = psaCC_ctb(idx)->curSrc; | |
1055 | |
1056 cmhCC_tstAndUnflagCall( idx, &cmhPrm[srcBuf].ccCmdPrm.mltyCncFlg ); | |
1057 | |
1058 psaCC_ctb(idx)->curCmd = AT_CMD_NONE; | |
1059 psaCC_ctb(idx)->curSrc = CMD_SRC_NONE; | |
1060 doneFlg = TRUE; | |
1061 } | |
1062 } | |
1063 if( doneFlg ) | |
1064 { | |
1065 if( srcBuf NEQ srcId ) | |
1066 { | |
1067 R_AT( RAT_CME, srcBuf ) | |
1068 ( AT_CMD_A, CME_ERR_Unknown ); | |
1069 } | |
1070 return( AT_CMPL ); | |
1071 } | |
1072 break; | |
1073 | |
1074 case( AT_CMD_Z ): /* Z command id */ | |
1075 case( AT_CMD_CHUP ): /* +CHUP command id */ | |
1076 case( AT_CMD_CHLD ): /* +CHLD command id */ | |
1077 case( AT_CMD_CTFR ): /* +CTFR command id */ | |
1078 | |
1079 for( idx = 0; idx < MAX_CALL_NR; idx++ ) | |
1080 { | |
1081 if (ccShrdPrm.ctb[idx] NEQ NULL AND | |
1082 psaCC_ctb(idx)->curCmd EQ cmd) | |
1083 { | |
1084 srcBuf = psaCC_ctb(idx)->curSrc; | |
1085 | |
1086 cmhCC_tstAndUnflagCall( idx, &cmhPrm[srcBuf].ccCmdPrm.mltyCncFlg ); | |
1087 cmhCC_tstAndUnflagCall( idx, &cmhPrm[srcBuf].ccCmdPrm.mltyDscFlg ); | |
1088 | |
1089 psaCC_ctb(idx)->curCmd = AT_CMD_NONE; | |
1090 psaCC_ctb(idx)->curSrc = CMD_SRC_NONE; | |
1091 doneFlg = TRUE; | |
1092 } | |
1093 } | |
1094 if( doneFlg ) | |
1095 { | |
1096 if( srcBuf NEQ srcId ) | |
1097 { | |
1098 R_AT( RAT_CME, srcBuf ) | |
1099 ( cmd, CME_ERR_Unknown ); | |
1100 } | |
1101 return( AT_CMPL ); | |
1102 } | |
1103 break; | |
1104 | |
1105 case( AT_CMD_VTS ): /* +VTS command id */ | |
1106 | |
1107 for( idx = 0; idx < MAX_CALL_NR; idx++ ) | |
1108 { | |
1109 if (ccShrdPrm.ctb[idx] NEQ NULL AND | |
1110 psaCC_ctb(idx)->dtmfCmd EQ cmd) | |
1111 { | |
1112 if (psaCC_ctb(idx)->dtmfMode NEQ DTMF_MOD_AUTO) /* DTMF in Auto Mode is not abortable | |
1113 since the tone is always immediately stopped | |
1114 after the network confirmed the tone to CC. So | |
1115 it makes absolut no sense to abort the VTS nor | |
1116 does this have any effect on the length of the tone. */ | |
1117 { | |
1118 srcBuf = psaCC_ctb(idx)->dtmfSrc; | |
1119 psaCC_ctb(idx)->dtmfCmd = AT_CMD_NONE; | |
1120 psaCC_ctb(idx)->dtmfSrc = CMD_SRC_NONE; | |
1121 sAT_PlusVTS( srcId, ccShrdPrm.dtmf.dig[0], VTS_MOD_ManStop ); | |
1122 doneFlg = TRUE; | |
1123 } | |
1124 } | |
1125 } | |
1126 if( doneFlg ) | |
1127 { | |
1128 if( srcBuf NEQ srcId ) | |
1129 { | |
1130 R_AT( RAT_CME, srcBuf ) | |
1131 ( AT_CMD_VTS, CME_ERR_Unknown ); | |
1132 } | |
1133 return( AT_CMPL ); | |
1134 } | |
1135 | |
1136 break; | |
1137 | |
1138 /* | |
1139 *--------------------------------------------------------------- | |
1140 * for SS related commands | |
1141 *--------------------------------------------------------------- | |
1142 */ | |
1143 case( AT_CMD_CLIR ): /* +CLIR command id */ | |
1144 case( AT_CMD_CLIP ): /* +CLIP command id */ | |
1145 case( AT_CMD_COLP ): /* +COLP command id */ | |
1146 case( AT_CMD_CCFC ): /* +CCFC command id */ | |
1147 case( AT_CMD_CLCK ): /* +CLCK command id */ | |
1148 case( AT_CMD_CCWA ): /* +CCWA command id */ | |
1149 case( AT_CMD_CPWD ): /* +CPWD command id */ | |
1150 case( AT_CMD_CUSD ): /* +CUSD command id */ | |
1151 | |
1152 for( idx = 0; idx < MAX_SS_NR; idx++ ) | |
1153 { | |
1154 if( ssShrdPrm.stb[idx].curCmd EQ cmd ) | |
1155 { | |
1156 srcBuf = ssShrdPrm.stb[idx].srvOwn; | |
1157 psaSS_EndTrns(idx); | |
1158 cmhPrm[srcId].ssCmdPrm.mltyTrnFlg = 0; | |
1159 ssShrdPrm.stb[idx].ntryUsdFlg = FALSE; | |
1160 ssShrdPrm.stb[idx].curCmd = AT_CMD_NONE; | |
1161 doneFlg = TRUE; | |
1162 } | |
1163 } | |
1164 if( simEntStat.curCmd EQ AT_CMD_CLCK ) | |
1165 { | |
1166 simEntStat.curCmd = AT_CMD_NONE; | |
1167 doneFlg = TRUE; | |
1168 } | |
1169 if( doneFlg ) | |
1170 { | |
1171 if( srcBuf NEQ srcId ) | |
1172 { | |
1173 R_AT( RAT_CME, srcBuf ) | |
1174 ( cmd, CME_ERR_Unknown ); | |
1175 } | |
1176 return( AT_CMPL ); | |
1177 } | |
1178 break; /* SS not implemented */ | |
1179 | |
1180 /* | |
1181 *--------------------------------------------------------------- | |
1182 * for SMS related commands | |
1183 *--------------------------------------------------------------- | |
1184 */ | |
1185 case( AT_CMD_CMGD ): /* +CMGD command id */ | |
1186 case( AT_CMD_CMGW ): /* +CMGW command id */ | |
1187 case( AT_CMD_CMGS ): /* +CMGS command id */ | |
1188 case( AT_CMD_CMSS ): /* +CMSS command id */ | |
1189 case( AT_CMD_CSMP ): /* +CSMP command id */ | |
1190 case( AT_CMD_CSCA ): /* +CSCA command id */ | |
1191 | |
1192 if( smsShrdPrm.smsEntStat.curCmd EQ cmd ) | |
1193 { | |
1194 if( smsShrdPrm.smsEntStat.entOwn NEQ srcId ) | |
1195 { | |
1196 R_AT( RAT_CMS, smsShrdPrm.smsEntStat.entOwn ) | |
1197 ( cmd, CMS_ERR_UnknownErr, NULL ); | |
1198 } | |
1199 | |
1200 smsShrdPrm.smsEntStat.entOwn = OWN_NONE; | |
1201 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
1202 return( AT_CMPL ); | |
1203 } | |
1204 | |
1205 break; | |
1206 | |
1207 #ifdef GPRS | |
1208 /* brz:to check | |
1209 /* | |
1210 *--------------------------------------------------------------- | |
1211 * for GMM related commands | |
1212 *--------------------------------------------------------------- | |
1213 */ | |
1214 case( AT_CMD_CGATT ): /* +CGATT command id */ | |
1215 case( AT_CMD_CGCLASS ): /* +CGCLASS command id */ | |
1216 if( gmmEntStat.curCmd EQ cmd ) | |
1217 { | |
1218 TRACE_EVENT("Command abortion for CGATT/CGCLASS/CGAUTO"); | |
1219 if( gmmEntStat.entOwn NEQ srcId ) | |
1220 { | |
1221 R_AT( RAT_CME, gmmEntStat.entOwn ) | |
1222 ( cmd, CME_ERR_Unknown ); | |
1223 } | |
1224 gmmEntStat.entOwn = OWN_NONE; | |
1225 gmmEntStat.curCmd = AT_CMD_NONE; | |
1226 return( AT_CMPL ); | |
1227 } | |
1228 | |
1229 break; | |
1230 /* | |
1231 *--------------------------------------------------------------- | |
1232 * for SM related commands | |
1233 *--------------------------------------------------------------- | |
1234 */ | |
1235 case( AT_CMD_CGACT ): /* +CGACT command id */ | |
1236 if( smEntStat.curCmd EQ cmd ) | |
1237 { | |
1238 TRACE_EVENT("Command abortion for CGACT"); | |
1239 if( smEntStat.entOwn NEQ srcId ) | |
1240 { | |
1241 R_AT( RAT_CME, smEntStat.entOwn ) | |
1242 ( cmd, CME_ERR_Unknown ); | |
1243 } | |
1244 switch(get_state_working_cid()) | |
1245 { | |
1246 case CS_WAITS_FOR_ACTIVATING: | |
1247 case CS_ACTIVATING: | |
1248 case CS_ACTIVATED: | |
1249 smEntStat.entOwn = OWN_NONE; | |
1250 smEntStat.curCmd = AT_CMD_NONE; | |
1251 nsapi_set = cmhSM_Give_nsapi_set( work_cids[cid_pointer] ); | |
1252 if ( nsapi_set ) | |
1253 { | |
1254 set_state_working_cid( CS_DEACTIVATE_NORMAL ); | |
1255 psaSM_PDP_Deactivate( nsapi_set, SMREG_NONLOCAL); | |
1256 } | |
1257 else | |
1258 { | |
1259 set_state_working_cid( CS_DEFINED ); | |
1260 *work_cids = 0; | |
1261 cid_pointer = 0; | |
1262 } | |
1263 break; | |
1264 } | |
1265 return( AT_CMPL ); | |
1266 } | |
1267 break; /* LINT warning */ | |
1268 case( AT_CMD_CGDATA ): /* +CGDATA command id */ | |
1269 if( gpppEntStat.curCmd EQ cmd || | |
1270 smEntStat.curCmd EQ cmd ) | |
1271 { | |
1272 TRACE_EVENT("Command abortion for CGDATA"); | |
1273 if( gpppEntStat.entOwn NEQ srcId && | |
1274 smEntStat.entOwn NEQ srcId ) | |
1275 { | |
1276 R_AT( RAT_CME, gpppEntStat.entOwn ) | |
1277 ( cmd, CME_ERR_Unknown ); | |
1278 } | |
1279 | |
1280 return cmhSM_deactivateAContext(srcId, work_cids[cid_pointer] ); | |
1281 } | |
1282 break; | |
1283 | |
1284 case( AT_CMD_CGANS ): /* +CGANS command id */ | |
1285 | |
1286 if( smEntStat.curCmd EQ cmd ) | |
1287 { | |
1288 TRACE_EVENT("Command abortion for CGANS"); | |
1289 if( smEntStat.entOwn NEQ srcId ) | |
1290 { | |
1291 R_AT( RAT_CME, smEntStat.entOwn ) | |
1292 ( cmd, CME_ERR_Unknown ); | |
1293 } | |
1294 smEntStat.entOwn = OWN_NONE; | |
1295 smEntStat.curCmd = AT_CMD_NONE; | |
1296 doneFlg = TRUE; | |
1297 } | |
1298 | |
1299 if( gpppEntStat.curCmd EQ cmd ) | |
1300 { | |
1301 if( gpppEntStat.entOwn NEQ srcId ) | |
1302 { | |
1303 R_AT( RAT_CME, gpppEntStat.entOwn ) | |
1304 ( cmd, CME_ERR_Unknown ); | |
1305 } | |
1306 gpppEntStat.entOwn = OWN_NONE; | |
1307 gpppEntStat.curCmd = AT_CMD_NONE; | |
1308 return( AT_EXCT ); | |
1309 } | |
1310 | |
1311 if( doneFlg == TRUE ) | |
1312 return( AT_EXCT ); | |
1313 break; | |
1314 | |
1315 case( AT_CMD_CGSMS ): /* +CGSMS command id */ | |
1316 if( smEntStat.curCmd EQ cmd ) | |
1317 { | |
1318 TRACE_EVENT("Command abortion for CGSMS"); | |
1319 if( smEntStat.entOwn NEQ srcId ) | |
1320 { | |
1321 R_AT( RAT_CME, smEntStat.entOwn ) | |
1322 ( cmd, CME_ERR_Unknown ); | |
1323 } | |
1324 smEntStat.entOwn = OWN_NONE; | |
1325 smEntStat.curCmd = AT_CMD_NONE; | |
1326 } | |
1327 return AT_CMPL; | |
1328 | |
1329 #endif /*GPRS*/ | |
1330 | |
1331 } | |
1332 | |
1333 return( AT_FAIL ); | |
1334 } | |
1335 | |
1336 /* | |
1337 +-------------------------------------------------------------------+ | |
1338 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1339 | ROUTINE : cmh_mergeTOA | | |
1340 +-------------------------------------------------------------------+ | |
1341 | |
1342 PURPOSE : this function converts the type of number (TON) and the | |
1343 numbering plan identification into the octet representation | |
1344 according to GSM 04.08 ( 10.5.4.7 ). | |
1345 */ | |
1346 | |
1347 GLOBAL UBYTE cmh_mergeTOA ( UBYTE ton, UBYTE npi ) | |
1348 { | |
1349 | |
1350 /* | |
1351 *------------------------------------------------------------------- | |
1352 * convert TON and NPI | |
1353 *------------------------------------------------------------------- | |
1354 */ | |
1355 return( ((ton & 0x07)<<4)+ | |
1356 ((npi & 0x0F)<<0)+0x80 ); | |
1357 | |
1358 } | |
1359 | |
1360 /* | |
1361 +-------------------------------------------------------------------+ | |
1362 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1363 | ROUTINE : cmh_mergeTOS | | |
1364 +-------------------------------------------------------------------+ | |
1365 | |
1366 PURPOSE : this function converts the type of subaddress (TOS) and the | |
1367 odd/even indicator into the octet representation | |
1368 according to GSM 04.08 ( 10.5.4.8 ). | |
1369 | |
1370 */ | |
1371 | |
1372 GLOBAL UBYTE cmh_mergeTOS ( UBYTE tos, UBYTE oe ) | |
1373 { | |
1374 | |
1375 /* | |
1376 *------------------------------------------------------------------- | |
1377 * convert TOS and odd/even | |
1378 *------------------------------------------------------------------- | |
1379 */ | |
1380 return( ((tos & 0x07)<<4)+ | |
1381 ((oe & 0x01)<<3)+0x80 ); | |
1382 } | |
1383 | |
1384 /* | |
1385 +-------------------------------------------------------------------+ | |
1386 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1387 | ROUTINE : cmh_demergeTOA | | |
1388 +-------------------------------------------------------------------+ | |
1389 | |
1390 PURPOSE : this function converts the the octet representation | |
1391 according to GSM 04.08 ( 10.5.4.7 ) into type of number | |
1392 (TON) and the numbering plan identification. | |
1393 */ | |
1394 | |
1395 GLOBAL void cmh_demergeTOA ( UBYTE toa, UBYTE* ton, UBYTE* npi ) | |
1396 { | |
1397 | |
1398 /* | |
1399 *------------------------------------------------------------------- | |
1400 * convert TON and NPI | |
1401 *------------------------------------------------------------------- | |
1402 */ | |
1403 *ton = (toa>>4) & 0x07; | |
1404 *npi = (toa>>0) & 0x0F; | |
1405 } | |
1406 | |
1407 /* | |
1408 +-------------------------------------------------------------------+ | |
1409 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1410 | ROUTINE : cmh_demergeTOS | | |
1411 +-------------------------------------------------------------------+ | |
1412 | |
1413 PURPOSE : this function converts the octet representation | |
1414 according to GSM 04.08 ( 10.5.4.8 ) into the type of | |
1415 subaddress (TOS) and the odd/even indicator. | |
1416 | |
1417 */ | |
1418 | |
1419 GLOBAL void cmh_demergeTOS ( UBYTE tosa, UBYTE* tos, UBYTE* oe ) | |
1420 { | |
1421 | |
1422 /* | |
1423 *------------------------------------------------------------------- | |
1424 * convert TOS and odd/even | |
1425 *------------------------------------------------------------------- | |
1426 */ | |
1427 *tos = (tosa>>4) & 0x07; | |
1428 *oe = (tosa>>3) & 0x01; | |
1429 } | |
1430 | |
1431 | |
1432 | |
1433 /* | |
1434 +--------------------------------------------------------------------+ | |
1435 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1436 | STATE : code ROUTINE : cmh_setToaDef | | |
1437 +--------------------------------------------------------------------+ | |
1438 | |
1439 PURPOSE : This function sets the type of address to default values | |
1440 (when the first character of address is '+' or the first | |
1441 two characters are '0' default is 145 otherwise default | |
1442 is 129) | |
1443 */ | |
1444 GLOBAL CHAR* cmh_setToaDef ( CHAR* number, T_ACI_TOA *toa ) | |
1445 { | |
1446 toa->npi = NPI_IsdnTelephony; | |
1447 | |
1448 if ( *number EQ '+' ) | |
1449 { | |
1450 toa->ton = TON_International; | |
1451 return number+1; | |
1452 } | |
1453 else | |
1454 { | |
1455 toa->ton = TON_Unknown; | |
1456 return number; | |
1457 } | |
1458 } | |
1459 | |
1460 | |
1461 | |
1462 | |
1463 /* | |
1464 +-------------------------------------------------------------------+ | |
1465 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1466 | ROUTINE : cmh_packBCD | | |
1467 +-------------------------------------------------------------------+ | |
1468 | |
1469 PURPOSE : packing two BCD values in one octet | |
1470 <bcd_out> resulting packed BCD numbers | |
1471 <char_in> BCD values input per character | |
1472 <len_in> number of BCD values to be packed | |
1473 RETURN : number of packed octets | |
1474 */ | |
1475 | |
1476 GLOBAL USHORT cmh_packBCD (UBYTE *bcd_out, const UBYTE *char_in, | |
1477 USHORT len_in) | |
1478 { | |
1479 USHORT no_oct = 0, i; | |
1480 | |
1481 if (len_in > MAX_SMS_ADDR_DIG) /* check length */ | |
1482 len_in = MAX_SMS_ADDR_DIG; | |
1483 | |
1484 for (i = 0; i < len_in; i++) | |
1485 { | |
1486 if ((i & 1) EQ 0) /* pack high nibble */ | |
1487 { | |
1488 no_oct++; | |
1489 *bcd_out = *char_in++ | 0xF0; /* in case of odd length */ | |
1490 } | |
1491 else /* pack low nibble */ | |
1492 *bcd_out++ &= (*char_in++ << 4) | 0xF; | |
1493 } | |
1494 return no_oct; | |
1495 } | |
1496 | |
1497 /* | |
1498 +-------------------------------------------------------------------+ | |
1499 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1500 | ROUTINE : cmh_unpackBCD | | |
1501 +-------------------------------------------------------------------+ | |
1502 | |
1503 PURPOSE : unpacking one octet in two BCD values | |
1504 <char_out> resulting unpacked BCD values | |
1505 <bcd_in> BCD numbers input | |
1506 <len_in> number of octets to be unpacked | |
1507 RETURN : number of unpacked BCD values | |
1508 */ | |
1509 | |
1510 GLOBAL USHORT cmh_unpackBCD (UBYTE *char_out, const UBYTE *bcd_in, | |
1511 USHORT len_in) | |
1512 { | |
1513 USHORT no_bcd = 0, i; | |
1514 | |
1515 if (len_in > MAX_SMS_ADDR_DIG/2) /* check length */ | |
1516 len_in = MAX_SMS_ADDR_DIG/2; | |
1517 | |
1518 for (i = 0; i < len_in; i++) | |
1519 { | |
1520 if ((*bcd_in & 0xF) NEQ 0xF) /* in case of wrong length */ | |
1521 { | |
1522 *char_out++ = *bcd_in & 0xF; /* unpack low nibble */ | |
1523 no_bcd++; | |
1524 } | |
1525 else | |
1526 break; | |
1527 if ((*bcd_in & 0xF0) NEQ 0xF0) /* in case of odd length */ | |
1528 { | |
1529 *char_out++ = *bcd_in++ >> 4; /* unpack high nibble */ | |
1530 no_bcd++; | |
1531 } | |
1532 else | |
1533 break; | |
1534 } | |
1535 return no_bcd; | |
1536 } | |
1537 | |
1538 /* | |
1539 +-------------------------------------------------------------------+ | |
1540 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1541 | ROUTINE : cmh_unpackSCTS | | |
1542 +-------------------------------------------------------------------+ | |
1543 | |
1544 PURPOSE : unpacking SCTS (or validity period absolute) to the | |
1545 T_ACI_VP_ABS structure | |
1546 */ | |
1547 GLOBAL void cmh_unpackSCTS (T_ACI_VP_ABS *scts, const UBYTE *buf_in) | |
1548 { | |
1549 | |
1550 UBYTE lsb, msb, sign; | |
1551 | |
1552 cmh_unpackBCD ((UBYTE*)scts, buf_in, 6); | |
1553 | |
1554 /* get the time zone octet */ | |
1555 buf_in += 6; | |
1556 | |
1557 lsb = *buf_in >> 4; | |
1558 msb = *buf_in & 0x07; | |
1559 scts->timezone = (msb *10) + lsb; /* BCD */ | |
1560 sign = *buf_in & 0x08; | |
1561 if (sign) | |
1562 scts->timezone = -scts->timezone; /* ~scts->timezone + 1; */ | |
1563 } | |
1564 | |
1565 /* | |
1566 +-------------------------------------------------------------------+ | |
1567 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1568 | ROUTINE : cmh_logRslt | | |
1569 +-------------------------------------------------------------------+ | |
1570 | |
1571 PURPOSE : log result code. | |
1572 | |
1573 */ | |
1574 | |
1575 GLOBAL void cmh_logRslt ( T_ACI_CMD_SRC dest, RAT_ID rat, | |
1576 T_ACI_AT_CMD cmd, SHORT cId, | |
1577 T_ACI_BS_SPEED spd, T_ACI_CME_ERR err ) | |
1578 { | |
1579 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1580 T_ACI_RLOG rslt; /* holds result pararmeter */ | |
1581 | |
1582 rslt.dest = dest; | |
1583 | |
1584 switch( rat ) | |
1585 { | |
1586 case( RAT_OK ): | |
1587 | |
1588 rslt.atRslt = RLOG_RSLT_OK; | |
1589 rslt.rsltPrm.rOK.cmdId = cmd; | |
1590 rslt.rsltPrm.rOK.cId = cId; | |
1591 break; | |
1592 | |
1593 case( RAT_NO_CARRIER ): | |
1594 | |
1595 rslt.atRslt = RLOG_RSLT_NoCarrier; | |
1596 rslt.rsltPrm.rNO_CARRIER.cmdId = cmd; | |
1597 rslt.rsltPrm.rNO_CARRIER.cId = cId; | |
1598 break; | |
1599 | |
1600 case( RAT_CONNECT ): | |
1601 | |
1602 rslt.atRslt = RLOG_RSLT_Connect; | |
1603 rslt.rsltPrm.rCONNECT.cmdId = cmd; | |
1604 rslt.rsltPrm.rCONNECT.cId = cId; | |
1605 rslt.rsltPrm.rCONNECT.speed = spd; | |
1606 break; | |
1607 | |
1608 case( RAT_BUSY ): | |
1609 | |
1610 rslt.atRslt = RLOG_RSLT_Busy; | |
1611 rslt.rsltPrm.rBUSY.cmdId = cmd; | |
1612 rslt.rsltPrm.rBUSY.cId = cId; | |
1613 break; | |
1614 | |
1615 case( RAT_NO_ANSWER ): | |
1616 | |
1617 rslt.atRslt = RLOG_RSLT_NoAnswer; | |
1618 rslt.rsltPrm.rNO_ANSWER.cmdId = cmd; | |
1619 rslt.rsltPrm.rNO_ANSWER.cId = cId; | |
1620 break; | |
1621 | |
1622 case( RAT_CME ): | |
1623 | |
1624 rslt.atRslt = RLOG_RSLT_CME; | |
1625 rslt.rsltPrm.rCME.cmdId = cmd; | |
1626 rslt.rsltPrm.rCME.err = err; | |
1627 rslt.rsltPrm.rCME.cId = cId; | |
1628 break; | |
1629 | |
1630 default: | |
1631 | |
1632 return; | |
1633 } | |
1634 | |
1635 rAT_PercentRLOG( &rslt ); | |
1636 #endif | |
1637 } | |
1638 | |
1639 /* | |
1640 +-------------------------------------------------------------------+ | |
1641 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1642 | ROUTINE : cmh_cvtToDefGsm | | |
1643 +-------------------------------------------------------------------+ | |
1644 | |
1645 PURPOSE : converts from internal GSM to default GSM alphabet. | |
1646 | |
1647 */ | |
1648 GLOBAL void cmh_cvtToDefGsm ( CHAR* in, CHAR* out, USHORT* len ) | |
1649 { | |
1650 USHORT i; /* used for counting */ | |
1651 | |
1652 *len = ( USHORT ) strlen ( in ); | |
1653 | |
1654 for ( i = 0; i < *len; i++ ) | |
1655 out[i] = in[i] & 0x7F; | |
1656 } | |
1657 | |
1658 /* | |
1659 +-------------------------------------------------------------------+ | |
1660 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1661 | ROUTINE : cmh_cvtFromDefGsm | | |
1662 +-------------------------------------------------------------------+ | |
1663 | |
1664 PURPOSE : converts from default GSM to internal GSM alphabet. | |
1665 | |
1666 */ | |
1667 GLOBAL void cmh_cvtFromDefGsm ( CHAR* in, USHORT len, CHAR* out ) | |
1668 { | |
1669 USHORT i; /* used for counting */ | |
1670 | |
1671 for ( i = 0; i < len; i++ ) | |
1672 out[i] = in[i] | 0x80; | |
1673 | |
1674 out[len] = '\0'; | |
1675 } | |
1676 | |
1677 /* | |
1678 +--------------------------------------------------------------------+ | |
1679 | PROJECT: GSM-PS (6147) MODULE: ACI_CMD | | |
1680 | STATE : code ROUTINE: cmh_set_delayed_call| | |
1681 +--------------------------------------------------------------------+ | |
1682 | |
1683 PURPOSE : Set function pointer for general-purpose timer routine. | |
1684 TRUE, if delayed call timer slot is available | |
1685 FALSE otherwise | |
1686 setting call=NULL always succeeds. | |
1687 */ | |
1688 static UCHAR (*cmh_timeout_delayed_call) (void*) = NULL; | |
1689 static void* cmh_timeout_delayed_arg = NULL; | |
1690 | |
1691 GLOBAL UBYTE cmh_set_delayed_call (UCHAR (*call) (void*), void* arg) | |
1692 { | |
1693 UCHAR ret; | |
1694 if (cmh_timeout_delayed_call EQ NULL | |
1695 OR cmh_timeout_delayed_call EQ call | |
1696 OR call EQ NULL) | |
1697 { | |
1698 cmh_timeout_delayed_call = call; | |
1699 cmh_timeout_delayed_arg = arg; | |
1700 ret = TRUE; | |
1701 } | |
1702 else ret = FALSE; | |
1703 return ret; | |
1704 } | |
1705 | |
1706 /* | |
1707 +--------------------------------------------------------------------+ | |
1708 | PROJECT: GSM-PS (6147) MODULE: ACI_CMD | | |
1709 | STATE : code ROUTINE: cmh_set_delayed_call| | |
1710 +--------------------------------------------------------------------+ | |
1711 | |
1712 PURPOSE : start timer for general-purpose timer routine. | |
1713 TRUE, if delayed call timer slot has been set before | |
1714 */ | |
1715 | |
1716 GLOBAL UBYTE cmh_start_delayed_call (ULONG ms) | |
1717 { | |
1718 UBYTE ret; | |
1719 if (cmh_timeout_delayed_call NEQ NULL) { | |
1720 TRACE_FUNCTION ("cmh_start_delayed_call()"); | |
1721 vsi_t_start (hCommACI, ACI_TDELAY, ms); | |
1722 ret = TRUE; | |
1723 } else ret = FALSE; | |
1724 return ret; | |
1725 } | |
1726 | |
1727 /* | |
1728 +--------------------------------------------------------------------+ | |
1729 | PROJECT: GSM-PS (6147) MODULE: ACI_CMD | | |
1730 | STATE : code ROUTINE: cmh_timeout | | |
1731 +--------------------------------------------------------------------+ | |
1732 | |
1733 PURPOSE : A timeout has occured for a timer. The function returns | |
1734 TRUE, if it is a timer which is handled by CMH, else FALSE | |
1735 is returned to indicate that the timer has not been | |
1736 processed. | |
1737 | |
1738 */ | |
1739 | |
1740 GLOBAL UBYTE cmh_timeout (USHORT index) | |
1741 { | |
1742 TRACE_FUNCTION ("cmh_timeout()"); | |
1743 | |
1744 if (index EQ ACI_TMPTY) | |
1745 { | |
1746 /* | |
1747 * timeout multiparty timer | |
1748 */ | |
1749 cmhCC_MPTYTimeout(); | |
1750 return TRUE; | |
1751 } | |
1752 | |
1753 if (index EQ ACI_TECT) | |
1754 { | |
1755 /* | |
1756 * timeout multiparty timer | |
1757 */ | |
1758 cmhCC_ECTTimeout(); | |
1759 return TRUE; | |
1760 } | |
1761 | |
1762 #ifdef FF_FAX | |
1763 if (index EQ ACI_TFIT) | |
1764 { | |
1765 /* | |
1766 * timeout FAX inactivity timer | |
1767 */ | |
1768 cmhT30_FITTimeout(); | |
1769 return TRUE; | |
1770 } | |
1771 #endif /* FF_FAX */ | |
1772 | |
1773 if (index EQ ACI_TDELAY) | |
1774 { | |
1775 /* | |
1776 * timeout delayed call timer | |
1777 */ | |
1778 if (cmh_timeout_delayed_call EQ NULL) | |
1779 { | |
1780 vsi_t_stop (hCommACI, ACI_TDELAY); | |
1781 } | |
1782 else if (!cmh_timeout_delayed_call (cmh_timeout_delayed_arg)) | |
1783 { | |
1784 cmh_timeout_delayed_call = NULL; | |
1785 vsi_t_stop (hCommACI, ACI_TDELAY); | |
1786 } | |
1787 return TRUE; | |
1788 } | |
1789 | |
1790 if (index EQ ACI_REPEAT_HND) | |
1791 { | |
1792 /* redial timer is elapsed */ | |
1793 cmhCC_redialTimeout(); | |
1794 } | |
1795 /* | |
1796 * the timeout is not for CMH | |
1797 */ | |
1798 return FALSE; | |
1799 } | |
1800 | |
1801 /* | |
1802 +-------------------------------------------------------------------+ | |
1803 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1804 | ROUTINE : cmh_bldCalPrms | | |
1805 +-------------------------------------------------------------------+ | |
1806 | |
1807 PURPOSE : this function converts a dial string into the settings | |
1808 for the called address parameters. | |
1809 */ | |
1810 | |
1811 /******************************************* | |
1812 This function is intended only to be called ONCE | |
1813 for a given number... | |
1814 Otherwise, TOA info might be corrupted | |
1815 ********************************************/ | |
1816 GLOBAL SHORT cmh_bldCalPrms ( char * pDialStr, T_CLPTY_PRM * calPrm ) | |
1817 { | |
1818 char * pSubAdr; /* points to subaddress */ | |
1819 int i; | |
1820 int len = strlen(pDialStr); | |
1821 | |
1822 TRACE_FUNCTION("cmh_bldCalPrms()"); | |
1823 | |
1824 /* seach for subaddress */ | |
1825 pSubAdr = strchr( pDialStr, '-' ); | |
1826 if ( pSubAdr NEQ NULL ) /* subaddress found */ | |
1827 { | |
1828 *pSubAdr = 0x0; /* cut off subaddress */ | |
1829 pSubAdr++; | |
1830 | |
1831 /* | |
1832 * fill in subaddress information | |
1833 */ | |
1834 calPrm -> tos = TOS_NSAP; | |
1835 strncpy( calPrm->sub, pSubAdr, MAX_SUBADDR_LEN-1 ); | |
1836 calPrm->sub[MAX_SUBADDR_LEN-1] = 0x0; | |
1837 calPrm -> oe = (strlen(calPrm->sub) & 1)? OE_ODD : OE_EVEN; | |
1838 } | |
1839 else /* subaddress not found */ | |
1840 { | |
1841 calPrm -> tos = TOS_NOT_PRES; | |
1842 calPrm -> oe = OE_EVEN; | |
1843 calPrm->sub[0] = 0x0; | |
1844 } | |
1845 | |
1846 /* fill in address information */ | |
1847 | |
1848 /* Sign "+" could be found anywhere in the string: | |
1849 for instance in a Key Stroke Sequence */ | |
1850 | |
1851 /* Copy character until '+' digit */ | |
1852 for (i = 0; (i < len) && (pDialStr[i] != '+'); i++) | |
1853 calPrm->num[i] = pDialStr[i]; | |
1854 | |
1855 if (i != len) | |
1856 { | |
1857 calPrm->ton = TON_INT_NUMB; | |
1858 | |
1859 /* Skip '+' digit and copy next characters */ | |
1860 for (i++; i < len; i++) | |
1861 calPrm->num[i-1] = pDialStr[i]; | |
1862 i--; | |
1863 } | |
1864 else | |
1865 calPrm->ton = TON_UNKNOWN; | |
1866 | |
1867 /* Copy EOS */ | |
1868 calPrm->num[i] = '\0'; | |
1869 | |
1870 calPrm -> npi = NPI_ISDN_TEL_NUMB_PLAN; | |
1871 | |
1872 return 0; | |
1873 } | |
1874 | |
1875 /* | |
1876 +-------------------------------------------------------------------+ | |
1877 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
1878 | ROUTINE : percentCSTAT_stateField | | |
1879 +-------------------------------------------------------------------+ | |
1880 | |
1881 PURPOSE : This function calls the %CSTAT callback and | |
1882 handels the occurance of %CSTAT and | |
1883 %CSTAT: RDY indication. | |
1884 */ | |
1885 GLOBAL void percentCSTAT_indication(T_ACI_ENTITY_ID_MSG entityId, | |
1886 T_ACI_ENTITY_STATE_MSG entityState) | |
1887 { | |
1888 T_ACI_STATE_MSG msgType; | |
1889 int i = 0; | |
1890 msgType.entityId = entityId; | |
1891 msgType.entityState = entityState; | |
1892 | |
1893 for(; i < CMD_SRC_MAX; i++) | |
1894 { | |
1895 R_AT( RAT_CSTAT, i)(msgType); | |
1896 } | |
1897 if( (percentCSTAT_stateField >> entityId & 1U) EQ (unsigned) entityState ) | |
1898 { | |
1899 percentCSTAT_stateField ^= 1U << entityId; | |
1900 } | |
1901 | |
1902 if(!percentCSTAT_stateField) | |
1903 { | |
1904 msgType.entityId = STATE_MSG_RDY; | |
1905 for(i = 0; i < CMD_SRC_MAX; i++) | |
1906 { | |
1907 R_AT( RAT_CSTAT, i)(msgType); | |
1908 } | |
1909 } | |
1910 } | |
1911 | |
1912 | |
1913 /* | |
1914 +-------------------------------------------------------------------+ | |
1915 | PROJECT : MODULE : CMH_F | | |
1916 | ROUTINE : aci_rat_cmd_mode | | |
1917 +-------------------------------------------------------------------+ | |
1918 | |
1919 PURPOSE : This function is used by the R_AT macro and determines | |
1920 the command mode that should be used to send the response. | |
1921 | |
1922 */ | |
1923 GLOBAL T_ACI_CMD_MODE aci_rat_cmd_mode( | |
1924 RAT_ID cmd, | |
1925 T_ACI_CMD_SRC src) | |
1926 { | |
1927 T_ACI_CMD_MODE mode; | |
1928 | |
1929 if (src!=CMD_SRC_NONE) | |
1930 { | |
1931 if (src<CMD_SRC_MAX) | |
1932 { | |
1933 if (IS_SRC_USED(src)) | |
1934 { | |
1935 | |
1936 /* | |
1937 * Get the command mode for the specified source. | |
1938 */ | |
1939 mode = aci_cmd_src_mode_get(src); | |
1940 | |
1941 /* | |
1942 * If RATJmpTbl is populated for the specified command mode | |
1943 * and command, indicate this by returning the command mode. | |
1944 * The nature of the R_AT macro is such that it is not possible | |
1945 * to simply call the function in the table from here. | |
1946 */ | |
1947 if (mode NEQ CMD_MODE_NONE) | |
1948 { | |
1949 if (RATJmpTbl[cmd][mode]) | |
1950 { | |
1951 return(mode); | |
1952 } | |
1953 TRACE_EVENT_P2("RATJmpTbl[cmd=%d][mode=%d]", cmd, mode); /* in case of problems */ | |
1954 } | |
1955 } | |
1956 } | |
1957 } | |
1958 | |
1959 /* | |
1960 * A return value of CMD_MODE_NONE is meant to indicate that the | |
1961 * response should not be sent at all. | |
1962 */ | |
1963 TRACE_EVENT_P1("aci_rat_cmd_mode(): CMD_MODE_NONE for src %d", src); | |
1964 return(CMD_MODE_NONE); | |
1965 } | |
1966 | |
1967 /* | |
1968 +-------------------------------------------------------------------+ | |
1969 | PROJECT : MODULE : CMH_F | | |
1970 | ROUTINE : aci_cmd_src_mode_get | | |
1971 +-------------------------------------------------------------------+ | |
1972 | |
1973 PURPOSE : Access function for reading aci_cmd_src_mode[] which | |
1974 stores the command mode of each command source. | |
1975 | |
1976 */ | |
1977 GLOBAL T_ACI_CMD_MODE aci_cmd_src_mode_get( | |
1978 T_ACI_CMD_SRC src_id) | |
1979 { | |
1980 T_ACI_CMD_MODE mode; | |
1981 | |
1982 | |
1983 if (src_id<CMD_SRC_MAX) | |
1984 { | |
1985 mode = aci_cmd_src_mode[src_id]; | |
1986 TRACE_EVENT_P2("aci_cmd_src_mode_get(): aci_cmd_src_mode[%d] = %d", src_id, mode); | |
1987 return(mode); | |
1988 } | |
1989 else | |
1990 { | |
1991 TRACE_EVENT("aci_cmd_src_mode_get(): CMD_MODE_NONE"); | |
1992 return(CMD_MODE_NONE); | |
1993 } | |
1994 } | |
1995 | |
1996 | |
1997 /* | |
1998 +-------------------------------------------------------------------+ | |
1999 | PROJECT : MODULE : CMH_F | | |
2000 | ROUTINE : aci_cmd_src_mode_set | | |
2001 +-------------------------------------------------------------------+ | |
2002 | |
2003 PURPOSE : Access function for writing to aci_cmd_src_mode[] which | |
2004 stores the command mode of each command source. | |
2005 | |
2006 */ | |
2007 GLOBAL void aci_cmd_src_mode_set( | |
2008 UBYTE src_id, | |
2009 T_ACI_CMD_MODE mode) | |
2010 { | |
2011 if (src_id<CMD_SRC_MAX) | |
2012 { | |
2013 aci_cmd_src_mode[src_id]=mode; | |
2014 TRACE_EVENT_P2("aci_cmd_src_mode_set(): aci_cmd_src_mode[%d] = %d", src_id, mode); | |
2015 } | |
2016 } | |
2017 | |
2018 | |
2019 /*==== EOF ========================================================*/ |