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