comparison src/aci2/aci/cmh_ssr.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_SSR
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 the functions which are responsible
18 | for the responses of the protocol stack adapter for
19 | supplementary service.
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef CMH_SSR_C
24 #define CMH_SSR_C
25 #endif
26
27 #include "aci_all.h"
28 /*==== INCLUDES ===================================================*/
29 #include "aci_cmh.h"
30 #include "ati_cmd.h"
31 #include "aci_cmd.h"
32 #include "aci_mem.h"
33
34 #ifdef FAX_AND_DATA
35 #include "aci_fd.h"
36 #endif /* of #ifdef FAX_AND_DATA */
37
38 #include "ksd.h"
39 #include "aci.h"
40 #include "psa.h"
41 #include "psa_ss.h"
42 #include "psa_util.h"
43 #include "cmh.h"
44 #include "cmh_ss.h"
45
46 #include "psa_cc.h"
47 #ifdef SIM_TOOLKIT
48 #include "psa_sat.h"
49 #endif /* SIM_TOOLKIT */
50
51 #include "cmh_cc.h"
52
53 #ifdef FF_CPHS
54 #include "cphs.h"
55 #endif /* FF_CPHS */
56
57 /*==== CONSTANTS ==================================================*/
58
59 /*==== TYPES ======================================================*/
60
61 /*==== EXPORT =====================================================*/
62
63 /*==== VARIABLES ==================================================*/
64 EXTERN T_PCEER causeMod;
65 EXTERN SHORT causeCeer;
66
67 #define CF_LST_SIZE (sizeof(T_CF_FEAT)*MAX_CF_FEAT_NR)
68 #define CB_LST_SIZE (sizeof(T_CB_INFO)*MAX_CB_INFO_NR)
69 #define CW_LST_SIZE (sizeof(T_Cx_BSG) *MAX_CW_BSG_NR)
70 #define CC_LST_SIZE (sizeof(T_CC_FEAT)*MAX_CC_FEAT_NR)
71
72 #define MAX_LST_BUF (MAXIMUM(MAXIMUM(MAXIMUM(CF_LST_SIZE,CB_LST_SIZE),\
73 CW_LST_SIZE),\
74 CC_LST_SIZE))
75
76 LOCAL ULONG ssLstBuf[MAX_LST_BUF/sizeof(ULONG)];
77 EXTERN T_ACI_CUSCFG_PARAMS cuscfgParams;
78 EXTERN SHORT Ext_USSD_Res_Pending_sId;
79 EXTERN T_CUSDR_EXT_USSD_RES Ext_USSD_Res_Pending;
80
81 /*==== FUNCTIONS ==================================================*/
82
83 /*
84 +-------------------------------------------------------------------+
85 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
86 | ROUTINE : cmhSS_SSResultFailure |
87 +-------------------------------------------------------------------+
88
89 PURPOSE : A result was received, that is corrupt.
90
91 */
92
93 /* Check whether KSD returned with an error: TRUE if error, FALSE otherwise */
94 LOCAL BOOL check_ksd_error( T_OWN srcId, SHORT sId, T_ACI_KSIR * ksStat )
95 {
96 UBYTE err = KSD_NO_ERROR;
97
98 /* Check if this is a response generated by an error */
99 switch ( ksStat -> ksdCmd )
100 {
101 case( KSD_CMD_CF ):
102 err = ksStat->ir.rKSCF.ssErr;
103 break;
104 case( KSD_CMD_CW ):
105 err = ksStat->ir.rKSCW.ssErr;
106 break;
107 case( KSD_CMD_CB ):
108 err = ksStat->ir.rKSCB.ssErr;
109 break;
110 case( KSD_CMD_CL ):
111 err = ksStat->ir.rKSCL.ssErr;
112 break;
113 case( KSD_CMD_PWD ):
114 err = ksStat->ir.rKSPW.ssErr;
115 break;
116 case( KSD_CMD_USSD ):
117 err = ksStat->ir.rKSUS.ssErr;
118 break;
119
120 }
121 if( err NEQ KSD_NO_ERROR AND
122 srcId NEQ CMD_SRC_LCL ) /* MFW has its own implementation regarding errors in KSD */
123 {
124 TRACE_EVENT_P1( "SS error. Code error: %d", err);
125
126 return(TRUE);
127 }
128 return(FALSE);
129 }
130
131 GLOBAL void cmhSS_SSResultFailure( SHORT sId )
132 {
133 T_ACI_KSIR ksStat; /* holds KS status */
134 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
135 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
136
137 TRACE_FUNCTION ("cmhSS_SSResultFailure()");
138
139 switch( cmdBuf )
140 {
141 case( AT_CMD_NONE ): break;
142
143 case( KSD_CMD_CF ):
144 case( KSD_CMD_CW ):
145 case( KSD_CMD_CB ):
146 case( KSD_CMD_CL ):
147 case( KSD_CMD_PWD ):
148 case( KSD_CMD_USSD ):
149
150 memset( &ksStat, 0, sizeof(ksStat));
151
152 cmhSS_ksdBuildErrRslt( sId, &ksStat, KSD_NO_ERROR );
153
154 if(!check_ksd_error( owner, sId, &ksStat ))
155 {
156 /*
157 ** CQ12314 : NDH : 23/9/2003
158 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
159 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
160 */
161 ksStat.srcId = owner;
162
163 #if defined (MFW)
164 if (ksStat.srcId NEQ CMD_SRC_LCL)
165 {
166 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
167 }
168 #endif
169
170 R_AT( RAT_KSIR, owner )
171 ( &ksStat );
172 }
173
174 /* NO BREAK HERE... Continue... */
175
176 /* lint -fallthrough */
177 default:
178
179 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
180
181 if (owner > OWN_NONE AND owner < OWN_MAX) /* Just to remove LINT warning */
182 {
183 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
184 }
185
186 R_AT( RAT_CME, owner )
187 ( cmdBuf, CME_ERR_NotPresent );
188 cmh_logRslt ( owner, RAT_CME, cmdBuf, -1, -1, CME_ERR_NotPresent );
189 }
190
191 /* set service table entry to unused */
192 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
193
194 }
195
196 /*
197 +-------------------------------------------------------------------+
198 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
199 | ROUTINE : cmhSS_CLIP_Interrogated |
200 +-------------------------------------------------------------------+
201
202 PURPOSE : Interrogation result is available.
203
204 */
205
206 /* process result for +CLIP command */
207 LOCAL void cmhSS_CLIP_Interrogated( T_OWN owner, T_INTERROGATE_SS_RES *irgtSS )
208 {
209 T_ACI_CLIP_STAT clip_status;
210
211 TRACE_FUNCTION ("cmhSS_CLIP_Interrogated()");
212
213 if( ! irgtSS->interrogateSSRes.v_ssStatus )
214 {
215 clip_status = CLIP_STAT_Unknown; /* if no status is present */
216 }
217 else if( irgtSS->interrogateSSRes.ssStatus & SSS_P )
218 {
219 clip_status = CLIP_STAT_Prov; /* if service is provisioned */
220 }
221 else
222 {
223 clip_status = CLIP_STAT_NotProv; /* else service is not provisioned */
224 }
225
226 R_AT( RAT_CLIP, owner )
227 ( clip_status, NULL, NULL, PRES_NOT_PRES, NULL, NULL, NULL );
228
229 }
230
231 /*
232 +-------------------------------------------------------------------+
233 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
234 | ROUTINE : cmhSS_SSInterrogated |
235 +-------------------------------------------------------------------+
236
237 PURPOSE : Interrogation result is available.
238 Process result for +CDIP command
239 */
240 LOCAL void cmhSS_CDIP_Interrogated( T_OWN owner, T_INTERROGATE_SS_RES *irgtSS )
241 {
242 T_ACI_CDIP_STAT CDIP_status;
243
244 TRACE_FUNCTION ("cmhSS_CDIP_Interrogated()");
245
246 if( ! irgtSS->interrogateSSRes.v_ssStatus )
247 {
248 CDIP_status = CDIP_STAT_Unknown; /* if no status is present */
249 }
250 else if( irgtSS->interrogateSSRes.ssStatus & SSS_P )
251 {
252 CDIP_status = CDIP_STAT_Prov; /* if service is provisioned */
253 }
254 else
255 {
256 CDIP_status = CDIP_STAT_NotProv; /* else service is not provisioned */
257 }
258
259 R_AT( RAT_CDIP, owner )
260 ( NULL, NULL, NULL, NULL );
261
262 }
263
264 /* process result for +CLIR command */
265 LOCAL void cmhSS_CLIR_Interrogated( SHORT sId, T_INTERROGATE_SS_RES *irgtSS )
266 {
267 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
268 T_ACI_CLIR_STAT clir_status;
269 T_OWN owner;
270
271 TRACE_FUNCTION ("cmhSS_CLIR_Interrogated()");
272
273 owner = ssShrdPrm.stb[sId].srvOwn;
274 pCCCmdPrm = &cmhPrm[owner].ccCmdPrm;
275
276 if( irgtSS->interrogateSSRes.v_ssStatus ) /* if status is present */
277 {
278 if( irgtSS->interrogateSSRes.ssStatus & SSS_P ) /* if service is provisioned */
279 {
280 clir_status = CLIR_STAT_Permanent;
281 }
282 else /* else service is not provisioned */
283 {
284 clir_status = CLIR_STAT_NotProv;
285 }
286 }
287 else if( ! irgtSS->interrogateSSRes.v_cliRestrictionInfo OR
288 ! irgtSS->interrogateSSRes.cliRestrictionInfo.v_ssStatus ) /* if no status is present */
289 {
290 clir_status = CLIR_STAT_Unknown;
291 }
292 else if( irgtSS->interrogateSSRes.cliRestrictionInfo.ssStatus & SSS_P ) /* if service is provisioned */
293 {
294 /* check the restriction info */
295 if( irgtSS->interrogateSSRes.cliRestrictionInfo.v_cliRestrictionOption )
296 {
297 switch( irgtSS->
298 interrogateSSRes.cliRestrictionInfo.cliRestrictionOption )
299 {
300 case( CLIR_OPT_PERMANENT ):
301 clir_status = CLIR_STAT_Permanent;
302 break;
303
304 case( CLIR_OPT_TEMPORARY ):
305 clir_status = CLIR_STAT_RestrictTemp;
306 break;
307
308 case( CLIR_OPT_ALLOWED ):
309 clir_status = CLIR_STAT_AllowTemp;
310 break;
311
312 default:
313 clir_status = CLIR_STAT_Unknown;
314 }
315 }
316 /* else no restriction info present */
317 else
318 {
319 clir_status = CLIR_STAT_Unknown;
320 }
321 }
322 else /* else service is not provisioned */
323 {
324 clir_status = CLIR_STAT_NotProv;
325 }
326
327 /* sends indication to user */
328 R_AT( RAT_CLIR, owner )
329 ( pCCCmdPrm -> CLIRmode, clir_status );
330 }
331
332
333 /* process result for +COLP command */
334 LOCAL void cmhSS_COLP_Interrogated( T_OWN owner, T_INTERROGATE_SS_RES *irgtSS )
335 {
336 T_ACI_COLP_STAT colp_status;
337
338 TRACE_FUNCTION ("cmhSS_COLP_Interrogated()");
339
340 if( ! irgtSS->interrogateSSRes.v_ssStatus ) /* if no status is present */
341 {
342 colp_status = COLP_STAT_Unknown;
343 }
344 else if( irgtSS->interrogateSSRes.ssStatus & SSS_P ) /* if service is provisioned */
345 {
346 colp_status = COLP_STAT_Prov;
347 }
348 else /* else service is not provisioned */
349 {
350 colp_status = COLP_STAT_NotProv;
351 }
352
353 R_AT( RAT_COLP, owner )
354 ( colp_status, NULL, NULL, NULL, NULL, NULL );
355 }
356
357 /* process result for +COLR command */
358 LOCAL void cmhSS_COLR_Interrogated( T_OWN owner, T_INTERROGATE_SS_RES *irgtSS )
359 {
360 T_ACI_COLR_STAT colr_status;
361
362 TRACE_FUNCTION ("cmhSS_COLR_Interrogated()");
363
364 if( ! irgtSS->interrogateSSRes.v_ssStatus ) /* if no status is present */
365 {
366 colr_status = COLR_STAT_Unknown;
367 }
368 else if( irgtSS->interrogateSSRes.ssStatus & SSS_P ) /* if service is provisioned */
369 {
370 colr_status = COLR_STAT_Prov;
371 }
372 else /* else service is not provisioned */
373 {
374 colr_status = COLR_STAT_NotProv;
375 }
376
377 R_AT( RAT_COLR, owner )
378 ( colr_status );
379 }
380
381
382 LOCAL void cmhSS_CLCK_CCWA_Interrogated( SHORT sId, T_INTERROGATE_SS_RES *irgtSS, UBYTE cmdBuf )
383 {
384 T_ACI_CLSSTAT srvStat; /* holds service status */
385 USHORT queried_classes = ssShrdPrm.stb[sId].ClassType; /* classes queried by the user */
386 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
387
388 srvStat.status = STATUS_NotPresent; /* Lint */
389 srvStat.class_type = CLASS_NotPresent; /* Lint */
390
391 srvStat.class_type = CLASS_NotPresent;
392
393 /* if status is present, service is provisioned but not active for
394 any basic service type ref.GSM 04.83/1.6/Ver.5.0.0 and
395 ref.GSM 04.88/1.5/Ver.5.0.0 */
396 if( irgtSS->interrogateSSRes.v_ssStatus )
397 {
398 srvStat.status = (irgtSS->interrogateSSRes.ssStatus & SSS_A)?
399 STATUS_Active : STATUS_NotActive;
400 if ( cmdBuf EQ AT_CMD_CLCK )
401 srvStat.class_type = CLASS_VceDatFaxSms;
402 else
403 srvStat.class_type = CLASS_VceDatFax;
404 }
405
406 /* if BS group list is present, the service is active for the
407 containing BS/TS ref.GSM 04.83/1.6/Ver.5.0.0 and
408 ref.GSM 04.88/1.5/Ver.5.0.0 */
409 else if( irgtSS->interrogateSSRes.v_basicServiceGroupList )
410 {
411 /* no basic services present */
412 if( irgtSS->interrogateSSRes.basicServiceGroupList.c_bearerService EQ 0 AND
413 irgtSS->interrogateSSRes.basicServiceGroupList.c_teleservice EQ 0 )
414 {
415 TRACE_EVENT("UNEXP: NO BASIC SERVICES IN BASIC SERVICE LIST");
416 }
417
418 /* basic service list present */
419 else
420 {
421 srvStat.status = STATUS_Active;
422 srvStat.class_type =
423 cmhSS_GetClassLst( &irgtSS->interrogateSSRes.basicServiceGroupList );
424
425 TRACE_EVENT_P1("srvStat.class_type: %d",srvStat.class_type);
426 }
427 }
428
429 /* filter answer before sending message */
430 /* addition here because class values follow recommendation where each
431 class is bit represented */
432
433 TRACE_EVENT_P1("userClass: %d", queried_classes);
434
435 if( (srvStat.class_type & queried_classes) EQ 0 )
436 {
437 /* means classes queried by user are not active !! */
438 srvStat.status = STATUS_NotActive;
439 srvStat.class_type = queried_classes;
440 }
441 else
442 {
443 srvStat.class_type = srvStat.class_type & queried_classes;
444 }
445
446 switch( cmdBuf)
447 {
448 case( AT_CMD_CCWA ):
449 R_AT( RAT_CCWA, owner )
450 ( &srvStat, NULL, NULL, PRES_NOT_PRES, CLASS_NotPresent, NULL );
451 break;
452
453 case( AT_CMD_CLCK ):
454 R_AT( RAT_CLCK, owner )
455 ( &srvStat );
456 break;
457 }
458 }
459
460 /* process result for +CLCK command */
461 LOCAL void cmhSS_CLCK_Interrogated( SHORT sId, T_INTERROGATE_SS_RES *irgtSS )
462 {
463 TRACE_FUNCTION ("cmhSS_CLCK_Interrogated()");
464
465 cmhSS_CLCK_CCWA_Interrogated( sId, irgtSS, AT_CMD_CLCK );
466 }
467
468 /* process result for +CCWA command */
469 LOCAL void cmhSS_CCWA_Interrogated( SHORT sId, T_INTERROGATE_SS_RES *irgtSS )
470 {
471 TRACE_FUNCTION ("cmhSS_CCWA_Interrogated()");
472
473 cmhSS_CLCK_CCWA_Interrogated( sId, irgtSS, AT_CMD_CCWA );
474 }
475
476 /* process result for +CCFC command */
477 LOCAL void cmhSS_CCFC_Interrogated( SHORT sId, T_INTERROGATE_SS_RES *irgtSS )
478 {
479 T_ACI_CCFC_SET ccfcStat; /* holds CCFC service status */
480 UBYTE idx; /* holds list index */
481 UBYTE active_class_list = 0; /* list of active classes */
482 USHORT queried_classes = ssShrdPrm.stb[sId].ClassType; /* classes queried by the user */
483 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
484
485 TRACE_FUNCTION ("cmhSS_CCFC_Interrogated()");
486
487 /* if status is present, service is provisioned but not active for
488 any basic service type ref.GSM 04.82/x.6/Ver.5.0.0 */
489 if( irgtSS->interrogateSSRes.v_ssStatus )
490 {
491 ccfcStat.clsstat.status = (irgtSS->interrogateSSRes.ssStatus & SSS_A)?
492 STATUS_Active:STATUS_NotActive;
493 ccfcStat.number[0] = 0x0;
494 ccfcStat.type.npi = NPI_NotPresent;
495 ccfcStat.type.ton = TON_NotPresent;
496 ccfcStat.subaddr[0] = 0x0;
497 ccfcStat.satype.tos = TOS_NotPresent;
498 ccfcStat.satype.oe = OE_NotPresent;
499 ccfcStat.time = ACI_NumParmNotPresent;
500
501 ccfcStat.clsstat.class_type = CLASS_VceDatFax & queried_classes;
502
503 R_AT( RAT_CCFC, owner )
504 ( &ccfcStat );
505
506 return;
507
508 }
509
510 /* if forwarding feature list is present, decode the forwarding
511 information */
512 else if( irgtSS->interrogateSSRes.v_forwardingFeatureList )
513 {
514 /* no forwarding features present */
515 if( irgtSS->interrogateSSRes.forwardingFeatureList.c_ff EQ 0 )
516 {
517 TRACE_EVENT("UNEXP: NO BASIC SERVICES IN BASIC SERVICE LIST");
518 }
519
520 /* fowarding feature list present */
521 else
522 {
523 for( idx=0;
524 idx < irgtSS->interrogateSSRes.forwardingFeatureList.c_ff;
525 idx++ )
526 {
527 ccfcStat.clsstat.class_type =
528 cmhSS_GetClass( &irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].
529 basicService );
530
531 if( !irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].v_ssStatus )
532 {
533 ccfcStat.clsstat.status = STATUS_NotPresent;
534 }
535 else if( irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].ssStatus
536 & SSS_A )
537 {
538 ccfcStat.clsstat.status = STATUS_Active;
539 }
540 else
541 {
542 ccfcStat.clsstat.status = STATUS_NotActive;
543 }
544
545 if( irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].
546 v_forwardedToNumber AND
547 irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].
548 forwardedToNumber.c_bcdDigit )
549 {
550 utl_BCD2DialStr
551 (irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].
552 forwardedToNumber.bcdDigit,
553 ccfcStat.number,
554 irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].
555 forwardedToNumber.c_bcdDigit);
556
557 ccfcStat.type.npi = irgtSS->interrogateSSRes.forwardingFeatureList.
558 ff[idx].forwardedToNumber.npi;
559 ccfcStat.type.ton = irgtSS->interrogateSSRes.forwardingFeatureList.
560 ff[idx].forwardedToNumber.noa;
561 }
562 else
563 {
564 ccfcStat.number[0] = 0x0;
565 ccfcStat.type.npi = NPI_NotPresent;
566 ccfcStat.type.ton = TON_NotPresent;
567 }
568
569 if( irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].
570 v_forwardedToSubaddress AND
571 irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].
572 forwardedToSubaddress.c_bcdDigit)
573 {
574 utl_BCD2DialStr
575 (irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].
576 forwardedToSubaddress.bcdDigit,
577 ccfcStat.subaddr,
578 irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].
579 forwardedToSubaddress.c_bcdDigit);
580
581 ccfcStat.satype.tos = irgtSS->interrogateSSRes.
582 forwardingFeatureList.ff[idx].
583 forwardedToSubaddress.tos;
584 ccfcStat.satype.oe = irgtSS->interrogateSSRes.
585 forwardingFeatureList.ff[idx].
586 forwardedToSubaddress.oei;
587 }
588 else
589 {
590 ccfcStat.subaddr[0] = 0x0;
591 ccfcStat.satype.tos = TOS_NotPresent;
592 ccfcStat.satype.oe = OE_NotPresent;
593 }
594
595 if( irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].
596 v_noReplyConditionTime)
597 ccfcStat.time = irgtSS->interrogateSSRes.forwardingFeatureList.ff[idx].
598 noReplyConditionTime;
599 else
600 ccfcStat.time = ACI_NumParmNotPresent;
601
602 TRACE_EVENT_P1("network class: %d", ccfcStat.clsstat.class_type);
603 TRACE_EVENT_P1("userClass: %d", queried_classes);
604 TRACE_EVENT_P1("status: %d", ccfcStat.clsstat.status);
605
606 if( ccfcStat.clsstat.status EQ STATUS_Active )
607 {
608 active_class_list += ccfcStat.clsstat.class_type;
609
610 if( (ccfcStat.clsstat.class_type & queried_classes) NEQ 0 )
611 /* filter what the user has queried */
612 {
613 R_AT( RAT_CCFC, owner )
614 ( &ccfcStat );
615 }
616 }
617 }
618
619 if( (active_class_list EQ 0) /* means there are no active classes */
620 OR
621 ((active_class_list & queried_classes) EQ 0) /* means user querried unactive classes */ )
622 {
623 ccfcStat.clsstat.class_type = CLASS_VceDatFax & queried_classes;
624 ccfcStat.clsstat.status = STATUS_NotActive;
625
626 R_AT( RAT_CCFC, owner )
627 ( &ccfcStat );
628 }
629 }
630 }
631 }
632
633 /* process result for %CCBS command */
634 LOCAL void cmhSS_CCBS_Interrogated( T_OWN owner, T_INTERROGATE_SS_RES *irgtSS )
635 {
636 T_ACI_CCBS_STAT ccbsStat; /* holds CCBS service status */
637 UBYTE idx; /* holds list index */
638 T_ACI_CCBS_SET ccbsSet; /* holds CCBS service status */
639
640 TRACE_FUNCTION ("cmhSS_CCBS_Interrogated()");
641
642 /* if present, decode the CCBS information */
643 if( irgtSS->interrogateSSRes.v_cliRestrictionInfo )
644 {
645 if( !irgtSS->interrogateSSRes.cliRestrictionInfo.v_ssStatus )
646 ccbsStat = CCBS_STAT_NotPresent;
647 else
648 {
649 if(!(irgtSS->interrogateSSRes.cliRestrictionInfo.ssStatus
650 & SSS_P))
651 ccbsStat = CCBS_STAT_NotProvisioned;
652 else if( irgtSS->interrogateSSRes.cliRestrictionInfo.ssStatus
653 & SSS_A )
654 ccbsStat = CCBS_STAT_Active;
655 else
656 ccbsStat = CCBS_STAT_Provisioned;
657 }
658
659 /* no CCBS features present */
660 if( irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.c_ccbsf EQ 0 )
661 {
662 TRACE_EVENT("UNEXP: NO FEATURES IN CCBS FEATURE LIST");
663
664 cmhrat_ccbs( (UBYTE)owner, CCBS_IND_IrgtResult, ccbsStat, NULL );
665 }
666
667 /* CCBS feature list present */
668 else
669 {
670 ccbsStat = CCBS_STAT_Active;
671
672 for( idx=0;
673 idx < irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.c_ccbsf;
674 idx++ )
675 {
676 if( irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.ccbsf[idx].
677 v_b_subscriberNumber AND
678 irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.ccbsf[idx].
679 b_subscriberNumber.c_bcdDigit )
680 {
681 utl_BCD2DialStr
682 (irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.ccbsf[idx].
683 b_subscriberNumber.bcdDigit,
684 ccbsSet.number,
685 irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.ccbsf[idx].
686 b_subscriberNumber.c_bcdDigit);
687
688 ccbsSet.type.npi = irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.
689 ccbsf[idx].b_subscriberNumber.npi;
690 ccbsSet.type.ton = irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.
691 ccbsf[idx].b_subscriberNumber.noa;
692 }
693 else
694 {
695 ccbsSet.number[0] = 0x0;
696 ccbsSet.type.npi = NPI_NotPresent;
697 ccbsSet.type.ton = TON_NotPresent;
698 }
699
700 if( irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.ccbsf[idx].
701 v_b_subscriberSubaddress AND
702 irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.ccbsf[idx].
703 b_subscriberSubaddress.c_bcdDigit )
704 {
705 utl_BCD2DialStr
706 (irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.ccbsf[idx].b_subscriberSubaddress.bcdDigit,
707 ccbsSet.subaddr,
708 irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.ccbsf[idx].b_subscriberSubaddress.c_bcdDigit);
709
710 ccbsSet.satype.tos = irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.
711 ccbsf[idx].b_subscriberSubaddress.tos;
712 ccbsSet.satype.oe = irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.
713 ccbsf[idx].b_subscriberSubaddress.oei;
714 }
715 else
716 {
717 ccbsSet.subaddr[0] = 0x0;
718 ccbsSet.satype.tos = TOS_NotPresent;
719 ccbsSet.satype.oe = OE_NotPresent;
720 }
721
722 if( irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.ccbsf[idx].
723 v_ccbsIndex )
724 ccbsSet.idx = irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.
725 ccbsf[idx].ccbsIndex;
726 else
727 ccbsSet.idx = ACI_NumParmNotPresent;
728
729 if( irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.ccbsf[idx].
730 v_basicServiceGroup )
731 ccbsSet.class_type =
732 cmhSS_GetClass( (T_basicService*)&irgtSS->interrogateSSRes.cliRestrictionInfo.
733 ccbsFeatureList.ccbsf[idx].basicServiceGroup );
734 else
735 ccbsSet.class_type = CLASS_NotPresent;
736
737 ccbsSet.alrtPtn = ALPT_NotPresent;
738
739 cmhrat_ccbs( (UBYTE)owner, CCBS_IND_IrgtResult, ccbsStat, &ccbsSet );
740 }
741 }
742 }
743 }
744
745 /* process result for KSD CF command */
746 LOCAL void cmhSS_KSDCF_Interrogated( SHORT sId, T_INTERROGATE_SS_RES *irgtSS )
747 {
748 T_ACI_KSIR ksStat; /* holds KS status */
749 T_CF_FEAT *cfFeat; /* points to CF feature list element */
750 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
751 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
752
753 TRACE_FUNCTION ("cmhSS_KSDCF_Interrogated()");
754
755 cfFeat = (T_CF_FEAT *)ssLstBuf;
756 memset( &ksStat, 0, sizeof(ksStat));
757
758 ksStat.ksdCmd = KSD_CMD_CF;
759 ksStat.ir.rKSCF.opCd = KSD_OP_IRGT;
760 ksStat.ir.rKSCF.ssCd = ssShrdPrm.stb[sId].ssCode;
761 ksStat.ir.rKSCF.ssErr = KSD_NO_ERROR;
762
763 /* if status is present, service is provisioned but not active for
764 any basic service type ref.GSM 04.82/x.6/Ver.5.0.0 */
765 if( irgtSS->interrogateSSRes.v_ssStatus )
766 {
767 ksStat.ir.rKSCF.c_cfFeatLst = 1;
768 ksStat.ir.rKSCF.cfFeatLst = cfFeat;
769
770 cfFeat->ssSt = irgtSS->interrogateSSRes.ssStatus;
771 cfFeat->bsTp = KSD_BS_TP_None;
772 cfFeat->bsCd = KSD_BS_TeleBearerUnknown;
773
774 cfFeat->npi = 0xFF;
775 cfFeat->ton = 0xFF;
776 cfFeat->tos = 0xFF;
777 cfFeat->oe = 0xFF;
778 cfFeat->time = 0xFF;
779 }
780
781 /* if forwarding number present, copy the number parameters */
782 else if( irgtSS->interrogateSSRes.v_forwardedToNumber )
783 {
784 ksStat.ir.rKSCF.c_cfFeatLst = 1;
785 ksStat.ir.rKSCF.cfFeatLst = cfFeat;
786
787 cfFeat->ssSt = KSD_ST_NOT_VALID;
788 cfFeat->bsTp = KSD_BS_TP_None;
789 cfFeat->bsCd = KSD_BS_TeleBearerUnknown;
790
791 if( irgtSS->interrogateSSRes.forwardedToNumber.c_bcdDigit )
792 {
793 utl_BCD2DialStr
794 (irgtSS->interrogateSSRes.forwardedToNumber.bcdDigit,
795 (char*)cfFeat->num,
796 irgtSS->interrogateSSRes.forwardedToNumber.c_bcdDigit);
797
798 cfFeat->npi = irgtSS->interrogateSSRes.forwardedToNumber.npi;
799 cfFeat->ton = irgtSS->interrogateSSRes.forwardedToNumber.noa;
800 }
801 else
802 {
803 cfFeat->npi = 0xFF;
804 cfFeat->ton = 0xFF;
805 }
806
807 cfFeat->tos = 0xFF;
808 cfFeat->oe = 0xFF;
809 cfFeat->time = 0xFF;
810 }
811
812 /* if forwarding feature list is present, decode the forwarding
813 information */
814 else if( irgtSS->interrogateSSRes.v_forwardingFeatureList )
815 {
816 /* no forwarding features present */
817 if( irgtSS->interrogateSSRes.forwardingFeatureList.c_ff EQ 0 )
818 {
819 TRACE_EVENT("UNEXP: NO BASIC SERVICES IN BASIC SERVICE LIST");
820 }
821
822 /* fowarding feature list present */
823 else
824 {
825 ksStat.ir.rKSCF.cfFeatLst = cfFeat;
826
827 ksStat.ir.rKSCF.c_cfFeatLst =
828 cmhSS_ksdFillFwdFeatList( &irgtSS->interrogateSSRes.forwardingFeatureList,
829 cfFeat );
830 }
831 }
832
833 if(check_ksd_error( owner, sId, &ksStat ))
834 {
835 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
836
837 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
838
839 R_AT( RAT_CME, owner )
840 ( cmdBuf, CME_ERR_NotPresent );
841 }
842 else
843 {
844 /*
845 ** CQ12314 : NDH : 23/9/2003
846 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
847 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
848 */
849 ksStat.srcId = owner;
850
851 #if defined (MFW)
852 if (ksStat.srcId NEQ CMD_SRC_LCL)
853 {
854 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
855 }
856 #endif
857
858 R_AT( RAT_KSIR, owner )
859 ( &ksStat );
860 }
861 }
862
863 /* process result for KSD CB command */
864 LOCAL void cmhSS_KSDCB_Interrogated( SHORT sId, T_INTERROGATE_SS_RES *irgtSS )
865 {
866 T_CB_INFO * cbInfo; /* points to CB information element */
867 T_ACI_KSIR ksStat; /* holds KS status */
868 UBYTE lstSpce; /* holds list space */
869 UBYTE idx; /* holds list index */
870 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
871 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
872
873 TRACE_FUNCTION ("cmhSS_KSDCB_Interrogated()");
874
875 cbInfo = (T_CB_INFO *)ssLstBuf;
876 memset( &ksStat, 0, sizeof(ksStat));
877
878 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
879
880 ksStat.ksdCmd = KSD_CMD_CB;
881 ksStat.ir.rKSCB.opCd = KSD_OP_IRGT;
882 ksStat.ir.rKSCB.ssCd = ssShrdPrm.stb[sId].ssCode;
883 ksStat.ir.rKSCB.ssErr = KSD_NO_ERROR;
884
885 /* if status is present, service is provisioned but not active for
886 any basic service type ref.GSM 04.83/1.6/Ver.5.0.0 and
887 ref.GSM 04.88/1.5/Ver.5.0.0 */
888 if( irgtSS->interrogateSSRes.v_ssStatus )
889 {
890 ksStat.ir.rKSCB.c_cbInfoLst = 1;
891 ksStat.ir.rKSCB.cbInfoLst = cbInfo;
892 cbInfo->ssSt = irgtSS->interrogateSSRes.ssStatus;
893 cbInfo->bsTp = KSD_BS_TP_None;
894 cbInfo->bsCd = KSD_BS_TeleBearerUnknown;
895 }
896
897 /* if BS group list is present, the service is active for the
898 containing BS/TS ref.GSM 04.83/1.6/Ver.5.0.0 and
899 ref.GSM 04.88/1.5/Ver.5.0.0 */
900 else if( irgtSS->interrogateSSRes.v_basicServiceGroupList )
901 {
902 /* no basic services present */
903 if( irgtSS->interrogateSSRes.basicServiceGroupList.c_teleservice EQ 0 AND
904 irgtSS->interrogateSSRes.basicServiceGroupList.c_bearerService EQ 0 )
905 {
906 TRACE_EVENT("UNEXP: NO BASIC SERVICES IN BASIC SERVICE LIST");
907 }
908
909 /* basic service list present */
910 else
911 {
912 TRACE_EVENT("Basic service list is present: Status is SET for these services");
913
914 ksStat.ir.rKSCB.cbInfoLst = cbInfo;
915
916 lstSpce = MAX_CB_INFO_NR;
917
918 for( idx=0;
919 idx < irgtSS->interrogateSSRes.basicServiceGroupList.
920 c_teleservice AND lstSpce;
921 idx++, cbInfo++, lstSpce-- )
922 {
923 cbInfo->bsCd = irgtSS->interrogateSSRes.basicServiceGroupList.
924 teleservice[idx];
925 cbInfo->bsTp = KSD_BS_TP_Tele;
926 cbInfo->ssSt = KSD_ST_A;
927 }
928
929 for( idx=0;
930 idx < irgtSS->interrogateSSRes.basicServiceGroupList.
931 c_bearerService AND lstSpce;
932 idx++, cbInfo++, lstSpce-- )
933 {
934 cbInfo->bsCd = irgtSS->interrogateSSRes.basicServiceGroupList.
935 bearerService[idx];
936 cbInfo->bsTp = KSD_BS_TP_Bearer;
937 cbInfo->ssSt = KSD_ST_A;
938 }
939
940 ksStat.ir.rKSCB.c_cbInfoLst = MAX_CB_INFO_NR - lstSpce;
941 }
942 }
943
944 if(check_ksd_error( owner, sId, &ksStat ))
945 {
946 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
947
948 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
949
950 R_AT( RAT_CME, owner )
951 ( cmdBuf, CME_ERR_NotPresent );
952 }
953 else
954 {
955 /*
956 ** CQ12314 : NDH : 23/9/2003
957 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
958 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
959 */
960 ksStat.srcId = owner;
961
962 #if defined (MFW)
963 if (ksStat.srcId NEQ CMD_SRC_LCL)
964 {
965 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
966 }
967 #endif
968
969 R_AT( RAT_KSIR, owner )
970 ( &ksStat );
971 }
972 }
973
974 /* process result for KSD CW command */
975 LOCAL void cmhSS_KSDCW_Interrogated( SHORT sId, T_INTERROGATE_SS_RES *irgtSS )
976 {
977 T_ACI_KSIR ksStat; /* holds KS status */
978 T_Cx_BSG * cxBSG; /* points to Cx basic service group element */
979 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
980 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
981
982 TRACE_FUNCTION ("cmhSS_KSDCW_Interrogated()");
983
984 cxBSG = (T_Cx_BSG *)ssLstBuf;
985 memset( &ksStat, 0, sizeof(ksStat));
986
987 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
988
989 ksStat.ksdCmd = KSD_CMD_CW;
990 ksStat.ir.rKSCW.opCd = KSD_OP_IRGT;
991 ksStat.ir.rKSCW.ssCd = ssShrdPrm.stb[sId].ssCode;
992 ksStat.ir.rKSCW.ssErr = KSD_NO_ERROR;
993
994 ksStat.ir.rKSCW.ssSt = KSD_ST_NOT_VALID;
995
996 /* if status is present, service is provisioned but not active for
997 any basic service type ref.GSM 04.83/1.6/Ver.5.0.0 and
998 ref.GSM 04.88/1.5/Ver.5.0.0 */
999 if( irgtSS->interrogateSSRes.v_ssStatus )
1000 {
1001 ksStat.ir.rKSCW.ssSt = irgtSS->interrogateSSRes.ssStatus;
1002 ksStat.ir.rKSCW.c_cwBSGLst = 1;
1003 ksStat.ir.rKSCW.cwBSGLst = cxBSG;
1004 cxBSG->bsTp = KSD_BS_TP_None;
1005 cxBSG->bsCd = KSD_BS_TeleBearerUnknown;
1006 }
1007
1008 /* if BS group list is present, the service is active for the
1009 containing BS/TS ref.GSM 04.83/1.6/Ver.5.0.0 and
1010 ref.GSM 04.88/1.5/Ver.5.0.0 */
1011 else if( irgtSS->interrogateSSRes.v_basicServiceGroupList )
1012 {
1013 /* no basic services present */
1014 if( irgtSS->interrogateSSRes.basicServiceGroupList.c_bearerService EQ 0 AND
1015 irgtSS->interrogateSSRes.basicServiceGroupList.c_teleservice EQ 0 )
1016 {
1017 TRACE_EVENT("UNEXP: NO BASIC SERVICES IN BASIC SERVICE LIST");
1018 }
1019
1020 /* basic service list present */
1021 else
1022 {
1023 ksStat.ir.rKSCW.ssSt = KSD_ST_A;
1024 ksStat.ir.rKSCW.cwBSGLst = cxBSG;
1025
1026 ksStat.ir.rKSCW.c_cwBSGLst =
1027 cmhSS_ksdFillBSGList ( &irgtSS->interrogateSSRes.basicServiceGroupList,
1028 cxBSG );
1029 }
1030 }
1031
1032 if(check_ksd_error( owner, sId, &ksStat ))
1033 {
1034 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1035
1036 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
1037
1038 R_AT( RAT_CME, owner )
1039 ( cmdBuf, CME_ERR_NotPresent );
1040 }
1041 else
1042 {
1043 /*
1044 ** CQ12314 : NDH : 23/9/2003
1045 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
1046 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
1047 */
1048 ksStat.srcId = owner;
1049
1050 #if defined (MFW)
1051 if (ksStat.srcId NEQ CMD_SRC_LCL)
1052 {
1053 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
1054 }
1055 #endif
1056
1057 R_AT( RAT_KSIR, owner )
1058 ( &ksStat );
1059 }
1060 }
1061
1062 /* process result for KSD CL command */
1063 LOCAL void cmhSS_KSDCL_Interrogated( SHORT sId, T_INTERROGATE_SS_RES *irgtSS )
1064 {
1065 T_ACI_KSIR ksStat; /* holds KS status */
1066 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
1067 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
1068 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
1069
1070 TRACE_FUNCTION ("cmhSS_KSDCL_Interrogated()");
1071
1072 pCCCmdPrm = &cmhPrm[owner].ccCmdPrm;
1073
1074 ksStat.ir.rKSCL.mode = pCCCmdPrm -> CLIRmode;
1075
1076 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1077
1078 ksStat.ksdCmd = KSD_CMD_CL;
1079 ksStat.ir.rKSCL.opCd = KSD_OP_IRGT;
1080 ksStat.ir.rKSCL.ssCd = ssShrdPrm.stb[sId].ssCode;
1081 ksStat.ir.rKSCL.ssErr = KSD_NO_ERROR;
1082
1083 if( irgtSS->interrogateSSRes.v_ssStatus )
1084 {
1085 ksStat.ir.rKSCL.ssSt = irgtSS->interrogateSSRes.ssStatus;
1086 }
1087
1088 if( irgtSS->interrogateSSRes.v_cliRestrictionInfo )
1089 {
1090 ksStat.ir.rKSCL.ssSt =
1091 (irgtSS->interrogateSSRes.cliRestrictionInfo.v_ssStatus)?
1092 irgtSS->interrogateSSRes.cliRestrictionInfo.ssStatus:
1093 (U8)KSD_ST_NOT_VALID;
1094
1095 ksStat.ir.rKSCL.clirOpt =
1096 (irgtSS->interrogateSSRes.cliRestrictionInfo.v_cliRestrictionOption)?
1097 irgtSS->interrogateSSRes.cliRestrictionInfo.cliRestrictionOption:
1098 (U8)KSD_CO_NOT_VALID;
1099 }
1100
1101 if(check_ksd_error( owner, sId, &ksStat ))
1102 {
1103 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1104
1105 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
1106
1107 R_AT( RAT_CME, owner )
1108 ( cmdBuf, CME_ERR_NotPresent );
1109 }
1110 else
1111 {
1112 /*
1113 ** CQ12314 : NDH : 23/9/2003
1114 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
1115 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
1116 */
1117 ksStat.srcId = owner;
1118
1119 #if defined (MFW)
1120 if (ksStat.srcId NEQ CMD_SRC_LCL)
1121 {
1122 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
1123 }
1124 #endif
1125
1126 R_AT( RAT_KSIR, owner )
1127 ( &ksStat );
1128 }
1129 }
1130
1131 /* process result for KSD CCBS command */
1132 LOCAL void cmhSS_KSDCCBS_Interrogated( SHORT sId, T_INTERROGATE_SS_RES *irgtSS )
1133 {
1134 T_ACI_KSIR ksStat; /* holds KS status */
1135 T_CC_FEAT * ccFeat; /* points to CC feature list element */
1136 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
1137 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
1138
1139 TRACE_FUNCTION ("cmhSS_KSDCCBS_Interrogated()");
1140
1141 ccFeat = (T_CC_FEAT *)ssLstBuf;
1142 memset( &ksStat, 0, sizeof(ksStat));
1143
1144 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1145
1146 ksStat.ksdCmd = KSD_CMD_CCBS;
1147 ksStat.ir.rKSCF.opCd = KSD_OP_IRGT;
1148 ksStat.ir.rKSCF.ssCd = ssShrdPrm.stb[sId].ssCode;
1149 ksStat.ir.rKSCF.ssErr = KSD_NO_ERROR;
1150
1151 /* if present, decode the CCBS information */
1152 if( irgtSS->interrogateSSRes.v_cliRestrictionInfo )
1153 {
1154 ksStat.ir.rKSCL.ssSt =
1155 (irgtSS->interrogateSSRes.cliRestrictionInfo.v_ssStatus)?
1156 irgtSS->interrogateSSRes.cliRestrictionInfo.ssStatus:
1157 (U8)KSD_ST_NOT_VALID;
1158
1159 /* no CCBS features present */
1160 if( irgtSS->interrogateSSRes.cliRestrictionInfo.ccbsFeatureList.c_ccbsf EQ 0 )
1161 {
1162 TRACE_EVENT("UNEXP: NO FEATURES IN CCBS FEATURE LIST");
1163 }
1164
1165 /* CCBS feature list present */
1166 else
1167 {
1168 ksStat.ir.rKSCC.ccFeatLst = ccFeat;
1169
1170 ksStat.ir.rKSCC.c_ccFeatLst =
1171 cmhSS_ksdFillCCBSFeatList( &irgtSS->interrogateSSRes.cliRestrictionInfo.
1172 ccbsFeatureList,
1173 ccFeat );
1174 }
1175 }
1176
1177 if(check_ksd_error( owner, sId, &ksStat ))
1178 {
1179 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1180
1181 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
1182
1183 R_AT( RAT_CME, owner )
1184 ( cmdBuf, CME_ERR_NotPresent );
1185 }
1186 else
1187 {
1188 /*
1189 ** CQ12314 : NDH : 23/9/2003
1190 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
1191 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
1192 */
1193 ksStat.srcId = owner;
1194
1195 #if defined (MFW)
1196 if (ksStat.srcId NEQ CMD_SRC_LCL)
1197 {
1198 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
1199 }
1200 #endif
1201
1202 R_AT( RAT_KSIR, owner )
1203 ( &ksStat );
1204 }
1205 }
1206
1207 LOCAL void cmhSS_CNAP_Interrogated( T_OWN owner, T_INTERROGATE_SS_RES *irgtSS )
1208 {
1209 T_ACI_CNAP_STATUS status = CNAP_SERVICE_STATUS_UNKNOWN;
1210
1211 TRACE_FUNCTION ("cmhSS_CNAP_Interrogated()");
1212
1213 if( irgtSS->interrogateSSRes.v_ssStatus )
1214 {
1215 TRACE_EVENT("service status information present");
1216 status = (irgtSS->interrogateSSRes.ssStatus & SSS_P)? CNAP_SERVICE_PROVISIONED : CNAP_SERVICE_NOT_PROVISIONED;
1217 }
1218
1219 R_AT( RAT_CNAP, owner )
1220 ( NULL, status );
1221 }
1222
1223 GLOBAL void cmhSS_SSInterrogated( SHORT sId, T_INTERROGATE_SS_RES *irgtSS )
1224 {
1225 T_SS_CMD_PRM *pSSCmdPrm; /* points to SS command parameters */
1226 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
1227 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
1228
1229 TRACE_FUNCTION ("cmhSS_SSInterrogated()");
1230
1231 pSSCmdPrm = &cmhPrm[owner].ssCmdPrm;
1232
1233 /* check for command context */
1234 switch( cmdBuf )
1235 {
1236 case( AT_CMD_CLIP ):
1237 cmhSS_CLIP_Interrogated( owner, irgtSS );
1238 break;
1239
1240 case( AT_CMD_CDIP ):
1241 cmhSS_CDIP_Interrogated( owner, irgtSS );
1242 break;
1243
1244 case( AT_CMD_CLIR ):
1245 cmhSS_CLIR_Interrogated( sId, irgtSS );
1246 break;
1247
1248 case( AT_CMD_COLP ):
1249 cmhSS_COLP_Interrogated( owner, irgtSS );
1250 break;
1251
1252 case( AT_CMD_COLR ):
1253 cmhSS_COLR_Interrogated( owner, irgtSS );
1254 break;
1255
1256 case( AT_CMD_CCWA ):
1257 /* if the service is not provisioned by the network, an error component was received.
1258 This is not handled here, see cmhSS_ErrorReturn() */
1259 cmhSS_tstAndUnflagTrn( sId, &(pSSCmdPrm -> mltyTrnFlg));
1260 cmhSS_CCWA_Interrogated( sId, irgtSS );
1261 break;
1262
1263 case( AT_CMD_CLCK ):
1264 /* if the service is not provisioned by the network, an error component was received.
1265 This is not handled here, see cmhSS_ErrorReturn() */
1266 cmhSS_tstAndUnflagTrn( sId, &(pSSCmdPrm -> mltyTrnFlg));
1267 cmhSS_CLCK_Interrogated( sId, irgtSS );
1268 break;
1269
1270 case( AT_CMD_CCFC ):
1271 cmhSS_tstAndUnflagTrn( sId, &(pSSCmdPrm -> mltyTrnFlg));
1272 /* if the service is not provisioned by the network, an error component was received.
1273 This is not handled here, see cmhSS_ErrorReturn() */
1274 cmhSS_CCFC_Interrogated( sId, irgtSS );
1275 break;
1276
1277 case( AT_CMD_CCBS ):
1278 cmhSS_CCBS_Interrogated( owner, irgtSS );
1279 break;
1280
1281 /* process result for KSD CF command */
1282 case( KSD_CMD_CF ):
1283 cmhSS_KSDCF_Interrogated( sId, irgtSS );
1284 break;
1285
1286 case( KSD_CMD_CB ):
1287 cmhSS_KSDCB_Interrogated( sId, irgtSS );
1288 break;
1289
1290 case( KSD_CMD_CW ):
1291 cmhSS_KSDCW_Interrogated( sId, irgtSS );
1292 break;
1293
1294 case( KSD_CMD_CL ):
1295 cmhSS_KSDCL_Interrogated( sId, irgtSS );
1296 break;
1297
1298 case( KSD_CMD_CCBS ):
1299 cmhSS_KSDCCBS_Interrogated( sId, irgtSS );
1300 break;
1301
1302 case( AT_CMD_CNAP ):
1303 cmhSS_CNAP_Interrogated( owner, irgtSS );
1304 break;
1305 }
1306
1307 /* set service table entry to unused */
1308 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
1309
1310 R_AT( RAT_OK, owner )
1311 ( cmdBuf );
1312 cmh_logRslt( owner, RAT_OK, cmdBuf, -1, -1, -1 );
1313
1314 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1315 }
1316
1317 /*
1318 +-------------------------------------------------------------------+
1319 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
1320 | ROUTINE : cmhSS_SSRegistered |
1321 +-------------------------------------------------------------------+
1322
1323 PURPOSE : SS registration result is available.
1324
1325 */
1326
1327 GLOBAL void cmhSS_SSRegistrated( SHORT sId,
1328 T_REGISTER_SS_RES *regSS )
1329 {
1330 T_SS_CMD_PRM *pSSCmdPrm; /* points to SS command parameters */
1331 T_ACI_KSIR ksStat; /* holds KS status */
1332 T_CF_FEAT *cfFeat; /* points to CF feature list element */
1333 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
1334 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
1335
1336 TRACE_FUNCTION ("cmhSS_SSRegistrated()");
1337
1338 /* check for command context */
1339 switch( ssShrdPrm.stb[sId].curCmd )
1340 {
1341 /* process result for +CCFC command */
1342 case( AT_CMD_CCFC ):
1343
1344 pSSCmdPrm = &cmhPrm[owner].ssCmdPrm;
1345
1346 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1347
1348 if( !regSS -> ssInfo.v_forwardingInfo )
1349 {
1350 TRACE_EVENT( "WRONG SS INFO DURING REGISTER CF" );
1351 }
1352
1353 /* terminate command */
1354 if( cmhSS_tstAndUnflagTrn( sId, &(pSSCmdPrm -> mltyTrnFlg)))
1355 {
1356 if( pSSCmdPrm -> mltyTrnFlg EQ 0 ) /* if last service */
1357 {
1358 R_AT( RAT_OK, owner )
1359 ( AT_CMD_CCFC );
1360 cmh_logRslt ( owner, RAT_OK, AT_CMD_CCFC, -1, -1, -1 );
1361 }
1362 }
1363 break;
1364
1365 /* process result for KSD CF command */
1366 case( KSD_CMD_CF ):
1367
1368 cfFeat = (T_CF_FEAT *)ssLstBuf;
1369 memset( &ksStat, 0, sizeof(ksStat));
1370
1371 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1372
1373 ksStat.ksdCmd = KSD_CMD_CF;
1374 ksStat.ir.rKSCF.opCd = KSD_OP_REG;
1375 ksStat.ir.rKSCF.ssErr = KSD_NO_ERROR;
1376
1377 if( regSS->ssInfo.v_forwardingInfo )
1378 {
1379 cmhSS_ksdFillFwdRes( &regSS->ssInfo.forwardingInfo,
1380 &ksStat, cfFeat );
1381 #if defined(MFW) OR defined(FF_MMI_RIV)
1382 if (ksStat.ir.rKSCF.ssCd EQ KSD_SS_NONE)
1383 ksStat.ir.rKSCF.ssCd = ssShrdPrm.stb[sId].ssCode; /* 1a) help the BMI about the last code (o2 - de) */
1384 #endif
1385 }
1386 #if defined(MFW) OR defined(FF_MMI_RIV)
1387 else
1388 {
1389 ksStat.ir.rKSCF.ssCd = ssShrdPrm.stb[sId].ssCode; /* 2a) help the BMI about the last code */
1390 }
1391 #endif
1392
1393 if(check_ksd_error( owner, sId, &ksStat ))
1394 {
1395 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1396
1397 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
1398
1399 R_AT( RAT_CME, owner )
1400 ( cmdBuf, CME_ERR_NotPresent );
1401 }
1402 else
1403 {
1404 /*
1405 ** CQ12314 : NDH : 23/9/2003
1406 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
1407 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
1408 */
1409 ksStat.srcId = owner;
1410
1411 #if defined (MFW)
1412 if (ksStat.srcId NEQ CMD_SRC_LCL)
1413 {
1414 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
1415 }
1416 #endif
1417
1418 R_AT( RAT_KSIR, owner )
1419 ( &ksStat );
1420
1421 /* terminate command */
1422 R_AT( RAT_OK, owner )
1423 ( KSD_CMD_CF );
1424 cmh_logRslt ( owner, RAT_OK, KSD_CMD_CF, -1, -1, -1 );
1425 }
1426 break;
1427 }
1428
1429 /* set service table entry to unused */
1430 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
1431 }
1432
1433 /*
1434 +-------------------------------------------------------------------+
1435 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
1436 | ROUTINE : cmhSS_SSErased |
1437 +-------------------------------------------------------------------+
1438
1439 PURPOSE : SS erasure result is available.
1440
1441 */
1442
1443 GLOBAL void cmhSS_SSErased( SHORT sId,
1444 T_ERASE_SS_RES *ersSS )
1445 {
1446 T_SS_CMD_PRM * pSSCmdPrm; /* points to SS command parameters */
1447 T_ACI_KSIR ksStat; /* holds KS status */
1448 T_CF_FEAT * cfFeat; /* points to CF feature list element */
1449 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
1450 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
1451
1452 TRACE_FUNCTION ("cmhSS_SSErased()");
1453
1454 /* check for command context */
1455 switch( ssShrdPrm.stb[sId].curCmd )
1456 {
1457 /* process result for +CCFC command */
1458 case( AT_CMD_CCFC ):
1459
1460 pSSCmdPrm = &cmhPrm[owner].ssCmdPrm;
1461
1462 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1463
1464 /* terminate command */
1465 if( cmhSS_tstAndUnflagTrn( sId, &(pSSCmdPrm -> mltyTrnFlg)))
1466 {
1467 if( pSSCmdPrm -> mltyTrnFlg EQ 0 ) /* if last service */
1468 {
1469 R_AT( RAT_OK, owner )
1470 ( AT_CMD_CCFC );
1471 cmh_logRslt ( owner, RAT_OK, AT_CMD_CCFC, -1, -1, -1 );
1472 }
1473 }
1474 break;
1475
1476 /* process result for KSD CF command */
1477 case( KSD_CMD_CF ):
1478
1479 cfFeat = (T_CF_FEAT *)ssLstBuf;
1480 memset( &ksStat, 0, sizeof(ksStat));
1481
1482 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1483
1484 ksStat.ksdCmd = KSD_CMD_CF;
1485 ksStat.ir.rKSCF.opCd = KSD_OP_ERS;
1486 ksStat.ir.rKSCF.ssErr = KSD_NO_ERROR;
1487
1488 if( ersSS->ssInfo.v_forwardingInfo )
1489 {
1490 cmhSS_ksdFillFwdRes( &ersSS->ssInfo.forwardingInfo,
1491 &ksStat, cfFeat );
1492 #if defined(MFW) OR defined(FF_MMI_RIV)
1493 if (ksStat.ir.rKSCF.ssCd EQ KSD_SS_NONE)
1494 ksStat.ir.rKSCF.ssCd = ssShrdPrm.stb[sId].ssCode; /* 1b) help the BMI about the last code (o2 - de) */
1495 #endif
1496 }
1497 #if defined(MFW) OR defined(FF_MMI_RIV)
1498 else
1499 {
1500 ksStat.ir.rKSCF.ssCd = ssShrdPrm.stb[sId].ssCode; /* 2b) help the BMI about the last code (e+ - de) */
1501 }
1502 #endif
1503
1504 if(check_ksd_error( owner, sId, &ksStat ))
1505 {
1506 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1507
1508 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
1509
1510 R_AT( RAT_CME, owner )
1511 ( cmdBuf, CME_ERR_NotPresent );
1512 }
1513 else
1514 {
1515 /*
1516 ** CQ12314 : NDH : 23/9/2003
1517 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
1518 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
1519 */
1520 ksStat.srcId = owner;
1521
1522 #if defined (MFW)
1523 if (ksStat.srcId NEQ CMD_SRC_LCL)
1524 {
1525 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
1526 }
1527 #endif
1528 R_AT( RAT_KSIR, owner )
1529 ( &ksStat );
1530
1531 /* terminate command */
1532 R_AT( RAT_OK, owner )
1533 ( KSD_CMD_CF );
1534 cmh_logRslt ( owner, RAT_OK, KSD_CMD_CF, -1, -1, -1 );
1535 }
1536 break;
1537 }
1538
1539 /* set service table entry to unused */
1540 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
1541 }
1542
1543 /*
1544 +-------------------------------------------------------------------+
1545 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
1546 | ROUTINE : cmhSS_SSActivated |
1547 +-------------------------------------------------------------------+
1548
1549 PURPOSE : SS erasure result is available.
1550
1551 */
1552
1553 GLOBAL void cmhSS_SSActivated( SHORT sId,
1554 T_ACTIVATE_SS_RES *actSS )
1555 {
1556 T_SS_CMD_PRM * pSSCmdPrm; /* points to SS command parameters */
1557 T_ACI_KSIR ksStat; /* holds KS status */
1558 T_CF_FEAT * cfFeat; /* points to CF feature list element */
1559 T_CB_INFO * cbInfo; /* points to CB feature list element */
1560 T_Cx_BSG * cwBSG; /* points to CW basic service list element */
1561 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
1562 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
1563
1564 TRACE_FUNCTION ("cmhSS_SSActivated()");
1565
1566 /*
1567 *-------------------------------------------------------------------
1568 * check for command context
1569 *-------------------------------------------------------------------
1570 */
1571 switch( cmdBuf )
1572 {
1573 /*
1574 *----------------------------------------------------------------
1575 * process result for +CCFC, +CLCK and +CCWA command
1576 *----------------------------------------------------------------
1577 */
1578 case( AT_CMD_CCFC ):
1579 case( AT_CMD_CLCK ):
1580 case( AT_CMD_CCWA ):
1581
1582 pSSCmdPrm = &cmhPrm[owner].ssCmdPrm;
1583
1584 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1585
1586 /* terminate command */
1587 if( cmhSS_tstAndUnflagTrn( sId, &(pSSCmdPrm -> mltyTrnFlg)))
1588 {
1589 if( pSSCmdPrm -> mltyTrnFlg EQ 0 ) /* if last service */
1590 {
1591 R_AT( RAT_OK, owner )
1592 ( cmdBuf );
1593 cmh_logRslt ( owner, RAT_OK, cmdBuf, -1, -1, -1 );
1594 }
1595 }
1596 break;
1597
1598 /*
1599 *----------------------------------------------------------------
1600 * process result for KSD CF command
1601 *----------------------------------------------------------------
1602 */
1603 case( KSD_CMD_CF ):
1604
1605 cfFeat = (T_CF_FEAT *)ssLstBuf;
1606 memset( &ksStat, 0, sizeof(ksStat));
1607
1608 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1609
1610 ksStat.ksdCmd = KSD_CMD_CF;
1611 ksStat.ir.rKSCF.opCd = KSD_OP_ACT;
1612 ksStat.ir.rKSCF.ssErr = KSD_NO_ERROR;
1613
1614 if( actSS->ssInfo.v_forwardingInfo )
1615 {
1616 cmhSS_ksdFillFwdRes( &actSS->ssInfo.forwardingInfo,
1617 &ksStat, cfFeat );
1618 #if defined(MFW) OR defined(FF_MMI_RIV)
1619 if (ksStat.ir.rKSCF.ssCd EQ KSD_SS_NONE)
1620 ksStat.ir.rKSCF.ssCd = ssShrdPrm.stb[sId].ssCode; /* 1c) help the BMI about the last code (o2 - de) */
1621 #endif
1622 }
1623 #if defined(MFW) OR defined(FF_MMI_RIV)
1624 else
1625 {
1626 ksStat.ir.rKSCF.ssCd = ssShrdPrm.stb[sId].ssCode; /* 2c) help the BMI about the last code (e+ - de) */
1627 }
1628 #endif
1629
1630 if(check_ksd_error( owner, sId, &ksStat ))
1631 {
1632 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1633
1634 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
1635
1636 R_AT( RAT_CME, owner )
1637 ( cmdBuf, CME_ERR_NotPresent );
1638 }
1639 else
1640 {
1641 /*
1642 ** CQ12314 : NDH : 23/9/2003
1643 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
1644 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
1645 */
1646 ksStat.srcId = owner;
1647
1648 #if defined (MFW)
1649 if (ksStat.srcId NEQ CMD_SRC_LCL)
1650 {
1651 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
1652 }
1653 #endif
1654
1655 R_AT( RAT_KSIR, owner )
1656 ( &ksStat );
1657
1658 /* terminate command */
1659 R_AT( RAT_OK, owner )
1660 ( KSD_CMD_CF );
1661 cmh_logRslt ( owner, RAT_OK, KSD_CMD_CF, -1, -1, -1 );
1662 }
1663 break;
1664
1665 /*
1666 *----------------------------------------------------------------
1667 * process result for KSD CB command
1668 *----------------------------------------------------------------
1669 */
1670 case( KSD_CMD_CB ):
1671
1672 cbInfo = (T_CB_INFO *)ssLstBuf;
1673 memset( &ksStat, 0, sizeof(ksStat));
1674
1675 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1676
1677 ksStat.ksdCmd = KSD_CMD_CB;
1678 ksStat.ir.rKSCF.opCd = KSD_OP_ACT;
1679 ksStat.ir.rKSCF.ssErr = KSD_NO_ERROR;
1680
1681 if( actSS->ssInfo.v_callBarringInfo )
1682 {
1683 cmhSS_ksdFillCbRes( &actSS->ssInfo.callBarringInfo,
1684 &ksStat, cbInfo );
1685 }
1686
1687 if(check_ksd_error( owner, sId, &ksStat ))
1688 {
1689 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1690
1691 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
1692
1693 R_AT( RAT_CME, owner )
1694 ( cmdBuf, CME_ERR_NotPresent );
1695 }
1696 else
1697 {
1698 /*
1699 ** CQ12314 : NDH : 23/9/2003
1700 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
1701 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
1702 */
1703 ksStat.srcId = owner;
1704
1705 #if defined (MFW)
1706 if (ksStat.srcId NEQ CMD_SRC_LCL)
1707 {
1708 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
1709 }
1710 #endif
1711
1712 R_AT( RAT_KSIR, owner )
1713 ( &ksStat );
1714
1715 /* terminate command */
1716 R_AT( RAT_OK, owner )
1717 ( KSD_CMD_CB );
1718 cmh_logRslt ( owner, RAT_OK, KSD_CMD_CB, -1, -1, -1 );
1719 }
1720 break;
1721
1722 /*
1723 *----------------------------------------------------------------
1724 * process result for KSD CW command
1725 *----------------------------------------------------------------
1726 */
1727 case( KSD_CMD_CW ):
1728
1729 cwBSG = (T_Cx_BSG *)ssLstBuf;
1730 memset( &ksStat, 0, sizeof(ksStat));
1731
1732 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1733
1734 ksStat.ksdCmd = KSD_CMD_CW;
1735 ksStat.ir.rKSCW.opCd = KSD_OP_ACT;
1736 ksStat.ir.rKSCW.ssErr = KSD_NO_ERROR;
1737
1738 if( actSS->ssInfo.v_ssData )
1739 {
1740 cmhSS_ksdFillCwRes( &actSS->ssInfo.ssData,
1741 &ksStat, cwBSG );
1742 }
1743 else
1744 {
1745 ksStat.ir.rKSCW.ssCd = KSD_SS_NONE;
1746 ksStat.ir.rKSCW.ssSt = KSD_ST_NONE;
1747 }
1748
1749 if(check_ksd_error( owner, sId, &ksStat ))
1750 {
1751 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1752
1753 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
1754
1755 R_AT( RAT_CME, owner )
1756 ( cmdBuf, CME_ERR_NotPresent );
1757 }
1758 else
1759 {
1760 /*
1761 ** CQ12314 : NDH : 23/9/2003
1762 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
1763 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
1764 */
1765 ksStat.srcId = owner;
1766
1767 #if defined (MFW)
1768 if (ksStat.srcId NEQ CMD_SRC_LCL)
1769 {
1770 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
1771 }
1772 #endif
1773
1774 R_AT( RAT_KSIR, owner )
1775 ( &ksStat );
1776
1777 /* terminate command */
1778 R_AT( RAT_OK, owner )
1779 ( KSD_CMD_CW );
1780 cmh_logRslt ( owner, RAT_OK, KSD_CMD_CW, -1, -1, -1 );
1781 }
1782 break;
1783
1784 }
1785
1786 /*
1787 *-------------------------------------------------------------------
1788 * set service table entry to unused
1789 *-------------------------------------------------------------------
1790 */
1791 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
1792
1793 }
1794
1795 /*
1796 +-------------------------------------------------------------------+
1797 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
1798 | ROUTINE : cmhSS_SSDeactivated |
1799 +-------------------------------------------------------------------+
1800
1801 PURPOSE : SS erasure result is available.
1802
1803 */
1804
1805 GLOBAL void cmhSS_SSDeactivated( SHORT sId,
1806 T_DEACTIVATE_SS_RES *deactSS )
1807 {
1808 T_SS_CMD_PRM * pSSCmdPrm; /* points to SS command parameters */
1809 T_ACI_KSIR ksStat; /* holds KS status */
1810 T_CF_FEAT * cfFeat; /* points to CF feature list element */
1811 T_CB_INFO * cbInfo; /* points to CB feature list element */
1812 T_Cx_BSG * cwBSG; /* points to CW basic service list element */
1813 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
1814 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
1815
1816 TRACE_FUNCTION ("cmhSS_SSDeactivated()");
1817
1818 /*
1819 *-------------------------------------------------------------------
1820 * check for command context
1821 *-------------------------------------------------------------------
1822 */
1823 switch( cmdBuf )
1824 {
1825 /*
1826 *----------------------------------------------------------------
1827 * process result for +CCFC, +CLCK and +CCWA command
1828 *----------------------------------------------------------------
1829 */
1830 case( AT_CMD_CCFC ):
1831 case( AT_CMD_CLCK ):
1832 case( AT_CMD_CCWA ):
1833
1834 pSSCmdPrm = &cmhPrm[owner].ssCmdPrm;
1835
1836 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1837
1838 /* terminate command */
1839 if( cmhSS_tstAndUnflagTrn( sId, &(pSSCmdPrm -> mltyTrnFlg)))
1840 {
1841 if( pSSCmdPrm -> mltyTrnFlg EQ 0 ) /* if last service */
1842 {
1843
1844 R_AT( RAT_OK, owner )
1845 ( cmdBuf );
1846 cmh_logRslt ( owner, RAT_OK, cmdBuf, -1, -1, -1 );
1847 }
1848 }
1849 break;
1850
1851 /*
1852 *----------------------------------------------------------------
1853 * process result for KSD CF command
1854 *----------------------------------------------------------------
1855 */
1856 case( KSD_CMD_CF ):
1857
1858 cfFeat = (T_CF_FEAT *)ssLstBuf;
1859 memset( &ksStat, 0, sizeof(ksStat));
1860
1861 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1862
1863 ksStat.ksdCmd = KSD_CMD_CF;
1864 ksStat.ir.rKSCF.opCd = KSD_OP_DEACT;
1865 ksStat.ir.rKSCF.ssErr = KSD_NO_ERROR;
1866
1867 if( deactSS->ssInfo.v_forwardingInfo )
1868 {
1869 cmhSS_ksdFillFwdRes( &deactSS->ssInfo.forwardingInfo,
1870 &ksStat, cfFeat );
1871 #if defined(MFW) OR defined(FF_MMI_RIV)
1872 if (ksStat.ir.rKSCF.ssCd EQ KSD_SS_NONE)
1873 ksStat.ir.rKSCF.ssCd = ssShrdPrm.stb[sId].ssCode; /* 1d) help the BMI about the last code (o2 - de) */
1874 #endif
1875 }
1876 #if defined(MFW) OR defined(FF_MMI_RIV)
1877 else
1878 {
1879 ksStat.ir.rKSCF.ssCd = ssShrdPrm.stb[sId].ssCode; /* 2d) help the BMI about the last code (e+ - de) */
1880 }
1881 #endif
1882
1883 if(check_ksd_error( owner, sId, &ksStat ))
1884 {
1885 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1886
1887 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
1888
1889 R_AT( RAT_CME, owner )
1890 ( cmdBuf, CME_ERR_NotPresent );
1891 }
1892 else
1893 {
1894
1895 /*
1896 ** CQ12314 : NDH : 23/9/2003
1897 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
1898 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
1899 */
1900 ksStat.srcId = owner;
1901
1902 #if defined (MFW)
1903 if (ksStat.srcId NEQ CMD_SRC_LCL)
1904 {
1905 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
1906 }
1907 #endif
1908
1909 R_AT( RAT_KSIR, owner )
1910 ( &ksStat );
1911
1912 /* terminate command */
1913 R_AT( RAT_OK, owner )
1914 ( KSD_CMD_CF );
1915 cmh_logRslt ( owner, RAT_OK, KSD_CMD_CF, -1, -1, -1 );
1916 }
1917 break;
1918
1919 /*
1920 *----------------------------------------------------------------
1921 * process result for KSD CB command
1922 *----------------------------------------------------------------
1923 */
1924 case( KSD_CMD_CB ):
1925
1926 cbInfo = (T_CB_INFO *)ssLstBuf;
1927 memset( &ksStat, 0, sizeof(ksStat));
1928
1929 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1930
1931 ksStat.ksdCmd = KSD_CMD_CB;
1932 ksStat.ir.rKSCF.opCd = KSD_OP_DEACT;
1933 ksStat.ir.rKSCF.ssErr = KSD_NO_ERROR;
1934
1935 if( deactSS->ssInfo.v_callBarringInfo )
1936 {
1937 cmhSS_ksdFillCbRes( &deactSS->ssInfo.callBarringInfo,
1938 &ksStat, cbInfo );
1939 }
1940
1941 if(check_ksd_error( owner, sId, &ksStat ))
1942 {
1943 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1944
1945 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
1946
1947 R_AT( RAT_CME, owner )
1948 ( cmdBuf, CME_ERR_NotPresent );
1949 }
1950 else
1951 {
1952 /*
1953 ** CQ12314 : NDH : 23/9/2003
1954 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
1955 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
1956 */
1957 ksStat.srcId = owner;
1958
1959 #if defined (MFW)
1960 if (ksStat.srcId NEQ CMD_SRC_LCL)
1961 {
1962 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
1963 }
1964 #endif
1965
1966 R_AT( RAT_KSIR, owner )
1967 ( &ksStat );
1968
1969 /* terminate command */
1970 R_AT( RAT_OK, owner )
1971 ( KSD_CMD_CB );
1972 cmh_logRslt ( owner, RAT_OK, KSD_CMD_CB, -1, -1, -1 );
1973 }
1974 break;
1975
1976 /*
1977 *----------------------------------------------------------------
1978 * process result for KSD CW command
1979 *----------------------------------------------------------------
1980 */
1981 case( KSD_CMD_CW ):
1982
1983 cwBSG = (T_Cx_BSG *)ssLstBuf;
1984 memset( &ksStat, 0, sizeof(ksStat));
1985
1986 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1987
1988 ksStat.ksdCmd = KSD_CMD_CW;
1989 ksStat.ir.rKSCW.opCd = KSD_OP_DEACT;
1990 ksStat.ir.rKSCW.ssErr = KSD_NO_ERROR;
1991
1992 if( deactSS->ssInfo.v_ssData )
1993 {
1994 cmhSS_ksdFillCwRes( &deactSS->ssInfo.ssData,
1995 &ksStat, cwBSG );
1996 }
1997
1998 if(check_ksd_error( owner, sId, &ksStat ))
1999 {
2000 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
2001
2002 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
2003
2004 R_AT( RAT_CME, owner )
2005 ( cmdBuf, CME_ERR_NotPresent );
2006 }
2007 else
2008 {
2009 /*
2010 ** CQ12314 : NDH : 23/9/2003
2011 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
2012 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
2013 */
2014 ksStat.srcId = owner;
2015
2016 #if defined (MFW)
2017 if (ksStat.srcId NEQ CMD_SRC_LCL)
2018 {
2019 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
2020 }
2021 #endif
2022
2023 R_AT( RAT_KSIR, owner )
2024 ( &ksStat );
2025
2026 /* terminate command */
2027 R_AT( RAT_OK, owner )
2028 ( KSD_CMD_CW );
2029 cmh_logRslt ( owner, RAT_OK, KSD_CMD_CW, -1, -1, -1 );
2030 }
2031 break;
2032 }
2033
2034 /*
2035 *-------------------------------------------------------------------
2036 * set service table entry to unused
2037 *-------------------------------------------------------------------
2038 */
2039 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
2040
2041 }
2042
2043 /*
2044 +-------------------------------------------------------------------+
2045 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
2046 | ROUTINE : cmhSS_getPassword |
2047 +-------------------------------------------------------------------+
2048
2049 PURPOSE : get password guidance.
2050
2051 */
2052
2053 GLOBAL void cmhSS_getPassword( SHORT sId,
2054 T_GET_PWD_INV *getPWD )
2055 {
2056 T_SS_CMD_PRM *pSSCmdPrm; /* points to SS command parameters */
2057 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
2058 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
2059
2060 TRACE_FUNCTION ("cmhSS_getPassword()");
2061
2062 if(owner EQ OWN_SAT)
2063 {
2064 TRACE_EVENT("Owner SAT");
2065 }
2066
2067 /*
2068 *-------------------------------------------------------------------
2069 * check for mandatory info
2070 *-------------------------------------------------------------------
2071 */
2072 if( ! getPWD -> v_guidanceInfo )
2073 {
2074 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
2075
2076 R_AT( RAT_CME, owner )
2077 ( cmdBuf, CME_ERR_NotPresent );
2078 cmh_logRslt ( owner, RAT_CME, cmdBuf, -1, -1, CME_ERR_NotPresent );
2079 return;
2080 }
2081 /*
2082 *-------------------------------------------------------------------
2083 * check for command context
2084 *-------------------------------------------------------------------
2085 */
2086 switch( ssShrdPrm.stb[sId].curCmd )
2087 {
2088 /*
2089 *----------------------------------------------------------------
2090 * process result for +CPWD and +CLCK and KSD PWD and KSD CB command
2091 *----------------------------------------------------------------
2092 */
2093 case( AT_CMD_CPWD ):
2094 case( AT_CMD_CLCK ):
2095 case( KSD_CMD_PWD ):
2096 case( KSD_CMD_CB ):
2097
2098 if (owner > OWN_NONE) /* Just to remove LINT warning */
2099 {
2100 pSSCmdPrm = &cmhPrm[owner].ssCmdPrm;
2101
2102
2103 switch( getPWD -> guidanceInfo )
2104 {
2105 case( GUI_ENTER_PW ):
2106 if(strcmp((CHAR*)pSSCmdPrm->CXXXpwd, "FFFF") EQ 0)
2107 {
2108 /* remember sId to answer with password */
2109 #ifdef SIM_TOOLKIT
2110 satShrdPrm.sId_pwd_requested = sId;
2111 #endif /* SIM_TOOLKIT */
2112
2113 /* Password never given before ask for it */
2114 R_AT( RAT_CME, owner )
2115 ( AT_CMD_CPWD, CME_ERR_WrongPasswd );
2116 cmh_logRslt ( owner, RAT_CME, AT_CMD_CPWD, -1, -1, CME_ERR_WrongPasswd );
2117 return;
2118 }
2119 else
2120 {
2121 psaSS_asmVerifyPWD( pSSCmdPrm -> CXXXpwd );
2122 psaSS_CntTrns(sId);
2123 }
2124 break;
2125
2126 case( GUI_ENTER_NEW_PW ):
2127
2128 psaSS_asmVerifyPWD( pSSCmdPrm -> CXXXnewPwd );
2129 psaSS_CntTrns(sId);
2130 break;
2131
2132 case( GUI_ENTER_NEW_PW_AGAIN ):
2133
2134 psaSS_asmVerifyPWD( pSSCmdPrm -> CXXXnewPwd2 );
2135 psaSS_CntTrns(sId);
2136 break;
2137
2138 case( GUI_BAD_PW_RETRY ):
2139 case( GUI_BAD_PW_FORM ):
2140
2141 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
2142 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
2143
2144 R_AT( RAT_CME, owner )
2145 ( AT_CMD_CPWD, CME_ERR_WrongPasswd );
2146 cmh_logRslt ( owner, RAT_CME, AT_CMD_CPWD, -1, -1, CME_ERR_WrongPasswd );
2147
2148 /* end of transaction */
2149 psaSS_asmEmptyRslt();
2150 psaSS_EndTrns(sId);
2151
2152 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
2153 }
2154 break;
2155 }
2156 }
2157 }
2158
2159 /*
2160 +-------------------------------------------------------------------+
2161 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
2162 | ROUTINE : cmhSS_SSPWDRegistrated |
2163 +-------------------------------------------------------------------+
2164
2165 PURPOSE : Password registration result is available.
2166
2167 */
2168
2169 GLOBAL void cmhSS_SSPWDRegistrated( SHORT sId,
2170 T_REGISTER_PWD_RES *regPWD )
2171 {
2172 T_ACI_KSIR ksStat; /* holds KS status */
2173 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
2174 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
2175
2176 TRACE_FUNCTION ("cmhSS_SSPWDRegistrated()");
2177
2178 /*
2179 *-------------------------------------------------------------------
2180 * check for command context
2181 *-------------------------------------------------------------------
2182 */
2183 switch( ssShrdPrm.stb[sId].curCmd )
2184 {
2185 /*
2186 *----------------------------------------------------------------
2187 * process result for +CPWD command
2188 *----------------------------------------------------------------
2189 */
2190 case( AT_CMD_CPWD ):
2191
2192 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
2193
2194 /* terminate command */
2195 R_AT( RAT_OK, owner )
2196 ( AT_CMD_CPWD );
2197 cmh_logRslt ( owner, RAT_OK, AT_CMD_CPWD, -1, -1, -1 );
2198 break;
2199
2200 /*
2201 *----------------------------------------------------------------
2202 * process result for KSD PWD command
2203 *----------------------------------------------------------------
2204 */
2205 case( KSD_CMD_PWD ):
2206
2207 memset( &ksStat, 0, sizeof(ksStat));
2208
2209 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
2210
2211 ksStat.ksdCmd = KSD_CMD_PWD;
2212 ksStat.ir.rKSPW.opCd = KSD_OP_REG;
2213 ksStat.ir.rKSPW.ssCd = ssShrdPrm.stb[sId].ssCode;
2214 ksStat.ir.rKSPW.ssErr = KSD_NO_ERROR;
2215
2216 if( regPWD->v_newPassword )
2217 {
2218 memcpy( ksStat.ir.rKSPW.newPwd, regPWD->newPassword.digit,
2219 MAX_PWD_NUM );
2220 }
2221
2222 if(check_ksd_error( owner, sId, &ksStat ))
2223 {
2224 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
2225
2226 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
2227
2228 R_AT( RAT_CME, owner )
2229 ( cmdBuf, CME_ERR_NotPresent );
2230 }
2231 else
2232 {
2233 /*
2234 ** CQ12314 : NDH : 23/9/2003
2235 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
2236 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
2237 */
2238 ksStat.srcId = owner;
2239
2240 #if defined (MFW)
2241 if (ksStat.srcId NEQ CMD_SRC_LCL)
2242 {
2243 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
2244 }
2245 #endif
2246
2247 R_AT( RAT_KSIR, owner )
2248 ( &ksStat );
2249
2250 /* terminate command */
2251 R_AT( RAT_OK, owner )
2252 ( KSD_CMD_PWD );
2253 cmh_logRslt ( owner, RAT_OK, KSD_CMD_PWD, -1, -1, -1 );
2254 }
2255 break;
2256 }
2257
2258 /*
2259 *-------------------------------------------------------------------
2260 * set service table entry to unused
2261 *-------------------------------------------------------------------
2262 */
2263 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
2264
2265 }
2266
2267 /*
2268 +-------------------------------------------------------------------+
2269 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
2270 | ROUTINE : cmhSS_CCNtryErased |
2271 +-------------------------------------------------------------------+
2272
2273 PURPOSE : CC entry erased.
2274
2275 */
2276
2277 GLOBAL void cmhSS_CCNtryErased( SHORT sId,
2278 T_ERASE_CC_ENTRY_RES *ersCCNtry )
2279 {
2280 /* T_ACI_KSIR ksStat; */ /* holds KS status */
2281 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
2282
2283 TRACE_FUNCTION ("cmhSS_CCNtryErased()");
2284
2285 /*
2286 *-------------------------------------------------------------------
2287 * check for command context
2288 *-------------------------------------------------------------------
2289 */
2290 switch( ssShrdPrm.stb[sId].curCmd )
2291 {
2292 /* process result for %CCBS command */
2293 case( AT_CMD_CCBS ):
2294 /* terminate command */
2295 R_AT( RAT_OK, owner )
2296 ( AT_CMD_CCBS );
2297 cmh_logRslt ( owner, RAT_OK, AT_CMD_CCBS, -1, -1, -1 );
2298 break;
2299
2300 /* process result for KSD CCBS command */
2301 case( KSD_CMD_CCBS ):
2302
2303 /* Should be removed...
2304 CLB: why should any status notification be sent to user ???
2305 SS has just been erased !!
2306 05 Feb 2002
2307
2308 memset( &ksStat, 0, sizeof(ksStat));
2309
2310 ksStat.ksdCmd = KSD_CMD_CCBS;
2311 ksStat.ir.rKSCC.opCd = KSD_OP_ERS;
2312 ksStat.ir.rKSCC.ssCd = KSD_SS_NONE;
2313 ksStat.ir.rKSCC.ssSt = KSD_ST_NOT_VALID;
2314 ksStat.ir.rKSCC.ssErr = KSD_NO_ERROR;
2315
2316 ksStat.ir.rKSCC.c_ccFeatLst = 0;
2317 ksStat.ir.rKSCC.ccFeatLst = NULL;
2318
2319 if( ersCCNtry -> eraseCCEntryRes.v_ssCode )
2320 {
2321 ksStat.ir.rKSCC.ssCd = ersCCNtry -> eraseCCEntryRes.ssCode;
2322 }
2323
2324 if( ersCCNtry -> eraseCCEntryRes.v_ssStatus )
2325 {
2326 ksStat.ir.rKSCC.ssSt = ersCCNtry -> eraseCCEntryRes.ssStatus;
2327 }
2328
2329 R_AT( RAT_KSIR, owner )
2330 ( &ksStat );*/
2331
2332 /* terminate command */
2333 R_AT( RAT_OK, owner )
2334 ( KSD_CMD_CCBS );
2335 cmh_logRslt (owner, RAT_OK, KSD_CMD_CCBS, -1, -1, -1 );
2336 break;
2337 }
2338
2339 /*
2340 *-------------------------------------------------------------------
2341 * set service table entry to unused
2342 *-------------------------------------------------------------------
2343 */
2344 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
2345 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
2346 }
2347
2348 /*
2349 +-------------------------------------------------------------------+
2350 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
2351 | ROUTINE : cmhSS_USSDNotify |
2352 +-------------------------------------------------------------------+
2353
2354 PURPOSE : Network initiated USSD notification received.
2355
2356 */
2357
2358 GLOBAL void cmhSS_USSDNotify( SHORT sId,
2359 T_USSD_NOTIFY_INV *ussdNtfy )
2360 {
2361 UBYTE idx;
2362 SHORT dcs = ACI_NumParmNotPresent;
2363 T_ACI_USSD_DATA *ussd = NULL;
2364
2365 TRACE_FUNCTION ("cmhSS_USSDNotify()");
2366
2367 /*
2368 *-------------------------------------------------------------------
2369 * check for another service in progress
2370 *-------------------------------------------------------------------
2371 */
2372 if( psaSS_stbFindActSrv( sId ) NEQ NO_ENTRY )
2373 {
2374 psaSS_asmErrorRslt( sId, ERR_USSD_BUSY );
2375
2376 psaSS_EndTrns(sId);
2377
2378 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
2379
2380 return;
2381 }
2382
2383 /*
2384 *-------------------------------------------------------------------
2385 * send unsolicited result code
2386 *-------------------------------------------------------------------
2387 */
2388 if( ussdNtfy -> v_ussdArg )
2389 {
2390 if( ussdNtfy -> ussdArg.v_ussdDataCodingScheme )
2391 dcs = ussdNtfy -> ussdArg.ussdDataCodingScheme;
2392
2393 if( ussdNtfy -> ussdArg.v_ussdString )
2394 {
2395 MALLOC(ussd, sizeof(T_ACI_USSD_DATA));
2396
2397 /* SDU offset is assumed to be zero for ussd string */
2398 ussd->len = ussdNtfy -> ussdArg.ussdString.l_ussdString>>3;
2399
2400 if( utl_getAlphabetCb( (UBYTE)dcs ) EQ 0 ) /* 7bit alphabet */
2401 {
2402 ussd->len = utl_cvt7To8( ussdNtfy -> ussdArg.ussdString.b_ussdString,
2403 ussd->len,
2404 ussd->data,
2405 0 );
2406 }
2407 else
2408 memcpy( ussd->data, ussdNtfy -> ussdArg.ussdString.b_ussdString,
2409 ussd->len );
2410
2411 TRACE_EVENT_P1("USSD str len: %d", ussd->len);
2412 ussd->data[ussd->len]=0x00;
2413 }
2414
2415 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
2416 {
2417 R_AT( RAT_CUSD, idx )
2418 ( CUSD_MOD_NoActReq, ussd, dcs );
2419 }
2420
2421 if (ussd NEQ NULL)
2422 {
2423 MFREE(ussd);
2424 }
2425 }
2426
2427 ssShrdPrm.stb[sId].ussd_operation = TRUE;
2428
2429 /*
2430 *-------------------------------------------------------------------
2431 * confirm USSD notify receiption with empty result if Extended USSD Response feature is not enabled.
2432 *-------------------------------------------------------------------
2433 */
2434 if(cuscfgParams.Ext_USSD_Response EQ CUSCFG_STAT_Disabled)
2435 {
2436 psaSS_asmEmptyRslt();
2437
2438 psaSS_CntTrns(sId);
2439
2440 }
2441 else
2442 {
2443 Ext_USSD_Res_Pending = CUSDR_EXT_USSD_RES_Notify;
2444 Ext_USSD_Res_Pending_sId = sId;
2445 }
2446
2447 }
2448
2449 /*
2450 +-------------------------------------------------------------------+
2451 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
2452 | ROUTINE : cmhSS_USSDRequest |
2453 +-------------------------------------------------------------------+
2454
2455 PURPOSE : Network initiated USSD request received.
2456
2457 */
2458
2459 GLOBAL void cmhSS_USSDRequest( SHORT sId,
2460 T_USSD_REQ_INV *ussdReq )
2461 {
2462 UBYTE idx;
2463 UBYTE srcId = srcId_cb;
2464 SHORT dcs = ACI_NumParmNotPresent;
2465 T_ACI_USSD_DATA *ussd = NULL;
2466 T_ACI_KSIR ksStat;
2467
2468 TRACE_FUNCTION ("cmhSS_USSDRequest()");
2469
2470 /* check for another service in progress */
2471 if( psaSS_stbFindActSrv( sId ) NEQ NO_ENTRY )
2472 {
2473 psaSS_asmErrorRslt( sId, ERR_USSD_BUSY );
2474
2475 psaSS_EndTrns(sId);
2476
2477 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
2478 return;
2479 }
2480
2481 /* send unsolicited result code */
2482 if( ussdReq -> v_ussdArg )
2483 {
2484 if( ussdReq -> ussdArg.v_ussdDataCodingScheme )
2485 dcs = ussdReq -> ussdArg.ussdDataCodingScheme;
2486
2487 if( ussdReq -> ussdArg.v_ussdString )
2488 {
2489 MALLOC(ussd, sizeof(T_ACI_USSD_DATA));
2490 /* SDU offset is assumed to be zero for ussd string */
2491 ussd->len = ussdReq -> ussdArg.ussdString.l_ussdString>>3;
2492
2493 if( utl_getAlphabetCb( (UBYTE)dcs ) EQ 0 ) /* 7bit alphabet */
2494 {
2495 ussd->len = utl_cvt7To8( ussdReq -> ussdArg.ussdString.b_ussdString,
2496 ussd->len,
2497 ussd->data,
2498 0 );
2499 }
2500 else
2501 memcpy( ussd->data, ussdReq -> ussdArg.ussdString.b_ussdString,
2502 ussd->len );
2503
2504 ussd->data[ussd->len]=0x00;
2505 }
2506
2507 if(ssShrdPrm.stb[sId].curCmd EQ AT_CMD_CUSD )
2508 {
2509 R_AT( RAT_CUSD, ssShrdPrm.stb[sId].srvOwn )
2510 ( CUSD_MOD_YesActReq, ussd, dcs );
2511 }
2512 else if (ssShrdPrm.stb[sId].curCmd EQ KSD_CMD_USSD)
2513 {
2514 ksStat.ksdCmd = KSD_CMD_USSD;
2515 ksStat.ir.rKSUS.mode = CUSD_MOD_YesActReq;
2516 ksStat.ir.rKSUS.ussd = ussd->data;
2517 ksStat.ir.rKSUS.len = ussd->len;
2518 ksStat.ir.rKSUS.dcs = dcs;
2519
2520 R_AT( RAT_KSIR, ssShrdPrm.stb[sId].srvOwn )
2521 ( &ksStat );
2522 }
2523 else
2524 {
2525 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
2526 {
2527 R_AT( RAT_CUSD, idx )
2528 ( CUSD_MOD_YesActReq, ussd, dcs );
2529 }
2530 }
2531
2532 if(ussd NEQ NULL)
2533 {
2534 MFREE(ussd);
2535 }
2536 ssShrdPrm.stb[sId].ussdReqFlg = TRUE;
2537 }
2538
2539 ssShrdPrm.stb[sId].ussd_operation = TRUE;
2540
2541 if(cuscfgParams.Ext_USSD_Response NEQ CUSCFG_STAT_Disabled)
2542 {
2543 Ext_USSD_Res_Pending = CUSDR_EXT_USSD_RES_Request;
2544 Ext_USSD_Res_Pending_sId = sId;
2545 }
2546
2547 /* check command context */
2548 if(ssShrdPrm.stb[sId].curCmd EQ AT_CMD_CUSD )
2549 {
2550 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
2551 }
2552 }
2553
2554
2555 /*
2556 +-------------------------------------------------------------------+
2557 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
2558 | ROUTINE : cmhSS_USSDReqProcessed |
2559 +-------------------------------------------------------------------+
2560
2561 PURPOSE : USSD request was processed.
2562
2563 */
2564
2565 /* TRUE returned means operation has been processed by SAT:
2566 function os to return immediatly */
2567 LOCAL BOOL cmhss_sat_ussd_reqprocessed( SHORT sId,
2568 T_PROCESS_USSD_REQ_RES *prcUSSDReq )
2569 {
2570 #ifdef SIM_TOOLKIT
2571 BOOL retvalue = FALSE;
2572 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
2573 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
2574
2575 T_text USSD_resp;
2576 T_ACI_SAT_TERM_RESP resp_data;
2577
2578 /* ACI-SPR-16433: temporaly used to hold incoming USSD string */
2579 UBYTE additionalData[MAX_USSD_LEN];
2580 UBYTE additionalDataLen = 0; /* max 183 Byte, see MAX_USSD_LEN */
2581 USHORT index = 0;
2582 UBYTE ussdAddLen = 0;
2583
2584 psaSAT_InitTrmResp( &resp_data );
2585
2586 TRACE_FUNCTION ("cmhss_sat_ussd_reqprocessed()");
2587
2588 if( (cmdBuf NEQ AT_CMD_NONE) AND
2589 ( (owner NEQ OWN_SAT) OR (cmdBuf NEQ KSD_CMD_USSD) ) )
2590
2591 {
2592 TRACE_EVENT_P1("cmhss_sat_ussd_reqprocessed(): ssShrdPrm.stb[sId].curCmd NEQ AT_CMD_NONE --> %d",
2593 ssShrdPrm.stb[sId].curCmd);
2594 retvalue = FALSE;
2595 }
2596 else if ( satShrdPrm.USSDterm ) /* response to a user defined termination */
2597 {
2598 psaSAT_SendTrmResp( RSLT_USER_TERM_SS, &resp_data );
2599 satShrdPrm.USSDterm = FALSE; /* reinitialize */
2600 retvalue = TRUE;
2601 }
2602 /* ACI-SPR-16433: USSD session might been started as SS command and KSD
2603 identified an USSD key sequence */
2604 else if ( sId EQ satShrdPrm.SentUSSDid AND
2605 ( (satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_USSD) OR
2606 (satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_SS ) ))
2607 {
2608 /* Terminal response to SEND USSD when no error */
2609
2610 if( prcUSSDReq -> v_ussdRes )
2611 {
2612 if ( prcUSSDReq -> ussdRes.v_ussdString )
2613 {
2614 USSD_resp.c_text_str = prcUSSDReq -> ussdRes.ussdString.l_ussdString>>3;
2615
2616 memcpy( &(USSD_resp.text_str),
2617 &(prcUSSDReq -> ussdRes.ussdString.b_ussdString),
2618 USSD_resp.c_text_str);
2619 }
2620 else
2621 USSD_resp.c_text_str = 0;
2622
2623 if ( prcUSSDReq -> ussdRes.v_ussdDataCodingScheme )
2624 {
2625 /*
2626 ACI: OMAPS00060422
2627
2628 According to the 11.14 the USSD string Data Coding Scheme
2629 is coded as for Cell Broadcast defined in TS 23.038.
2630 So, we store the USSD Data Coding Scheme when we receive from SIM
2631 as a CBS Data coding Scheme.
2632
2633 But, while seding the TERMINAL RESPONSE to the SIM we send the string
2634 as Text String. According to the 11.14 for Text String Data Coding
2635 Scheme is coded as for SMS Data Coding Scheme defined in 23.038
2636 */
2637
2638 /*
2639 If we receive the DCS in USSD String from SIM as F0 (CBS DCS value:
2640 Means 7-Bit Default, with No Message Class.
2641
2642 But, in the Text string while sending TERMINAL RESPONSE the DCS value
2643 we have to change according to the 11.14 Specification. So, in Text
2644 String the the DCS value of CBS will become 00(SMS DCS for text
2645 String which Means 7-Bit Default, with No Message Class.)
2646
2647 */
2648
2649 if ( prcUSSDReq -> ussdRes.ussdDataCodingScheme EQ 0xF0 )
2650 {
2651 /* This is a special case. The CBS DCS for F0 (Special case 7-bit
2652 default GSM alphabet with No Message class) we can send SMS
2653 value as 0x00. The CBS DCS for F1 (Special case 8-bit with No
2654 Message class) we can send SMS value as 0x01 as the if bit 4
2655 is ZERO then message class has no meaning.
2656 */
2657 USSD_resp.dcs = prcUSSDReq -> ussdRes.ussdDataCodingScheme & 0x0f;
2658 }
2659 else if ( prcUSSDReq -> ussdRes.ussdDataCodingScheme >= 0x40 AND
2660 prcUSSDReq -> ussdRes.ussdDataCodingScheme <= 0x7F )
2661 {
2662 /* Below are the mapping between CBS DCS -> SMS DCS values.
2663 For any values of CBS from 40 - 7F we can send SMS DCS as 00 - 3F
2664 */
2665 USSD_resp.dcs = prcUSSDReq -> ussdRes.ussdDataCodingScheme & 0x3f;
2666 }
2667 else if ( prcUSSDReq -> ussdRes.ussdDataCodingScheme >= 0xF1 AND
2668 prcUSSDReq -> ussdRes.ussdDataCodingScheme <= 0xF4 )
2669 {
2670 /* For CBS DCS 0xF1..0xF4 SMS DCS is sent as other than above we can
2671 send as it is */
2672 USSD_resp.dcs = prcUSSDReq -> ussdRes.ussdDataCodingScheme;
2673 }
2674 else
2675 {
2676 /* For any values for CBS DCS other than above we can send as it is */
2677 TRACE_EVENT_P1("Possible problem in converting CBS to SMS DCS: %d", prcUSSDReq -> ussdRes.ussdDataCodingScheme);
2678 USSD_resp.dcs = prcUSSDReq -> ussdRes.ussdDataCodingScheme;
2679 }
2680 }
2681
2682 resp_data.text = &USSD_resp;
2683
2684 /* ACI-SPR-16344: Prepare additional data for terminal response
2685 as requested in GSM 11.14 section 12.12.1 */
2686 if ( satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_SS )
2687 {
2688 /* calculate length */
2689 if ( prcUSSDReq->ussdRes.v_ussdString )
2690 {
2691 ussdAddLen = prcUSSDReq->ussdRes.ussdString.l_ussdString>>3;
2692 }
2693 /* also consider the first byte */
2694 additionalDataLen = ussdAddLen + 8;
2695
2696 /* START: reconstruct the operation component received */
2697 /* copy msg_type */
2698 additionalData[index++] = prcUSSDReq->msg_type;
2699 /* set sequence tag */
2700 additionalData[index++] = 0x30; /* sequence tag */
2701 /* length might be in one or 2 bytes representation (see GSM5_TLV)
2702 (-2) because the first two bytes are not counted */
2703 if( (additionalDataLen-2) <= 0x7F )
2704 {
2705 additionalData[index++] = additionalDataLen-2;
2706 }
2707 else
2708 {
2709 additionalData[index++] = 0x81; /* prefix */
2710 additionalData[index++] = additionalDataLen-2;
2711 }
2712 /* set dcs tag and dcs length and dcs */
2713 additionalData[index++] = 0x04; /* dcs tag */
2714 additionalData[index++] = 0x01; /* dcs length (always 1) */
2715 if ( prcUSSDReq->ussdRes.v_ussdDataCodingScheme )
2716 {
2717 additionalData[index++] = prcUSSDReq->ussdRes.ussdDataCodingScheme;
2718 }
2719 else
2720 {
2721 TRACE_EVENT("cmhss_sat_ussd_req processed: DCS undef assuming 0x00");
2722 additionalData[index++] = 0x00; /* default value */
2723 }
2724 /* set ussd tag, length and string */
2725 additionalData[index++] = 0x04; /* ussd tag */
2726 /* length might be one or 2 bytes (see GSM5_TLV) */
2727 if( (additionalDataLen-2) <= 0x7F )
2728 {
2729 additionalData[index++] = ussdAddLen;
2730 }
2731 else
2732 {
2733 additionalData[index++] = 0x81; /* prefix */
2734 additionalData[index++] = ussdAddLen;
2735 }
2736 /* copy ussd string */
2737 if ( prcUSSDReq->ussdRes.v_ussdString )
2738 {
2739 memcpy(additionalData+index,
2740 &(prcUSSDReq -> ussdRes.ussdString.b_ussdString),
2741 ussdAddLen);
2742 }
2743 /* copy additional data to terminal response */
2744 resp_data.add = additionalData;
2745 resp_data.addLen = additionalDataLen;
2746 }
2747 /* End of ACI-SPR-16344: Prepare additional data for terminal response */
2748
2749 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data );
2750
2751 satShrdPrm.SentUSSDid = NO_ENTRY; /* reinitialize */
2752
2753 retvalue = TRUE;
2754 }
2755 }
2756 return retvalue;
2757 #else /* SIM_TOOLKIT */
2758 return FALSE;
2759 #endif /* SIM_TOOLKIT */
2760 }
2761
2762
2763 GLOBAL void cmhSS_USSDReqProcessed( SHORT sId,
2764 T_PROCESS_USSD_REQ_RES *prcUSSDReq )
2765 {
2766 SHORT dcs = ACI_NumParmNotPresent;
2767 T_ACI_KSIR ksStat; /* holds KS status */
2768 T_ACI_USSD_DATA *ussd;
2769 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
2770 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
2771 BOOL end_of_process;
2772
2773 TRACE_FUNCTION ("cmhSS_USSDReqProcessed()");
2774
2775 /* Check whether this is a SAT action */
2776 end_of_process = cmhss_sat_ussd_reqprocessed( sId, prcUSSDReq );
2777 if(end_of_process)
2778 {
2779 /* set service table entry to unused */
2780 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
2781 return;
2782 }
2783
2784 /* check command context */
2785 switch( ssShrdPrm.stb[sId].curCmd )
2786 {
2787 case( AT_CMD_NONE ):
2788 case( AT_CMD_CUSD ):
2789
2790 /* send unsolicited result code */
2791 if( prcUSSDReq -> v_ussdRes )
2792 {
2793 if( prcUSSDReq -> ussdRes.v_ussdDataCodingScheme )
2794 dcs = prcUSSDReq -> ussdRes.ussdDataCodingScheme;
2795
2796 if( prcUSSDReq -> ussdRes.v_ussdString )
2797 {
2798 MALLOC(ussd, sizeof(T_ACI_USSD_DATA));
2799
2800 /* SDU offset is assumed to be zero for ussd string */
2801 ussd->len = prcUSSDReq -> ussdRes.ussdString.l_ussdString>>3;
2802
2803 if( utl_getAlphabetCb( (UBYTE)dcs ) EQ 0 ) /* 7bit alphabet */
2804 {
2805 ussd->len = utl_cvt7To8( prcUSSDReq -> ussdRes.ussdString.b_ussdString,
2806 ussd->len,
2807 ussd->data,
2808 0 );
2809 }
2810 else
2811 memcpy( ussd->data,
2812 prcUSSDReq -> ussdRes.ussdString.b_ussdString,
2813 ussd->len );
2814
2815 ussd->data[ussd->len]=0x00;
2816
2817 R_AT( RAT_CUSD, owner )
2818 ( CUSD_MOD_NoActReq, ussd, dcs );
2819
2820 MFREE(ussd);
2821 }
2822 }
2823 else
2824 {
2825 R_AT( RAT_CUSD, owner )
2826 ( CUSD_MOD_NoActReq, NULL, ACI_NumParmNotPresent );
2827 }
2828
2829 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
2830 break;
2831
2832 case( KSD_CMD_USSD ):
2833
2834 MALLOC(ussd, sizeof(T_ACI_USSD_DATA));
2835
2836 memset( &ksStat, 0, sizeof(ksStat));
2837 ksStat.ksdCmd = KSD_CMD_USSD;
2838 ksStat.ir.rKSUS.mode = CUSD_MOD_NoActReq;
2839 ksStat.ir.rKSUS.ussd = ussd->data;
2840 ussd->len = 0;
2841 ussd->data[0] = 0x0;
2842
2843 if( prcUSSDReq -> v_ussdRes )
2844 {
2845 if( prcUSSDReq -> ussdRes.v_ussdDataCodingScheme )
2846 {
2847 dcs = prcUSSDReq -> ussdRes.ussdDataCodingScheme;
2848 ksStat.ir.rKSUS.dcs = prcUSSDReq -> ussdRes.ussdDataCodingScheme;
2849 }
2850 else
2851 {
2852 ksStat.ir.rKSUS.dcs = ACI_NumParmNotPresent;
2853 }
2854
2855 if( prcUSSDReq -> ussdRes.v_ussdString )
2856 {
2857 ussd->len = prcUSSDReq -> ussdRes.ussdString.l_ussdString>>3;
2858
2859 if( utl_getAlphabetCb( (UBYTE)dcs ) EQ 0 ) /* 7bit alphabet */
2860 {
2861 ussd->len = utl_cvt7To8( prcUSSDReq -> ussdRes.ussdString.b_ussdString,
2862 ussd->len,
2863 ussd->data,
2864 0 );
2865 }
2866 else
2867 memcpy( ussd->data, prcUSSDReq -> ussdRes.ussdString.b_ussdString,
2868 ussd->len );
2869
2870 if( !utl_cvtGsmIra ( ussd->data,
2871 ussd->len,
2872 ussd->data,
2873 MAX_USSD_LEN,
2874 CSCS_DIR_GsmToIra ))
2875 {
2876 TRACE_EVENT("utl_cvtGsmIra() could not be performed");
2877 }
2878 }
2879 }
2880
2881 ksStat.ir.rKSUS.len = ussd->len;
2882 ussd->data[ussd->len] = 0x00;
2883 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
2884
2885 TRACE_EVENT_P2("cmhSS_USSDReqProcessed: sId: %d, owner: %d", sId, owner);
2886
2887 if(check_ksd_error( owner, sId, &ksStat ))
2888 {
2889 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
2890
2891 R_AT( RAT_CME, owner )
2892 ( cmdBuf, CME_ERR_NotPresent );
2893 }
2894 else
2895 {
2896 /*
2897 ** CQ12314 : NDH : 23/9/2003
2898 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
2899 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
2900 */
2901 ksStat.srcId = owner;
2902
2903 #if defined (MFW)
2904 if (ksStat.srcId NEQ CMD_SRC_LCL)
2905 {
2906 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
2907 }
2908 #endif
2909
2910 R_AT( RAT_KSIR, owner )
2911 ( &ksStat );
2912
2913 R_AT( RAT_OK, owner )
2914 ( KSD_CMD_USSD );
2915 cmh_logRslt ( owner, RAT_OK, KSD_CMD_USSD, -1, -1, -1 );
2916 }
2917 MFREE(ussd);
2918 break;
2919 }
2920
2921 /* set service table entry to unused */
2922 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
2923 }
2924
2925 /*
2926 +-------------------------------------------------------------------+
2927 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
2928 | ROUTINE : cmhSS_USSDDatProcessed |
2929 +-------------------------------------------------------------------+
2930
2931 PURPOSE : USSD data was processed.
2932
2933 */
2934
2935 GLOBAL void cmhSS_USSDDatProcessed( SHORT sId,
2936 T_PROCESS_USSD_RES *prcUSSDdat )
2937 {
2938 T_ACI_KSIR ksStat; /* holds KS status */
2939 T_ACI_USSD_DATA *ussd;
2940 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
2941 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
2942
2943 #ifdef SIM_TOOLKIT
2944 T_text USSD_resp;
2945 T_ACI_SAT_TERM_RESP resp_data;
2946 psaSAT_InitTrmResp( &resp_data );
2947 #endif /* SIM_TOOLKIT */
2948
2949 TRACE_FUNCTION ("cmhSS_USSDDatProcessed()");
2950
2951 /*
2952 *-------------------------------------------------------------------
2953 * check command context
2954 *-------------------------------------------------------------------
2955 */
2956 switch( ssShrdPrm.stb[sId].curCmd )
2957 {
2958 case( AT_CMD_NONE ):
2959
2960 #ifdef SIM_TOOLKIT
2961 if ( satShrdPrm.USSDterm ) /* response to a user defined termination */
2962 {
2963 psaSAT_SendTrmResp( RSLT_USER_TERM_SS, &resp_data );
2964 satShrdPrm.USSDterm = FALSE; /* reinitialize */
2965 break;
2966 }
2967
2968 if ( sId EQ satShrdPrm.SentUSSDid AND
2969 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_USSD )
2970 {
2971 /* Terminal response to SEND USSD when no error */
2972 if( prcUSSDdat -> v_ssUserData )
2973 {
2974 USSD_resp.c_text_str = prcUSSDdat -> ssUserData.l_ssUserData>>3;
2975 memcpy( &(USSD_resp.text_str),&(prcUSSDdat -> ssUserData.b_ssUserData), USSD_resp.c_text_str);
2976 }
2977 else
2978 {
2979 USSD_resp.c_text_str = 0;
2980 }
2981
2982 USSD_resp.dcs = 0xD4;
2983
2984 resp_data.text = &USSD_resp;
2985
2986 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data );
2987
2988 satShrdPrm.SentUSSDid = NO_ENTRY; /* reinitialize */
2989
2990 break;
2991 }
2992 #endif /* SIM_TOOLKIT */
2993 /* no break if NO SIM_TOOLKIT...
2994 or if it is an answer to another ss as the one initiated by SAT */
2995
2996 /*lint -fallthrough*/
2997 case( AT_CMD_CUSD ):
2998
2999 /* prepare unsolicited result code */
3000 if( prcUSSDdat -> v_ssUserData )
3001 {
3002 MALLOC(ussd, sizeof(T_ACI_USSD_DATA));
3003
3004 /* SDU offset is assumed to be zero for ussd string */
3005 ussd->len = prcUSSDdat -> ssUserData.l_ssUserData>>3;
3006
3007 memcpy( ussd->data, prcUSSDdat -> ssUserData.b_ssUserData,
3008 MAX_USSD_LEN );
3009
3010 if( utl_cvtGsmIra ( prcUSSDdat -> ssUserData.b_ssUserData,
3011 ussd->len,
3012 ussd->data,
3013 MAX_USSD_LEN,
3014 CSCS_DIR_IraToGsm ) )
3015 {
3016 ussd->data[ussd->len]=0x00;
3017 }
3018
3019 R_AT( RAT_CUSD, owner )
3020 ( CUSD_MOD_NoActReq, ussd, 0 );
3021 MFREE(ussd);
3022 }
3023 else
3024 {
3025 R_AT( RAT_CUSD, owner )
3026 ( CUSD_MOD_NoActReq, NULL, ACI_NumParmNotPresent );
3027 }
3028
3029 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
3030 break;
3031
3032 case( KSD_CMD_USSD ):
3033
3034 memset( &ksStat, 0, sizeof(ksStat));
3035 ksStat.ksdCmd = KSD_CMD_USSD;
3036 ksStat.ir.rKSUS.mode = CUSD_MOD_NoActReq;
3037 ksStat.ir.rKSUS.dcs = ACI_NumParmNotPresent;
3038 ksStat.ir.rKSUS.len = prcUSSDdat -> ssUserData.l_ssUserData>>3;
3039
3040
3041 if( prcUSSDdat -> v_ssUserData )
3042 {
3043 prcUSSDdat -> ssUserData.b_ssUserData
3044 [prcUSSDdat -> ssUserData.l_ssUserData] = 0x0;
3045 ksStat.ir.rKSUS.ussd = prcUSSDdat -> ssUserData.b_ssUserData;
3046
3047 }
3048
3049 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
3050
3051 if(check_ksd_error( owner, sId, &ksStat ))
3052 {
3053 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
3054
3055 R_AT( RAT_CME, owner )
3056 ( cmdBuf, CME_ERR_NotPresent );
3057 }
3058 else
3059 {
3060 /*
3061 ** CQ12314 : NDH : 23/9/2003
3062 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
3063 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
3064 */
3065 ksStat.srcId = owner;
3066
3067 #if defined (MFW)
3068 if (ksStat.srcId NEQ CMD_SRC_LCL)
3069 {
3070 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
3071 }
3072 #endif
3073
3074 R_AT( RAT_KSIR, owner )
3075 ( &ksStat );
3076
3077 R_AT( RAT_OK, owner )
3078 ( KSD_CMD_USSD );
3079 cmh_logRslt ( owner, RAT_OK, KSD_CMD_USSD, -1, -1, -1 );
3080 }
3081 break;
3082 }
3083
3084 /*
3085 *-------------------------------------------------------------------
3086 * set service table entry to unused
3087 *-------------------------------------------------------------------
3088 */
3089 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
3090
3091 }
3092
3093 /*
3094 +-------------------------------------------------------------------+
3095 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
3096 | ROUTINE : cmhSS_FwdChckSS |
3097 +-------------------------------------------------------------------+
3098
3099 PURPOSE : Forward check SS indication.
3100
3101 */
3102
3103 GLOBAL void cmhSS_FwdChckSS( SHORT sId )
3104 {
3105 TRACE_FUNCTION ("cmhSS_FwdChckSS()");
3106
3107 /* send unsolicited result code */
3108 send_CSSX_notification(NO_ENTRY,
3109 CSSX_CODE_FwrdCheckSS,
3110 ACI_NumParmNotPresent,
3111 NULL, NULL, NULL, NULL);
3112
3113
3114 /* end of transaction */
3115 psaSS_asmEmptyRslt();
3116 psaSS_EndTrns(sId);
3117
3118 /* set service table entry to unused */
3119 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
3120 }
3121
3122 /*
3123 +-------------------------------------------------------------------+
3124 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
3125 | ROUTINE : SSTransFail_default |
3126 +-------------------------------------------------------------------+
3127
3128 PURPOSE : SS transaction failed.
3129
3130 */
3131 LOCAL void SSTransFail_default ( SHORT sId )
3132 {
3133 T_ACI_CME_ERR error;
3134 UBYTE current_cmd = ssShrdPrm.stb[sId].curCmd, errCd;
3135 T_OWN owner = ssShrdPrm.stb[sId].srvOwn;
3136 USHORT idx = 0;
3137
3138 TRACE_FUNCTION ("SSTransFail_default()");
3139
3140 cmhPrm[owner].ssCmdPrm.mltyTrnFlg = 0;
3141
3142 if (ssShrdPrm.stb[sId].errCd EQ ERR_UNEXPECT_DATA)
3143 {
3144 error = CME_ERR_OpNotAllow;
3145 }
3146 else
3147 {
3148 error = CME_ERR_NotPresent;
3149 }
3150
3151 if (current_cmd EQ KSD_CMD_USSD OR current_cmd EQ AT_CMD_CUSD )
3152 {
3153 switch (ssShrdPrm.stb[sId].errCd)
3154 {
3155 case ERR_UNEXPECT_DATA:
3156 errCd = CUSD_MOD_OperationNotSupported;
3157 break;
3158 default:
3159 errCd = CUSD_MOD_TerminatedByNetwork;
3160 break;
3161 }
3162 for (idx = 0; idx < CMD_SRC_MAX; idx++)
3163 {
3164 R_AT( RAT_CUSD, idx )( errCd, NULL,
3165 ACI_NumParmNotPresent);
3166 }
3167 }
3168 else
3169 {
3170 R_AT( RAT_CME, owner )( current_cmd, error );
3171 cmh_logRslt ( owner, RAT_CME, current_cmd, -1, -1, error );
3172 }
3173
3174 }
3175
3176
3177 T_ACI_CME_ERR mapSSerrorCME(UBYTE SSerrCode)
3178 {
3179 /*SRM 04/12/2003 Added decode function to map out SS error returns to CME errors*/
3180 /*It may be neccessary to map out other codes in the FAC.DOC sec 6.4 Error Codes*/
3181 T_ACI_CME_ERR mapped_SS2cme = CME_ERR_OpNotSupp;
3182
3183 TRACE_FUNCTION ("mapSSerrorCME(): map SS err to CME err");
3184
3185 switch(SSerrCode)
3186 {
3187
3188 case ERR_NEG_PWD_CHECK:
3189 mapped_SS2cme = CME_ERR_WrongPasswd;
3190 break;
3191
3192 default:
3193 mapped_SS2cme = CME_ERR_OpNotSupp;
3194 break;
3195
3196 }
3197 return mapped_SS2cme;
3198
3199 }
3200
3201
3202 GLOBAL SHORT cmhSS_TransFail( SHORT sId )
3203 {
3204 T_ACI_KSIR ksStat; /* holds KS status */
3205 T_SS_CMD_PRM *pSSCmdPrm; /* points to SS command parameters */
3206 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
3207 T_OWN current_owner = ssShrdPrm.stb[sId].srvOwn;
3208 UBYTE cmdBuf = ssShrdPrm.stb[sId].curCmd;
3209 USHORT idx = 0;
3210
3211 TRACE_FUNCTION ("cmhSS_TransFail()");
3212
3213 pSSCmdPrm = &cmhPrm[current_owner].ssCmdPrm;
3214
3215 /* an error occured: kill pending transactions... */
3216 pSSCmdPrm->mltyTrnFlg &= ~ssShrdPrm.mltyTrnFlg;
3217 psaSS_KillAllPendingTrn( );
3218
3219 /* Marcus: Issue 1640: 27/01/2003: ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE; */
3220
3221 #ifdef SIM_TOOLKIT
3222 /* if SIM TOOLKIT initiated action send terminal response to SAT */
3223 if( current_owner EQ OWN_SAT )
3224 {
3225 /* send error message to SAT */
3226 psaSAT_SSRejComp(RSLT_NTW_UNAB_PROC);
3227
3228 /* free SS Entry */
3229
3230 cmhPrm[current_owner].ssCmdPrm.mltyTrnFlg = 0;
3231
3232 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
3233 ssShrdPrm.stb[sId].srvOwn = NO_VLD_OWN;
3234 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE; /* Marcus: Issue 1640: 27/01/2003 */
3235 /* that should be enough to free the SS entry */
3236 return 0;
3237 }
3238 #endif /* SIM_TOOLKIT */
3239
3240 switch( cmdBuf )
3241 {
3242 case( AT_CMD_NONE ):
3243 {
3244 if ( ssShrdPrm.stb[sId].opCode EQ OPC_UNSTRUCT_SS_REQ )
3245 {
3246 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
3247 {
3248 R_AT( RAT_CUSD, idx ) ( CUSD_MOD_TerminatedByNetwork, NULL, 0 );
3249 }
3250 }
3251 break;
3252 }
3253 case( AT_CMD_COLP ):
3254 {
3255 R_AT( RAT_COLP, current_owner )
3256 ( COLP_STAT_Unknown, NULL, NULL, NULL, NULL, NULL);
3257
3258 R_AT( RAT_OK, current_owner )
3259 ( AT_CMD_COLP);
3260 break;
3261 }
3262 case( AT_CMD_CLIP ):
3263 {
3264 R_AT( RAT_CLIP, current_owner )
3265 ( CLIP_STAT_Unknown, NULL, NULL, PRES_NOT_PRES, NULL, NULL, NULL);
3266
3267 R_AT( RAT_OK, current_owner )
3268 ( AT_CMD_CLIP);
3269 break;
3270 }
3271 /* Following case added to fix issue ACI-SPR-23109 */
3272 case( AT_CMD_CPWD ):
3273 {
3274 R_AT( RAT_CME, current_owner )
3275 ( AT_CMD_CPWD, CME_ERR_WrongPasswd );
3276 R_AT( RAT_OK, current_owner )
3277 ( AT_CMD_CPWD);
3278 break;
3279 }
3280 case( AT_CMD_CLIR ):
3281 {
3282 pCCCmdPrm = &cmhPrm[current_owner].ccCmdPrm;
3283
3284 R_AT( RAT_CLIR, current_owner )
3285 ( pCCCmdPrm -> CLIRmode, CLIR_STAT_Unknown);
3286
3287 R_AT( RAT_OK, current_owner )
3288 ( AT_CMD_CLIR);
3289 break;
3290 }
3291 case( AT_CMD_CCFC ):
3292 case( AT_CMD_CCWA ):
3293 case( AT_CMD_CLCK ):
3294 {
3295 if (ssShrdPrm.stb[sId].failType EQ SSF_SS_ENT)
3296 {
3297 SSTransFail_default( sId );
3298 }
3299 else if( cmhSS_tstAndUnflagTrn( sId, &(pSSCmdPrm->mltyTrnFlg))) /*test service flag and clear it*/
3300 {
3301 if( pSSCmdPrm -> mltyTrnFlg EQ 0 ) /* if no other service flags remaining*/
3302 {
3303 T_ACI_CME_ERR mapped_SS2cme = mapSSerrorCME(ssShrdPrm.stb[sId].errCd);
3304
3305 R_AT( RAT_CME, current_owner )( cmdBuf, mapped_SS2cme );
3306 cmh_logRslt ( current_owner, RAT_CME, cmdBuf, -1, -1, mapped_SS2cme );
3307 }
3308 }
3309 else
3310 {
3311 /* do nothing */
3312 }
3313 break;
3314 }
3315 case( KSD_CMD_CF ):
3316 case( KSD_CMD_CW ):
3317 case( KSD_CMD_CB ):
3318 case( KSD_CMD_CL ):
3319 case( KSD_CMD_PWD ):
3320 case( KSD_CMD_CCBS ):
3321 case( KSD_CMD_USSD ):
3322 {
3323 memset( &ksStat, 0, sizeof(ksStat));
3324
3325 cmhSS_ksdBuildErrRslt( sId, &ksStat, KSD_NO_ERROR );
3326
3327 if(check_ksd_error( current_owner, sId, &ksStat ))
3328 {
3329 /* Marcus: Issue 1640: 27/01/2003: ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE; */
3330
3331 cmhPrm[current_owner].ssCmdPrm.mltyTrnFlg = 0;
3332 }
3333 else
3334 {
3335 /*
3336 ** CQ12314 : NDH : 23/9/2003
3337 ** Added srcID field to ksStat to enable called entity to determine the originator of the command
3338 ** and take appropriate action. (eg to Activate Call Forwarding Icon)
3339 */
3340 ksStat.srcId = current_owner;
3341
3342 #if defined (MFW)
3343 if (ksStat.srcId NEQ CMD_SRC_LCL)
3344 {
3345 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat );
3346 }
3347 #endif
3348 R_AT( RAT_KSIR, current_owner )( &ksStat );
3349 }
3350
3351 SSTransFail_default( sId );
3352 break;
3353 }
3354 default:
3355 {
3356 SSTransFail_default( sId );
3357 break;
3358 }
3359 }
3360
3361 /* Set extended error cause for KSD and AT commands */
3362 if (ssShrdPrm.stb[sId].errCd)
3363 {
3364 causeMod = P_CEER_ss; /* Set the module for ceer cause */
3365 causeCeer = (SHORT)ssShrdPrm.stb[sId].errCd;
3366 }
3367
3368 /* set service table entry to unused */
3369 ssShrdPrm.stb[sId].ntryUsdFlg = FALSE;
3370 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE; /* Marcus: Issue 1640: 27/01/2003 */
3371 return 0;
3372 }
3373
3374
3375 /*
3376 +-------------------------------------------------------------------+
3377 | PROJECT : GSM-PS (6147) MODULE : CMH_SSR |
3378 | ROUTINE : cmhSS_sendFie |
3379 +-------------------------------------------------------------------+
3380
3381 PURPOSE : forward unsolicited facility responses from SS to terminal
3382
3383 */
3384 GLOBAL T_ACI_RETURN cmhSS_sendFie( T_ACI_FAC_DIR tDirection,
3385 T_ACI_FAC_TRANS_TYPE tType,
3386 T_fac_inf *fie )
3387 {
3388 T_ACI_CMD_SRC tSrc;
3389
3390 TRACE_EVENT( "cmhSS_sendFie()" );
3391
3392 for( tSrc=CMD_SRC_LCL; tSrc<CMD_SRC_MAX; tSrc++ ) /* try over all sources */
3393 {
3394 if( cmhPrm[tSrc].ssCmdPrm.CSCNss_mode.SsCSCNModeState EQ SS_CSCN_MOD_STATE_ON )
3395 {
3396 switch (cmhPrm[tSrc].ssCmdPrm.CSCNss_mode.SsCSCNModeDirection)
3397 {
3398 case SS_CSCN_MOD_DIR_BOTH:
3399 break; /* printout regardless of direction */
3400
3401 case SS_CSCN_MOD_DIR_IN:
3402 if( tDirection NEQ CSCN_FACILITY_DIRECTION_IN)
3403 continue; /* settings for source don't match, advance to next source */
3404 break;
3405
3406 case SS_CSCN_MOD_DIR_OUT:
3407 if( tDirection NEQ CSCN_FACILITY_DIRECTION_OUT )
3408 continue; /* settings for source don't match, advance to next source */
3409 break;
3410
3411 default:
3412 continue; /* illegal setting, advance to next source */
3413 }
3414 R_AT( RAT_CSSN, tSrc )( tDirection, tType, fie );
3415 }
3416 }
3417 return( AT_CMPL );
3418 }
3419
3420
3421 /*==== EOF ========================================================*/
3422