FreeCalypso > hg > tcs211-l1-reconst
comparison g23m/condat/ms/src/aci/cmh_ssf.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CMH_SSF | |
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 used by the command | |
18 | handler for the supplementary service module. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 #ifndef CMH_SSF_C | |
22 #define CMH_SSF_C | |
23 #endif | |
24 | |
25 #include "aci_all.h" | |
26 /*==== INCLUDES ===================================================*/ | |
27 #include "aci_cmh.h" | |
28 #include "ati_cmd.h" | |
29 #include "aci_cmd.h" | |
30 | |
31 | |
32 #ifdef FAX_AND_DATA | |
33 #include "aci_fd.h" | |
34 #endif /* of #ifdef FAX_AND_DATA */ | |
35 | |
36 #ifdef UART | |
37 #include "dti.h" | |
38 #include "dti_conn_mng.h" | |
39 #endif | |
40 | |
41 #include "pcm.h" | |
42 #include "ksd.h" | |
43 #include "aci.h" | |
44 #include "psa.h" | |
45 #include "psa_ss.h" | |
46 #include "psa_sim.h" | |
47 #include "psa_util.h" | |
48 #include "cmh.h" | |
49 #include "cmh_ss.h" | |
50 #include "cmh_sim.h" | |
51 #include "psa_cc.h" | |
52 #include "psa_sat.h" | |
53 | |
54 #include "cl_imei.h" | |
55 | |
56 /* For SAT and FDN check */ | |
57 #include "cmh_cc.h" | |
58 #include "cmh_sat.h" | |
59 #include "phb.h" | |
60 | |
61 | |
62 /*==== CONSTANTS ==================================================*/ | |
63 #ifdef SIM_TOOLKIT | |
64 /* cModMapTable maps Mode into SS Mode Code. */ | |
65 const T_IDX_TO_STR_MAP cModMapTable[] = | |
66 {{CCFC_MOD_Disable, "#"}, {CCFC_MOD_Enable, "*"}, {CCFC_MOD_Register, "**"}, | |
67 {CCFC_MOD_Erasure, "##"}, {CCFC_MOD_Query, "*#"}, {NULL, NULL}}; | |
68 | |
69 /* Call Forwarding */ | |
70 /* cRsnMapTable maps Reason into SS Service Code. Must correspond to T_ACI_CCFC_RSN*/ | |
71 const T_IDX_TO_STR_MAP cCFRsnMapTable[] = | |
72 {{CCFC_RSN_Uncond, "21"}, {CCFC_RSN_Busy, "67"}, {CCFC_RSN_NoReply, "61"}, | |
73 {CCFC_RSN_NotReach, "62"}, {CCFC_RSN_Forward, "002"}, {CCFC_RSN_CondForward, "004"}, | |
74 {NULL, NULL}}; | |
75 | |
76 /* Call Barring */ | |
77 /* cRsnMapTable maps Reason into SS Service Code. Must correspond to T_ACI_CLCK_FAC*/ | |
78 const T_IDX_TO_STR_MAP cCBRsnMapTable[] = | |
79 {{CLCK_FAC_Ao, "33"}, {CLCK_FAC_Oi, "331"}, {CLCK_FAC_Ox, "332"}, | |
80 {CLCK_FAC_Ai, "35"}, {CLCK_FAC_Ir, "351"}, {CLCK_FAC_Ab, "330"}, | |
81 {CLCK_FAC_Ag, "333"}, {CLCK_FAC_Ac, "353"}, | |
82 {NULL, NULL}}; | |
83 | |
84 | |
85 const T_IDX_TO_DIG_MAP cCFBSMapTable[] = | |
86 {{CLASS_Vce, KSD_BS_Telephony}, {CLASS_Dat, KSD_BS_AllBearer}, {CLASS_VceDat, KSD_BS_Telephony}, | |
87 {CLASS_Fax, KSD_BS_AllFax}, {CLASS_VceFax, KSD_BS_AllTeleXcptSMS}, {CLASS_DatFax, KSD_BS_AllFax}, | |
88 {CLASS_VceDatFax, KSD_BS_AllTeleXcptSMS}, {CLASS_Sms, KSD_BS_SMS}, {CLASS_DatSms, KSD_BS_SMS}, | |
89 {CLASS_VceDatFaxSms, KSD_BS_AllTele}, {CLASS_DatCirSync, KSD_BS_AllDataCircSync}, | |
90 {CLASS_DatCirAsync, KSD_BS_AllDataCircAsync}, {CLASS_AllSync, KSD_BS_AllSync}, {CLASS_AllAsync, KSD_BS_AllAsync}, | |
91 {CLASS_DedPacAccess, KSD_BS_AllDedPackAcc}, {CLASS_DedPADAcess, KSD_BS_AllDedPADAcc}, | |
92 {CLASS_AuxVce, KSD_BS_PLMN1}, {NULL, NULL}}; | |
93 | |
94 const T_IDX_TO_DIG_MAP cCFBSAllBearMapTable[] = | |
95 {{CLASS_VceDat, KSD_BS_AllBearer}, {CLASS_DatFax, KSD_BS_AllBearer}, {CLASS_VceDatFax, KSD_BS_AllBearer}, | |
96 {CLASS_Sms, KSD_BS_AllBearer}, {CLASS_VceDatFaxSms, KSD_BS_AllBearer}, {NULL, NULL}}; | |
97 #endif /* SIM_TOOLKIT */ | |
98 | |
99 /*==== TYPES ======================================================*/ | |
100 | |
101 LOCAL UBYTE cmhSS_getSumOf2Digits ( UBYTE digits ); | |
102 | |
103 /*==== EXPORT =====================================================*/ | |
104 | |
105 | |
106 /*==== VARIABLES ==================================================*/ | |
107 | |
108 EXTERN T_PCEER causeMod; | |
109 EXTERN SHORT causeCeer; | |
110 | |
111 /*==== FUNCTIONS ==================================================*/ | |
112 | |
113 /* | |
114 +-------------------------------------------------------------------+ | |
115 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
116 | ROUTINE : cmhSS_GetClass | | |
117 +-------------------------------------------------------------------+ | |
118 | |
119 PURPOSE : Get class value out of a basic service type. | |
120 | |
121 */ | |
122 | |
123 GLOBAL T_ACI_CLASS cmhSS_GetClass( T_basicService * bs ) | |
124 { | |
125 TRACE_FUNCTION ("cmhSS_GetClass()"); | |
126 | |
127 if( bs -> v_bearerService ) | |
128 { | |
129 return( CLASS_Dat ); | |
130 } | |
131 | |
132 else if( bs -> v_teleservice ) | |
133 { | |
134 switch( bs -> teleservice ) | |
135 { | |
136 case( TS_CD_ALL_SPCH ): return( CLASS_Vce ); | |
137 case( TS_CD_ALL_FAX ): return( CLASS_Fax ); | |
138 case( TS_CD_ALL_XCPT_SMS ): return( CLASS_VceFax ); | |
139 case( TS_CD_PLMN1 ): return( CLASS_AuxVce ); | |
140 default: return( CLASS_None ); | |
141 } | |
142 } | |
143 | |
144 else | |
145 | |
146 return( CLASS_None ); | |
147 } | |
148 | |
149 /* | |
150 +-------------------------------------------------------------------+ | |
151 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
152 | ROUTINE : cmhSS_GetClassLst | | |
153 +-------------------------------------------------------------------+ | |
154 | |
155 PURPOSE : Get combined class value out of a basic service list. | |
156 | |
157 */ | |
158 | |
159 GLOBAL T_ACI_CLASS cmhSS_GetClassLst( T_basicServiceGroupList * bs ) | |
160 { | |
161 T_ACI_CLASS class_type = CLASS_None; | |
162 UBYTE idx; | |
163 | |
164 TRACE_FUNCTION ("cmhSS_GetClassLst()"); | |
165 | |
166 if( bs -> c_bearerService ) | |
167 { | |
168 class_type |= CLASS_Dat; | |
169 } | |
170 | |
171 if( bs -> c_teleservice ) | |
172 { | |
173 for( idx = 0; idx < bs -> c_teleservice; idx++ ) | |
174 { | |
175 switch( bs -> teleservice[idx] ) | |
176 { | |
177 case( TS_CD_ALL_SPCH ): class_type |= CLASS_Vce; break; | |
178 case( TS_CD_ALL_FAX ): class_type |= CLASS_Fax; break; | |
179 case( TS_CD_ALL_XCPT_SMS ): class_type |= CLASS_VceFax; break; | |
180 case( TS_CD_ALL_SMS ): | |
181 case( TS_CD_SMS_MT ): | |
182 case( TS_CD_SMS_MO ): class_type |= CLASS_Sms; break; | |
183 case( TS_CD_PLMN1 ): class_type |= CLASS_AuxVce; break; | |
184 } | |
185 } | |
186 } | |
187 | |
188 return( class_type ); | |
189 } | |
190 | |
191 /* | |
192 +-------------------------------------------------------------------+ | |
193 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
194 | ROUTINE : cmhSS_CheckClass | | |
195 +-------------------------------------------------------------------+ | |
196 | |
197 PURPOSE : Check class value. | |
198 | |
199 */ | |
200 | |
201 GLOBAL BOOL cmhSS_CheckClassInterr( T_ACI_CLASS class_type) | |
202 { | |
203 TRACE_FUNCTION ("cmhSS_CheckClassInterr()"); | |
204 | |
205 switch( class_type ) | |
206 { | |
207 case( CLASS_None ): | |
208 case( CLASS_Vce ): | |
209 case( CLASS_Dat ): | |
210 case( CLASS_VceDat ): | |
211 case( CLASS_Fax ): | |
212 case( CLASS_VceFax ): | |
213 case( CLASS_DatFax ): | |
214 case( CLASS_NotPresent ): | |
215 case( CLASS_VceDatFax ): | |
216 case( CLASS_DatCirSync ): | |
217 case( CLASS_DatCirAsync ): | |
218 case( CLASS_DedPacAccess ): | |
219 case( CLASS_AllSync ): | |
220 case( CLASS_AllAsync ): | |
221 case( CLASS_DedPADAcess ): | |
222 case( CLASS_AuxVce ): | |
223 return( TRUE ); | |
224 | |
225 default: | |
226 return( FALSE ); | |
227 } | |
228 } | |
229 | |
230 GLOBAL BOOL cmhSS_CheckCbClassInterr( T_ACI_CLASS class_type) | |
231 { | |
232 TRACE_FUNCTION ("cmhSS_CheckClassInterr()"); | |
233 | |
234 switch( class_type ) | |
235 { | |
236 case( CLASS_None ): | |
237 case( CLASS_Vce ): | |
238 case( CLASS_Dat ): | |
239 case( CLASS_VceDat ): | |
240 case( CLASS_Fax ): | |
241 case( CLASS_VceFax ): | |
242 case( CLASS_DatFax ): | |
243 case( CLASS_NotPresent ): | |
244 case( CLASS_VceDatFax ): | |
245 case( CLASS_Sms ): | |
246 case( CLASS_VceSms ): | |
247 case( CLASS_DatSms ): | |
248 case( CLASS_VceDatSms ): | |
249 case( CLASS_FaxSms ): | |
250 case( CLASS_VceFaxSms ): | |
251 case( CLASS_DatFaxSms ): | |
252 case( CLASS_VceDatFaxSms ): | |
253 case( CLASS_DatCirSync ): | |
254 case( CLASS_DatCirAsync ): | |
255 case( CLASS_DedPacAccess ): | |
256 case( CLASS_AllSync ): | |
257 case( CLASS_AllAsync ): | |
258 case( CLASS_DedPADAcess ): | |
259 case( CLASS_AuxVce) : | |
260 return( TRUE ); | |
261 | |
262 default: | |
263 return( FALSE ); | |
264 } | |
265 } | |
266 | |
267 GLOBAL BOOL cmhSS_CheckClass( T_ACI_CLASS class_type, | |
268 UBYTE *bs1, UBYTE *bst1, | |
269 UBYTE *bs2, UBYTE *bst2, | |
270 BOOL *mltyTrnFlg ) | |
271 { | |
272 TRACE_FUNCTION ("cmhSS_CheckClass()"); | |
273 | |
274 *bs1 = *bs2 = *bst1 = *bst2 = SS_NO_PRM; | |
275 *mltyTrnFlg = FALSE; | |
276 | |
277 switch( class_type ) | |
278 { | |
279 case( CLASS_NotPresent ): | |
280 case( CLASS_None ): *bs1 = *bst1 = SS_NO_PRM; | |
281 break; | |
282 case( CLASS_Vce ): *bs1 = TS_CD_ALL_SPCH; *bst1 = BS_TELE_SRV; | |
283 break; | |
284 case( CLASS_AuxVce ): *bs1 = TS_CD_PLMN1; *bst1 = BS_TELE_SRV; | |
285 break; | |
286 case( CLASS_Dat ): *bs1 = BS_CD_ALL_BS; *bst1 = BS_BEAR_SRV; | |
287 break; | |
288 case( CLASS_VceDat ): *bs1 = TS_CD_ALL_SPCH; *bst1 = BS_TELE_SRV; | |
289 *bs2 = BS_CD_ALL_BS; *bst2 = BS_BEAR_SRV; | |
290 *mltyTrnFlg = TRUE; | |
291 break; | |
292 case( CLASS_Fax ): *bs1 = TS_CD_ALL_FAX; *bst1 = BS_TELE_SRV; | |
293 break; | |
294 case( CLASS_VceFax ): *bs1 = TS_CD_ALL_XCPT_SMS; *bst1 = BS_TELE_SRV; | |
295 break; | |
296 case( CLASS_DatFax ): *bs1 = TS_CD_ALL_FAX; *bst1 = BS_TELE_SRV; | |
297 *bs2 = BS_CD_ALL_BS; *bst2 = BS_BEAR_SRV; | |
298 *mltyTrnFlg = TRUE; | |
299 break; | |
300 | |
301 case( CLASS_VceDatFax ): *bs1 = TS_CD_ALL_XCPT_SMS; *bst1 = BS_TELE_SRV; | |
302 *bs2 = BS_CD_ALL_BS; *bst2 = BS_BEAR_SRV; | |
303 *mltyTrnFlg = TRUE; | |
304 break; | |
305 case( CLASS_DatCirSync ): | |
306 *bs1 = BS_CD_ALL_DC_SYN; *bst1 = BS_BEAR_SRV; | |
307 break; | |
308 case( CLASS_DatCirAsync ): | |
309 *bs1 = BS_CD_ALL_DC_ASYN; *bst1 = BS_BEAR_SRV; | |
310 break; | |
311 case( CLASS_DedPacAccess ): | |
312 *bs1 = BS_CD_ALL_DATA_PDS; *bst1 = BS_BEAR_SRV; | |
313 break; | |
314 case( CLASS_AllSync ): | |
315 *bs1 = BS_CD_ALL_SYN; *bst1 = BS_BEAR_SRV; | |
316 break; | |
317 case( CLASS_AllAsync ): | |
318 *bs1 = BS_CD_ALL_ASYN; *bst1 = BS_BEAR_SRV; | |
319 break; | |
320 case( CLASS_DedPADAcess ): | |
321 *bs1 = BS_CD_ALL_DATA_PAD; *bst1 = BS_BEAR_SRV; | |
322 break; | |
323 default: | |
324 return( FALSE ); | |
325 } | |
326 | |
327 return( TRUE ); | |
328 } | |
329 | |
330 GLOBAL BOOL cmhSS_CheckCbClass( T_ACI_CLASS class_type, | |
331 UBYTE *bs1, UBYTE *bst1, | |
332 UBYTE *bs2, UBYTE *bst2, | |
333 BOOL *mltyTrnFlg ) | |
334 { | |
335 TRACE_FUNCTION ("cmhSS_CheckCBClass()"); | |
336 | |
337 *bs1 = *bs2 = *bst1 = *bst2 = SS_NO_PRM; | |
338 *mltyTrnFlg = FALSE; | |
339 | |
340 switch( class_type ) | |
341 { | |
342 case CLASS_NotPresent: | |
343 case CLASS_None: *bs1 = *bst1 = SS_NO_PRM; | |
344 break; | |
345 case CLASS_Vce: *bs1 = TS_CD_ALL_SPCH; *bst1 = BS_TELE_SRV; | |
346 break; | |
347 case CLASS_AuxVce: *bs1 = TS_CD_PLMN1; *bst1 = BS_TELE_SRV; | |
348 break; | |
349 case CLASS_Dat : *bs1 = BS_CD_ALL_BS; *bst1 = BS_BEAR_SRV; | |
350 break; | |
351 case CLASS_VceDat: *bs1 = TS_CD_ALL_SPCH; *bst1 = BS_TELE_SRV; | |
352 *bs2 = BS_CD_ALL_BS; *bst2 = BS_BEAR_SRV; | |
353 *mltyTrnFlg = TRUE; | |
354 break; | |
355 case CLASS_Fax: *bs1 = TS_CD_ALL_FAX; *bst1 = BS_TELE_SRV; | |
356 break; | |
357 case CLASS_VceFax: *bs1 = TS_CD_ALL_XCPT_SMS; *bst1 = BS_TELE_SRV; | |
358 break; | |
359 case CLASS_DatFax: *bs1 = TS_CD_ALL_FAX; *bst1 = BS_TELE_SRV; | |
360 *bs2 = BS_CD_ALL_BS; *bst2 = BS_BEAR_SRV; | |
361 *mltyTrnFlg = TRUE; | |
362 break; | |
363 case CLASS_VceDatFax: *bs1 = TS_CD_ALL_XCPT_SMS; *bst1 = BS_TELE_SRV; | |
364 *bs2 = BS_CD_ALL_BS; *bst2 = BS_BEAR_SRV; | |
365 *mltyTrnFlg = TRUE; | |
366 break; | |
367 case CLASS_Sms: *bs1 = TS_CD_ALL_SMS; *bst1 = BS_TELE_SRV; | |
368 break; | |
369 case CLASS_DatSms: *bs1 = TS_CD_ALL_SMS; *bst1 = BS_TELE_SRV; | |
370 *bs2 = BS_CD_ALL_BS; *bst2 = BS_BEAR_SRV; | |
371 *mltyTrnFlg = TRUE; | |
372 break; | |
373 case CLASS_VceDatFaxSms: *bs1 = TS_CD_ALL_TS; *bst1 = BS_TELE_SRV; | |
374 *bs2 = BS_CD_ALL_BS; *bst2 = BS_BEAR_SRV; | |
375 *mltyTrnFlg = TRUE; | |
376 break; | |
377 case( CLASS_DatCirSync ): | |
378 *bs1 = BS_CD_ALL_DC_SYN; *bst1 = BS_BEAR_SRV; | |
379 break; | |
380 case( CLASS_DatCirAsync ): | |
381 *bs1 = BS_CD_ALL_DC_ASYN; *bst1 = BS_BEAR_SRV; | |
382 break; | |
383 case( CLASS_DedPacAccess ): | |
384 *bs1 = BS_CD_ALL_DATA_PDS; *bst1 = BS_BEAR_SRV; | |
385 break; | |
386 case( CLASS_AllSync ): | |
387 *bs1 = BS_CD_ALL_SYN; *bst1 = BS_BEAR_SRV; | |
388 break; | |
389 case( CLASS_AllAsync ): | |
390 *bs1 = BS_CD_ALL_ASYN; *bst1 = BS_BEAR_SRV; | |
391 break; | |
392 case( CLASS_DedPADAcess ): | |
393 *bs1 = BS_CD_ALL_DATA_PAD; *bst1 = BS_BEAR_SRV; | |
394 break; | |
395 | |
396 case CLASS_VceSms: | |
397 case CLASS_VceDatSms: | |
398 case CLASS_FaxSms: | |
399 case CLASS_VceFaxSms: | |
400 case CLASS_DatFaxSms: | |
401 return( FALSE ); | |
402 | |
403 default: | |
404 return( FALSE ); | |
405 } | |
406 | |
407 | |
408 return( TRUE ); | |
409 } | |
410 | |
411 /* | |
412 +-------------------------------------------------------------------+ | |
413 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
414 | ROUTINE : cmhSS_CheckBscSrv | | |
415 +-------------------------------------------------------------------+ | |
416 | |
417 PURPOSE : Check basic service value. | |
418 | |
419 */ | |
420 | |
421 GLOBAL BOOL cmhSS_CheckBscSrv ( UBYTE bsCd, | |
422 UBYTE *bs, UBYTE *bst, T_ACI_CLASS *class_type ) | |
423 { | |
424 T_ACI_CLASS dummy_class; | |
425 | |
426 TRACE_FUNCTION ("cmhSS_CheckBscSrv()"); | |
427 | |
428 if(class_type EQ NULL) | |
429 { | |
430 class_type = &dummy_class; | |
431 } | |
432 | |
433 *bs = *bst = SS_NO_PRM; | |
434 *class_type = CLASS_None; | |
435 | |
436 switch( bsCd ) | |
437 { | |
438 case( KSD_BS_None ): | |
439 case( KSD_BS_AllTeleAllBearer ): /* no code required */ | |
440 *class_type = CLASS_VceDatFaxSms + CLASS_AuxVce; | |
441 break; | |
442 case( KSD_BS_AllTele ): *bs = TS_CD_ALL_TS; *bst = BS_TELE_SRV; *class_type = CLASS_VceFaxSms + CLASS_AuxVce; | |
443 break; | |
444 /* For MMI service Code Telephony, use the corresponding Service Group | |
445 "Speech"... The MS shall always send the Service Group... See GSM: 03.11 */ | |
446 case( KSD_BS_Telephony ): *bs = TS_CD_ALL_SPCH; *bst = BS_TELE_SRV; *class_type = CLASS_Vce + CLASS_AuxVce; | |
447 break; | |
448 case( KSD_BS_AllData ): *bs = TS_CD_ALL_DATA; *bst = BS_TELE_SRV; *class_type = CLASS_Dat; | |
449 break; | |
450 case( KSD_BS_AllFax ): *bs = TS_CD_ALL_FAX; *bst = BS_TELE_SRV; *class_type = CLASS_Fax; | |
451 break; | |
452 case( KSD_BS_SMS ): *bs = TS_CD_ALL_SMS; *bst = BS_TELE_SRV; *class_type = CLASS_Sms; | |
453 break; | |
454 case( KSD_BS_VoiceGroup ): *bs = TS_CD_ALL_SPCH; *bst = BS_TELE_SRV; *class_type = CLASS_Vce + CLASS_AuxVce; | |
455 break; | |
456 case( KSD_BS_AllTeleXcptSMS ): *bs = TS_CD_ALL_XCPT_SMS; *bst = BS_TELE_SRV; *class_type = CLASS_VceFax + CLASS_AuxVce; | |
457 break; | |
458 case( KSD_BS_AllBearer ): *bs = BS_CD_ALL_BS; *bst = BS_BEAR_SRV; *class_type = CLASS_Dat; | |
459 break; | |
460 case( KSD_BS_AllAsync ): *bs = BS_CD_ALL_ASYN; *bst = BS_BEAR_SRV; *class_type = CLASS_Dat; | |
461 break; | |
462 case( KSD_BS_AllSync ): *bs = BS_CD_ALL_SYN; *bst = BS_BEAR_SRV; *class_type = CLASS_Dat; | |
463 break; | |
464 case( KSD_BS_AllDataCircSync ): *bs = BS_CD_ALL_DC_SYN; *bst = BS_BEAR_SRV; *class_type = CLASS_Dat; | |
465 break; | |
466 case( KSD_BS_AllDataCircAsync ): *bs = BS_CD_ALL_DC_ASYN; *bst = BS_BEAR_SRV; *class_type = CLASS_Dat; | |
467 break; | |
468 case( KSD_BS_AllDedPackAcc ): *bs = BS_CD_ALL_DATA_PDS; *bst = BS_BEAR_SRV; *class_type = CLASS_Dat; | |
469 break; | |
470 case( KSD_BS_AllDedPADAcc ): *bs = BS_CD_ALL_DATA_PAD; *bst = BS_BEAR_SRV; *class_type = CLASS_Dat; | |
471 break; | |
472 case( KSD_BS_AllPLMNSpecTele ): *bs = TS_CD_ALL_PSSS; *bst = BS_TELE_SRV; | |
473 break; | |
474 case( KSD_BS_PLMNSpecTele1 ): *bs = TS_CD_PLMN1; *bst = BS_TELE_SRV; | |
475 break; | |
476 case( KSD_BS_PLMNSpecTele2 ): *bs = TS_CD_PLMN2; *bst = BS_TELE_SRV; | |
477 break; | |
478 case( KSD_BS_PLMNSpecTele3 ): *bs = TS_CD_PLMN3; *bst = BS_TELE_SRV; | |
479 break; | |
480 case( KSD_BS_PLMNSpecTele4 ): *bs = TS_CD_PLMN4; *bst = BS_TELE_SRV; | |
481 break; | |
482 case( KSD_BS_PLMNSpecTele5 ): *bs = TS_CD_PLMN5; *bst = BS_TELE_SRV; | |
483 break; | |
484 case( KSD_BS_PLMNSpecTele6 ): *bs = TS_CD_PLMN6; *bst = BS_TELE_SRV; | |
485 break; | |
486 case( KSD_BS_PLMNSpecTele7 ): *bs = TS_CD_PLMN7; *bst = BS_TELE_SRV; | |
487 break; | |
488 case( KSD_BS_PLMNSpecTele8 ): *bs = TS_CD_PLMN8; *bst = BS_TELE_SRV; | |
489 break; | |
490 case( KSD_BS_PLMNSpecTele9 ): *bs = TS_CD_PLMN9; *bst = BS_TELE_SRV; | |
491 break; | |
492 case( KSD_BS_PLMNSpecTele10 ): *bs = TS_CD_PLMNA; *bst = BS_TELE_SRV; | |
493 break; | |
494 case( KSD_BS_PLMNSpecTele11 ): *bs = TS_CD_PLMNB; *bst = BS_TELE_SRV; | |
495 break; | |
496 case( KSD_BS_PLMNSpecTele12 ): *bs = TS_CD_PLMNC; *bst = BS_TELE_SRV; | |
497 break; | |
498 case( KSD_BS_PLMNSpecTele13 ): *bs = TS_CD_PLMND; *bst = BS_TELE_SRV; | |
499 break; | |
500 case( KSD_BS_PLMNSpecTele14 ): *bs = TS_CD_PLMNE; *bst = BS_TELE_SRV; | |
501 break; | |
502 case( KSD_BS_PLMNSpecTele15 ): *bs = TS_CD_PLMNF; *bst = BS_TELE_SRV; | |
503 break; | |
504 case( KSD_BS_AllPLMNSpecBearer ):*bs = BS_CD_ALL_PSSS; *bst = BS_BEAR_SRV; | |
505 break; | |
506 case( KSD_BS_PLMNSpecBearer1 ): *bs = BS_CD_PLMN1; *bst = BS_BEAR_SRV; | |
507 break; | |
508 case( KSD_BS_PLMNSpecBearer2 ): *bs = BS_CD_PLMN2; *bst = BS_BEAR_SRV; | |
509 break; | |
510 case( KSD_BS_PLMNSpecBearer3 ): *bs = BS_CD_PLMN3; *bst = BS_BEAR_SRV; | |
511 break; | |
512 case( KSD_BS_PLMNSpecBearer4 ): *bs = BS_CD_PLMN4; *bst = BS_BEAR_SRV; | |
513 break; | |
514 case( KSD_BS_PLMNSpecBearer5 ): *bs = BS_CD_PLMN5; *bst = BS_BEAR_SRV; | |
515 break; | |
516 case( KSD_BS_PLMNSpecBearer6 ): *bs = BS_CD_PLMN6; *bst = BS_BEAR_SRV; | |
517 break; | |
518 case( KSD_BS_PLMNSpecBearer7 ): *bs = BS_CD_PLMN7; *bst = BS_BEAR_SRV; | |
519 break; | |
520 case( KSD_BS_PLMNSpecBearer8 ): *bs = BS_CD_PLMN8; *bst = BS_BEAR_SRV; | |
521 break; | |
522 case( KSD_BS_PLMNSpecBearer9 ): *bs = BS_CD_PLMN9; *bst = BS_BEAR_SRV; | |
523 break; | |
524 case( KSD_BS_PLMNSpecBearer10 ): *bs = BS_CD_PLMNA; *bst = BS_BEAR_SRV; | |
525 break; | |
526 case( KSD_BS_PLMNSpecBearer11 ): *bs = BS_CD_PLMNB; *bst = BS_BEAR_SRV; | |
527 break; | |
528 case( KSD_BS_PLMNSpecBearer12 ): *bs = BS_CD_PLMNC; *bst = BS_BEAR_SRV; | |
529 break; | |
530 case( KSD_BS_PLMNSpecBearer13 ): *bs = BS_CD_PLMND; *bst = BS_BEAR_SRV; | |
531 break; | |
532 case( KSD_BS_PLMNSpecBearer14 ): *bs = BS_CD_PLMNE; *bst = BS_BEAR_SRV; | |
533 break; | |
534 case( KSD_BS_PLMNSpecBearer15 ): *bs = BS_CD_PLMNF; *bst = BS_BEAR_SRV; | |
535 break; | |
536 case( KSD_BS_AuxTelephony ): *bs = TS_CD_PLMN1; *bst = BS_TELE_SRV; *class_type = CLASS_AuxVce; | |
537 break; | |
538 | |
539 default: | |
540 | |
541 return( FALSE ); | |
542 } | |
543 | |
544 | |
545 return( TRUE ); | |
546 } | |
547 | |
548 /* | |
549 +-------------------------------------------------------------------+ | |
550 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
551 | ROUTINE : cmhSS_GetBscSrv | | |
552 +-------------------------------------------------------------------+ | |
553 | |
554 PURPOSE : Get basic service code out of a basic service type. | |
555 | |
556 */ | |
557 | |
558 GLOBAL void cmhSS_GetBscSrv( T_basicService * p, UBYTE * bs, | |
559 UBYTE * bst ) | |
560 { | |
561 TRACE_FUNCTION ("cmhSS_GetBscSrv()"); | |
562 | |
563 if( p -> v_bearerService ) | |
564 { | |
565 *bst = KSD_BS_TP_Bearer; | |
566 *bs = p -> bearerService; | |
567 } | |
568 | |
569 else if( p -> v_teleservice ) | |
570 { | |
571 *bst = KSD_BS_TP_Tele; | |
572 *bs = p -> teleservice; | |
573 } | |
574 | |
575 else | |
576 { | |
577 *bst = KSD_BS_None; | |
578 *bs = KSD_BS_TeleBearerUnknown; | |
579 } | |
580 } | |
581 | |
582 /* | |
583 +-------------------------------------------------------------------+ | |
584 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
585 | ROUTINE : cmhSS_flagTrn | | |
586 +-------------------------------------------------------------------+ | |
587 | |
588 PURPOSE : flag a call for multy-transaction operation | |
589 | |
590 */ | |
591 | |
592 GLOBAL void cmhSS_flagTrn ( SHORT sId, USHORT * flags ) | |
593 { | |
594 *flags |= (0x1 << sId); | |
595 } | |
596 | |
597 /* | |
598 +-------------------------------------------------------------------+ | |
599 | PROJECT : GSM-PS (6147) MODULE : CMH_F | | |
600 | ROUTINE : cmhSS_tstAndUnflagTrn | | |
601 +-------------------------------------------------------------------+ | |
602 | |
603 PURPOSE : test and unflag a call for multy-transaction operation. | |
604 Return the test result. | |
605 | |
606 */ | |
607 | |
608 GLOBAL BOOL cmhSS_tstAndUnflagTrn ( SHORT sId, USHORT * flags ) | |
609 { | |
610 if( *flags & (1u << sId)) | |
611 { | |
612 *flags &= ~(1u << sId); | |
613 return( TRUE ); | |
614 } | |
615 return( FALSE ); | |
616 } | |
617 | |
618 /* | |
619 +--------------------------------------------------------------------+ | |
620 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
621 | STATE : code ROUTINE : cmhSS_ksdCF | | |
622 +--------------------------------------------------------------------+ | |
623 | |
624 PURPOSE : This function invokes the operation for key sequence | |
625 command for call forwarding supplementary services. | |
626 */ | |
627 | |
628 GLOBAL T_ACI_RETURN cmhSS_ksdCF ( T_ACI_CMD_SRC srcId, | |
629 T_ACI_KSD_CF_PRM * cfPrm ) | |
630 { | |
631 SHORT sId; /* holds service id */ | |
632 UBYTE bst; /* holds basic service type */ | |
633 UBYTE bs; /* holds basic service */ | |
634 T_ACI_CLASS user_class; | |
635 | |
636 TRACE_FUNCTION ("cmhSS_ksdCF"); | |
637 | |
638 /* | |
639 *------------------------------------------------------------------- | |
640 * check parameter ss code | |
641 *------------------------------------------------------------------- | |
642 */ | |
643 switch( cfPrm->ssCd ) | |
644 { | |
645 case( KSD_SS_CFU ): | |
646 case( KSD_SS_CFB ): | |
647 case( KSD_SS_CFNRY ): | |
648 case( KSD_SS_CFNRC ): | |
649 case( KSD_SS_ALL_FWSS ): | |
650 case( KSD_SS_ALL_CFWSS ): | |
651 | |
652 break; | |
653 | |
654 default: | |
655 | |
656 return( AT_FAIL ); | |
657 } | |
658 | |
659 /* | |
660 *------------------------------------------------------------------- | |
661 * check parameter basic service code | |
662 *------------------------------------------------------------------- | |
663 */ | |
664 if( !cmhSS_CheckBscSrv( cfPrm->bsCd, &bs, &bst, &user_class )) | |
665 | |
666 return( AT_FAIL ); | |
667 | |
668 /* | |
669 *------------------------------------------------------------------- | |
670 * check parameter <class> against possible ALS-Lock | |
671 *------------------------------------------------------------------- | |
672 */ | |
673 if ((ALSlock EQ ALS_MOD_SPEECH AND user_class EQ CLASS_AuxVce) OR | |
674 (ALSlock EQ ALS_MOD_AUX_SPEECH AND user_class NEQ CLASS_AuxVce)) | |
675 { | |
676 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_AlsLock ); | |
677 return( AT_FAIL ); | |
678 } | |
679 | |
680 /* | |
681 *------------------------------------------------------------------- | |
682 * get a new service table entry | |
683 *------------------------------------------------------------------- | |
684 */ | |
685 sId = psaSS_stbNewEntry(); | |
686 | |
687 if( sId EQ NO_ENTRY ) | |
688 { | |
689 return( AT_FAIL ); | |
690 } | |
691 | |
692 /* | |
693 *------------------------------------------------------------------- | |
694 * check parameter operation code | |
695 *------------------------------------------------------------------- | |
696 */ | |
697 CCD_START; | |
698 | |
699 switch( cfPrm->opCd ) | |
700 { | |
701 /* interrogate call forwarding service */ | |
702 case( KSD_OP_IRGT ): | |
703 psaSS_asmInterrogateSS( cfPrm->ssCd, bst, bs ); | |
704 break; | |
705 | |
706 /* register call forwarding service */ | |
707 case( KSD_OP_REG ): | |
708 | |
709 psaSS_asmRegisterSS( cfPrm->ssCd, bst, bs, | |
710 cfPrm->ton, cfPrm->npi, cfPrm->num, | |
711 cfPrm->tos, cfPrm->oe, cfPrm->sub, | |
712 cfPrm->time ); | |
713 break; | |
714 | |
715 /* erase call forwarding service */ | |
716 case( KSD_OP_ERS ): | |
717 psaSS_asmEraseSS( cfPrm->ssCd, bst, bs ); | |
718 break; | |
719 | |
720 /* activate call forwarding service */ | |
721 case( KSD_OP_ACT ): | |
722 psaSS_asmActivateSS( cfPrm->ssCd, bst, bs ); | |
723 break; | |
724 | |
725 /* deactivate call forwarding service */ | |
726 case( KSD_OP_DEACT ): | |
727 psaSS_asmDeactivateSS( cfPrm->ssCd, bst, bs ); | |
728 break; | |
729 | |
730 /* unexpected operation code */ | |
731 default: | |
732 | |
733 CCD_END; | |
734 return( AT_FAIL ); | |
735 } | |
736 | |
737 /* | |
738 *------------------------------------------------------------------- | |
739 * start transaction | |
740 *------------------------------------------------------------------- | |
741 */ | |
742 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE; | |
743 ssShrdPrm.stb[sId].ssCode = cfPrm->ssCd; | |
744 ssShrdPrm.stb[sId].orgOPC = cfPrm->opCd; | |
745 ssShrdPrm.stb[sId].opCode = cfPrm->opCd; | |
746 ssShrdPrm.stb[sId].srvOwn = srcId; | |
747 ssShrdPrm.stb[sId].ClassType = user_class; | |
748 | |
749 TRACE_EVENT_P1("USER_CLASS: %d", user_class); | |
750 | |
751 ssShrdPrm.stb[sId].curCmd = KSD_CMD_CF; | |
752 | |
753 psaSS_NewTrns(sId); | |
754 | |
755 CCD_END; | |
756 /* | |
757 *------------------------------------------------------------------- | |
758 * log command execution | |
759 *------------------------------------------------------------------- | |
760 */ | |
761 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
762 if( srcId NEQ OWN_SAT ) | |
763 { | |
764 T_ACI_CLOG cmdLog; /* holds logging info */ | |
765 | |
766 cmdLog.atCmd = KSD_CMD_CF; | |
767 cmdLog.cmdType = CLOG_TYPE_Set; | |
768 cmdLog.retCode = AT_EXCT; | |
769 cmdLog.cId = ACI_NumParmNotPresent; | |
770 cmdLog.sId = sId+1; | |
771 cmdLog.cmdPrm.sKSCF.srcId = srcId; | |
772 cmdLog.cmdPrm.sKSCF.opCd = cfPrm->opCd; | |
773 cmdLog.cmdPrm.sKSCF.ssCd = cfPrm->ssCd; | |
774 cmdLog.cmdPrm.sKSCF.bsTp = bst; | |
775 cmdLog.cmdPrm.sKSCF.bsCd = bs; | |
776 cmdLog.cmdPrm.sKSCF.num = cfPrm->num; | |
777 cmdLog.cmdPrm.sKSCF.ton = cfPrm->ton; | |
778 cmdLog.cmdPrm.sKSCF.npi = cfPrm->npi; | |
779 cmdLog.cmdPrm.sKSCF.sub = cfPrm->sub; | |
780 cmdLog.cmdPrm.sKSCF.tos = cfPrm->tos; | |
781 cmdLog.cmdPrm.sKSCF.oe = cfPrm->oe; | |
782 cmdLog.cmdPrm.sKSCF.time = cfPrm->time; | |
783 | |
784 rAT_PercentCLOG( &cmdLog ); | |
785 } | |
786 #endif | |
787 | |
788 return( AT_EXCT ); | |
789 } | |
790 | |
791 /* | |
792 +--------------------------------------------------------------------+ | |
793 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
794 | STATE : code ROUTINE : cmhSS_ksdCB | | |
795 +--------------------------------------------------------------------+ | |
796 | |
797 PURPOSE : This function invokes the operation for key sequence | |
798 command for call barring supplementary services. | |
799 */ | |
800 | |
801 GLOBAL T_ACI_RETURN cmhSS_ksdCB ( T_ACI_CMD_SRC srcId, | |
802 T_ACI_KSD_CB_PRM * cbPrm ) | |
803 { | |
804 SHORT sId; /* holds service id */ | |
805 UBYTE bst; /* holds basic service type */ | |
806 UBYTE bs; /* holds basic service */ | |
807 | |
808 TRACE_FUNCTION ("cmhSS_ksdCB"); | |
809 | |
810 /* | |
811 *------------------------------------------------------------------- | |
812 * check parameter ss code | |
813 *------------------------------------------------------------------- | |
814 */ | |
815 switch( cbPrm->ssCd ) | |
816 { | |
817 case( KSD_SS_BOC ): | |
818 case( KSD_SS_BOICXH ): | |
819 case( KSD_SS_BOIC ): | |
820 case( KSD_SS_ALL_CBSS ): | |
821 case( KSD_SS_BAOC ): | |
822 case( KSD_SS_BIC ): | |
823 case( KSD_SS_BAIC ): | |
824 case( KSD_SS_BICRM ): | |
825 | |
826 break; | |
827 | |
828 default: | |
829 | |
830 return( AT_FAIL ); | |
831 } | |
832 | |
833 /* | |
834 *------------------------------------------------------------------- | |
835 * check parameter basic service code | |
836 *------------------------------------------------------------------- | |
837 */ | |
838 if( !cmhSS_CheckBscSrv( cbPrm->bsCd, &bs, &bst, NULL )) | |
839 | |
840 return( AT_FAIL ); | |
841 | |
842 /* | |
843 *------------------------------------------------------------------- | |
844 * get a new service table entry | |
845 *------------------------------------------------------------------- | |
846 */ | |
847 sId = psaSS_stbNewEntry(); | |
848 | |
849 if( sId EQ NO_ENTRY ) | |
850 { | |
851 return( AT_FAIL ); | |
852 } | |
853 | |
854 /* | |
855 *------------------------------------------------------------------- | |
856 * check parameter operation code | |
857 *------------------------------------------------------------------- | |
858 */ | |
859 CCD_START; | |
860 | |
861 switch( cbPrm->opCd ) | |
862 { | |
863 /* interrogate call barring service */ | |
864 case( KSD_OP_IRGT ): | |
865 psaSS_asmInterrogateSS( cbPrm->ssCd, bst, bs ); | |
866 break; | |
867 | |
868 /* activate call barring service */ | |
869 case( KSD_OP_ACT ): | |
870 psaSS_asmActivateSS( cbPrm->ssCd, bst, bs ); | |
871 break; | |
872 | |
873 /* deactivate call barring service */ | |
874 case( KSD_OP_DEACT ): | |
875 psaSS_asmDeactivateSS( cbPrm->ssCd, bst, bs ); | |
876 break; | |
877 | |
878 /* register call barring service */ | |
879 case( KSD_OP_REG ): | |
880 /* erase call barring service */ | |
881 case( KSD_OP_ERS ): | |
882 /* unexpected operation code */ | |
883 default: | |
884 | |
885 CCD_END; | |
886 return( AT_FAIL ); | |
887 } | |
888 | |
889 /* | |
890 *------------------------------------------------------------------- | |
891 * start transaction | |
892 *------------------------------------------------------------------- | |
893 */ | |
894 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE; | |
895 ssShrdPrm.stb[sId].ssCode = cbPrm->ssCd; | |
896 ssShrdPrm.stb[sId].orgOPC = cbPrm->opCd; | |
897 ssShrdPrm.stb[sId].opCode = cbPrm->opCd; | |
898 ssShrdPrm.stb[sId].srvOwn = srcId; | |
899 | |
900 ssShrdPrm.stb[sId].curCmd = KSD_CMD_CB; | |
901 | |
902 psaSS_NewTrns(sId); | |
903 | |
904 CCD_END; | |
905 | |
906 /* | |
907 *------------------------------------------------------------------- | |
908 * store password for later use | |
909 *------------------------------------------------------------------- | |
910 */ | |
911 if( cbPrm->pwd ) | |
912 { | |
913 strncpy | |
914 ( | |
915 (char *) cmhPrm[srcId].ssCmdPrm.CXXXpwd, | |
916 (char *) cbPrm->pwd, | |
917 MAX_PWD_NUM | |
918 ); | |
919 cmhPrm[srcId].ssCmdPrm.CXXXpwd[MAX_PWD_NUM] = '\0'; | |
920 } | |
921 else | |
922 { | |
923 /* No password was given reset to default */ | |
924 strncpy | |
925 ( | |
926 (char *) cmhPrm[srcId].ssCmdPrm.CXXXpwd, | |
927 "FFFF", | |
928 MAX_PWD_NUM | |
929 ); | |
930 cmhPrm[srcId].ssCmdPrm.CXXXpwd[MAX_PWD_NUM] = '\0'; | |
931 } | |
932 | |
933 /* | |
934 *------------------------------------------------------------------- | |
935 * log command execution | |
936 *------------------------------------------------------------------- | |
937 */ | |
938 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
939 if( srcId NEQ OWN_SAT ) | |
940 { | |
941 T_ACI_CLOG cmdLog; /* holds logging info */ | |
942 | |
943 cmdLog.atCmd = KSD_CMD_CB; | |
944 cmdLog.cmdType = CLOG_TYPE_Set; | |
945 cmdLog.retCode = AT_EXCT; | |
946 cmdLog.cId = ACI_NumParmNotPresent; | |
947 cmdLog.sId = sId+1; | |
948 cmdLog.cmdPrm.sKSCB.srcId = srcId; | |
949 cmdLog.cmdPrm.sKSCB.opCd = cbPrm->opCd; | |
950 cmdLog.cmdPrm.sKSCB.ssCd = cbPrm->ssCd; | |
951 cmdLog.cmdPrm.sKSCB.bsTp = bst; | |
952 cmdLog.cmdPrm.sKSCB.bsCd = bs; | |
953 cmdLog.cmdPrm.sKSCB.pwd = cbPrm->pwd; | |
954 | |
955 rAT_PercentCLOG( &cmdLog ); | |
956 } | |
957 #endif | |
958 | |
959 return( AT_EXCT ); | |
960 } | |
961 | |
962 /* | |
963 +--------------------------------------------------------------------+ | |
964 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
965 | STATE : code ROUTINE : cmhSS_ksdPW | | |
966 +--------------------------------------------------------------------+ | |
967 | |
968 PURPOSE : This function invokes the operation for key sequence | |
969 command for password registration supplementary services. | |
970 */ | |
971 | |
972 GLOBAL T_ACI_RETURN cmhSS_ksdPW ( T_ACI_CMD_SRC srcId, | |
973 T_ACI_KSD_PWD_PRM * pwPrm ) | |
974 { | |
975 SHORT sId=NO_ENTRY; /* holds service id */ | |
976 | |
977 TRACE_FUNCTION ("cmhSS_ksdPW"); | |
978 | |
979 /* | |
980 *------------------------------------------------------------------- | |
981 * check password parameter | |
982 *------------------------------------------------------------------- | |
983 */ | |
984 if( !pwPrm->oldPwd OR !pwPrm->newPwd ) | |
985 { | |
986 TRACE_EVENT("parameters are missing"); | |
987 return( AT_FAIL ); | |
988 } | |
989 | |
990 /* | |
991 *------------------------------------------------------------------- | |
992 * check parameter ss code | |
993 *------------------------------------------------------------------- | |
994 */ | |
995 switch( pwPrm->ssCd ) | |
996 { | |
997 /* | |
998 *------------------------------------------------------------------- | |
999 * if password relates to SS | |
1000 *------------------------------------------------------------------- | |
1001 */ | |
1002 case( KSD_SS_BOC ): | |
1003 case( KSD_SS_BOICXH ): | |
1004 case( KSD_SS_BOIC ): | |
1005 case( KSD_SS_ALL_CBSS ): | |
1006 case( KSD_SS_BAOC ): | |
1007 case( KSD_SS_BIC ): | |
1008 case( KSD_SS_BAIC ): | |
1009 case( KSD_SS_BICRM ): | |
1010 case( KSD_SS_NONE ): | |
1011 case( KSD_SS_ALL_SERV ): | |
1012 | |
1013 | |
1014 /* | |
1015 *------------------------------------------------------------------- | |
1016 * check password length | |
1017 *------------------------------------------------------------------- | |
1018 */ | |
1019 if( strlen( (char *) pwPrm->oldPwd ) > MAX_PWD_NUM OR | |
1020 strlen( (char *) pwPrm->newPwd ) > MAX_PWD_NUM OR | |
1021 strlen( (char *) pwPrm->newPwd2) > MAX_PWD_NUM ) | |
1022 { | |
1023 TRACE_EVENT("password too long"); | |
1024 return( AT_FAIL ); | |
1025 } | |
1026 | |
1027 /* | |
1028 *------------------------------------------------------------------- | |
1029 * get a new service table entry | |
1030 *------------------------------------------------------------------- | |
1031 */ | |
1032 sId = psaSS_stbNewEntry(); | |
1033 | |
1034 if( sId EQ NO_ENTRY ) | |
1035 { | |
1036 return( AT_FAIL ); | |
1037 } | |
1038 | |
1039 /* | |
1040 *------------------------------------------------------------------- | |
1041 * check parameter operation code | |
1042 *------------------------------------------------------------------- | |
1043 */ | |
1044 CCD_START; | |
1045 | |
1046 psaSS_asmRegisterPWD( pwPrm->ssCd ); | |
1047 | |
1048 /* | |
1049 *------------------------------------------------------------------- | |
1050 * start transaction | |
1051 *------------------------------------------------------------------- | |
1052 */ | |
1053 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE; | |
1054 ssShrdPrm.stb[sId].ssCode = pwPrm->ssCd; | |
1055 ssShrdPrm.stb[sId].orgOPC = KSD_OP_REG; | |
1056 ssShrdPrm.stb[sId].opCode = KSD_OP_REG; | |
1057 ssShrdPrm.stb[sId].srvOwn = srcId; | |
1058 | |
1059 ssShrdPrm.stb[sId].curCmd = KSD_CMD_PWD; | |
1060 | |
1061 psaSS_NewTrns(sId); | |
1062 | |
1063 CCD_END; | |
1064 | |
1065 /* | |
1066 *------------------------------------------------------------------- | |
1067 * store passwords for later use | |
1068 *------------------------------------------------------------------- | |
1069 */ | |
1070 strncpy | |
1071 ( | |
1072 (char *) cmhPrm[srcId].ssCmdPrm.CXXXpwd, | |
1073 (char *) pwPrm->oldPwd, | |
1074 MAX_PWD_NUM | |
1075 ); | |
1076 cmhPrm[srcId].ssCmdPrm.CXXXpwd[MAX_PWD_NUM] = '\0'; | |
1077 | |
1078 strncpy | |
1079 ( | |
1080 (char *) cmhPrm[srcId].ssCmdPrm.CXXXnewPwd, | |
1081 (char *) pwPrm->newPwd, | |
1082 MAX_PWD_NUM | |
1083 ); | |
1084 cmhPrm[srcId].ssCmdPrm.CXXXnewPwd[MAX_PWD_NUM] = '\0'; | |
1085 | |
1086 strncpy | |
1087 ( | |
1088 (char *) cmhPrm[srcId].ssCmdPrm.CXXXnewPwd2, | |
1089 (char *) pwPrm->newPwd2, | |
1090 MAX_PWD_NUM | |
1091 ); | |
1092 cmhPrm[srcId].ssCmdPrm.CXXXnewPwd2[MAX_PWD_NUM] = '\0'; | |
1093 break; | |
1094 | |
1095 /* | |
1096 *------------------------------------------------------------------- | |
1097 * if password relates to SIM | |
1098 *------------------------------------------------------------------- | |
1099 */ | |
1100 case( KSD_SS_PIN1 ): | |
1101 case( KSD_SS_PIN2 ): | |
1102 | |
1103 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
1104 | |
1105 return( AT_BUSY ); | |
1106 | |
1107 if( strlen( (char *) pwPrm->oldPwd ) > PIN_LEN OR | |
1108 strlen( (char *) pwPrm->newPwd ) > PIN_LEN ) | |
1109 | |
1110 return( AT_FAIL ); | |
1111 | |
1112 /* Marcus: Issue 1589: 28/01/2003: Start */ | |
1113 if( strlen( (char *) pwPrm->oldPwd ) < MIN_PIN_LEN OR | |
1114 strlen( (char *) pwPrm->newPwd ) < MIN_PIN_LEN ) | |
1115 | |
1116 return( AT_FAIL ); | |
1117 /* Marcus: Issue 1589: 28/01/2003: End */ | |
1118 | |
1119 /* if newPwd2 (verify new PIN ) is given, then check if | |
1120 newPwd2 is identical with newPwd */ | |
1121 if( strlen( (char *) pwPrm->newPwd2 ) > 0 ) | |
1122 { | |
1123 if( strlen( (char *) pwPrm->newPwd ) > PIN_LEN ) | |
1124 { | |
1125 return( AT_FAIL ); | |
1126 } | |
1127 if( strcmp((char *)pwPrm->newPwd, (char *)pwPrm->newPwd2) ) | |
1128 { | |
1129 TRACE_EVENT_P2("new PIN (%s) differs from verify new PIN (%s)", | |
1130 (char *)pwPrm->newPwd, (char *)pwPrm->newPwd2 ); | |
1131 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_WrongPasswd); | |
1132 return( AT_FAIL ); | |
1133 } | |
1134 } | |
1135 | |
1136 cmhSIM_FillInPIN ( (char *) pwPrm->oldPwd, simShrdPrm.setPrm[srcId].curPIN, PIN_LEN ); | |
1137 cmhSIM_FillInPIN ( (char *) pwPrm->newPwd, simShrdPrm.setPrm[srcId].newPIN, PIN_LEN ); | |
1138 | |
1139 simShrdPrm.setPrm[srcId].PINType = (pwPrm->ssCd EQ KSD_SS_PIN1)? | |
1140 PHASE_2_PIN_1:PHASE_2_PIN_2; | |
1141 | |
1142 if ( simShrdPrm.setPrm[srcId].PINType EQ PHASE_2_PIN_1 AND | |
1143 simShrdPrm.PEDStat EQ PEDS_DIS ) | |
1144 { | |
1145 TRACE_EVENT( "FATAL RETURN PIN not enabled" ); | |
1146 return( AT_FAIL ); | |
1147 } | |
1148 | |
1149 simEntStat.curCmd = KSD_CMD_PWD; | |
1150 simEntStat.entOwn = simShrdPrm.owner = srcId; | |
1151 | |
1152 if( psaSIM_ChangePIN() < 0 ) /* change PIN */ | |
1153 { | |
1154 TRACE_EVENT( "FATAL RETURN psaSIM in key sequence" ); | |
1155 return( AT_FAIL ); | |
1156 } | |
1157 break; | |
1158 | |
1159 default: | |
1160 TRACE_EVENT("unexpected SS code"); | |
1161 return( AT_FAIL ); | |
1162 } | |
1163 | |
1164 /* | |
1165 *------------------------------------------------------------------- | |
1166 * log command execution | |
1167 *------------------------------------------------------------------- | |
1168 */ | |
1169 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1170 if( srcId NEQ OWN_SAT ) | |
1171 { | |
1172 T_ACI_CLOG cmdLog; /* holds logging info */ | |
1173 | |
1174 cmdLog.atCmd = KSD_CMD_PWD; | |
1175 cmdLog.cmdType = CLOG_TYPE_Set; | |
1176 cmdLog.retCode = AT_EXCT; | |
1177 cmdLog.cId = ACI_NumParmNotPresent; | |
1178 cmdLog.sId = sId+1; | |
1179 cmdLog.cmdPrm.sKSPW.srcId = srcId; | |
1180 cmdLog.cmdPrm.sKSPW.ssCd = pwPrm->ssCd; | |
1181 cmdLog.cmdPrm.sKSPW.oldPwd = pwPrm->oldPwd; | |
1182 cmdLog.cmdPrm.sKSPW.newPwd = pwPrm->newPwd; | |
1183 | |
1184 rAT_PercentCLOG( &cmdLog ); | |
1185 } | |
1186 #endif | |
1187 | |
1188 return( AT_EXCT ); | |
1189 } | |
1190 | |
1191 /* | |
1192 +--------------------------------------------------------------------+ | |
1193 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
1194 | STATE : code ROUTINE : cmhSS_ksdUSSD | | |
1195 +--------------------------------------------------------------------+ | |
1196 | |
1197 PURPOSE : This function invokes the operation for key sequence | |
1198 command for unstructured supplementary services. | |
1199 */ | |
1200 | |
1201 GLOBAL T_ACI_RETURN cmhSS_ksdUSSD ( T_ACI_CMD_SRC srcId, | |
1202 T_ACI_KSD_USSD_PRM * ussdPrm ) | |
1203 { | |
1204 SHORT sId; /* holds service id */ | |
1205 T_ACI_RETURN retCd; /* holds return code */ | |
1206 UBYTE ussdLen; | |
1207 UBYTE *ussdString; | |
1208 UBYTE src_len; | |
1209 | |
1210 TRACE_FUNCTION ("cmhSS_ksdUSSD"); | |
1211 | |
1212 /* | |
1213 *------------------------------------------------------------------- | |
1214 * check for ussd string | |
1215 *------------------------------------------------------------------- | |
1216 */ | |
1217 if( !ussdPrm->ussd ) | |
1218 | |
1219 return( AT_FAIL ); | |
1220 | |
1221 /* | |
1222 *------------------------------------------------------------------- | |
1223 * get a new service table entry | |
1224 *------------------------------------------------------------------- | |
1225 */ | |
1226 sId = psaSS_stbNewEntry(); | |
1227 | |
1228 if( sId EQ NO_ENTRY ) | |
1229 { | |
1230 return( AT_FAIL ); | |
1231 } | |
1232 | |
1233 /* | |
1234 *------------------------------------------------------------------- | |
1235 * check parameter operation code | |
1236 *------------------------------------------------------------------- | |
1237 */ | |
1238 sId = psaSS_stbFindUssdReq(); | |
1239 | |
1240 if( sId EQ NO_ENTRY ) | |
1241 { | |
1242 /* check if there is another service in progress */ | |
1243 if( psaSS_stbFindActSrv( sId ) NEQ NO_ENTRY ) | |
1244 return( AT_FAIL ); | |
1245 | |
1246 /* get new service table entry */ | |
1247 sId = psaSS_stbNewEntry(); | |
1248 if( sId EQ NO_ENTRY ) return( AT_FAIL ); | |
1249 | |
1250 ssShrdPrm.ussdLen = strlen((char *)ussdPrm->ussd); | |
1251 | |
1252 if( !utl_cvtGsmIra ( ussdPrm->ussd, | |
1253 ssShrdPrm.ussdLen, | |
1254 ssShrdPrm.ussdBuf, | |
1255 MAX_USSD_DATA, | |
1256 CSCS_DIR_IraToGsm ) ) return( AT_FAIL ); | |
1257 CCD_START; | |
1258 | |
1259 MALLOC(ussdString, MAX_USSD_STRING); | |
1260 | |
1261 src_len = (UBYTE)MINIMUM( MAX_USSD_STRING, ssShrdPrm.ussdLen); | |
1262 /* to be sent as dcs = 0x0F: so always pack */ | |
1263 ussdLen = utl_cvt8To7( ssShrdPrm.ussdBuf, | |
1264 src_len, | |
1265 ussdString, 0 ); | |
1266 | |
1267 /* According to spec 23.038 section 6.1.2.3 for USSD packing, for bytes end with | |
1268 * (8*n)-1 i.e where n is 1,2,3....i.e byte 7, 15, 23 ... to be padded | |
1269 * with carriage return <CR>(0xD) | |
1270 */ | |
1271 if ((src_len+1)%8 EQ 0) | |
1272 { | |
1273 ussdString[ussdLen-1] |= (0xD << 1); | |
1274 } | |
1275 | |
1276 psaSS_asmProcUSSDReq( 0x0F, ussdString, ussdLen ); | |
1277 | |
1278 MFREE(ussdString); | |
1279 | |
1280 /* start new transaction */ | |
1281 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE; | |
1282 ssShrdPrm.stb[sId].curCmd = KSD_CMD_USSD; | |
1283 ssShrdPrm.stb[sId].srvOwn = srcId; | |
1284 psaSS_NewTrns(sId); | |
1285 | |
1286 CCD_END; | |
1287 | |
1288 if(satShrdPrm.SIMCCParm.owner EQ OWN_SAT) | |
1289 { | |
1290 TRACE_EVENT("own_sat in ksdUSSD"); | |
1291 /* some more info needed if sat initiated USSD*/ | |
1292 satShrdPrm.SentUSSDid = sId; | |
1293 } | |
1294 retCd = AT_CMPL; | |
1295 } | |
1296 else | |
1297 { | |
1298 ssShrdPrm.ussdLen = strlen((char *)ussdPrm->ussd); | |
1299 | |
1300 if( !utl_cvtGsmIra ( ussdPrm->ussd, | |
1301 ssShrdPrm.ussdLen, | |
1302 ssShrdPrm.ussdBuf, | |
1303 MAX_USSD_DATA, | |
1304 CSCS_DIR_IraToGsm ) ) return( AT_FAIL ); | |
1305 | |
1306 CCD_START; | |
1307 | |
1308 psaSS_asmCnfUSSDReq( 0x0F, ssShrdPrm.ussdBuf, ssShrdPrm.ussdLen ); | |
1309 | |
1310 ssShrdPrm.stb[sId].ussdReqFlg = FALSE; | |
1311 | |
1312 /* continue existing transaction */ | |
1313 psaSS_CntTrns(sId); | |
1314 | |
1315 CCD_END; | |
1316 | |
1317 retCd = AT_CMPL; | |
1318 } | |
1319 | |
1320 /* | |
1321 *------------------------------------------------------------------- | |
1322 * log command execution | |
1323 *------------------------------------------------------------------- | |
1324 */ | |
1325 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1326 if( srcId NEQ OWN_SAT ) | |
1327 { | |
1328 T_ACI_CLOG cmdLog; /* holds logging info */ | |
1329 | |
1330 cmdLog.atCmd = KSD_CMD_USSD; | |
1331 cmdLog.cmdType = CLOG_TYPE_Set; | |
1332 cmdLog.retCode = retCd; | |
1333 cmdLog.cId = ACI_NumParmNotPresent; | |
1334 cmdLog.sId = sId+1; | |
1335 cmdLog.cmdPrm.sKSUS.srcId = srcId; | |
1336 cmdLog.cmdPrm.sKSUS.ussd = ussdPrm->ussd; | |
1337 | |
1338 rAT_PercentCLOG( &cmdLog ); | |
1339 } | |
1340 #endif | |
1341 | |
1342 return( retCd ); | |
1343 } | |
1344 | |
1345 /* | |
1346 +--------------------------------------------------------------------+ | |
1347 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
1348 | STATE : code ROUTINE : cmhSS_ksdUBLK | | |
1349 +--------------------------------------------------------------------+ | |
1350 | |
1351 PURPOSE : This function invokes the operation for key sequence | |
1352 command for unblocking PIN. | |
1353 */ | |
1354 | |
1355 GLOBAL T_ACI_RETURN cmhSS_ksdUBLK ( T_ACI_CMD_SRC srcId, | |
1356 T_ACI_KSD_UBLK_PRM * ublkPrm ) | |
1357 { | |
1358 TRACE_FUNCTION ("cmhSS_ksdUBLK"); | |
1359 | |
1360 /* | |
1361 *------------------------------------------------------------------- | |
1362 * check parameter puk | |
1363 *------------------------------------------------------------------- | |
1364 */ | |
1365 if( !ublkPrm->puk OR strlen( (char *) ublkPrm->puk ) NEQ PUK_LEN ) | |
1366 | |
1367 return( AT_FAIL ); | |
1368 | |
1369 /* | |
1370 *------------------------------------------------------------------- | |
1371 * check parameter pin | |
1372 *------------------------------------------------------------------- | |
1373 */ | |
1374 if( !ublkPrm->pin OR strlen( (char *) ublkPrm->pin ) > PIN_LEN | |
1375 OR strlen( (char *) ublkPrm->pin ) < MIN_PIN_LEN) | |
1376 | |
1377 return( AT_FAIL ); | |
1378 | |
1379 /* | |
1380 *------------------------------------------------------------------- | |
1381 * check parameter ss code | |
1382 *------------------------------------------------------------------- | |
1383 */ | |
1384 switch( ublkPrm->ssCd ) | |
1385 { | |
1386 case( KSD_SS_PIN1 ): | |
1387 case( KSD_SS_PIN2 ): | |
1388 | |
1389 break; | |
1390 | |
1391 default: | |
1392 | |
1393 return( AT_FAIL ); | |
1394 } | |
1395 | |
1396 /* | |
1397 *------------------------------------------------------------------- | |
1398 * unblock PIN | |
1399 *------------------------------------------------------------------- | |
1400 */ | |
1401 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
1402 | |
1403 return( AT_BUSY ); | |
1404 | |
1405 cmhSIM_FillInPIN ( (char *) ublkPrm->puk, simShrdPrm.setPrm[srcId].unblkKey, PUK_LEN ); | |
1406 cmhSIM_FillInPIN ( (char *) ublkPrm->pin, simShrdPrm.setPrm[srcId].curPIN, PIN_LEN ); | |
1407 | |
1408 simShrdPrm.setPrm[srcId].PINType = (ublkPrm->ssCd EQ KSD_SS_PIN1)? | |
1409 PHASE_2_PUK_1:PHASE_2_PUK_2; | |
1410 | |
1411 simEntStat.curCmd = KSD_CMD_UBLK; | |
1412 simEntStat.entOwn = simShrdPrm.owner = srcId; | |
1413 | |
1414 if( psaSIM_UnblockCard( ) < 0 ) /* verify PIN */ | |
1415 { | |
1416 TRACE_EVENT( "FATAL RETURN psaSIM in KSD" ); | |
1417 return( AT_FAIL ); | |
1418 } | |
1419 | |
1420 /* | |
1421 *------------------------------------------------------------------- | |
1422 * log command execution | |
1423 *------------------------------------------------------------------- | |
1424 */ | |
1425 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1426 if( srcId NEQ OWN_SAT ) | |
1427 { | |
1428 T_ACI_CLOG cmdLog; /* holds logging info */ | |
1429 | |
1430 cmdLog.atCmd = KSD_CMD_UBLK; | |
1431 cmdLog.cmdType = CLOG_TYPE_Set; | |
1432 cmdLog.retCode = AT_EXCT; | |
1433 cmdLog.cId = ACI_NumParmNotPresent; | |
1434 cmdLog.sId = ACI_NumParmNotPresent; | |
1435 cmdLog.cmdPrm.sKSUB.srcId = srcId; | |
1436 cmdLog.cmdPrm.sKSUB.ssCd = ublkPrm->ssCd; | |
1437 cmdLog.cmdPrm.sKSUB.puk = ublkPrm->puk; | |
1438 cmdLog.cmdPrm.sKSUB.pin = ublkPrm->pin; | |
1439 | |
1440 rAT_PercentCLOG( &cmdLog ); | |
1441 } | |
1442 #endif | |
1443 | |
1444 return( AT_EXCT ); | |
1445 } | |
1446 | |
1447 /* | |
1448 +--------------------------------------------------------------------+ | |
1449 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
1450 | STATE : code ROUTINE : cmhSS_ksdCW | | |
1451 +--------------------------------------------------------------------+ | |
1452 | |
1453 PURPOSE : This function invokes the operation for key sequence | |
1454 command for call waiting supplementary services. | |
1455 */ | |
1456 | |
1457 GLOBAL T_ACI_RETURN cmhSS_ksdCW ( T_ACI_CMD_SRC srcId, | |
1458 T_ACI_KSD_CW_PRM * cwPrm ) | |
1459 { | |
1460 SHORT sId; /* holds service id */ | |
1461 UBYTE bst; /* holds basic service type */ | |
1462 UBYTE bs; /* holds basic service */ | |
1463 | |
1464 TRACE_FUNCTION ("cmhSS_ksdCW"); | |
1465 | |
1466 /* | |
1467 *------------------------------------------------------------------- | |
1468 * check parameter basic service code | |
1469 *------------------------------------------------------------------- | |
1470 */ | |
1471 if( !cmhSS_CheckBscSrv( cwPrm->bsCd, &bs, &bst, NULL )) | |
1472 | |
1473 return( AT_FAIL ); | |
1474 | |
1475 /* | |
1476 *------------------------------------------------------------------- | |
1477 * get a new service table entry | |
1478 *------------------------------------------------------------------- | |
1479 */ | |
1480 sId = psaSS_stbNewEntry(); | |
1481 | |
1482 if( sId EQ NO_ENTRY ) | |
1483 { | |
1484 return( AT_FAIL ); | |
1485 } | |
1486 | |
1487 /* | |
1488 *------------------------------------------------------------------- | |
1489 * check parameter operation code | |
1490 *------------------------------------------------------------------- | |
1491 */ | |
1492 CCD_START; | |
1493 | |
1494 switch( cwPrm->opCd ) | |
1495 { | |
1496 /* interrogate call forwarding service */ | |
1497 case( KSD_OP_IRGT ): | |
1498 psaSS_asmInterrogateSS( KSD_SS_CW, bst, bs ); | |
1499 break; | |
1500 | |
1501 /* activate call forwarding service */ | |
1502 case( KSD_OP_ACT ): | |
1503 psaSS_asmActivateSS( KSD_SS_CW, bst, bs ); | |
1504 break; | |
1505 | |
1506 /* deactivate call forwarding service */ | |
1507 case( KSD_OP_DEACT ): | |
1508 psaSS_asmDeactivateSS( KSD_SS_CW, bst, bs ); | |
1509 break; | |
1510 | |
1511 /* register call forwarding service */ | |
1512 case( KSD_OP_REG ): | |
1513 /* erase call forwarding service */ | |
1514 case( KSD_OP_ERS ): | |
1515 /* unexpected operation code */ | |
1516 default: | |
1517 | |
1518 CCD_END; | |
1519 return( AT_FAIL ); | |
1520 } | |
1521 | |
1522 /* | |
1523 *------------------------------------------------------------------- | |
1524 * start transaction | |
1525 *------------------------------------------------------------------- | |
1526 */ | |
1527 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE; | |
1528 ssShrdPrm.stb[sId].ssCode = KSD_SS_CW; | |
1529 ssShrdPrm.stb[sId].orgOPC = cwPrm->opCd; | |
1530 ssShrdPrm.stb[sId].opCode = cwPrm->opCd; | |
1531 ssShrdPrm.stb[sId].srvOwn = srcId; | |
1532 | |
1533 ssShrdPrm.stb[sId].curCmd = KSD_CMD_CW; | |
1534 | |
1535 psaSS_NewTrns(sId); | |
1536 | |
1537 CCD_END; | |
1538 | |
1539 /* | |
1540 *------------------------------------------------------------------- | |
1541 * log command execution | |
1542 *------------------------------------------------------------------- | |
1543 */ | |
1544 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1545 if( srcId NEQ OWN_SAT ) | |
1546 { | |
1547 T_ACI_CLOG cmdLog; /* holds logging info */ | |
1548 | |
1549 cmdLog.atCmd = KSD_CMD_CW; | |
1550 cmdLog.cmdType = CLOG_TYPE_Set; | |
1551 cmdLog.retCode = AT_EXCT; | |
1552 cmdLog.cId = ACI_NumParmNotPresent; | |
1553 cmdLog.sId = sId+1; | |
1554 cmdLog.cmdPrm.sKSCW.srcId = srcId; | |
1555 cmdLog.cmdPrm.sKSCW.opCd = cwPrm->opCd; | |
1556 cmdLog.cmdPrm.sKSCW.bsTp = bst; | |
1557 cmdLog.cmdPrm.sKSCW.bsCd = bs; | |
1558 | |
1559 rAT_PercentCLOG( &cmdLog ); | |
1560 } | |
1561 #endif | |
1562 | |
1563 return( AT_EXCT ); | |
1564 } | |
1565 | |
1566 /* | |
1567 +--------------------------------------------------------------------+ | |
1568 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
1569 | STATE : code ROUTINE : cmhSS_ksdCL | | |
1570 +--------------------------------------------------------------------+ | |
1571 | |
1572 PURPOSE : This function invokes the operation for key sequence | |
1573 command for calling line supplementary services. | |
1574 */ | |
1575 | |
1576 GLOBAL T_ACI_RETURN cmhSS_ksdCL ( T_ACI_CMD_SRC srcId, | |
1577 T_ACI_KSD_CL_PRM * clPrm ) | |
1578 { | |
1579 SHORT sId; /* holds service id */ | |
1580 | |
1581 TRACE_FUNCTION ("cmhSS_ksdCL"); | |
1582 | |
1583 /* | |
1584 *------------------------------------------------------------------- | |
1585 * check parameter ss code | |
1586 *------------------------------------------------------------------- | |
1587 */ | |
1588 switch( clPrm->ssCd ) | |
1589 { | |
1590 case( KSD_SS_CLIP ): | |
1591 case( KSD_SS_CLIR ): | |
1592 case( KSD_SS_COLP ): | |
1593 case( KSD_SS_COLR ): | |
1594 | |
1595 break; | |
1596 | |
1597 default: | |
1598 | |
1599 return( AT_FAIL ); | |
1600 } | |
1601 | |
1602 /* | |
1603 *------------------------------------------------------------------- | |
1604 * get a new service table entry | |
1605 *------------------------------------------------------------------- | |
1606 */ | |
1607 sId = psaSS_stbNewEntry(); | |
1608 | |
1609 if( sId EQ NO_ENTRY ) | |
1610 { | |
1611 return( AT_FAIL ); | |
1612 } | |
1613 | |
1614 /* | |
1615 *------------------------------------------------------------------- | |
1616 * check parameter operation code | |
1617 *------------------------------------------------------------------- | |
1618 */ | |
1619 CCD_START; | |
1620 | |
1621 switch( clPrm->opCd ) | |
1622 { | |
1623 /* interrogate call forwarding service */ | |
1624 case( KSD_OP_IRGT ): | |
1625 psaSS_asmInterrogateSS( clPrm->ssCd, SS_NO_PRM, SS_NO_PRM ); | |
1626 break; | |
1627 | |
1628 /* activate call forwarding service */ | |
1629 case( KSD_OP_ACT ): | |
1630 /* deactivate call forwarding service */ | |
1631 case( KSD_OP_DEACT ): | |
1632 /* register call forwarding service */ | |
1633 case( KSD_OP_REG ): | |
1634 /* erase call forwarding service */ | |
1635 case( KSD_OP_ERS ): | |
1636 /* unexpected operation code */ | |
1637 default: | |
1638 | |
1639 CCD_END; | |
1640 return( AT_FAIL ); | |
1641 } | |
1642 | |
1643 /* | |
1644 *------------------------------------------------------------------- | |
1645 * start transaction | |
1646 *------------------------------------------------------------------- | |
1647 */ | |
1648 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE; | |
1649 ssShrdPrm.stb[sId].ssCode = clPrm->ssCd; | |
1650 ssShrdPrm.stb[sId].orgOPC = clPrm->opCd; | |
1651 ssShrdPrm.stb[sId].opCode = clPrm->opCd; | |
1652 ssShrdPrm.stb[sId].srvOwn = srcId; | |
1653 | |
1654 ssShrdPrm.stb[sId].curCmd = KSD_CMD_CL; | |
1655 | |
1656 psaSS_NewTrns(sId); | |
1657 | |
1658 CCD_END; | |
1659 | |
1660 /* | |
1661 *------------------------------------------------------------------- | |
1662 * log command execution | |
1663 *------------------------------------------------------------------- | |
1664 */ | |
1665 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1666 if( srcId NEQ OWN_SAT ) | |
1667 { | |
1668 T_ACI_CLOG cmdLog; /* holds logging info */ | |
1669 | |
1670 cmdLog.atCmd = KSD_CMD_CW; | |
1671 cmdLog.cmdType = CLOG_TYPE_Set; | |
1672 cmdLog.retCode = AT_EXCT; | |
1673 cmdLog.cId = ACI_NumParmNotPresent; | |
1674 cmdLog.sId = sId+1; | |
1675 cmdLog.cmdPrm.sKSCL.srcId = srcId; | |
1676 cmdLog.cmdPrm.sKSCL.opCd = clPrm->opCd; | |
1677 cmdLog.cmdPrm.sKSCL.ssCd = clPrm->ssCd; | |
1678 | |
1679 rAT_PercentCLOG( &cmdLog ); | |
1680 } | |
1681 #endif | |
1682 | |
1683 return( AT_EXCT ); | |
1684 } | |
1685 | |
1686 /* | |
1687 +--------------------------------------------------------------------+ | |
1688 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
1689 | STATE : code ROUTINE : cmhSS_ksdCCBS | | |
1690 +--------------------------------------------------------------------+ | |
1691 | |
1692 PURPOSE : This function invokes the operation for key sequence | |
1693 command for call completion to busy subscriber | |
1694 supplementary services. | |
1695 */ | |
1696 | |
1697 GLOBAL T_ACI_RETURN cmhSS_ksdCCBS ( T_ACI_CMD_SRC srcId, | |
1698 T_ACI_KSD_CCBS_PRM * ccbsPrm ) | |
1699 { | |
1700 SHORT sId; /* holds service id */ | |
1701 | |
1702 TRACE_FUNCTION ("cmhSS_ksdCCBS"); | |
1703 | |
1704 /* | |
1705 *------------------------------------------------------------------- | |
1706 * check parameter ccbs index | |
1707 *------------------------------------------------------------------- | |
1708 */ | |
1709 if( ccbsPrm->idx NEQ KSD_IDX_NONE AND | |
1710 (ccbsPrm->idx < 1 OR ccbsPrm->idx > 5 )) | |
1711 | |
1712 return( AT_FAIL ); | |
1713 | |
1714 /* | |
1715 *------------------------------------------------------------------- | |
1716 * get a new service table entry | |
1717 *------------------------------------------------------------------- | |
1718 */ | |
1719 sId = psaSS_stbNewEntry(); | |
1720 | |
1721 if( sId EQ NO_ENTRY ) | |
1722 { | |
1723 return( AT_FAIL ); | |
1724 } | |
1725 | |
1726 /* | |
1727 *------------------------------------------------------------------- | |
1728 * check parameter operation code | |
1729 *------------------------------------------------------------------- | |
1730 */ | |
1731 CCD_START; | |
1732 | |
1733 switch( ccbsPrm->opCd ) | |
1734 { | |
1735 #if 0 /* For further study, so not yet used */ | |
1736 case( KSD_OP_ACT ): | |
1737 psaSS_asmActivateCCBS( ); | |
1738 break; | |
1739 #endif | |
1740 | |
1741 /* interrogate CCBS */ | |
1742 case( KSD_OP_IRGT ): | |
1743 psaSS_asmInterrogateSS( SS_CD_CCBS, SS_NO_PRM, SS_NO_PRM ); | |
1744 ssShrdPrm.stb[sId].SSver = SS_VERSION_2; | |
1745 break; | |
1746 | |
1747 /* deactivate CCBS */ | |
1748 case( KSD_OP_DEACT ): | |
1749 psaSS_asmDeactivateCCBS( ccbsPrm -> idx ); | |
1750 ssShrdPrm.stb[sId].SSver = SS_VERSION_3; | |
1751 break; | |
1752 | |
1753 default: | |
1754 | |
1755 CCD_END; | |
1756 return( AT_FAIL ); | |
1757 } | |
1758 | |
1759 /* | |
1760 *------------------------------------------------------------------- | |
1761 * start transaction | |
1762 *------------------------------------------------------------------- | |
1763 */ | |
1764 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE; | |
1765 ssShrdPrm.stb[sId].ssCode = KSD_SS_CCBS; | |
1766 ssShrdPrm.stb[sId].orgOPC = ccbsPrm->opCd; | |
1767 ssShrdPrm.stb[sId].opCode = ccbsPrm->opCd; | |
1768 ssShrdPrm.stb[sId].srvOwn = srcId; | |
1769 | |
1770 ssShrdPrm.stb[sId].curCmd = KSD_CMD_CCBS; | |
1771 | |
1772 psaSS_NewTrns(sId); | |
1773 | |
1774 CCD_END; | |
1775 | |
1776 /* | |
1777 *------------------------------------------------------------------- | |
1778 * log command execution | |
1779 *------------------------------------------------------------------- | |
1780 */ | |
1781 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1782 if( srcId NEQ OWN_SAT ) | |
1783 { | |
1784 T_ACI_CLOG cmdLog; /* holds logging info */ | |
1785 | |
1786 cmdLog.atCmd = KSD_CMD_CCBS; | |
1787 cmdLog.cmdType = CLOG_TYPE_Set; | |
1788 cmdLog.retCode = AT_EXCT; | |
1789 cmdLog.cId = ACI_NumParmNotPresent; | |
1790 cmdLog.sId = sId+1; | |
1791 cmdLog.cmdPrm.sKSCC.srcId = srcId; | |
1792 cmdLog.cmdPrm.sKSCC.opCd = ccbsPrm->opCd; | |
1793 cmdLog.cmdPrm.sKSCC.ssCd = KSD_SS_CCBS; | |
1794 cmdLog.cmdPrm.sKSCC.idx = ccbsPrm->idx; | |
1795 | |
1796 rAT_PercentCLOG( &cmdLog ); | |
1797 } | |
1798 #endif | |
1799 | |
1800 return( AT_EXCT ); | |
1801 } | |
1802 | |
1803 /* | |
1804 +--------------------------------------------------------------------+ | |
1805 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
1806 | STATE : code ROUTINE : cmhSS_getSumOf2Digits | | |
1807 +--------------------------------------------------------------------+ | |
1808 | |
1809 PURPOSE : This function is used to compute the sum of an even and | |
1810 an odd labeled digit acc. to GSM 02.16. Only used for | |
1811 computing the CD for an IMEI. | |
1812 */ | |
1813 | |
1814 LOCAL UBYTE cmhSS_getSumOf2Digits ( UBYTE digits ) | |
1815 { | |
1816 UBYTE dval; | |
1817 | |
1818 /* compute odd labeled digit */ | |
1819 dval = 2 * ( digits & 0x0F ); | |
1820 dval = dval - ( dval < 10 ? 0 : 9 ); | |
1821 | |
1822 /* | |
1823 return sum of even labeled digit and | |
1824 already processed odd labeled digit | |
1825 */ | |
1826 return dval + ( ( digits >> 4 ) & 0x0F ); | |
1827 } | |
1828 | |
1829 /* | |
1830 +--------------------------------------------------------------------+ | |
1831 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
1832 | STATE : code ROUTINE : cmhSS_getCdFromImei | | |
1833 +--------------------------------------------------------------------+ | |
1834 | |
1835 PURPOSE : This function is used to compute the CD for an IMEI | |
1836 according to GSM 02.16. | |
1837 */ | |
1838 | |
1839 GLOBAL UBYTE cmhSS_getCdFromImei ( T_ACI_IMEI* imei ) | |
1840 { | |
1841 UBYTE sum = 0; /* sum of step 2 */ | |
1842 UBYTE cd; /* Luhn Check Digit */ | |
1843 | |
1844 /* Step 1 and 2 of CD computation acc. GSM 02.16 */ | |
1845 sum += cmhSS_getSumOf2Digits ( imei -> tac1 ); | |
1846 sum += cmhSS_getSumOf2Digits ( imei -> tac2 ); | |
1847 sum += cmhSS_getSumOf2Digits ( imei -> tac3 ); | |
1848 sum += cmhSS_getSumOf2Digits ( imei -> fac ); | |
1849 sum += cmhSS_getSumOf2Digits ( imei -> snr1 ); | |
1850 sum += cmhSS_getSumOf2Digits ( imei -> snr2 ); | |
1851 sum += cmhSS_getSumOf2Digits ( imei -> snr3 ); | |
1852 | |
1853 /* Step 3 of CD computation acc. GSM 02.16 */ | |
1854 cd = 10 - ( sum % 10 ); | |
1855 cd = ( cd EQ 10 ? 0 : cd ); | |
1856 | |
1857 return ( cd ); | |
1858 } | |
1859 | |
1860 /* | |
1861 +--------------------------------------------------------------------+ | |
1862 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
1863 | STATE : code ROUTINE : cmhSS_ksdIMEI | | |
1864 +--------------------------------------------------------------------+ | |
1865 | |
1866 PURPOSE : This function invokes the operation for key sequence | |
1867 command for getting the IMEI. | |
1868 */ | |
1869 | |
1870 GLOBAL T_ACI_RETURN cmhSS_ksdIMEI( T_ACI_CMD_SRC srcId ) | |
1871 { | |
1872 UBYTE IMEIBuf[CL_IMEI_SIZE]; /* IMEI buffer */ | |
1873 EF_IMEI *pIMEI; /* points to IMEI */ | |
1874 BYTE retVal; /* holds return value */ | |
1875 T_ACI_KSIR ksStat; /* ksd status */ | |
1876 | |
1877 pIMEI = (EF_IMEI *)IMEIBuf; | |
1878 /* | |
1879 * ACI-SPR-19706: Get IMEISV from IMEI common library | |
1880 */ | |
1881 retVal = cl_get_imeisv(CL_IMEI_SIZE, IMEIBuf, CL_IMEI_GET_STORED_IMEI); | |
1882 if(retVal != CL_IMEI_OK) | |
1883 { | |
1884 TRACE_ERROR("ACI ERROR: no IMEISV available!"); | |
1885 return( AT_FAIL ); | |
1886 } | |
1887 TRACE_EVENT("ACI INFO IMEI: got IMEI"); | |
1888 TRACE_EVENT_P8("%02x%02x%02x%02x %02x%02x%02x %02x", | |
1889 IMEIBuf[0], IMEIBuf[1], IMEIBuf[2], IMEIBuf[3], | |
1890 IMEIBuf[4], IMEIBuf[5], IMEIBuf[6], IMEIBuf[7]); | |
1891 | |
1892 ksStat.ksdCmd = KSD_CMD_IMEI; | |
1893 ksStat.ir.rKSIMEI.tac1 = pIMEI->tac1; | |
1894 ksStat.ir.rKSIMEI.tac2 = pIMEI->tac2; | |
1895 ksStat.ir.rKSIMEI.tac3 = pIMEI->tac3; | |
1896 ksStat.ir.rKSIMEI.fac = pIMEI->fac; | |
1897 ksStat.ir.rKSIMEI.snr1 = pIMEI->snr1; | |
1898 ksStat.ir.rKSIMEI.snr2 = pIMEI->snr2; | |
1899 ksStat.ir.rKSIMEI.snr3 = pIMEI->snr3; | |
1900 ksStat.ir.rKSIMEI.svn = pIMEI->svn; | |
1901 ksStat.ir.rKSIMEI.cd = cmhSS_getCdFromImei ( &ksStat.ir.rKSIMEI ); | |
1902 | |
1903 /* | |
1904 ** CQ12314 : NDH : 23/9/2003 | |
1905 ** Added srcID field to ksStat to enable called entity to determine the originator of the command | |
1906 ** and take appropriate action. (eg to Activate Call Forwarding Icon) | |
1907 */ | |
1908 ksStat.srcId = srcId; | |
1909 | |
1910 #if defined (MFW) | |
1911 if (srcId NEQ CMD_SRC_LCL) | |
1912 { | |
1913 R_AT( RAT_KSIR, CMD_SRC_LCL)( &ksStat ); | |
1914 } | |
1915 #endif | |
1916 | |
1917 R_AT( RAT_KSIR, srcId )( &ksStat ); | |
1918 | |
1919 return( AT_CMPL ); | |
1920 } | |
1921 | |
1922 /* | |
1923 +--------------------------------------------------------------------+ | |
1924 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
1925 | STATE : code ROUTINE : cmhSS_ksdGetOpCd | | |
1926 +--------------------------------------------------------------------+ | |
1927 | |
1928 PURPOSE : Transforms SS operation code into KSD operation code. | |
1929 Returns KSD operation code. | |
1930 */ | |
1931 #if(0) | |
1932 GLOBAL UBYTE cmhSS_ksdGetOpCd ( UBYTE opcSS ) | |
1933 { | |
1934 switch( opcSS ) | |
1935 { | |
1936 case( OPC_REGISTER_SS ): return( KSD_OP_REG ); | |
1937 case( OPC_ERASE_SS ): return( KSD_OP_ERS ); | |
1938 case( OPC_ACTIVATE_SS ): return( KSD_OP_ACT ); | |
1939 case( OPC_DEACTIVATE_SS ): return( KSD_OP_DEACT ); | |
1940 case( OPC_INTERROGATE_SS ): return( KSD_OP_IRGT ); | |
1941 case( OPC_REGISTER_PASSWORD ): return( KSD_OP_REG ); | |
1942 } | |
1943 | |
1944 return( KSD_OP_NONE ); | |
1945 } | |
1946 #endif | |
1947 /* | |
1948 +--------------------------------------------------------------------+ | |
1949 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
1950 | STATE : code ROUTINE : cmhSS_ksdBuildErrRslt | | |
1951 +--------------------------------------------------------------------+ | |
1952 | |
1953 PURPOSE : This function build an error result for a failed KSD | |
1954 action. | |
1955 */ | |
1956 | |
1957 GLOBAL void cmhSS_ksdBuildErrRslt ( SHORT sId, T_ACI_KSIR * ksStat, UBYTE err ) | |
1958 { | |
1959 | |
1960 /* | |
1961 *------------------------------------------------------------------- | |
1962 * find error value | |
1963 *------------------------------------------------------------------- | |
1964 */ | |
1965 if( err EQ KSD_NO_ERROR ) | |
1966 { | |
1967 switch( ssShrdPrm.stb[sId].failType ) | |
1968 { | |
1969 case( SSF_SS_ERR ): | |
1970 | |
1971 err = ssShrdPrm.stb[sId].errCd; | |
1972 break; | |
1973 | |
1974 case( SSF_GEN_PRB ): | |
1975 | |
1976 err = ssShrdPrm.stb[sId].rejPrb + 0xA0; | |
1977 break; | |
1978 | |
1979 case( SSF_INV_PRB ): | |
1980 | |
1981 err = ssShrdPrm.stb[sId].rejPrb + 0xB0; | |
1982 break; | |
1983 | |
1984 case( SSF_RSL_PRB ): | |
1985 | |
1986 err = ssShrdPrm.stb[sId].rejPrb + 0xC0; | |
1987 break; | |
1988 | |
1989 case( SSF_ERR_PRB ): | |
1990 | |
1991 err = ssShrdPrm.stb[sId].rejPrb + 0xD0; | |
1992 break; | |
1993 | |
1994 case( SSF_CCD_DEC ): | |
1995 | |
1996 err = KSD_ERR_FATAL_CCD_DEC; | |
1997 break; | |
1998 | |
1999 case( SSF_SS_ENT ): | |
2000 | |
2001 err = KSD_ERR_FATAL_SS_ENT; | |
2002 break; | |
2003 } | |
2004 } | |
2005 | |
2006 /* | |
2007 *------------------------------------------------------------------- | |
2008 * check for command context | |
2009 *------------------------------------------------------------------- | |
2010 */ | |
2011 switch( ssShrdPrm.stb[sId].curCmd ) | |
2012 { | |
2013 /* | |
2014 *---------------------------------------------------------------- | |
2015 * process result for KSD CF command | |
2016 *---------------------------------------------------------------- | |
2017 */ | |
2018 case( KSD_CMD_CF ): | |
2019 | |
2020 ksStat->ksdCmd = KSD_CMD_CF; | |
2021 ksStat->ir.rKSCF.opCd = ssShrdPrm.stb[sId].orgOPC; | |
2022 ksStat->ir.rKSCF.ssCd = ssShrdPrm.stb[sId].ssCode; | |
2023 ksStat->ir.rKSCF.ssErr = err; | |
2024 break; | |
2025 /* | |
2026 *---------------------------------------------------------------- | |
2027 * process result for KSD CB command | |
2028 *---------------------------------------------------------------- | |
2029 */ | |
2030 case( KSD_CMD_CB ): | |
2031 | |
2032 ksStat->ksdCmd = KSD_CMD_CB; | |
2033 ksStat->ir.rKSCB.opCd = ssShrdPrm.stb[sId].orgOPC; | |
2034 ksStat->ir.rKSCB.ssCd = ssShrdPrm.stb[sId].ssCode; | |
2035 ksStat->ir.rKSCB.ssErr = err; | |
2036 break; | |
2037 /* | |
2038 *---------------------------------------------------------------- | |
2039 * process result for KSD CL command | |
2040 *---------------------------------------------------------------- | |
2041 */ | |
2042 case( KSD_CMD_CL ): | |
2043 | |
2044 ksStat->ksdCmd = KSD_CMD_CL; | |
2045 ksStat->ir.rKSCL.opCd = ssShrdPrm.stb[sId].orgOPC; | |
2046 ksStat->ir.rKSCL.ssCd = ssShrdPrm.stb[sId].ssCode; | |
2047 ksStat->ir.rKSCL.ssErr = err; | |
2048 ksStat->ir.rKSCL.ssSt = KSD_ST_NOT_VALID; | |
2049 ksStat->ir.rKSCL.clirOpt = KSD_CO_NOT_VALID; | |
2050 ksStat->ir.rKSCL.ovrdCtg = KSD_OVR_CAT_NOT_VALID; | |
2051 break; | |
2052 /* | |
2053 *---------------------------------------------------------------- | |
2054 * process result for KSD CW command | |
2055 *---------------------------------------------------------------- | |
2056 */ | |
2057 case( KSD_CMD_CW ): | |
2058 | |
2059 ksStat->ksdCmd = KSD_CMD_CW; | |
2060 ksStat->ir.rKSCW.opCd = ssShrdPrm.stb[sId].orgOPC; | |
2061 ksStat->ir.rKSCW.ssCd = ssShrdPrm.stb[sId].ssCode; | |
2062 ksStat->ir.rKSCW.ssErr = err; | |
2063 ksStat->ir.rKSCW.ssSt = KSD_ST_NOT_VALID; | |
2064 break; | |
2065 /* | |
2066 *---------------------------------------------------------------- | |
2067 * process result for KSD PW command | |
2068 *---------------------------------------------------------------- | |
2069 */ | |
2070 case( KSD_CMD_PWD ): | |
2071 | |
2072 ksStat->ksdCmd = KSD_CMD_PWD; | |
2073 ksStat->ir.rKSPW.opCd = ssShrdPrm.stb[sId].orgOPC; | |
2074 ksStat->ir.rKSPW.ssCd = ssShrdPrm.stb[sId].ssCode; | |
2075 ksStat->ir.rKSPW.ssErr = err; | |
2076 if(ssShrdPrm.stb[sId].errPrms NEQ NOT_PRESENT_8BIT) | |
2077 ksStat->ir.rKSPW.errPrms = ssShrdPrm.stb[sId].errPrms; | |
2078 | |
2079 break; | |
2080 /* | |
2081 *---------------------------------------------------------------- | |
2082 * process result for KSD USSD command | |
2083 *---------------------------------------------------------------- | |
2084 */ | |
2085 case( KSD_CMD_USSD ): | |
2086 | |
2087 ksStat->ksdCmd = KSD_CMD_USSD; | |
2088 ksStat->ir.rKSUS.ssErr = err; | |
2089 break; | |
2090 } | |
2091 } | |
2092 | |
2093 /* | |
2094 +--------------------------------------------------------------------+ | |
2095 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
2096 | STATE : code ROUTINE : cmhSS_ksdFillFwdFeatList | | |
2097 +--------------------------------------------------------------------+ | |
2098 | |
2099 PURPOSE : This function fills in the values of a forwarding | |
2100 feature list and returns the number of filled entries. | |
2101 */ | |
2102 | |
2103 GLOBAL UBYTE cmhSS_ksdFillFwdFeatList( T_forwardingFeatureList * ffSS, | |
2104 T_CF_FEAT * cfFeat ) | |
2105 { | |
2106 UBYTE idx; /* holds list index */ | |
2107 | |
2108 for( idx=0; | |
2109 idx < MINIMUM( ffSS->c_ff, MAX_CF_FEAT_NR ); | |
2110 idx++, cfFeat++ ) | |
2111 { | |
2112 cmhSS_GetBscSrv( &ffSS->ff[idx].basicService, | |
2113 &cfFeat->bsCd, | |
2114 &cfFeat->bsTp ); | |
2115 | |
2116 if( !ffSS->ff[idx].v_ssStatus ) | |
2117 cfFeat->ssSt = KSD_ST_NOT_VALID; | |
2118 else | |
2119 cfFeat->ssSt = ffSS->ff[idx].ssStatus; | |
2120 | |
2121 if( ffSS->ff[idx].v_forwardedToNumber AND | |
2122 ffSS->ff[idx].forwardedToNumber.c_bcdDigit ) | |
2123 { | |
2124 utl_BCD2DialStr | |
2125 (ffSS->ff[idx].forwardedToNumber.bcdDigit, | |
2126 (char*)cfFeat->num, | |
2127 ffSS->ff[idx].forwardedToNumber.c_bcdDigit); | |
2128 | |
2129 cfFeat->npi = ffSS->ff[idx].forwardedToNumber.npi; | |
2130 cfFeat->ton = ffSS->ff[idx].forwardedToNumber.noa; | |
2131 } | |
2132 else | |
2133 { | |
2134 cfFeat->npi = 0xFF; | |
2135 cfFeat->ton = 0xFF; | |
2136 } | |
2137 | |
2138 if( ffSS->ff[idx].v_forwardedToSubaddress AND | |
2139 ffSS->ff[idx].forwardedToSubaddress.c_bcdDigit ) | |
2140 { | |
2141 utl_BCD2DialStr | |
2142 (ffSS->ff[idx].forwardedToSubaddress.bcdDigit, | |
2143 (char*)cfFeat->sub, | |
2144 ffSS->ff[idx].forwardedToSubaddress.c_bcdDigit); | |
2145 | |
2146 cfFeat->tos = ffSS->ff[idx].forwardedToSubaddress.tos; | |
2147 cfFeat->oe = ffSS->ff[idx].forwardedToSubaddress.oei; | |
2148 } | |
2149 else | |
2150 { | |
2151 cfFeat->tos = 0xFF; | |
2152 cfFeat->oe = 0xFF; | |
2153 } | |
2154 | |
2155 if( ffSS->ff[idx].v_noReplyConditionTime ) | |
2156 cfFeat->time = ffSS->ff[idx].noReplyConditionTime; | |
2157 else | |
2158 cfFeat->time = 0xFF; | |
2159 } | |
2160 | |
2161 return( idx ); | |
2162 } | |
2163 | |
2164 /* | |
2165 +--------------------------------------------------------------------+ | |
2166 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
2167 | STATE : code ROUTINE : cmhSS_ksdFillCbFeatList | | |
2168 +--------------------------------------------------------------------+ | |
2169 | |
2170 PURPOSE : This function fills in the values of a call barring | |
2171 feature list and returns the number of filled entries. | |
2172 */ | |
2173 | |
2174 GLOBAL UBYTE cmhSS_ksdFillCbFeatList( T_callBarringFeatureList * bfSS, | |
2175 T_CB_INFO * cbInfo ) | |
2176 { | |
2177 UBYTE idx; /* holds list index */ | |
2178 | |
2179 for( idx=0; | |
2180 idx < MINIMUM( bfSS->c_cbf, MAX_CB_INFO_NR); | |
2181 idx++, cbInfo++ ) | |
2182 { | |
2183 cbInfo->ssSt = (bfSS->cbf[idx].v_ssStatus)? | |
2184 bfSS->cbf[idx].ssStatus : | |
2185 (UBYTE)KSD_ST_NOT_VALID; | |
2186 | |
2187 cmhSS_GetBscSrv(&bfSS->cbf[idx].basicService, | |
2188 &cbInfo->bsCd, | |
2189 &cbInfo->bsTp ); | |
2190 } | |
2191 | |
2192 return( idx ); | |
2193 } | |
2194 | |
2195 /* | |
2196 +--------------------------------------------------------------------+ | |
2197 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
2198 | STATE : code ROUTINE : cmhSS_ksdFillBSGList | | |
2199 +--------------------------------------------------------------------+ | |
2200 | |
2201 PURPOSE : This function fills in the values of a basic service | |
2202 group list and returns the number of filled entries. | |
2203 */ | |
2204 | |
2205 GLOBAL UBYTE cmhSS_ksdFillBSGList( T_basicServiceGroupList * bsgSS, | |
2206 T_Cx_BSG * cxBSG ) | |
2207 { | |
2208 UBYTE idx; /* holds list index */ | |
2209 UBYTE lstSpce; /* holds list space */ | |
2210 | |
2211 lstSpce = MAX_CW_BSG_NR; | |
2212 | |
2213 for( idx=0; | |
2214 idx < bsgSS->c_teleservice AND lstSpce; | |
2215 idx++, cxBSG++, lstSpce-- ) | |
2216 { | |
2217 cxBSG->bsCd = bsgSS->teleservice[idx]; | |
2218 cxBSG->bsTp = KSD_BS_TP_Tele; | |
2219 } | |
2220 | |
2221 for( idx=0; | |
2222 idx < bsgSS->c_bearerService AND lstSpce; | |
2223 idx++, cxBSG++, lstSpce-- ) | |
2224 { | |
2225 cxBSG->bsCd = bsgSS->bearerService[idx]; | |
2226 cxBSG->bsTp = KSD_BS_TP_Bearer; | |
2227 } | |
2228 | |
2229 return( MAX_CW_BSG_NR - lstSpce ); | |
2230 } | |
2231 | |
2232 /* | |
2233 +--------------------------------------------------------------------+ | |
2234 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
2235 | STATE : code ROUTINE : cmhSS_ksdFillCCBSFeatList| | |
2236 +--------------------------------------------------------------------+ | |
2237 | |
2238 PURPOSE : This function fills in the values of a forwarding | |
2239 feature list and returns the number of filled entries. | |
2240 */ | |
2241 | |
2242 GLOBAL UBYTE cmhSS_ksdFillCCBSFeatList( T_ccbsFeatureList * ccbsfSS, | |
2243 T_CC_FEAT * ccFeat ) | |
2244 { | |
2245 UBYTE idx; /* holds list index */ | |
2246 | |
2247 for( idx=0; | |
2248 idx < MINIMUM( ccbsfSS->c_ccbsf, MAX_CC_FEAT_NR ); | |
2249 idx++, ccFeat++ ) | |
2250 { | |
2251 cmhSS_GetBscSrv( (T_basicService*)&ccbsfSS->ccbsf[idx].basicServiceGroup, | |
2252 &ccFeat->bsCd, | |
2253 &ccFeat->bsTp ); | |
2254 | |
2255 if( ccbsfSS->ccbsf[idx].v_b_subscriberNumber AND | |
2256 ccbsfSS->ccbsf[idx].b_subscriberNumber.c_bcdDigit ) | |
2257 { | |
2258 utl_BCD2DialStr | |
2259 (ccbsfSS->ccbsf[idx].b_subscriberNumber.bcdDigit, | |
2260 (char*)ccFeat->num, | |
2261 ccbsfSS->ccbsf[idx].b_subscriberNumber.c_bcdDigit); | |
2262 | |
2263 ccFeat->npi = ccbsfSS->ccbsf[idx].b_subscriberNumber.npi; | |
2264 ccFeat->ton = ccbsfSS->ccbsf[idx].b_subscriberNumber.noa; | |
2265 } | |
2266 else | |
2267 { | |
2268 ccFeat->npi = 0xFF; | |
2269 ccFeat->ton = 0xFF; | |
2270 } | |
2271 | |
2272 if( ccbsfSS->ccbsf[idx].v_b_subscriberSubaddress AND | |
2273 ccbsfSS->ccbsf[idx].b_subscriberSubaddress.c_bcdDigit ) | |
2274 { | |
2275 utl_BCD2DialStr | |
2276 (ccbsfSS->ccbsf[idx].b_subscriberSubaddress.bcdDigit, | |
2277 (char*)ccFeat->sub, | |
2278 ccbsfSS->ccbsf[idx].b_subscriberSubaddress.c_bcdDigit); | |
2279 | |
2280 ccFeat->tos = ccbsfSS->ccbsf[idx].b_subscriberSubaddress.tos; | |
2281 ccFeat->oe = ccbsfSS->ccbsf[idx].b_subscriberSubaddress.oei; | |
2282 } | |
2283 else | |
2284 { | |
2285 ccFeat->tos = 0xFF; | |
2286 ccFeat->oe = 0xFF; | |
2287 } | |
2288 | |
2289 if( ccbsfSS->ccbsf[idx].v_ccbsIndex ) | |
2290 ccFeat->idx = ccbsfSS->ccbsf[idx].ccbsIndex; | |
2291 else | |
2292 ccFeat->idx = 0xFF; | |
2293 } | |
2294 | |
2295 return( idx ); | |
2296 } | |
2297 | |
2298 /* | |
2299 +--------------------------------------------------------------------+ | |
2300 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
2301 | STATE : code ROUTINE : cmhSS_ksdFillFwdRes | | |
2302 +--------------------------------------------------------------------+ | |
2303 | |
2304 PURPOSE : This function fills in a forwarding info | |
2305 into a forwarding result structure. | |
2306 */ | |
2307 | |
2308 GLOBAL void cmhSS_ksdFillFwdRes( T_forwardingInfo * fiSS, | |
2309 T_ACI_KSIR *ksStat, | |
2310 T_CF_FEAT * cfFeat ) | |
2311 { | |
2312 /* if SS code is present */ | |
2313 ksStat->ir.rKSCF.ssCd= (fiSS->v_ssCode)? | |
2314 fiSS->ssCode: | |
2315 (UBYTE)KSD_SS_NONE; | |
2316 | |
2317 /* if forwarding feature list is present, decode the forwarding | |
2318 information */ | |
2319 if( fiSS->v_forwardingFeatureList ) | |
2320 { | |
2321 /* no forwarding features present */ | |
2322 if( fiSS->forwardingFeatureList.c_ff EQ 0 ) | |
2323 { | |
2324 TRACE_EVENT("UNEXP: NO FORWARDING FEATURE IN FEATURE LIST"); | |
2325 } | |
2326 | |
2327 /* fowarding feature list present */ | |
2328 else | |
2329 { | |
2330 ksStat->ir.rKSCF.cfFeatLst = cfFeat; | |
2331 | |
2332 ksStat->ir.rKSCF.c_cfFeatLst = | |
2333 cmhSS_ksdFillFwdFeatList( &fiSS->forwardingFeatureList, cfFeat ); | |
2334 } | |
2335 } | |
2336 } | |
2337 | |
2338 /* | |
2339 +--------------------------------------------------------------------+ | |
2340 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
2341 | STATE : code ROUTINE : cmhSS_ksdFillCbRes | | |
2342 +--------------------------------------------------------------------+ | |
2343 | |
2344 PURPOSE : This function fills in a barring info | |
2345 into a barring result structure. | |
2346 */ | |
2347 | |
2348 GLOBAL void cmhSS_ksdFillCbRes( T_callBarringInfo * biSS, | |
2349 T_ACI_KSIR *ksStat, | |
2350 T_CB_INFO * cbInfo ) | |
2351 { | |
2352 /* if SS code is present */ | |
2353 ksStat->ir.rKSCB.ssCd= (biSS->v_ssCode)? | |
2354 biSS->ssCode: | |
2355 (UBYTE)KSD_SS_NONE; | |
2356 | |
2357 /* if barring feature list is present, decode the barring | |
2358 information */ | |
2359 if( biSS->v_callBarringFeatureList ) | |
2360 { | |
2361 /* no forwarding features present */ | |
2362 if( biSS->callBarringFeatureList.c_cbf EQ 0 ) | |
2363 { | |
2364 TRACE_EVENT("UNEXP: NO BARRING FEATURE IN FEATURE LIST"); | |
2365 } | |
2366 | |
2367 /* fowarding feature list present */ | |
2368 else | |
2369 { | |
2370 ksStat->ir.rKSCB.cbInfoLst = cbInfo; | |
2371 | |
2372 ksStat->ir.rKSCB.c_cbInfoLst = | |
2373 cmhSS_ksdFillCbFeatList( &biSS->callBarringFeatureList, cbInfo ); | |
2374 } | |
2375 } | |
2376 } | |
2377 | |
2378 /* | |
2379 +--------------------------------------------------------------------+ | |
2380 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
2381 | STATE : code ROUTINE : cmhSS_ksdFillCwRes | | |
2382 +--------------------------------------------------------------------+ | |
2383 | |
2384 PURPOSE : This function fills in a SS data | |
2385 into a waiting result structure. | |
2386 */ | |
2387 | |
2388 GLOBAL void cmhSS_ksdFillCwRes( T_ssData *datSS, | |
2389 T_ACI_KSIR *ksStat, | |
2390 T_Cx_BSG *cwBSG ) | |
2391 { | |
2392 /* if SS code is present */ | |
2393 ksStat->ir.rKSCW.ssCd= (datSS->v_ssCode)? | |
2394 datSS->ssCode: | |
2395 (UBYTE)KSD_SS_NONE; | |
2396 | |
2397 /* if SS status is present */ | |
2398 ksStat->ir.rKSCW.ssSt= (datSS->v_ssStatus)? | |
2399 datSS->ssStatus: | |
2400 (UBYTE)KSD_ST_NONE; | |
2401 | |
2402 /* if basic service list is present, decode the basic service | |
2403 information */ | |
2404 if( datSS->v_basicServiceGroupList ) | |
2405 { | |
2406 /* no forwarding features present */ | |
2407 if( datSS->basicServiceGroupList.c_bearerService EQ 0 AND | |
2408 datSS->basicServiceGroupList.c_teleservice EQ 0) | |
2409 { | |
2410 TRACE_EVENT("UNEXP: NO BASIC SERVICE IN SERVICE LIST"); | |
2411 } | |
2412 | |
2413 /* fowarding feature list present */ | |
2414 else | |
2415 { | |
2416 ksStat->ir.rKSCW.cwBSGLst = cwBSG; | |
2417 | |
2418 ksStat->ir.rKSCW.c_cwBSGLst = | |
2419 cmhSS_ksdFillBSGList( &datSS->basicServiceGroupList, cwBSG ); | |
2420 } | |
2421 } | |
2422 } | |
2423 | |
2424 /* | |
2425 +-------------------------------------------------------------------+ | |
2426 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2427 | ROUTINE : cmhSS_GetClassType | | |
2428 +-------------------------------------------------------------------+ | |
2429 | |
2430 PURPOSE : Convert class type value. | |
2431 | |
2432 */ | |
2433 | |
2434 GLOBAL T_ACI_CLASS cmhSS_GetClassType( UBYTE bsTp, UBYTE bsCd ) | |
2435 { | |
2436 TRACE_FUNCTION ("cmhSS_GetClassType()"); | |
2437 | |
2438 if ( bsTp EQ KSD_BS_TP_None AND | |
2439 bsCd EQ KSD_BS_TeleBearerUnknown ) | |
2440 return CLASS_VceDatFax; | |
2441 | |
2442 if (bsTp EQ KSD_BS_TP_Bearer) | |
2443 { | |
2444 return( CLASS_Dat ); | |
2445 } | |
2446 if (bsTp EQ KSD_BS_TP_Tele) | |
2447 { | |
2448 switch( bsCd ) | |
2449 { | |
2450 case( TS_CD_TLPHNY ): /* no break */ | |
2451 case( TS_CD_ALL_SPCH ): | |
2452 return( CLASS_Vce ); | |
2453 case( TS_CD_PLMN1 ): | |
2454 return( CLASS_AuxVce); | |
2455 | |
2456 case( TS_CD_ALL_FAX ): | |
2457 return( CLASS_Fax ); | |
2458 | |
2459 case( TS_CD_ALL_TS ): /* no break */ | |
2460 case( TS_CD_ALL_XCPT_SMS ): | |
2461 return( CLASS_VceFax ); | |
2462 | |
2463 default: | |
2464 return( CLASS_None ); | |
2465 } | |
2466 } | |
2467 return( CLASS_None ); | |
2468 } | |
2469 | |
2470 GLOBAL T_ACI_CLASS cmhSS_GetCbClassType( UBYTE bsTp, UBYTE bsCd ) | |
2471 { | |
2472 TRACE_FUNCTION ("cmhSS_GetCbClassType()"); | |
2473 | |
2474 if ( bsTp EQ KSD_BS_TP_None AND | |
2475 bsCd EQ KSD_BS_TeleBearerUnknown ) | |
2476 return CLASS_VceDatFaxSms; | |
2477 | |
2478 if (bsTp EQ KSD_BS_TP_Bearer) | |
2479 { | |
2480 return( CLASS_Dat ); | |
2481 } | |
2482 if (bsTp EQ KSD_BS_TP_Tele) | |
2483 { | |
2484 switch( bsCd ) | |
2485 { | |
2486 case( TS_CD_TLPHNY ): /* no break */ | |
2487 case( TS_CD_ALL_SPCH ): return( CLASS_Vce ); | |
2488 case( TS_CD_PLMN1 ): return( CLASS_AuxVce); | |
2489 | |
2490 case( TS_CD_ALL_FAX ): return( CLASS_Fax ); | |
2491 | |
2492 case( TS_CD_ALL_XCPT_SMS ): return( CLASS_VceFax ); | |
2493 | |
2494 case( TS_CD_ALL_SMS ): | |
2495 case( TS_CD_SMS_MT ): | |
2496 case( TS_CD_SMS_MO ): return (CLASS_Sms ); | |
2497 | |
2498 case( TS_CD_ALL_TS ): return (CLASS_VceFaxSms ); | |
2499 | |
2500 default: return( CLASS_None ); | |
2501 } | |
2502 } | |
2503 return( CLASS_None ); | |
2504 } | |
2505 | |
2506 | |
2507 /* | |
2508 +-------------------------------------------------------------------+ | |
2509 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2510 | ROUTINE : checkSSforFDN | | |
2511 +-------------------------------------------------------------------+ | |
2512 | |
2513 PURPOSE : Check, if SS string exists in FDN phone book | |
2514 Returns FALSE if not found | |
2515 | |
2516 */ | |
2517 T_ACI_RETURN checkSSforFDN(char *cSSString) | |
2518 { | |
2519 | |
2520 T_CLPTY_PRM ssCldPty; | |
2521 | |
2522 if(cSSString NEQ NULL) | |
2523 { | |
2524 cmhCC_init_cldPty( &ssCldPty ); | |
2525 cmh_bldCalPrms ( cSSString, &ssCldPty ); | |
2526 /* | |
2527 *------------------------------------------------------------------- | |
2528 * check fixed dialing phonebook if enabled | |
2529 *------------------------------------------------------------------- | |
2530 */ | |
2531 if((simShrdPrm.crdFun EQ SIM_FDN_ENABLED OR | |
2532 simShrdPrm.crdFun EQ SIM_FDN_BDN_ENABLED) ) | |
2533 { | |
2534 if( ksd_isFDNCheckSeq ( ssCldPty.num ) ) | |
2535 { | |
2536 if(!psaCC_phbNtryFnd( FDN, &ssCldPty )) | |
2537 { | |
2538 TRACE_EVENT ( "SS FDN check failed" ); | |
2539 return FALSE; | |
2540 } | |
2541 } | |
2542 } | |
2543 } | |
2544 return TRUE; | |
2545 } | |
2546 | |
2547 /* | |
2548 +-------------------------------------------------------------------+ | |
2549 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2550 | ROUTINE : checkFDNSendSS | | |
2551 +-------------------------------------------------------------------+ | |
2552 | |
2553 PURPOSE : Check, if SS string exists in FDN phone book and send to STK if allowed | |
2554 Returns AT_FAIL if FDN is not allowed or send to STK fails | |
2555 | |
2556 */ | |
2557 T_ACI_RETURN checkFDNSendSS(T_ACI_CMD_SRC srcId, CHAR *pSSString) | |
2558 { | |
2559 /* If SS string should be checked, but not found in FDN - return error */ | |
2560 if (!checkSSforFDN(pSSString)) | |
2561 { | |
2562 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_FdnCheck ); | |
2563 return AT_FAIL; | |
2564 } | |
2565 #ifdef SIM_TOOLKIT | |
2566 return cmhSS_SendToSAT(srcId, pSSString); | |
2567 #else /* SIM_TOOLKIT */ | |
2568 return AT_CMPL; | |
2569 #endif /* SIM_TOOLKIT */ | |
2570 | |
2571 } | |
2572 | |
2573 /* | |
2574 +-------------------------------------------------------------------+ | |
2575 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2576 | ROUTINE : mapIdxToString | | |
2577 +-------------------------------------------------------------------+ | |
2578 | |
2579 PURPOSE : Find the occurence of the record of type T_IDX_TO_STR_MAP with "idx" field | |
2580 equal index and returns field "cod" | |
2581 If NULL is reurned, no record with correct "idx" has been found | |
2582 | |
2583 */ | |
2584 char *mapIdxToString(const T_IDX_TO_STR_MAP *table, BYTE index) | |
2585 { | |
2586 int i=0; | |
2587 while (table[i].cod NEQ NULL) | |
2588 { | |
2589 if (table[i].idx EQ index) | |
2590 return table[i].cod; | |
2591 i++; | |
2592 } | |
2593 return NULL; | |
2594 } | |
2595 | |
2596 /* | |
2597 +-------------------------------------------------------------------+ | |
2598 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2599 | ROUTINE : mapIdxToDigit | | |
2600 +-------------------------------------------------------------------+ | |
2601 | |
2602 PURPOSE : Find the occurence of the record of type T_IDX_TO_STR_MAP with "idx" field | |
2603 equal index and returns field "cod" | |
2604 | |
2605 */ | |
2606 | |
2607 BYTE mapIdxToDigit(const T_IDX_TO_DIG_MAP *table, BYTE index, BYTE * result) | |
2608 { | |
2609 int i=0; | |
2610 while (table[i].cod NEQ NULL || table[i].idx NEQ NULL) | |
2611 { | |
2612 if (table[i].idx EQ index) | |
2613 { | |
2614 *result = table[i].cod; | |
2615 return 0; | |
2616 } | |
2617 i++; | |
2618 } | |
2619 return -1; | |
2620 } | |
2621 | |
2622 #ifdef SIM_TOOLKIT | |
2623 /* | |
2624 +-------------------------------------------------------------------+ | |
2625 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2626 | ROUTINE : cmhSS_SendToSAT | | |
2627 +-------------------------------------------------------------------+ | |
2628 | |
2629 PURPOSE : Send SS string to SIM | |
2630 | |
2631 */ | |
2632 T_ACI_RETURN cmhSS_SendToSAT(T_ACI_CMD_SRC srcId, CHAR *pSSString) | |
2633 { | |
2634 T_CLPTY_PRM *cldPty_sim; | |
2635 T_ACI_RETURN retVal; | |
2636 | |
2637 TRACE_EVENT_P1("cmhSS_SendToSAT SS String = %s", pSSString); | |
2638 | |
2639 retVal = AT_CMPL; | |
2640 | |
2641 MALLOC(cldPty_sim, sizeof(T_CLPTY_PRM)); | |
2642 | |
2643 cmhCC_init_cldPty( cldPty_sim ); | |
2644 cmh_bldCalPrms ( pSSString, cldPty_sim ); | |
2645 | |
2646 if( ksd_isSATSscs (cldPty_sim->num) ) | |
2647 { | |
2648 retVal = cmhSAT_SSCntrlBySIM( cldPty_sim, (UBYTE)srcId ); | |
2649 } | |
2650 | |
2651 MFREE(cldPty_sim); | |
2652 | |
2653 switch (retVal) | |
2654 { | |
2655 case AT_FAIL: | |
2656 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
2657 break; | |
2658 | |
2659 case AT_BUSY: | |
2660 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_SimBusy); | |
2661 break; | |
2662 | |
2663 default: | |
2664 break; | |
2665 } | |
2666 return( retVal ); | |
2667 | |
2668 } | |
2669 #endif /* SIM_TOOLKIT */ | |
2670 /* | |
2671 +-------------------------------------------------------------------+ | |
2672 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2673 | ROUTINE : cmhSS_CF_SAT_Handle | | |
2674 +-------------------------------------------------------------------+ | |
2675 | |
2676 PURPOSE : Builds SS string from parameters of AT+CCFC command | |
2677 and sends to SIM | |
2678 | |
2679 */ | |
2680 T_ACI_RETURN cmhSS_CF_SAT_Handle(T_ACI_CMD_SRC srcId, | |
2681 T_ACI_CCFC_RSN reason, | |
2682 T_ACI_CCFC_MOD mode, | |
2683 CHAR* number, | |
2684 T_ACI_TOA* type, | |
2685 T_ACI_CLASS class_type, | |
2686 CHAR* subaddr, | |
2687 T_ACI_TOS* satype, | |
2688 SHORT time) | |
2689 { | |
2690 | |
2691 int ii; | |
2692 BYTE bMapResult; | |
2693 | |
2694 CHAR cSIString[MAX_DIAL_LEN]; | |
2695 CHAR cSIbuf[MAX_DIAL_LEN]; | |
2696 CHAR cSSString[MAX_DIAL_LEN]; | |
2697 | |
2698 | |
2699 char *stReason; | |
2700 char *stMode; | |
2701 BYTE bBaseService; | |
2702 BYTE bBaseSubService; | |
2703 | |
2704 | |
2705 cSIString[0]= '\0'; | |
2706 | |
2707 TRACE_EVENT("cmhSS_CF_SAT_Handle()"); | |
2708 | |
2709 | |
2710 stReason = mapIdxToString(cCFRsnMapTable/*lint -e40 */, reason); | |
2711 stMode = mapIdxToString(cModMapTable, mode); | |
2712 bMapResult = mapIdxToDigit(cCFBSMapTable, class_type, &bBaseService); | |
2713 | |
2714 | |
2715 if (stMode NEQ NULL AND stReason NEQ NULL) | |
2716 { | |
2717 /* Build SI string */ | |
2718 for (ii=0; ii<3; ii++) | |
2719 { | |
2720 cSIbuf[0] = '\0'; | |
2721 if (ii EQ 0) /* Step 1 - check Time */ | |
2722 { | |
2723 if (time NEQ 0 AND reason NEQ CCFC_RSN_Uncond | |
2724 AND reason NEQ CCFC_RSN_Busy AND reason NEQ CCFC_RSN_NotReach) /*No time for these Service code*/ | |
2725 { | |
2726 sprintf(cSIbuf, "%d", time); | |
2727 } | |
2728 } | |
2729 else if(ii EQ 1) /* Step 2 - check BS */ | |
2730 { | |
2731 if (bMapResult EQ NULL) | |
2732 sprintf(cSIbuf, "%d", bBaseService); | |
2733 } | |
2734 else if(ii EQ 2) /* Step 3 - check DN */ | |
2735 { | |
2736 if (number NEQ NULL) | |
2737 sprintf(cSIbuf, "%s", number); | |
2738 } | |
2739 strcat(cSIbuf, cSIString); | |
2740 if (strlen(cSIbuf) NEQ 0) /* If some parameters are already filled...*/ | |
2741 { | |
2742 sprintf(cSIString, "*%s", cSIbuf); | |
2743 } | |
2744 } | |
2745 | |
2746 sprintf(cSSString,"%s%s%s#",stMode, stReason, cSIString); /* Build SS string */ | |
2747 | |
2748 /* check is FDN is on and string is in FDN phone book. If OK - send to STK */ | |
2749 return checkFDNSendSS(srcId, cSSString); | |
2750 } | |
2751 else | |
2752 { | |
2753 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
2754 return AT_FAIL; | |
2755 } | |
2756 } | |
2757 | |
2758 /* | |
2759 +-------------------------------------------------------------------+ | |
2760 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2761 | ROUTINE : cmhSS_CW_SAT_Handle | | |
2762 +-------------------------------------------------------------------+ | |
2763 | |
2764 PURPOSE : Builds SS string from parameters of AT+CCWA command | |
2765 and sends to SIM | |
2766 | |
2767 */ | |
2768 T_ACI_RETURN cmhSS_CW_SAT_Handle(T_ACI_CMD_SRC srcId, | |
2769 T_ACI_CCFC_MOD mode, | |
2770 T_ACI_CLASS class_type) | |
2771 { | |
2772 | |
2773 BYTE bMapResult; | |
2774 CHAR cSSString[MAX_DIAL_LEN]; | |
2775 | |
2776 char *stMode; | |
2777 BYTE bBaseService; | |
2778 | |
2779 TRACE_EVENT("cmhSS_CW_SAT_Handle()"); | |
2780 stMode = mapIdxToString(cModMapTable, mode); | |
2781 bMapResult = mapIdxToDigit(cCFBSMapTable, class_type, &bBaseService); | |
2782 | |
2783 | |
2784 if (stMode NEQ NULL) | |
2785 { | |
2786 /* Build SS string */ | |
2787 if (bMapResult NEQ 0) | |
2788 sprintf(cSSString,"%s43#",stMode); | |
2789 else | |
2790 sprintf(cSSString,"%s43*%d#",stMode, bBaseService); | |
2791 | |
2792 /* check is FDN is on and string is in FDN phone book. If OK - send to STK */ | |
2793 return checkFDNSendSS(srcId, cSSString); | |
2794 } | |
2795 else | |
2796 { | |
2797 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
2798 return AT_FAIL; | |
2799 } | |
2800 } | |
2801 | |
2802 /* | |
2803 +-------------------------------------------------------------------+ | |
2804 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2805 | ROUTINE : cmhSS_CLIP_SAT_Handle | | |
2806 +-------------------------------------------------------------------+ | |
2807 | |
2808 PURPOSE : Builds SS string from parameters of AT+CLIP command | |
2809 and sends to SIM | |
2810 | |
2811 */ | |
2812 T_ACI_RETURN cmhSS_CLIP_SAT_Handle(T_ACI_CMD_SRC srcId) | |
2813 { | |
2814 CHAR cSSString[] = "*#30#"; /* Only Query */ | |
2815 | |
2816 TRACE_EVENT("cmhSS_CLIP_SAT_Handle()"); | |
2817 | |
2818 /* check is FDN is on and string is in FDN phone book. If OK - send to STK */ | |
2819 return checkFDNSendSS(srcId, cSSString); | |
2820 } | |
2821 | |
2822 /* | |
2823 +-------------------------------------------------------------------+ | |
2824 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2825 | ROUTINE : cmhSS_CLIR_SAT_Handle | | |
2826 +-------------------------------------------------------------------+ | |
2827 | |
2828 PURPOSE : Builds SS string from parameters of AT+CLIR command | |
2829 and sends to SIM | |
2830 | |
2831 */ | |
2832 T_ACI_RETURN cmhSS_CLIR_SAT_Handle(T_ACI_CMD_SRC srcId) | |
2833 { | |
2834 CHAR cSSString[] = "*#31#"; /* Only Query */ | |
2835 | |
2836 TRACE_EVENT("cmhSS_CLIR_SAT_Handle()"); | |
2837 | |
2838 /* check is FDN is on and string is in FDN phone book. If OK - send to STK */ | |
2839 return checkFDNSendSS(srcId, cSSString); | |
2840 } | |
2841 | |
2842 /* | |
2843 +-------------------------------------------------------------------+ | |
2844 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2845 | ROUTINE : cmhSS_COLP_SAT_Handle | | |
2846 +-------------------------------------------------------------------+ | |
2847 | |
2848 PURPOSE : Builds SS string from parameters of AT+COLP command | |
2849 and sends to SIM | |
2850 | |
2851 */ | |
2852 T_ACI_RETURN cmhSS_COLP_SAT_Handle(T_ACI_CMD_SRC srcId) | |
2853 { | |
2854 CHAR cSSString[] = "*#76#"; /* Only Query */ | |
2855 | |
2856 TRACE_EVENT("cmhSS_COLP_SAT_Handle()"); | |
2857 | |
2858 /* check is FDN is on and string is in FDN phone book. If OK - send to STK */ | |
2859 return checkFDNSendSS(srcId, cSSString); | |
2860 } | |
2861 | |
2862 | |
2863 /* | |
2864 +-------------------------------------------------------------------+ | |
2865 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2866 | ROUTINE : cmhSS_COLR_SAT_Handle | | |
2867 +-------------------------------------------------------------------+ | |
2868 | |
2869 PURPOSE : Builds SS string from parameters of AT+COLR command | |
2870 and sends to SIM | |
2871 | |
2872 */ | |
2873 T_ACI_RETURN cmhSS_COLR_SAT_Handle(T_ACI_CMD_SRC srcId) | |
2874 { | |
2875 CHAR cSSString[] = "*#77#"; /* Only Query */ | |
2876 | |
2877 TRACE_EVENT("cmhSS_COLR_SAT_Handle()"); | |
2878 | |
2879 /* check is FDN is on and string is in FDN phone book. If OK - send to STK */ | |
2880 return checkFDNSendSS(srcId, cSSString); | |
2881 } | |
2882 | |
2883 /* | |
2884 +-------------------------------------------------------------------+ | |
2885 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2886 | ROUTINE : cmhSS_CCBS_SAT_Handle | | |
2887 +-------------------------------------------------------------------+ | |
2888 | |
2889 PURPOSE : Builds SS string from parameters of AT+CCBS command | |
2890 and sends to SIM | |
2891 | |
2892 */ | |
2893 T_ACI_RETURN cmhSS_CCBS_SAT_Handle(T_ACI_CMD_SRC srcId, T_ACI_CCBS_MOD mode, SHORT idx) | |
2894 { | |
2895 char *stMode; | |
2896 CHAR cSSString[MAX_DIAL_LEN]; | |
2897 | |
2898 TRACE_EVENT("cmhSS_CCBS_SAT_Handle()"); | |
2899 | |
2900 stMode = mapIdxToString(cModMapTable, mode); | |
2901 | |
2902 if (stMode NEQ NULL) | |
2903 { | |
2904 /* Build SS string */ | |
2905 if (idx EQ -1) /* According to GSM 02.30 Index can vary 1..5*/ | |
2906 sprintf(cSSString,"%s37#",stMode); | |
2907 else | |
2908 sprintf(cSSString,"%s37*%d#",stMode, idx); | |
2909 | |
2910 /* check is FDN is on and string is in FDN phone book. If OK - send to STK */ | |
2911 return checkFDNSendSS(srcId, cSSString); | |
2912 } | |
2913 else | |
2914 { | |
2915 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
2916 return AT_FAIL; | |
2917 } | |
2918 } | |
2919 | |
2920 /* | |
2921 +-------------------------------------------------------------------+ | |
2922 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2923 | ROUTINE : cmhSS_CNAP_SAT_Handle | | |
2924 +-------------------------------------------------------------------+ | |
2925 | |
2926 PURPOSE : Builds SS string from parameters of AT+CNAP command | |
2927 and sends to SIM | |
2928 | |
2929 */ | |
2930 T_ACI_RETURN cmhSS_CNAP_SAT_Handle(T_ACI_CMD_SRC srcId) | |
2931 { | |
2932 CHAR cSSString[] = "*#300#"; /* Only Query */ | |
2933 | |
2934 TRACE_EVENT("cmhSS_CNAP_SAT_Handle()"); | |
2935 | |
2936 /* check is FDN is on and string is in FDN phone book. If OK - send to STK */ | |
2937 return checkFDNSendSS(srcId, cSSString); | |
2938 } | |
2939 | |
2940 /* | |
2941 +-------------------------------------------------------------------+ | |
2942 | PROJECT : GSM-PS (6147) MODULE : CMH_SSF | | |
2943 | ROUTINE : cmhSS_Call_Barr_SAT_Handle | | |
2944 +-------------------------------------------------------------------+ | |
2945 | |
2946 PURPOSE : Builds SS string from parameters of AT+CLCK command | |
2947 and sends to SIM | |
2948 | |
2949 */ | |
2950 T_ACI_RETURN cmhSS_Call_Barr_SAT_Handle(T_ACI_CMD_SRC srcId, | |
2951 T_ACI_CLCK_MOD mode, | |
2952 T_ACI_CLCK_FAC fac, | |
2953 CHAR *passwd, | |
2954 T_ACI_CLASS class_type) | |
2955 { | |
2956 int ii; | |
2957 BYTE bBaseService; | |
2958 BYTE bMapResult; | |
2959 | |
2960 char *stMode; | |
2961 char *stFac; | |
2962 | |
2963 CHAR cSIString[MAX_DIAL_LEN]; | |
2964 CHAR cSIbuf[MAX_DIAL_LEN]; | |
2965 CHAR cSSString[MAX_DIAL_LEN]; | |
2966 | |
2967 | |
2968 TRACE_EVENT("cmhSS_Call_Barr_SAT_Handle()"); | |
2969 | |
2970 cSIString[0]= '\0'; | |
2971 | |
2972 stMode = mapIdxToString(cModMapTable, mode); | |
2973 stFac = mapIdxToString(cCBRsnMapTable, fac); | |
2974 bMapResult = mapIdxToDigit(cCFBSMapTable, class_type, &bBaseService); | |
2975 | |
2976 if (stFac EQ NULL ) return AT_CMPL; /* If no call barring facility - continue executing sAT_PlusCLCK*/ | |
2977 | |
2978 if (stMode NEQ NULL) | |
2979 { | |
2980 for (ii=0; ii<2; ii++) | |
2981 { | |
2982 cSIbuf[0] = '\0'; | |
2983 if(ii EQ 0) /* Step 2 - check BS */ | |
2984 { | |
2985 if (bMapResult EQ NULL) | |
2986 sprintf(cSIbuf, "%d", bBaseService); | |
2987 } | |
2988 else if(ii EQ 1) /* Step 2 - check PW */ | |
2989 { | |
2990 if (passwd NEQ NULL) | |
2991 sprintf(cSIbuf, "%s", passwd); | |
2992 } | |
2993 strcat(cSIbuf, cSIString); | |
2994 if (strlen(cSIbuf) NEQ 0) /* If some parameters are already filled...*/ | |
2995 { | |
2996 sprintf(cSIString, "*%s", cSIbuf); | |
2997 } | |
2998 } | |
2999 | |
3000 /* Build SS string */ | |
3001 sprintf(cSSString,"%s%s%s#",stMode, stFac, cSIString); /* Build SS string */ | |
3002 | |
3003 /* check is FDN is on and string is in FDN phone book. If OK - send to STK */ | |
3004 return checkFDNSendSS(srcId, cSSString); | |
3005 | |
3006 } | |
3007 else | |
3008 { | |
3009 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
3010 return AT_FAIL; | |
3011 } | |
3012 } | |
3013 | |
3014 | |
3015 /*==== EOF ========================================================*/ |