FreeCalypso > hg > tcs211-fcmodem
comparison g23m/condat/ms/src/aci/psa_smsp.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_SMSP | |
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 processing functions for the | |
18 | primitives send to the protocol stack adapter by | |
19 | short message service. | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef PSA_SMSP_C | |
24 #define PSA_SMSP_C | |
25 #endif | |
26 | |
27 #include "aci_all.h" | |
28 | |
29 /*==== INCLUDES ===================================================*/ | |
30 #include "aci_cmh.h" | |
31 #include "ati_cmd.h" | |
32 #include "aci_cmd.h" | |
33 | |
34 | |
35 #ifdef FAX_AND_DATA | |
36 #include "aci_fd.h" | |
37 #endif /* of #ifdef FAX_AND_DATA */ | |
38 | |
39 #include "aci.h" | |
40 #include "psa.h" | |
41 #include "psa_sms.h" | |
42 #include "cmh.h" | |
43 #include "cmh_sms.h" | |
44 #include "aoc.h" | |
45 #ifdef SIM_PERS | |
46 #include "cl_imei.h" | |
47 #include "aci_ext_pers.h" | |
48 #include "aci_slock.h" | |
49 #endif | |
50 | |
51 #ifdef GPRS | |
52 #include "dti.h" | |
53 #include "dti_conn_mng.h" | |
54 #include "dti_cntrl_mng.h" | |
55 #include "gaci.h" | |
56 #include "gaci_cmh.h" | |
57 #include "psa_sm.h" | |
58 | |
59 #include "cmh_sm.h" | |
60 #endif /* GPRS */ | |
61 /*==== CONSTANTS ==================================================*/ | |
62 | |
63 | |
64 /*==== TYPES ======================================================*/ | |
65 | |
66 | |
67 /*==== EXPORT =====================================================*/ | |
68 | |
69 | |
70 /*==== VARIABLES ==================================================*/ | |
71 #ifndef PIN_LEN | |
72 #define PIN_LEN (8) | |
73 #endif | |
74 #ifdef SIM_PERS_OTA | |
75 #define CTRL_KEY_LEN PIN_LEN+1 | |
76 #define SMS_DATA_IDX 41 | |
77 #define IMEI_MISMATCH "0xFFFFFFFF" | |
78 #endif | |
79 | |
80 /*==== FUNCTIONS ==================================================*/ | |
81 | |
82 | |
83 /* | |
84 +-------------------------------------------------------------------+ | |
85 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
86 | ROUTINE : psa_mnsms_message_ind | | |
87 +-------------------------------------------------------------------+ | |
88 | |
89 PURPOSE : processes the MNSMS_MESSAGE_IND primitive send by SMS. | |
90 this indicates an incoming SMS. | |
91 | |
92 */ | |
93 | |
94 GLOBAL const void psa_mnsms_message_ind | |
95 ( T_MNSMS_MESSAGE_IND *mnsms_message_ind ) | |
96 { | |
97 /* (was psa_mnsms_alert_ind) */ | |
98 TRACE_FUNCTION ("psa_mnsms_message_ind()"); | |
99 | |
100 | |
101 if (smsShrdPrm.smsStat EQ SMS_STATE_INITIALISING) | |
102 { | |
103 TRACE_FUNCTION ("SMS_STATE_INITIALISING"); | |
104 cmhSMS_SMSInitState(mnsms_message_ind); | |
105 } | |
106 else | |
107 { | |
108 if (mnsms_message_ind->rec_num EQ SMS_RECORD_NOT_EXIST) | |
109 { | |
110 #ifdef FF_CPHS | |
111 if ( !cmhSMS_voice_mail_ind( &(mnsms_message_ind->sms_sdu)) ) | |
112 #endif /* FF_CPHS */ | |
113 cmhSMS_SMSDeliver (mnsms_message_ind); | |
114 } | |
115 else | |
116 { | |
117 /* | |
118 * Incoming SMS may modify the Advice of Charge Parameters | |
119 * | |
120 * Read them again | |
121 */ | |
122 aoc_sms (); | |
123 | |
124 #ifdef FF_CPHS | |
125 cmhSMS_voice_mail_ind( &(mnsms_message_ind->sms_sdu)); | |
126 #endif /* FF_CPHS */ | |
127 cmhSMS_SMSMemory (mnsms_message_ind); | |
128 } | |
129 } | |
130 | |
131 /* | |
132 *------------------------------------------------------------------- | |
133 * free the primitive buffer | |
134 *------------------------------------------------------------------- | |
135 */ | |
136 PFREE (mnsms_message_ind); | |
137 } | |
138 | |
139 /* | |
140 +-------------------------------------------------------------------+ | |
141 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
142 | ROUTINE : psa_mnsms_report_ind | | |
143 +-------------------------------------------------------------------+ | |
144 | |
145 PURPOSE : processes the MNSMS_REPORT_IND primitive send by SMS. | |
146 this indicates the state of the SMS Entity. | |
147 | |
148 */ | |
149 | |
150 GLOBAL const void psa_mnsms_report_ind | |
151 ( T_MNSMS_REPORT_IND *mnsms_report_ind ) | |
152 { | |
153 | |
154 TRACE_FUNCTION ("psa_mnsms_report_ind()"); | |
155 | |
156 cmhSMS_Result(mnsms_report_ind); | |
157 | |
158 /* | |
159 *------------------------------------------------------------------- | |
160 * free the primitive buffer | |
161 *------------------------------------------------------------------- | |
162 */ | |
163 PFREE (mnsms_report_ind); | |
164 | |
165 } | |
166 | |
167 /* | |
168 +-------------------------------------------------------------------+ | |
169 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
170 | ROUTINE : psa_mnsms_status_ind | | |
171 +-------------------------------------------------------------------+ | |
172 | |
173 PURPOSE : processes the MNSMS_STATUS_IND primitive send by SMS. | |
174 this indicates an incoming SMS status message. | |
175 | |
176 */ | |
177 | |
178 GLOBAL const void psa_mnsms_status_ind ( T_MNSMS_STATUS_IND *mnsms_status_ind ) | |
179 { | |
180 TRACE_FUNCTION ("psa_mnsms_status_ind()"); | |
181 | |
182 cmhSMS_SMSStatRpt (mnsms_status_ind); | |
183 | |
184 /* | |
185 *------------------------------------------------------------------- | |
186 * free the primitive buffer | |
187 *------------------------------------------------------------------- | |
188 */ | |
189 PFREE (mnsms_status_ind); | |
190 } | |
191 | |
192 /* | |
193 +-------------------------------------------------------------------+ | |
194 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
195 | ROUTINE : psa_mnsms_delete_cnf | | |
196 +-------------------------------------------------------------------+ | |
197 | |
198 PURPOSE : processes the MNSMS_DELETE_CNF primitive send by SMS. | |
199 | |
200 */ | |
201 | |
202 GLOBAL const void psa_mnsms_delete_cnf ( T_MNSMS_DELETE_CNF *mnsms_delete_cnf ) | |
203 { | |
204 TRACE_FUNCTION ("psa_mnsms_delete_cnf()"); | |
205 | |
206 cmhSMS_SMSDelCnf (mnsms_delete_cnf); | |
207 | |
208 /* | |
209 *------------------------------------------------------------------- | |
210 * free the primitive buffer | |
211 *------------------------------------------------------------------- | |
212 */ | |
213 PFREE (mnsms_delete_cnf); | |
214 } | |
215 | |
216 /* | |
217 +-------------------------------------------------------------------+ | |
218 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
219 | ROUTINE : psa_mnsms_read_cnf | | |
220 +-------------------------------------------------------------------+ | |
221 | |
222 PURPOSE : processes the MNSMS_READ_CNF primitive send by SMS. | |
223 | |
224 */ | |
225 | |
226 GLOBAL const void psa_mnsms_read_cnf ( T_MNSMS_READ_CNF *mnsms_read_cnf ) | |
227 { | |
228 TRACE_FUNCTION ("psa_mnsms_read_cnf()"); | |
229 | |
230 cmhSMS_SMRead (mnsms_read_cnf); | |
231 | |
232 /* | |
233 *------------------------------------------------------------------- | |
234 * free the primitive buffer | |
235 *------------------------------------------------------------------- | |
236 */ | |
237 PFREE (mnsms_read_cnf); | |
238 } | |
239 | |
240 /* | |
241 +-------------------------------------------------------------------+ | |
242 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
243 | ROUTINE : psa_mnsms_store_cnf | | |
244 +-------------------------------------------------------------------+ | |
245 | |
246 PURPOSE : processes the MNSMS_STORE_CNF primitive send by SMS. | |
247 | |
248 */ | |
249 | |
250 GLOBAL const void psa_mnsms_store_cnf ( T_MNSMS_STORE_CNF *mnsms_store_cnf ) | |
251 { | |
252 TRACE_FUNCTION ("psa_mnsms_store_cnf()"); | |
253 | |
254 cmhSMS_SMSStoCnf(mnsms_store_cnf); | |
255 | |
256 /* | |
257 *------------------------------------------------------------------- | |
258 * free the primitive buffer | |
259 *------------------------------------------------------------------- | |
260 */ | |
261 PFREE (mnsms_store_cnf); | |
262 } | |
263 | |
264 /* | |
265 +-------------------------------------------------------------------+ | |
266 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
267 | ROUTINE : psa_mnsms_submit_cnf | | |
268 +-------------------------------------------------------------------+ | |
269 | |
270 PURPOSE : processes the MNSMS_SUBMIT_CNF primitive send by SMS. | |
271 | |
272 */ | |
273 | |
274 GLOBAL const void psa_mnsms_submit_cnf ( T_MNSMS_SUBMIT_CNF *mnsms_submit_cnf ) | |
275 { | |
276 TRACE_FUNCTION ("psa_mnsms_submit_cnf()"); | |
277 | |
278 cmhSMS_SMSSbmCnf(mnsms_submit_cnf); | |
279 | |
280 /* | |
281 *------------------------------------------------------------------- | |
282 * free the primitive buffer | |
283 *------------------------------------------------------------------- | |
284 */ | |
285 PFREE (mnsms_submit_cnf); | |
286 } | |
287 | |
288 /* | |
289 +-------------------------------------------------------------------+ | |
290 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
291 | ROUTINE : psa_mnsms_command_cnf | | |
292 +-------------------------------------------------------------------+ | |
293 | |
294 PURPOSE : processes the MNSMS_COMMAND_CNF primitive send by SMS. | |
295 | |
296 */ | |
297 | |
298 GLOBAL const void psa_mnsms_command_cnf ( T_MNSMS_COMMAND_CNF *mnsms_command_cnf ) | |
299 { | |
300 TRACE_FUNCTION ("psa_mnsms_command_cnf()"); | |
301 | |
302 cmhSMS_SMSCmdCnf(mnsms_command_cnf); | |
303 | |
304 /* | |
305 *------------------------------------------------------------------- | |
306 * free the primitive buffer | |
307 *------------------------------------------------------------------- | |
308 */ | |
309 PFREE (mnsms_command_cnf); | |
310 } | |
311 | |
312 /* | |
313 +-------------------------------------------------------------------+ | |
314 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
315 | ROUTINE : psa_mnsms_error_ind | | |
316 +-------------------------------------------------------------------+ | |
317 | |
318 PURPOSE : processes the MNSMS_ERROR_IND primitive send by SMS. | |
319 | |
320 */ | |
321 | |
322 GLOBAL const void psa_mnsms_error_ind ( T_MNSMS_ERROR_IND *mnsms_error_ind ) | |
323 { | |
324 TRACE_FUNCTION ("psa_mnsms_error_ind()"); | |
325 | |
326 cmhSMS_SMSErrorInd(mnsms_error_ind); | |
327 | |
328 /* | |
329 *------------------------------------------------------------------- | |
330 * free the primitive buffer | |
331 *------------------------------------------------------------------- | |
332 */ | |
333 PFREE (mnsms_error_ind); | |
334 } | |
335 | |
336 | |
337 /* | |
338 +-------------------------------------------------------------------+ | |
339 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
340 | ROUTINE : psa_mnsms_resume_cnf | | |
341 +-------------------------------------------------------------------+ | |
342 | |
343 PURPOSE : processes the MNSMS_RESUME_CNF primitive send by SMS. | |
344 This confirms that the receiving of has been SMS is | |
345 activated. | |
346 | |
347 */ | |
348 | |
349 GLOBAL const void psa_mnsms_resume_cnf ( T_MNSMS_RESUME_CNF *mnsms_resume_cnf ) | |
350 { | |
351 TRACE_FUNCTION ("psa_mnsms_resume_cnf()"); | |
352 | |
353 /* inform command handler */ | |
354 cmhSMS_SMSResumeCnf(mnsms_resume_cnf); | |
355 | |
356 /* | |
357 *------------------------------------------------------------------- | |
358 * free the primitive buffer | |
359 *------------------------------------------------------------------- | |
360 */ | |
361 PFREE(mnsms_resume_cnf); | |
362 } | |
363 | |
364 /* | |
365 +-------------------------------------------------------------------+ | |
366 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
367 | ROUTINE : psa_mnsms_query_cnf | | |
368 +-------------------------------------------------------------------+ | |
369 | |
370 PURPOSE : processes the MNSMS_TEST_CNF primitive send by SMS. | |
371 This confirms that the receiving of has been SMS is | |
372 activated. | |
373 | |
374 */ | |
375 | |
376 GLOBAL const void psa_mnsms_query_cnf ( T_MNSMS_QUERY_CNF *mnsms_query_cnf) | |
377 { | |
378 TRACE_FUNCTION ("psa_mnsms_query_cnf()"); | |
379 | |
380 /* inform command handler */ | |
381 cmhSMS_SMSQueryCnf( mnsms_query_cnf ); | |
382 | |
383 /* | |
384 *------------------------------------------------------------------- | |
385 * free the primitive buffer | |
386 *------------------------------------------------------------------- | |
387 */ | |
388 PFREE(mnsms_query_cnf); | |
389 } | |
390 | |
391 | |
392 #if defined (GPRS) AND defined (DTI) | |
393 /* | |
394 +-------------------------------------------------------------------+ | |
395 | PROJECT : GSM-PS (6147) MODULE : PSA_SMSP | | |
396 | ROUTINE : psa_mnsms_info_cnf | | |
397 +-------------------------------------------------------------------+ | |
398 | |
399 PURPOSE : processes the MNSMS_MO_SERV_CNF primitive send by SMS. | |
400 this confirms the requested SMS message service. | |
401 | |
402 */ | |
403 | |
404 GLOBAL const void psa_mnsms_mo_serv_cnf | |
405 ( T_MNSMS_MO_SERV_CNF *mnsms_mo_serv_cnf ) | |
406 { | |
407 | |
408 TRACE_FUNCTION ("psa_mnsms_mo_serv_cnf()"); | |
409 | |
410 /* | |
411 *------------------------------------------------------------------- | |
412 * update sms parameters and notify ACI | |
413 *------------------------------------------------------------------- | |
414 */ | |
415 | |
416 cmhSM_sms_service_changed( mnsms_mo_serv_cnf->mo_sms_serv ); | |
417 | |
418 /* | |
419 *------------------------------------------------------------------- | |
420 * free the primitive buffer | |
421 *------------------------------------------------------------------- | |
422 */ | |
423 PFREE (mnsms_mo_serv_cnf); | |
424 | |
425 } | |
426 #endif /* GPRS */ | |
427 | |
428 | |
429 #ifdef SIM_PERS_OTA | |
430 | |
431 /* | |
432 +------------------------------------------------------------------------------ | |
433 | Function : psa_mnsms_OTA_decode_ind | |
434 +------------------------------------------------------------------------------ | |
435 | Description : processes the MNSMS_OTA_DECODE_IND primitive | |
436 | | |
437 | Parameters : mnsms_ota_decode_ind - primitive | |
438 | | |
439 | Return : void | |
440 | | |
441 +------------------------------------------------------------------------------ | |
442 */ | |
443 | |
444 GLOBAL const void psa_mnsms_OTA_decode_ind ( T_MNSMS_OTA_DECODE_IND *mnsms_ota_decode_ind ) | |
445 { | |
446 UBYTE lcktype; | |
447 UBYTE ctrl_key[CTRL_KEY_LEN]; | |
448 UBYTE *imei; | |
449 UBYTE imeiBufPtr[CL_IMEI_ISDID_SIZE]; | |
450 UBYTE ret_status = 0; | |
451 UINT i = 0,ctr; | |
452 | |
453 TRACE_FUNCTION ("psa_mnsms_OTA_decode_ind()"); | |
454 | |
455 imei = &mnsms_ota_decode_ind->tp_ud.data[73]; | |
456 | |
457 /*As the IMEI is 15 digits long (see TS 23.003 [3]), | |
458 the sixteenth digit present here is ignored by the ME | |
459 during the de-personalization procedure and should be set to zero.*/ | |
460 | |
461 *(imei+15) = 0; | |
462 cl_get_imeisv(CL_IMEI_ISDID_SIZE, imeiBufPtr, CL_IMEI_GET_SECURE_IMEI); | |
463 | |
464 while (*imei EQ imeiBufPtr[i] && i NEQ CL_IMEI_ISDID_SIZE ) | |
465 { | |
466 imei++; | |
467 i++; | |
468 } | |
469 if (i NEQ CL_IMEI_ISDID_SIZE) | |
470 ret_status = 0xff; //If IMEI mismatch occurs then status of all categories is set to IMEI Mismatch | |
471 | |
472 /*Extract the values from the SMS user data*/ | |
473 | |
474 memset(ctrl_key,0,CTRL_KEY_LEN); | |
475 | |
476 for(lcktype=SIMLOCK_NETWORK,ctr=SMS_DATA_IDX; lcktype<=SIMLOCK_CORPORATE;lcktype++,ctr+=PIN_LEN) | |
477 { | |
478 strncpy ( (char *) ctrl_key, (char*) mnsms_ota_decode_ind->tp_ud.data[ctr], PIN_LEN); | |
479 ctrl_key[PIN_LEN] = '\0'; | |
480 if (memcmp ((char *)ctrl_key,IMEI_MISMATCH,PIN_LEN)) | |
481 ret_status |= aci_ext_personalisation_get_status(lcktype); | |
482 else | |
483 { | |
484 if( aci_slock_unlock(lcktype, (char *) ctrl_key) EQ SIMLOCK_FAIL) | |
485 ret_status |= aci_ext_personalisation_get_status(lcktype); | |
486 } | |
487 if(lcktype NEQ SIMLOCK_CORPORATE) | |
488 ret_status <<= 2; | |
489 } | |
490 | |
491 imei = &mnsms_ota_decode_ind->tp_ud.data[ctr]; | |
492 { | |
493 PALLOC (mnsms_OTA_decode_res, MNSMS_OTA_DECODE_RES); | |
494 mnsms_OTA_decode_res->ota_status = ret_status; | |
495 for (i=0;i<CL_IMEI_ISDID_SIZE;i++) | |
496 { | |
497 mnsms_OTA_decode_res->imei[i] = *imei; | |
498 imei++; | |
499 } | |
500 PSEND (hCommSMS, mnsms_OTA_decode_res); | |
501 } | |
502 PFREE (mnsms_ota_decode_ind); | |
503 } | |
504 #endif //SIM_PERS_OTA | |
505 /*==== EOF =========================================================*/ |