FreeCalypso > hg > tcs211-l1-reconst
comparison g23m/condat/ms/src/aci/psa_sss.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : PSA_SSS | |
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 signalling functions of the | |
18 | protocol stack adapter for supplementary services. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef PSA_SSS_C | |
23 #define PSA_SSS_C | |
24 #endif | |
25 | |
26 #include "aci_all.h" | |
27 | |
28 /*==== INCLUDES ===================================================*/ | |
29 #include "aci_cmh.h" | |
30 #include "ati_cmd.h" | |
31 #include "aci_cmd.h" | |
32 #include "aci.h" | |
33 #include "psa.h" | |
34 #include "psa_ss.h" | |
35 #include "cmh_ss.h" | |
36 | |
37 #ifdef SIM_TOOLKIT | |
38 #include "psa_cc.h" | |
39 #include "psa_sat.h" | |
40 #endif /* of SIM_TOOLKIT */ | |
41 | |
42 | |
43 /*==== CONSTANTS ==================================================*/ | |
44 | |
45 | |
46 /*==== TYPES ======================================================*/ | |
47 | |
48 | |
49 /*==== EXPORT =====================================================*/ | |
50 | |
51 | |
52 /*==== VARIABLES ==================================================*/ | |
53 | |
54 EXTERN T_PCEER causeMod; | |
55 EXTERN SHORT causeCeer; | |
56 | |
57 /*==== FUNCTIONS ==================================================*/ | |
58 static UBYTE inv_opcode; | |
59 | |
60 /* | |
61 +-------------------------------------------------------------------+ | |
62 | PROJECT : GSM-PS (6147) MODULE : PSA_SSS | | |
63 | ROUTINE : psaSS_NewTrns | | |
64 +-------------------------------------------------------------------+ | |
65 | |
66 PURPOSE : start a new SS transaction | |
67 | |
68 */ | |
69 | |
70 GLOBAL SHORT psaSS_NewTrns ( SHORT sId ) | |
71 { | |
72 T_SS_SRV_TBL * pStbNtry; /* holds pointer to service table entry */ | |
73 BYTE ccdRet; /* holds CCD return value */ | |
74 | |
75 TRACE_FUNCTION ("psaSS_NewTrns()"); | |
76 | |
77 /* | |
78 *------------------------------------------------------------------- | |
79 * get a valid ti for a MOS, otherwise return | |
80 *------------------------------------------------------------------- | |
81 */ | |
82 if( psaSS_getMOSTi( sId ) < 0 ) return ( -1 ); | |
83 | |
84 causeMod = P_CEER_mod; /* Clear module which was set for ceer */ | |
85 causeCeer = CEER_NotPresent; /* Clear extended error cause */ | |
86 | |
87 /* | |
88 *------------------------------------------------------------------- | |
89 * create and send primitive | |
90 *------------------------------------------------------------------- | |
91 */ | |
92 { | |
93 PALLOC (mnss_begin_req, MNSS_BEGIN_REQ); | |
94 | |
95 /* | |
96 * fill in primitive parameter: begin request | |
97 */ | |
98 pStbNtry = &ssShrdPrm.stb[sId]; | |
99 | |
100 mnss_begin_req -> ti = pStbNtry -> ti; | |
101 | |
102 if( pStbNtry -> SSver NEQ NOT_PRESENT_8BIT ) | |
103 { | |
104 mnss_begin_req -> ss_ver.len = 1; | |
105 mnss_begin_req -> ss_ver.ver[0] = pStbNtry -> SSver; | |
106 } | |
107 else | |
108 | |
109 mnss_begin_req -> ss_ver.len = 0; | |
110 | |
111 { | |
112 MCAST( com, COMPONENT ); | |
113 | |
114 memset( com, 0, sizeof( T_COMPONENT )); | |
115 switch( ssShrdPrm.cmpType ) | |
116 { | |
117 case( CT_INV ): | |
118 com -> v_inv_comp = TRUE; | |
119 com -> inv_comp.v_inv_id = TRUE; | |
120 com -> inv_comp.inv_id = pStbNtry -> iId | |
121 = ssShrdPrm.iIdNxt++; | |
122 com -> inv_comp.v_op_code = TRUE; | |
123 com -> inv_comp.op_code = pStbNtry -> opCode | |
124 = ssFIECodeBuf.buf[0]; | |
125 | |
126 inv_opcode = com->inv_comp.op_code; | |
127 | |
128 com -> inv_comp.v_params = TRUE; | |
129 com -> inv_comp.params.l_params = ssFIECodeBuf.l_buf-8; | |
130 com -> inv_comp.params.o_params = 8; | |
131 memcpy( com -> inv_comp.params.b_params, | |
132 ssFIECodeBuf.buf, ssFIECodeBuf.l_buf>>3 ); | |
133 break; | |
134 case( CT_RET_RSLT ): | |
135 break; | |
136 case( CT_RET_ERR ): | |
137 break; | |
138 case( CT_RET_REJ ): | |
139 break; | |
140 } | |
141 mnss_begin_req -> fac_inf.l_fac = FACILITY_LEN<<3; | |
142 mnss_begin_req -> fac_inf.o_fac = 0; | |
143 ccdRet = ccd_codeMsg (CCDENT_FAC, | |
144 UPLINK, | |
145 (T_MSGBUF *) &mnss_begin_req -> fac_inf, | |
146 (UBYTE *) _decodedMsg, | |
147 COMPONENT); | |
148 | |
149 if( ccdRet NEQ ccdOK ) | |
150 { | |
151 CHAR buf[25]; | |
152 sprintf( buf, "CCD Coding Error: %d",ccdRet ); | |
153 TRACE_EVENT( buf ); | |
154 PFREE( mnss_begin_req ); | |
155 return( -1 ); | |
156 } | |
157 } | |
158 | |
159 pStbNtry -> srvType = ST_MOS; | |
160 | |
161 psaSS_DumpFIE ( &mnss_begin_req -> fac_inf ); | |
162 cmhSS_sendFie ( CSCN_FACILITY_DIRECTION_OUT, | |
163 CSCN_FACILITY_TRANS_TYPE_BEGIN, | |
164 &mnss_begin_req -> fac_inf ); | |
165 | |
166 if ( ssShrdPrm.mltyTrnFlg EQ 0 ) | |
167 { | |
168 PSENDX (SS, mnss_begin_req); /* send primitive */ | |
169 } | |
170 else | |
171 pStbNtry -> save_prim = mnss_begin_req; /* already one transaction in process */ | |
172 | |
173 | |
174 /* | |
175 * update service status | |
176 */ | |
177 pStbNtry -> srvStat = SSS_ACT; | |
178 } | |
179 | |
180 return 0; | |
181 } | |
182 | |
183 /* | |
184 +-------------------------------------------------------------------+ | |
185 | PROJECT : GSM-PS (6147) MODULE : PSA_SSS | | |
186 | ROUTINE : psaSS_EndTrns | | |
187 +-------------------------------------------------------------------+ | |
188 | |
189 PURPOSE : stop an existing SS transaction | |
190 | |
191 */ | |
192 | |
193 GLOBAL SHORT psaSS_EndTrns ( SHORT sId ) | |
194 { | |
195 T_SS_SRV_TBL * pStbNtry; /* holds pointer to service table entry */ | |
196 | |
197 TRACE_FUNCTION ("psaSS_EndTrns()"); | |
198 | |
199 /* | |
200 *------------------------------------------------------------------- | |
201 * create and send primitive | |
202 *------------------------------------------------------------------- | |
203 */ | |
204 { | |
205 PALLOC (mnss_end_req, MNSS_END_REQ); | |
206 | |
207 /* | |
208 * fill in primitive parameter: end request | |
209 */ | |
210 pStbNtry = &ssShrdPrm.stb[sId]; | |
211 | |
212 mnss_end_req -> ti = pStbNtry -> ti; | |
213 | |
214 { | |
215 UBYTE ccdRet; | |
216 | |
217 MCAST( com, COMPONENT ); | |
218 | |
219 memset( com, 0, sizeof( T_COMPONENT )); | |
220 switch( ssShrdPrm.cmpType ) | |
221 { | |
222 case( CT_RET_RSLT ): | |
223 com -> v_res_comp = TRUE; | |
224 com -> res_comp.v_inv_id = TRUE; | |
225 com -> res_comp.inv_id = pStbNtry -> iId; | |
226 com -> res_comp.v_sequence = TRUE; | |
227 com -> res_comp.sequence.v_op_code = TRUE; | |
228 com -> res_comp.sequence.op_code = pStbNtry -> opCode; | |
229 com -> res_comp.sequence.v_params = TRUE; | |
230 com -> res_comp.sequence.params.l_params = ssFIECodeBuf.l_buf-8; | |
231 com -> res_comp.sequence.params.o_params = 8; | |
232 memcpy( com -> res_comp.sequence.params.b_params, | |
233 ssFIECodeBuf.buf, ssFIECodeBuf.l_buf>>3 ); | |
234 break; | |
235 case( CT_RET_ERR ): | |
236 com -> v_err_comp = TRUE; | |
237 com -> err_comp.v_inv_id = TRUE; | |
238 com -> err_comp.inv_id = pStbNtry -> iId; | |
239 com -> err_comp.v_err_code = TRUE; | |
240 com -> err_comp.err_code = pStbNtry -> errCd; | |
241 break; | |
242 case( CT_RET_REJ ): | |
243 break; | |
244 } | |
245 mnss_end_req -> fac_inf.l_fac = FACILITY_LEN<<3; | |
246 mnss_end_req -> fac_inf.o_fac = 0; | |
247 ccdRet = ccd_codeMsg (CCDENT_FAC, | |
248 UPLINK, | |
249 (T_MSGBUF *) &mnss_end_req -> fac_inf, | |
250 (UBYTE *) _decodedMsg, | |
251 COMPONENT); | |
252 | |
253 if( ccdRet NEQ ccdOK ) | |
254 { | |
255 CHAR buf[25]; | |
256 sprintf( buf, "CCD Coding Error: %d",ccdRet ); | |
257 TRACE_EVENT( buf ); | |
258 PFREE( mnss_end_req ); | |
259 return( -1 ); | |
260 } | |
261 } | |
262 | |
263 psaSS_DumpFIE ( &mnss_end_req -> fac_inf ); | |
264 cmhSS_sendFie ( CSCN_FACILITY_DIRECTION_OUT, | |
265 CSCN_FACILITY_TRANS_TYPE_END, | |
266 &mnss_end_req -> fac_inf ); | |
267 | |
268 PSENDX (SS, mnss_end_req); | |
269 | |
270 #ifdef SIM_TOOLKIT | |
271 if ( sId EQ satShrdPrm.SentUSSDid AND | |
272 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_USSD ) | |
273 { | |
274 satShrdPrm.USSDterm = TRUE; | |
275 } | |
276 #endif | |
277 | |
278 /* | |
279 * update call status | |
280 */ | |
281 pStbNtry -> srvStat = SSS_IDL; | |
282 | |
283 } | |
284 | |
285 psaSS_retMOSTi (sId); | |
286 | |
287 return 0; | |
288 } | |
289 | |
290 /* | |
291 +-------------------------------------------------------------------+ | |
292 | PROJECT : GSM-PS (6147) MODULE : PSA_SSS | | |
293 | ROUTINE : psaSS_CntTrns | | |
294 +-------------------------------------------------------------------+ | |
295 | |
296 PURPOSE : continue with an existing SS transaction | |
297 | |
298 */ | |
299 | |
300 GLOBAL SHORT psaSS_CntTrns ( SHORT sId ) | |
301 { | |
302 T_SS_SRV_TBL * pStbNtry; /* holds pointer to service table entry */ | |
303 | |
304 TRACE_FUNCTION ("psaSS_CntTrns()"); | |
305 | |
306 /* | |
307 *------------------------------------------------------------------- | |
308 * create and send primitive | |
309 *------------------------------------------------------------------- | |
310 */ | |
311 { | |
312 PALLOC (mnss_facility_req, MNSS_FACILITY_REQ); | |
313 | |
314 /* | |
315 * fill in primitive parameter: facility request | |
316 */ | |
317 pStbNtry = &ssShrdPrm.stb[sId]; | |
318 | |
319 mnss_facility_req -> ti = pStbNtry -> ti; | |
320 | |
321 { | |
322 UBYTE ccdRet; | |
323 | |
324 MCAST( com, COMPONENT ); | |
325 | |
326 memset( com, 0, sizeof( T_COMPONENT )); | |
327 switch( ssShrdPrm.cmpType ) | |
328 { | |
329 case( CT_RET_RSLT ): | |
330 com -> v_res_comp = TRUE; | |
331 com -> res_comp.v_inv_id = TRUE; | |
332 com -> res_comp.inv_id = pStbNtry -> iId; | |
333 /* patch for FTA 31.9.2.1: | |
334 When empty facility should be returned, then message should | |
335 contain ONLY the invoke id. CLB 061201 */ | |
336 if( ssFIECodeBuf.l_buf NEQ 8 ) /* means there actually are parameters */ | |
337 { | |
338 com -> res_comp.v_sequence = TRUE; | |
339 com -> res_comp.sequence.v_op_code = TRUE; | |
340 com -> res_comp.sequence.op_code = pStbNtry -> opCode; | |
341 | |
342 pStbNtry -> opCode = inv_opcode; | |
343 | |
344 com -> res_comp.sequence.v_params = TRUE; | |
345 com -> res_comp.sequence.params.l_params = ssFIECodeBuf.l_buf-8; | |
346 com -> res_comp.sequence.params.o_params = 8; | |
347 memcpy( com -> res_comp.sequence.params.b_params, | |
348 ssFIECodeBuf.buf, ssFIECodeBuf.l_buf>>3 ); | |
349 } | |
350 break; | |
351 case( CT_RET_ERR ): | |
352 com -> v_err_comp = TRUE; | |
353 com -> err_comp.v_inv_id = TRUE; | |
354 com -> err_comp.inv_id = pStbNtry -> iId; | |
355 com -> err_comp.v_err_code = TRUE; | |
356 com -> err_comp.err_code = pStbNtry -> errCd; | |
357 break; | |
358 break; | |
359 case( CT_RET_REJ ): | |
360 break; | |
361 } | |
362 mnss_facility_req -> fac_inf.l_fac = FACILITY_LEN<<3; | |
363 mnss_facility_req -> fac_inf.o_fac = 0; | |
364 ccdRet = ccd_codeMsg (CCDENT_FAC, | |
365 UPLINK, | |
366 (T_MSGBUF *) &mnss_facility_req -> fac_inf, | |
367 (UBYTE *) _decodedMsg, | |
368 COMPONENT); | |
369 | |
370 if( ccdRet NEQ ccdOK ) | |
371 { | |
372 CHAR buf[25]; | |
373 sprintf( buf, "CCD Coding Error: %d",ccdRet ); | |
374 TRACE_EVENT( buf ); | |
375 PFREE( mnss_facility_req ); | |
376 return( -1 ); | |
377 } | |
378 } | |
379 | |
380 psaSS_DumpFIE ( &mnss_facility_req -> fac_inf ); | |
381 cmhSS_sendFie ( CSCN_FACILITY_DIRECTION_OUT, | |
382 CSCN_FACILITY_TRANS_TYPE, | |
383 &mnss_facility_req -> fac_inf ); | |
384 | |
385 PSENDX (SS, mnss_facility_req); | |
386 } | |
387 | |
388 return 0; | |
389 } | |
390 | |
391 /*==== EOF ========================================================*/ | |
392 |