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

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