FreeCalypso > hg > tcs211-l1-reconst
comparison g23m/condat/ms/src/aci/psa_smsf.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_SMSF | |
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 for the protocol | |
18 | stack adapter for the registration part of mobility | |
19 | management. | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef PSA_SMSF_C | |
24 #define PSA_SMSF_C | |
25 #endif | |
26 | |
27 #include "aci_all.h" | |
28 | |
29 #undef TRACING | |
30 | |
31 /*==== INCLUDES ===================================================*/ | |
32 #include "aci_cmh.h" | |
33 #include "ati_cmd.h" | |
34 #include "aci_cmd.h" | |
35 | |
36 #ifdef FAX_AND_DATA | |
37 #include "aci_fd.h" | |
38 #endif /* of #ifdef FAX_AND_DATA */ | |
39 | |
40 #include "aci.h" | |
41 #include "aci_lst.h" | |
42 #include "aci_mem.h" | |
43 #include "psa.h" | |
44 #ifdef SIM_TOOLKIT | |
45 #include "psa_cc.h" | |
46 #include "psa_sat.h" | |
47 #endif | |
48 #include "psa_sms.h" | |
49 #include "psa_util.h" | |
50 #include "cmh.h" | |
51 #include "cmh_sms.h" | |
52 #include "psa_sim.h" | |
53 | |
54 #if (defined (MFW) AND !defined (FF_MMI_RIV)) OR defined (_CONC_TESTING_) | |
55 #include "conc_sms.h" | |
56 #endif | |
57 | |
58 /*==== CONSTANTS ==================================================*/ | |
59 #define ITM_WDT (14) /* item width in chars */ | |
60 #define HDR_WDT (10) /* header width in chars */ | |
61 | |
62 /*==== TYPES ======================================================*/ | |
63 | |
64 /*==== EXPORT =====================================================*/ | |
65 | |
66 /*==== VARIABLES ==================================================*/ | |
67 GLOBAL T_ACI_LIST *set_prm_list = NULL; | |
68 | |
69 /*==== FUNCTIONS ==================================================*/ | |
70 | |
71 #ifdef SIM_TOOLKIT | |
72 EXTERN BOOL cmhSMS_FileUpdate (int, T_SIM_FILE_UPDATE_IND *); | |
73 #endif | |
74 | |
75 /* | |
76 +-------------------------------------------------------------------+ | |
77 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSF | | |
78 | ROUTINE : psaSMS_Init | | |
79 +-------------------------------------------------------------------+ | |
80 | |
81 PURPOSE : initialize the protocol stack adapter for SMS. | |
82 | |
83 */ | |
84 | |
85 /* MACRO: initializer for set parameter */ | |
86 #define INIT_SET_PARM( dest, def )\ | |
87 {smsShrdPrm.pSetPrm[0]->dest = def;} | |
88 | |
89 | |
90 | |
91 | |
92 | |
93 GLOBAL void psaSMS_InitParams ( void ) | |
94 { | |
95 INIT_SET_PARM( sca.ton, SMS_TON_UNKNOWN ); | |
96 INIT_SET_PARM( sca.npi, SMS_NPI_UNKNOWN ); | |
97 INIT_SET_PARM( sca.c_num, 0 ); | |
98 INIT_SET_PARM( vpRel, TP_VP_RELATIVE_DEFAULT ); | |
99 INIT_SET_PARM( pid, SMS_PID_DEFAULT ); | |
100 INIT_SET_PARM( dcs, SMS_DCS_GRP_DEF ); | |
101 INIT_SET_PARM( msgType, (TP_MTI_SMS_SUBMIT + TP_VPF_RELATIVE)); | |
102 | |
103 smsShrdPrm.cbmPrm.cbmFoundIds = 0; | |
104 memset(smsShrdPrm.cbmPrm.msgId, DEF_MID_RANGE, sizeof(smsShrdPrm.cbmPrm.msgId)); | |
105 } | |
106 GLOBAL void psaSMS_Init ( void ) | |
107 { | |
108 int LpCnt; /* holds loop counter for macro */ | |
109 T_SMS_SET_PRM * elem; | |
110 | |
111 /* | |
112 *------------------------------------------------------------------- | |
113 * set default parms | |
114 *------------------------------------------------------------------- | |
115 */ | |
116 smsShrdPrm.smsStat = SMS_STATE_NOT_AVAILABLE; | |
117 smsShrdPrm.accessEnabled = FALSE; | |
118 smsShrdPrm.aci_sms_parameter.simTotal = 0; | |
119 smsShrdPrm.aci_sms_parameter.simUsed = 0; | |
120 smsShrdPrm.aci_sms_parameter.meTotal = 0; | |
121 smsShrdPrm.aci_sms_parameter.meUsed = 0; | |
122 smsShrdPrm.owner = OWN_NONE; | |
123 smsShrdPrm.cbmPrm.cbchOwner = OWN_NONE; | |
124 smsShrdPrm.rslt = 0x200/*CS_OK*/; | |
125 | |
126 smsShrdPrm.aci_sms_parameter.snd_msg_ref = 0; | |
127 | |
128 smsShrdPrm.aci_sms_parameter.smsParamRecLen = 0; | |
129 smsShrdPrm.aci_sms_parameter.smsParamMaxRec = 0; | |
130 smsShrdPrm.mtHndl = MT0; | |
131 smsShrdPrm.srHndl = DS0; | |
132 smsShrdPrm.cbmPrm.cbmHndl = BM0; | |
133 smsShrdPrm.cbmPrm.cbmMode = CBCH_ACCEPT; | |
134 smsShrdPrm.cbmPrm.cbmFoundIds = 0; | |
135 smsShrdPrm.cbmPrm.cbmSIMmaxId = 0; | |
136 smsShrdPrm.cbmPrm.cbmSIMmaxIdRge = 0; | |
137 | |
138 smsShrdPrm.tpdu.tp_submit = NULL; | |
139 smsShrdPrm.tpdu.tp_deliver = NULL; | |
140 smsShrdPrm.tpdu.tp_command = NULL; | |
141 | |
142 #ifdef FF_HOMEZONE | |
143 smsShrdPrm.cbmPrm.hzMode = CBHZ_MOD_NotActive; | |
144 smsShrdPrm.cbmPrm.hzDcs = CS_GsmDef; | |
145 smsShrdPrm.cbmPrm.hzTimeout = CBHZ_DEF_TIMEOUT; | |
146 #endif /* FF_HOMEZONE */ | |
147 | |
148 smsShrdPrm.mem1 = MEM_SM; | |
149 smsShrdPrm.mem2 = MEM_SM; | |
150 smsShrdPrm.mem3 = MEM_SM; | |
151 smsShrdPrm.status = CMGD_DEL_INDEX; | |
152 smsShrdPrm.cnma_ack_expected = FALSE; | |
153 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE; | |
154 smsShrdPrm.smsSrcId = CMD_SRC_NONE; | |
155 | |
156 smsShrdPrm.CSMSservice = CSMS_SERV_GsmPh2; | |
157 smsShrdPrm.CSMSmt = CSMS_SUPP_Enable; | |
158 smsShrdPrm.CSMSmo = CSMS_SUPP_Enable; | |
159 smsShrdPrm.CSMSbm = CSMS_SUPP_Enable; | |
160 | |
161 smsShrdPrm.CNMImt = CNMI_MT_NoSmsDeliverInd; | |
162 smsShrdPrm.CNMIbm = CNMI_BM_NoCbmInd; | |
163 smsShrdPrm.CNMIds = CNMI_DS_NoSmsStatRpt; | |
164 | |
165 | |
166 smsShrdPrm.prmRdSeq = SMS_READ_SIM_CMPL; | |
167 smsShrdPrm.pDecMsg = NULL; | |
168 | |
169 smsShrdPrm.rplyCB.cmss = NULL; | |
170 smsShrdPrm.errorCB = NULL; | |
171 | |
172 smsShrdPrm.CMMSmode = CMMS_MODE_DEF; | |
173 | |
174 #ifdef FF_MMI_RIV | |
175 smsShrdPrm.perccmgf_smbs_mode = PERC_SMBS_MOD_DISABLE; | |
176 #endif /* #ifdef FF_MMI_RIV */ | |
177 | |
178 if (set_prm_list EQ NULL) | |
179 { | |
180 set_prm_list = new_list(); | |
181 ACI_MALLOC(elem, sizeof(T_SMS_SET_PRM)); | |
182 memset(elem, 0, sizeof(T_SMS_SET_PRM)); | |
183 insert_list(set_prm_list, elem); | |
184 | |
185 /* all set prm pointer should point to this element */ | |
186 for( LpCnt = 0; LpCnt < OWN_MAX; LpCnt++ ) | |
187 { | |
188 smsShrdPrm.pSetPrm[LpCnt] = elem; | |
189 } | |
190 } | |
191 | |
192 #ifndef SMS_PDU_SUPPORT | |
193 INIT_SET_PARM( CMGFmode, CMGF_MOD_Txt ); | |
194 #else | |
195 INIT_SET_PARM( CMGFmode, CMGF_MOD_Pdu ); | |
196 #endif | |
197 | |
198 INIT_SET_PARM( prflId, 1 ); | |
199 INIT_SET_PARM( isCopy, FALSE ); | |
200 INIT_SET_PARM( numOfRefs, OWN_MAX ); | |
201 INIT_SET_PARM( sca.ton, SMS_TON_UNKNOWN ); | |
202 INIT_SET_PARM( sca.npi, SMS_NPI_UNKNOWN ); | |
203 INIT_SET_PARM( sca.c_num, 0 ); | |
204 INIT_SET_PARM( vpRel, TP_VP_RELATIVE_DEFAULT ); | |
205 INIT_SET_PARM( pid, SMS_PID_DEFAULT ); | |
206 INIT_SET_PARM( dcs, SMS_DCS_GRP_DEF ); | |
207 INIT_SET_PARM( msgType, (TP_MTI_SMS_SUBMIT + TP_VPF_RELATIVE)); | |
208 | |
209 memset(smsShrdPrm.cbmPrm.msgId, DEF_MID_RANGE, sizeof(smsShrdPrm.cbmPrm.msgId)); | |
210 memset(smsShrdPrm.cbmPrm.dcsId, DEF_DCS_RANGE, sizeof(smsShrdPrm.cbmPrm.dcsId)); | |
211 | |
212 smsShrdPrm.pSetPrm[0]->vpAbs.year [0] = 7; | |
213 smsShrdPrm.pSetPrm[0]->vpAbs.year [1] = 0; | |
214 smsShrdPrm.pSetPrm[0]->vpAbs.month [0] = 0; | |
215 smsShrdPrm.pSetPrm[0]->vpAbs.month [1] = 1; | |
216 smsShrdPrm.pSetPrm[0]->vpAbs.day [0] = 0; | |
217 smsShrdPrm.pSetPrm[0]->vpAbs.day [1] = 1; | |
218 smsShrdPrm.pSetPrm[0]->vpAbs.hour [0] = 0; | |
219 smsShrdPrm.pSetPrm[0]->vpAbs.hour [1] = 0; | |
220 smsShrdPrm.pSetPrm[0]->vpAbs.minute[0] = 0; | |
221 smsShrdPrm.pSetPrm[0]->vpAbs.minute[1] = 0; | |
222 smsShrdPrm.pSetPrm[0]->vpAbs.second[0] = 0; | |
223 smsShrdPrm.pSetPrm[0]->vpAbs.second[1] = 0; | |
224 smsShrdPrm.pSetPrm[0]->vpAbs.tz_lsb = 0; | |
225 smsShrdPrm.pSetPrm[0]->vpAbs.tz_sign = 0; | |
226 smsShrdPrm.pSetPrm[0]->vpAbs.tz_msb = 0; | |
227 | |
228 memset(&smsShrdPrm.pSetPrm[0]->vpEnh, 0, sizeof(smsShrdPrm.pSetPrm[0]->vpEnh)); | |
229 smsShrdPrm.pSetPrm[0]->vpEnh.tvpf = SMS_TVPF_RELATIVE; | |
230 smsShrdPrm.pSetPrm[0]->vpEnh.v_tp_vp_rel = 1; | |
231 smsShrdPrm.pSetPrm[0]->vpEnh.tp_vp_rel = TP_VP_RELATIVE_DEFAULT; | |
232 | |
233 #ifdef SIM_TOOLKIT | |
234 simShrdPrm.fuRef = -1; | |
235 if (!psaSAT_FURegister (cmhSMS_FileUpdate)) | |
236 { | |
237 TRACE_EVENT ("FAILED to register the handler cmhSMS_FileUpdate() for FU"); | |
238 } | |
239 #endif | |
240 | |
241 #if (defined (MFW) AND !defined (FF_MMI_RIV)) OR defined (_CONC_TESTING_) | |
242 concSMS_Init(); | |
243 #endif | |
244 } | |
245 | |
246 /* | |
247 +-------------------------------------------------------------------+ | |
248 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSF | | |
249 | ROUTINE : psaSMS_shrPrmDump | | |
250 +-------------------------------------------------------------------+ | |
251 | |
252 PURPOSE : this function dumps the shared parameter to the debug | |
253 output. | |
254 */ | |
255 | |
256 GLOBAL void psaSMS_shrPrmDump ( void ) | |
257 { | |
258 #ifdef TRACING | |
259 | |
260 char lnBuf [80]; /* holds buffer for output line */ | |
261 SHORT chrNr; /* holds number of processed chars */ | |
262 | |
263 /* --- SIM total -----------------------------------------------*/ | |
264 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " SIM total" ); | |
265 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT, | |
266 smsShrdPrm.aci_sms_parameter.simTotal ); | |
267 TRACE_EVENT( lnBuf ); | |
268 | |
269 /* --- SIM used ------------------------------------------------*/ | |
270 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " SIM used" ); | |
271 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT, | |
272 smsShrdPrm.aci_sms_parameter.simUsed ); | |
273 TRACE_EVENT( lnBuf ); | |
274 | |
275 /* --- ME total ------------------------------------------------*/ | |
276 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " ME total" ); | |
277 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT, | |
278 smsShrdPrm.aci_sms_parameter.meTotal ); | |
279 TRACE_EVENT( lnBuf ); | |
280 | |
281 /* --- ME used -------------------------------------------------*/ | |
282 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " ME used" ); | |
283 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT, | |
284 smsShrdPrm.aci_sms_parameter.meUsed ); | |
285 TRACE_EVENT( lnBuf ); | |
286 | |
287 /* --- SMS status ----------------------------------------------*/ | |
288 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "SMS status" ); | |
289 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT, | |
290 smsShrdPrm.smsStat ); | |
291 TRACE_EVENT( lnBuf ); | |
292 | |
293 #endif /* of #ifdef TRACING */ | |
294 } | |
295 | |
296 | |
297 /* | |
298 +-------------------------------------------------------------------+ | |
299 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSF | | |
300 | ROUTINE : psaSMS_printSetPrm | | |
301 +-------------------------------------------------------------------+ | |
302 | |
303 PURPOSE : | |
304 */ | |
305 | |
306 GLOBAL void psaSMS_printSetPrm ( T_SMS_SET_PRM * pSMSSetPrm ) | |
307 { | |
308 #ifdef TRACING | |
309 | |
310 UBYTE prflId; | |
311 UBYTE isCopy; | |
312 UBYTE numOfRefs; | |
313 | |
314 SHORT fo; | |
315 SHORT vprel; | |
316 T_ACI_VP_ABS vpabs; | |
317 T_ACI_VP_ENH vpenh; | |
318 SHORT pid; | |
319 SHORT dcs; | |
320 char vpenh_str[15]; | |
321 | |
322 char vpabs_str[25] = {'\0'}; | |
323 | |
324 CHAR *buf; | |
325 | |
326 /* | |
327 *----------------------------------------------------------------- | |
328 * fill in parameters | |
329 *----------------------------------------------------------------- | |
330 */ | |
331 | |
332 isCopy = pSMSSetPrm -> isCopy; | |
333 prflId = pSMSSetPrm -> prflId; | |
334 numOfRefs = pSMSSetPrm -> numOfRefs; | |
335 | |
336 fo = pSMSSetPrm -> msgType; | |
337 vprel = pSMSSetPrm -> vpRel; | |
338 | |
339 cmhSMS_setVpabsCmh ( &vpabs, &pSMSSetPrm -> vpAbs ); | |
340 cmhSMS_setVpenhCmh ( &vpenh, &pSMSSetPrm -> vpEnh ); | |
341 | |
342 pid = pSMSSetPrm -> pid; | |
343 dcs = pSMSSetPrm -> dcs; | |
344 | |
345 | |
346 MALLOC(buf,MAX_CMD_LEN); | |
347 if ((fo & TP_VPF_MASK) EQ TP_VPF_ABSOLUTE) /*Bits 4,3 -> 11*/ | |
348 { | |
349 sprintf(vpabs_str,"\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", | |
350 vpabs.year [0], vpabs.year [1], | |
351 vpabs.month [0], vpabs.month [1], | |
352 vpabs.day [0], vpabs.day [1], | |
353 vpabs.hour [0], vpabs.hour [1], | |
354 vpabs.minute[0], vpabs.minute[1], | |
355 vpabs.second[0], vpabs.second[1], | |
356 vpabs.timezone); | |
357 sprintf(buf,"isCopy:%d,prflId:%d,numOfRefs:%d,fo:%d,vpabs:%s,pid:%d,dcs:%d", | |
358 isCopy,prflId,numOfRefs,fo,vpabs_str,pid,dcs); | |
359 } | |
360 else if ((fo & TP_VPF_MASK) EQ TP_VPF_ENHANCED) | |
361 { | |
362 | |
363 aci_encodeVpenh ( vpenh_str, &vpenh ); | |
364 | |
365 sprintf(buf,"isCopy:%d,prflId:%d,numOfRefs:%d,fo:%d,vpenh:\"%s\",pid:%d,dcs:%d", | |
366 isCopy,prflId,numOfRefs,fo,vpenh_str,pid,dcs); | |
367 } | |
368 else if ((fo & TP_VPF_MASK) EQ TP_VPF_RELATIVE) /*Bits 4,3 -> 10*/ | |
369 { | |
370 sprintf(buf,"isCopy:%d,prflId:%d,numOfRefs:%d,fo:%d,vprel:%d,pid:%d,dcs:%d", | |
371 isCopy,prflId,numOfRefs,fo,vprel,pid,dcs); | |
372 } | |
373 else | |
374 { | |
375 sprintf(buf,"isCopy:%d,prflId:%d,numOfRefs:%d,fo:%d,,pid:%d,dcs:%d", | |
376 isCopy,prflId,numOfRefs,fo,pid,dcs); | |
377 } | |
378 | |
379 TRACE_EVENT( buf ); | |
380 MFREE( buf ); | |
381 | |
382 #endif /* of #ifdef TRACING */ | |
383 } | |
384 | |
385 | |
386 /* | |
387 +-------------------------------------------------------------------+ | |
388 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSF | | |
389 | ROUTINE : psaSMS_printSetPrmList | | |
390 +-------------------------------------------------------------------+ | |
391 | |
392 PURPOSE : | |
393 */ | |
394 | |
395 GLOBAL void psaSMS_printSetPrmList ( T_ACI_CMD_SRC srcId ) | |
396 { | |
397 #ifdef TRACING | |
398 | |
399 T_ACI_LIST *current; | |
400 UBYTE index=0; | |
401 char tmp[25]; | |
402 | |
403 current = set_prm_list; | |
404 | |
405 while (current) | |
406 { | |
407 sprintf(tmp, "SET PRM List Element %d:", index++); | |
408 TRACE_EVENT(tmp); | |
409 psaSMS_printSetPrm(current->msg); | |
410 current = current->next; | |
411 } | |
412 | |
413 TRACE_EVENT("CURRENT SET PRM:"); | |
414 psaSMS_printSetPrm(smsShrdPrm.pSetPrm[srcId]); | |
415 | |
416 #endif /* of #ifdef TRACING */ | |
417 } | |
418 | |
419 /*==== EOF ========================================================*/ | |
420 |