comparison gsm-fw/g23m-aci/aci/cmh_ssr.c @ 775:eedbf248bac0

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