FreeCalypso > hg > tcs211-l1-reconst
comparison g23m/condat/ms/src/mfw/mfw_sms.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: MMI-Framework (8417) $Workfile:: mfw_sms.c $| | |
4 | $Author:: Vo $Revision:: 1 $| | |
5 | CREATED: 21.12.98 $Modtime:: 24.03.00 10:25 $| | |
6 | STATE : code | | |
7 +--------------------------------------------------------------------+ | |
8 | |
9 MODULE : MFW_SMS | |
10 PURPOSE : This module contains SMS management functions. | |
11 | |
12 Feb 07, 2006 DR: OMAPS00059261 x0pleela | |
13 Description: SMS is not forwarding STATUS reports that are read from SIM storage to ACI | |
14 Solution: sms_decode_status(): removed the code added for handling pending status of a status report | |
15 rat_plusCMGR(): updating sms_str based on tp_status of a status report | |
16 Removed macros STAT_MIN_VALUE and STAT_MAX_VALUE added earlier | |
17 Replaced MT_STATUS_RPT with MFW_SMS_STATRPT as MT_STATUS_RPT is removed | |
18 | |
19 Feb 01, 2006 DR: OMAPS00059261 x0pleela | |
20 Description: SMS is not forwarding STATUS reports that are read from SIM storage to ACI | |
21 Solution: Added two macros to check the range of status of status report | |
22 Used enums for the hardcoded values for MFW_MSG_DELIVER(MT), MFW_MSG_SUBMIT (MO) and MFW_MSG_STATUS_REPORT (STATUS REPORT) types while reading the messages | |
23 Added a check in "sms_decodeStatus" to support pending status of the status report | |
24 Made changes as per review comments | |
25 | |
26 Jan 30, 2006 DR: OMAPS00059261 x0pleela | |
27 Description: SMS is not forwarding STATUS reports that are read from SIM storage to ACI | |
28 Solution: Added code to read MT Status report | |
29 | |
30 | |
31 Jan 20, 2006 REF: DRT OMAPS00053377 xdeepadh | |
32 Description: SMS Validity Period - using MMI - Failure, MS not able to set SMS validity | |
33 Solution: While setting the validity period, the validity period format also has been set in the | |
34 frst octet. | |
35 | |
36 Nov 15,2005 DR : OMAPS00057280 - x0034700 | |
37 Description: Compilation Errors in Neptune build while integrating latest MMI Changes | |
38 Solution: Included the compilation FLAG "NEPTUNE_BOARD" for un wanted code for Neptune build | |
39 | |
40 Feb 22, 2006 REF: MMI-FIX-OMAPS00058684 x0035544(Sudha) | |
41 Description: Can't send a SMS with a specific SIM card | |
42 Solution: Check the PID(Protocol ID) value for an MO SMS and Set the PID(Protocol ID) accordingly. | |
43 | |
44 Dec 15, 2005 REF: MMI-FIX-OMAPS00058684 x0035544 | |
45 Description: OMAPS00045726 / MMI-FIX-30439 Follow-Up : ifdef for FF Home Zone forgotten. | |
46 Solution: Added Feature flag FF_HOMEZONE for the function sms_homezoneCBToggle(U8 Activate_CB) | |
47 | |
48 Nov 8, 2005 REF: OMAPS00050772, a0876501 (Shashi) | |
49 Issue description: CMGD merge from tcs4.0 to g23m. | |
50 Solution: New parameter is added to sAT_PlusCMGD function. Migrating the MFW changes. | |
51 | |
52 | |
53 Oct 18, 2005 REF: SPR 34678 xdeepadh | |
54 Description: MMI Screen – shows garbled characters for Cell Information | |
55 Solution: The CB messages with DCS 242(class-2,default alphabet) are discarded. | |
56 | |
57 May 27, 2005 MMI-FIX-29869 x0018858 | |
58 Description: There is a limitation on the number of messages that can be downloaded from | |
59 server even though there is space on the sim. | |
60 Solution: The limitation has been removed and the number of messages that can be dowloaded | |
61 has been modified to the masimum number that can be stored. | |
62 | |
63 Jun 14, 2005 REF: MMI-FIX-30439 x0018858 | |
64 Description: The homezone/cityzone tags were not being displayed properly. | |
65 Solution: Modified to save the tags properly in caches and also made the | |
66 appropriate modifications to update the same properly during mobility. | |
67 | |
68 July 7, 2005 REF: CRR MMI-SPR-32179 x0018858 | |
69 Issue description: PS crashed while performing call Forwarding. | |
70 Solution: Since this is related to memory leaks which occur, the code has been added to | |
71 free certain memory based on a a checking condition and also by cleaning the buffer. | |
72 | |
73 xrashmic 9 May, 2005 MMI-SPR-30159 | |
74 Concat PUSH msg are stored and sent to wap client once all parts are received | |
75 | |
76 x0018858 24 Mar, 2005 MMI-FIX-11321 | |
77 Issue Description :- If the inbox is full and a new message is receivd, no indication is received. | |
78 Fix: Added support for handling indication when message box is full and | |
79 there is a pending message. | |
80 | |
81 March 31, 2005 REF: CRR MMI-SPR-24511 x0012852 | |
82 Bug:The phone crashes when the user selects the 'Delete All' option | |
83 almost the same time as there's an incoming message. | |
84 Fix:Check added for part message before deleting all messages. | |
85 | |
86 March 2, 2005 REF: CRR 11536 x0018858 | |
87 Description: Reply path not supported while sending a reply. | |
88 Solution: Added menu option for the reply path. | |
89 | |
90 | |
91 Feb 28, 2004 REF: CRR 28809 Deepa M.D | |
92 Bug:SRAM Optimization :Dynamic allocation of sms_mo | |
93 Fix:The static T_MFW_SMS_MO sms_mo variable, is made a local pointer variable. | |
94 It is dynamically allocated and deallocated. | |
95 The Optimization changes done for golite build have been incorpaorated to color build. | |
96 The MMI_LITE flag used for rAT_PlusCMGR has been removed. | |
97 | |
98 Feb 16, 2005 REF: CRR MMI-SPR-27900 xnkulkar | |
99 Issue description: BMI: using the tool nowSMS the voicemail indication via sms does not work | |
100 Solution: Instead of identifying voice using addr[0] and pid, we use dcs. Also, messages belonging | |
101 to group "1100" are deleted when voicemail icon is displayed. | |
102 | |
103 Dec 23, 2004 REF: CRR MMI-SPR-27741 xkundadu | |
104 Issue description: BMI: crashing when using the function : sms_index_list() located in mfw | |
105 Solution: Changed the msg_list variable to array of T_MFW_SMS_IDX. | |
106 | |
107 Aug 18, 2004 REF: CRR 24282 Deepa M.D | |
108 Bug:Go-lite Optimization Dynamic allocation of sms_mo | |
109 Fix:static T_MFW_SMS_MO sms_mo has been made a local variable. | |
110 It is allocated/deallocated dynamically. | |
111 | |
112 Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
113 Bug:Clenup of sprintf used for tracing | |
114 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX | |
115 | |
116 Aug 17, 2004 REF: CRR 24281 Deepa M.D | |
117 Bug:Go-lite Optimization Remove the unsed variable temp_conv_buffer | |
118 Fix:Removed the unused variables from mfw_sms.c | |
119 | |
120 Aug 26, 2004 REF: CRR 23287 Deepa M.D | |
121 Bug:Inconsistent events being passed in MFW sms module | |
122 Fix:For E_SMS_MT_RECEIVED event,sms_id_wait is passed. | |
123 | |
124 Jul 07, 2004 REF: CRR 15846 Deepa M.D | |
125 Bug : Concatenated SMT : SMS present but not displayed !!! | |
126 Fix : Check has been made before freeing the memory. | |
127 | |
128 SPR 2260: Merged in bugfixes 1833, 1669, 872,1830, 1828, 2031, and 2007 | |
129 fom the 1.6.3 branch into this file. | |
130 | |
131 Apr 12, 2004 REF: CRR 13370 Deepa M.D | |
132 Bug : The Sender name was not displayed properly in the status report. | |
133 Fix : The sendername had garbage values when the corresponding number was not | |
134 present in the Phonebook.So when the name was not present, only the number is displayed. | |
135 | |
136 | |
137 | |
138 */ | |
139 | |
140 #define ENTITY_MFW | |
141 | |
142 #include <string.h> | |
143 #include <stdio.h> | |
144 #include <stdlib.h> | |
145 | |
146 #if defined (NEW_FRAME) | |
147 | |
148 #include "typedefs.h" | |
149 #include "vsi.h" | |
150 #include "custom.h" | |
151 #include "gsm.h" | |
152 | |
153 #else | |
154 | |
155 #include "STDDEFS.H" | |
156 #include "custom.h" | |
157 #include "gsm.h" | |
158 #include "vsi.h" | |
159 | |
160 #endif | |
161 | |
162 #include "cus_aci.h" | |
163 #include "message.h" | |
164 #include "prim.h" | |
165 #include "aci_cmh.h" | |
166 #include "ksd.h" | |
167 #include "prim.h" | |
168 #ifndef PCM_2_FFS | |
169 #include "pcm.h" | |
170 #endif | |
171 | |
172 #ifndef FF_2TO1_PS | |
173 #include "p_mnsms.val" | |
174 #endif | |
175 | |
176 #include "psa.h" | |
177 #include "psa_sim.h" | |
178 | |
179 #include "mfw_mfw.h" | |
180 #include "mfw_nm.h" | |
181 #include "mfw_sima.h" | |
182 #include "mfw_nmi.h" | |
183 #include "mfw_phb.h" | |
184 #include "mfw_cm.h" | |
185 #include "mfw_cmi.h" | |
186 #include "mfw_sim.h" | |
187 #include "mfw_simi.h" | |
188 #include "mfw_phbi.h" | |
189 #include "mfw_sms.h" | |
190 #include "mfw_smsi.h" | |
191 #include "mfw_win.h" | |
192 #include "mfw_cphs.h" | |
193 #include "mfw_cphsi.h" | |
194 #include "aci_lst.h" | |
195 #include "conc_sms.h" | |
196 | |
197 | |
198 #ifdef SIM_TOOLKIT | |
199 #include "mfw_sat.h" | |
200 #endif | |
201 | |
202 #include <string.h> | |
203 #include <stdio.h> | |
204 | |
205 /********* current define *******************************************/ | |
206 /*SPR 2260 added definitions*/ | |
207 #define FIRST_READ_OF_MEMORY_USE 1 | |
208 #define POST_DELETE_CHECK 2 | |
209 // Feb 22, 2006 DR:OMAPS00068268 x0035544 | |
210 //Added the #defines for the bits 7, 6 and 5 | |
211 #define BIT_7 0x80 | |
212 #define BIT_6 0x40 | |
213 #define BIT_5 0x20 | |
214 | |
215 //May 27, 2005 MMI-FIX-29869 x0018858 - Added the #defines | |
216 #ifdef FF_MMI_SMS_DYNAMIC | |
217 #define ALLOC_MEMORY mfwAlloc | |
218 #define FREE_MEMORY mfwFree | |
219 //May 27, 2005 MMI-FIX-29869 x0018858- Modified from staic array to dynamic memory. | |
220 T_MFW_SMS_MSG* msg_info = NULL; /* message table */ | |
221 | |
222 //May 27, 2005 MMI-FIX-29869 x0018858 - Added a Checking variable. | |
223 static int Counter_first = 0; | |
224 #else | |
225 static T_MFW_SMS_MSG msg_info[MAX_MESSAGES]; /* message table */ | |
226 #endif | |
227 | |
228 | |
229 static T_MFW_SMS_MT sms_mt; | |
230 static T_MFW_SMS_CB sms_cb; | |
231 static T_MFW_SMS_ID sms_id, sms_id_wait; | |
232 | |
233 static T_MFW_MEM_INFO memory; | |
234 | |
235 static SHORT first_id; | |
236 static SHORT flag; | |
237 static SHORT status_change_index; | |
238 static SHORT deleting_index; | |
239 static SHORT storage_index; | |
240 static SHORT mt_flag; | |
241 static UBYTE f_update; | |
242 static UBYTE int_req; | |
243 static UBYTE smsReady; | |
244 static UBYTE phbReady; | |
245 static UBYTE sentStatus; | |
246 static UBYTE sms_update = FALSE; | |
247 | |
248 static UBYTE coll_sms_send; /* mt sms during send process */ | |
249 static UBYTE coll_sms_read; /* mt sms during read process */ | |
250 static UBYTE coll_sms_delete; /* mt sms during delete process */ | |
251 static UBYTE coll_sms_req; /* mt sms during request process */ | |
252 | |
253 static UBYTE data[30]; | |
254 | |
255 static UBYTE initialising_flag; | |
256 | |
257 UBYTE sms_type; | |
258 UBYTE mt_type; | |
259 UBYTE int_init_req; | |
260 CHAR *wr_addr; | |
261 UBYTE Delete_1_2_1_vm_icon=FALSE; | |
262 UBYTE Display_1_2_1_vm_icon =FALSE; | |
263 static UBYTE cb_mid[10]; /* cell broadcast message identifier */ | |
264 static UBYTE fg; | |
265 EXTERN MfwHdr * current_mfw_elem; | |
266 | |
267 static BOOL cmgr_awaiting_ok = FALSE; // Marcus: Issue 2260: 03/10/2002 | |
268 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
269 static UBYTE sms_wap_sent_flag = FALSE; /* SPR#2086 - SH - TRUE if SMS is sent */ | |
270 #endif | |
271 | |
272 // Feb 16, 2005 REF: CRR MMI-SPR-27900 xnkulkar | |
273 // Added this variable to identify voice mail message to be deleted | |
274 BOOL invalidVm = FALSE; | |
275 | |
276 //x0pleela 30 Jan, 2006 DR: OMAPS00059261 | |
277 //SMS buffer storage size | |
278 #define MAX_STAT_MSG_LEN 30 | |
279 | |
280 extern UBYTE reply_path_bit ; | |
281 /*********************Prototypes****************************************/ | |
282 | |
283 //Feb 22, 2006 DR:OMAPS00068268 x0035544 | |
284 BOOL Sms_Check_PID(SHORT pid); | |
285 /*SPR2260 added prototype for new function*/ | |
286 BOOL delete_sms_from_table (SHORT index); | |
287 //Dec 14, 2005 REF: MMI-FIX-OMAPS00058684 x0035544 | |
288 #ifdef FF_HOMEZONE | |
289 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 | |
290 void sms_homezoneCBToggle(U8 Activate_CB); | |
291 #endif | |
292 | |
293 #ifdef FF_MMI_SMS_DYNAMIC | |
294 // May 27, 2005 MMI-FIX-29869 x0018858 - Begin | |
295 /* | |
296 +--------------------------------------------------------------------+ | |
297 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
298 | STATE : code ROUTINE : Check_max_sms_allowed | | |
299 +--------------------------------------------------------------------+ | |
300 | |
301 PURPOSE : Check for the max number of messages that can be stored and aloocate | |
302 memory accordingly. | |
303 | |
304 */ | |
305 void Check_max_sms_allowed(void) | |
306 { | |
307 | |
308 int i,num, my_count ; | |
309 T_MFW_SMS_MSG* cpy_msg_info = NULL; /* message table */ | |
310 U8 *MaxTotal; | |
311 | |
312 if((memory.total > 0) &&( Counter_first == 0)) | |
313 { | |
314 g_max_messages = memory.total; | |
315 | |
316 if( msg_info == NULL) | |
317 { | |
318 msg_info = (T_MFW_SMS_MSG*)ALLOC_MEMORY(g_max_messages*sizeof(T_MFW_SMS_MSG)); | |
319 | |
320 } | |
321 Counter_first ++; | |
322 } | |
323 | |
324 } | |
325 // May 27, 2005 MMI-FIX-29869 x0018858 - End | |
326 #endif | |
327 /* | |
328 +--------------------------------------------------------------------+ | |
329 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
330 | STATE : code ROUTINE : sms_init | | |
331 +--------------------------------------------------------------------+ | |
332 | |
333 PURPOSE : initialize for SMS management | |
334 | |
335 */ | |
336 | |
337 | |
338 void sms_init(void) | |
339 { | |
340 UBYTE i; | |
341 | |
342 TRACE_FUNCTION ("sms_init()"); | |
343 | |
344 /* Setting the default SMS parameter */ | |
345 sms_type = MFW_NO_MESSAGE; | |
346 mt_type = MFW_NO_MESSAGE; | |
347 flag = 0; | |
348 status_change_index = 0; | |
349 deleting_index = 0; | |
350 mt_flag = 0; | |
351 smsReady = 0; | |
352 phbReady = 0; | |
353 sms_id.index = sms_id_wait.index = 0; | |
354 #if 0 | |
355 for (i=0; i<MAX_MESSAGES; i++) | |
356 { | |
357 msg_info[i].index = -1; | |
358 msg_info[i].addr.number[0] = '\0'; | |
359 msg_info[i].addr.tag[0] = '\0'; | |
360 msg_info[i].addr.ton = MFW_TON_UNKNOWN; | |
361 msg_info[i].addr.npi = MFW_NPI_UNKNOWN; | |
362 msg_info[i].first_index = -1; /*SPR 2260*/ | |
363 msg_info[i].concat_status = MFW_SMS_NO_CONC; | |
364 | |
365 } | |
366 #endif | |
367 /* PATCH-6363 VO 30.01.01 */ | |
368 memory.mem = SMS_STOR_Sm; | |
369 memory.used = 0; | |
370 memory.total = 0; | |
371 /* PATCH-6363 end */ | |
372 | |
373 | |
374 | |
375 } | |
376 | |
377 // x0018858 24 Mar, 2005 MMI-FIX-11321 | |
378 //begin- MMI-FIX-11321 | |
379 /* | |
380 +--------------------------------------------------------------------+ | |
381 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
382 | STATE : code ROUTINE : sms_set_cind_values | | |
383 +--------------------------------------------------------------------+ | |
384 | |
385 PURPOSE : Set the Indication parameters. | |
386 | |
387 */ | |
388 | |
389 T_MFW sms_set_cind_values( T_ACI_MM_CIND_VAL_TYPE *cind_Settings) | |
390 { | |
391 if(0 == cind_Settings) | |
392 return MFW_SMS_FAIL; | |
393 | |
394 | |
395 if(sAT_PlusCIND(CMD_SRC_LCL,CIND_SIGNAL_INDICATOR_LVL0,CIND_SMSFULL_INDICATOR_MEMFULL)NEQ AT_CMPL) | |
396 { | |
397 TRACE_EVENT(" The indication couldnt not be set"); | |
398 return MFW_SMS_FAIL; | |
399 } | |
400 return MFW_SMS_OK; | |
401 } | |
402 | |
403 /* | |
404 +--------------------------------------------------------------------+ | |
405 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
406 | STATE : code ROUTINE : sms_set_cmer_values | | |
407 +--------------------------------------------------------------------+ | |
408 | |
409 PURPOSE : Set the CMER parameters. | |
410 | |
411 */ | |
412 T_MFW sms_set_cmer_values(T_ACI_MM_CMER_VAL_TYPE *cmer_Settings) | |
413 { | |
414 if(0 == cmer_Settings) | |
415 return MFW_SMS_FAIL; | |
416 | |
417 // ADDED BY RAVI - ACI CHANGES - 6-10-2005 | |
418 #if (BOARD==61) | |
419 if(sAT_PlusCMER(CMD_SRC_LCL,CMER_MODE_2,CMER_INDICATOR_2,CMER_BFR_1, 0)NEQ AT_CMPL) | |
420 #else | |
421 if(sAT_PlusCMER(CMD_SRC_LCL,CMER_MODE_2,CMER_INDICATOR_2,CMER_BFR_1)NEQ AT_CMPL) | |
422 #endif | |
423 // END ADDITION RAVI - 6-10-2005 | |
424 { | |
425 TRACE_EVENT(" The indication couldnt not be set"); | |
426 return MFW_SMS_FAIL; | |
427 } | |
428 return MFW_SMS_OK; | |
429 } | |
430 //end. - MMI-FIX-11321 | |
431 | |
432 /* | |
433 +--------------------------------------------------------------------+ | |
434 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
435 | STATE : code ROUTINE : sms_exit | | |
436 +--------------------------------------------------------------------+ | |
437 | |
438 PURPOSE : initialize for SMS management | |
439 | |
440 */ | |
441 | |
442 void sms_exit(void) | |
443 { | |
444 TRACE_FUNCTION ("sms_exit()"); | |
445 } | |
446 | |
447 /* | |
448 +--------------------------------------------------------------------+ | |
449 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
450 | STATE : code ROUTINE : sms_phbReady_ind | | |
451 +--------------------------------------------------------------------+ | |
452 | |
453 PURPOSE : finished initialize from the SIM card | |
454 | |
455 */ | |
456 | |
457 void sms_phbReady_ind(void) | |
458 { | |
459 if (smsReady) | |
460 { | |
461 TRACE_FUNCTION("sms_phbReady_ind"); | |
462 | |
463 f_update = MFW_SMS_NEW; | |
464 TRACE_EVENT("all free"); | |
465 coll_sms_send = coll_sms_read = coll_sms_delete = coll_sms_req = MFW_SMS_FREE; | |
466 sms_read_msg_info(); | |
467 smsReady = 0; | |
468 phbReady = 0; | |
469 } | |
470 else | |
471 phbReady = 1; | |
472 } | |
473 | |
474 /* | |
475 +--------------------------------------------------------------------+ | |
476 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
477 | STATE : code ROUTINE : rAT_sms_ready | | |
478 +--------------------------------------------------------------------+ | |
479 | |
480 PURPOSE : finished initialize from the SIM card | |
481 | |
482 */ | |
483 | |
484 void rAT_sms_ready(void) | |
485 { | |
486 TRACE_FUNCTION("rAT_sms_ready()"); | |
487 | |
488 if (phbReady) | |
489 { | |
490 f_update = MFW_SMS_NEW; | |
491 sms_read_msg_info(); | |
492 smsReady = 0; | |
493 phbReady = 0; | |
494 } | |
495 else | |
496 smsReady = 1; | |
497 } | |
498 | |
499 /* | |
500 +--------------------------------------------------------------------+ | |
501 | PROJECT : GSM-F&D (8411) MODULE : MFW_CB | | |
502 | STATE : code ROUTINE : rAT_SignalSMS | | |
503 +--------------------------------------------------------------------+ | |
504 | |
505 PURPOSE : handles rAT_SignalSMS call back | |
506 | |
507 */ | |
508 | |
509 GLOBAL void rAT_SignalSMS ( UBYTE state ) | |
510 { | |
511 TRACE_FUNCTION("rAT_SignalSMS()"); | |
512 switch (state) | |
513 { | |
514 #ifdef FF_2TO1_PS | |
515 case MNSMS_STATE_INITIALISING: initialising_flag = TRUE; break; | |
516 case MNSMS_STATE_READY: initialising_flag = FALSE; break; | |
517 #else | |
518 case SMS_STATE_INITIALISING: initialising_flag = TRUE; break; | |
519 case SMS_STATE_READY: initialising_flag = FALSE; break; | |
520 #endif | |
521 } | |
522 } | |
523 | |
524 | |
525 /* | |
526 +--------------------------------------------------------------------+ | |
527 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
528 | STATE : code ROUTINE : sms_create | | |
529 +--------------------------------------------------------------------+ | |
530 | |
531 PURPOSE : create SMS control | |
532 | |
533 */ | |
534 | |
535 T_MFW_HND sms_create(T_MFW_HND hWin, T_MFW_EVENT event, T_MFW_CB cbfunc) | |
536 { | |
537 T_MFW_HDR *hdr; | |
538 T_MFW_SMS *sms_para; | |
539 MfwHdr *insert_status =0; | |
540 | |
541 TRACE_FUNCTION ("sms_create()"); | |
542 | |
543 hdr = (T_MFW_HDR *) mfwAlloc(sizeof(T_MFW_HDR)); | |
544 sms_para = (T_MFW_SMS *) mfwAlloc(sizeof(T_MFW_SMS)); | |
545 | |
546 if (!hdr OR !sms_para) | |
547 { | |
548 TRACE_ERROR("ERROR: sms_create() Mem Alloc Failed."); | |
549 | |
550 if(hdr) | |
551 mfwFree((U8*)hdr,sizeof(MfwHdr)); | |
552 | |
553 if(sms_para) | |
554 mfwFree((U8*)sms_para,sizeof(T_MFW_SMS)); | |
555 | |
556 return FALSE; | |
557 } | |
558 /* initialisation of the handler */ | |
559 sms_para->emask = event; | |
560 sms_para->handler = cbfunc; | |
561 | |
562 hdr->data = sms_para; /* store parameter in node */ | |
563 hdr->type = MFW_TYP_SMS; /* store type of event handler */ | |
564 | |
565 /* installation of the handler */ | |
566 | |
567 insert_status = mfwInsert((T_MFW_HDR *)hWin, hdr);/*SPR 1968, inserted inadvertently deleted function call*/ | |
568 | |
569 if(!insert_status) | |
570 { | |
571 TRACE_ERROR("ERROR: sms_create() Failed to Install Handler. "); | |
572 mfwFree((U8*)hdr,sizeof(MfwHdr)); | |
573 mfwFree((U8*)sms_para,sizeof(T_MFW_SIM)); | |
574 return 0; | |
575 } | |
576 return insert_status; | |
577 } | |
578 | |
579 | |
580 /* | |
581 +--------------------------------------------------------------------+ | |
582 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
583 | STATE : code ROUTINE : sms_delete | | |
584 +--------------------------------------------------------------------+ | |
585 | |
586 PURPOSE : delete SMS control | |
587 | |
588 */ | |
589 | |
590 T_MFW_RES sms_delete(T_MFW_HND h) | |
591 { | |
592 TRACE_FUNCTION ("sms_delete()"); | |
593 | |
594 if (!h OR !((T_MFW_HDR *)h)->data) | |
595 return MFW_RES_ILL_HND; | |
596 | |
597 if (!mfwRemove((T_MFW_HDR *) h)) | |
598 return MFW_RES_ILL_HND; | |
599 | |
600 mfwFree((U8 *)(((T_MFW_HDR *) h)->data),sizeof(T_MFW_SMS)); | |
601 mfwFree((U8 *)h,sizeof(T_MFW_HDR)); | |
602 | |
603 return MFW_RES_OK; | |
604 } | |
605 | |
606 | |
607 /* | |
608 +--------------------------------------------------------------------+ | |
609 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
610 | STATE : code ROUTINE : sms_signal | | |
611 +--------------------------------------------------------------------+ | |
612 | |
613 PURPOSE : send a event. | |
614 | |
615 */ | |
616 | |
617 void sms_signal(T_MFW_EVENT event, void * para) | |
618 { | |
619 UBYTE temp = dspl_Enable(0); | |
620 TRACE_FUNCTION ("sms_signal()"); | |
621 if (mfwSignallingMethod EQ 0) | |
622 { | |
623 /* focus is on a window */ | |
624 if (mfwFocus) | |
625 /* send event to sim management handler if available */ | |
626 if (sms_sign_exec (mfwFocus, event, para)) | |
627 { | |
628 dspl_Enable(temp); | |
629 return; | |
630 } | |
631 | |
632 /* acutal focussed window is not available or has no | |
633 * network management registration handler, then search | |
634 * all nodes from the root. */ | |
635 if (mfwRoot) | |
636 sms_sign_exec (mfwRoot, event, para); | |
637 } | |
638 else | |
639 { | |
640 MfwHdr * h = 0; | |
641 | |
642 /* | |
643 * Focus set, then start here | |
644 */ | |
645 if (mfwFocus) | |
646 h = mfwFocus; | |
647 /* | |
648 * Focus not set, then start root | |
649 */ | |
650 if (!h) | |
651 h = mfwRoot; | |
652 | |
653 /* | |
654 * No elements available, return | |
655 */ | |
656 | |
657 while (h) | |
658 | |
659 | |
660 { | |
661 /* | |
662 * Signal consumed, then return | |
663 */ | |
664 if (sms_sign_exec (h, event, para)) | |
665 { | |
666 dspl_Enable(temp); | |
667 return; | |
668 } | |
669 | |
670 /* | |
671 * All windows tried inclusive root | |
672 */ | |
673 if (h == mfwRoot) | |
674 { | |
675 dspl_Enable(temp); | |
676 return; | |
677 } | |
678 | |
679 /* | |
680 * get parent window | |
681 */ | |
682 h = mfwParent(mfwParent(h)); | |
683 if(h) | |
684 h = ((MfwWin * )(h->data))->elems; | |
685 } | |
686 sms_sign_exec (mfwRoot, event, para); | |
687 } | |
688 dspl_Enable(temp); | |
689 return; | |
690 } | |
691 | |
692 | |
693 /* | |
694 +--------------------------------------------------------------------+ | |
695 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
696 | STATE : code ROUTINE : sms_sign_exec | | |
697 +--------------------------------------------------------------------+ | |
698 | |
699 PURPOSE : Send a signal if there is an SMS management handler. | |
700 | |
701 */ | |
702 | |
703 BOOL sms_sign_exec (T_MFW_HDR * cur_elem, | |
704 T_MFW_EVENT event, | |
705 T_MFW_SMS_PARA * para) | |
706 { | |
707 /***************************Go-lite Optimization changes Start***********************/ | |
708 //Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
709 TRACE_EVENT_P1("sms_sign_exec(): %d", event); | |
710 /***************************Go-lite Optimization changes end***********************/ | |
711 while (cur_elem) | |
712 { | |
713 /* event handler is available */ | |
714 if (cur_elem->type EQ MFW_TYP_SMS) | |
715 { | |
716 T_MFW_SMS * sms_data; | |
717 /* handler is SMS management handler */ | |
718 sms_data = (T_MFW_SMS *)cur_elem->data; | |
719 if (sms_data->emask & event) | |
720 { | |
721 /* event is expected by the call back function */ | |
722 sms_data->event = event; | |
723 switch (event) | |
724 { | |
725 case E_SMS_MO_AVAIL: | |
726 memcpy (&sms_data->para.index, para, sizeof (UBYTE)); | |
727 break; | |
728 case E_SMS_CMD_AVAIL: | |
729 memcpy (&sms_data->para.index, para, sizeof (UBYTE)); | |
730 break; | |
731 case E_SMS_SAVE_AVAIL: | |
732 memcpy (&sms_data->para.index, para, sizeof (UBYTE)); | |
733 break; | |
734 case E_SMS_MT: | |
735 memcpy (&sms_data->para.sms_mt, para, sizeof (T_MFW_SMS_MT)); | |
736 break; | |
737 case E_SMS_MO: | |
738 memcpy (&sms_data->para.sms_mo, para, sizeof (T_MFW_SMS_MO)); | |
739 break; | |
740 case E_SMS_CB: | |
741 memcpy (&sms_data->para.sms_cb, para, sizeof (T_MFW_SMS_CB)); | |
742 break; | |
743 case E_SMS_CB_RECEIVED: | |
744 memcpy (&sms_data->para.sms_id, para, sizeof (T_MFW_SMS_ID)); | |
745 break; | |
746 case E_SMS_MT_RECEIVED: | |
747 memcpy (&sms_data->para.sms_id, para, sizeof (T_MFW_SMS_ID)); | |
748 break; | |
749 case E_SMS_STATUS: | |
750 memcpy (&sms_data->para.sms_status, para, sizeof (T_MFW_SMS_STATUS)); | |
751 break; | |
752 case E_SMS_MEM: | |
753 memcpy (&sms_data->para.sms_mem, para, sizeof (T_MFW_SMS_MEM_INFO)); | |
754 break; | |
755 case E_SMS_OK: | |
756 /*SPR 2653, no need for conditional compilation round if, removing it*/ | |
757 // EF we only copy if non null | |
758 if (para != NULL) | |
759 memcpy (&sms_data->para.cmd_ind, para, sizeof (UBYTE)); | |
760 break; | |
761 case E_SMS_ERR: | |
762 memcpy (&sms_data->para.cmd_ind, para, sizeof (UBYTE)); | |
763 break; | |
764 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
765 /* SPR#2086 */ | |
766 case E_SMS_WAP_MT_RECEIVED: | |
767 memcpy (&sms_data->para.sms_mt, para, sizeof (T_MFW_SMS_MT)); | |
768 break; | |
769 case E_SMS_WAP_MO_SENT: | |
770 memcpy (&sms_data->para.index, para, sizeof (UBYTE)); | |
771 break; | |
772 case E_SMS_WAP_ERR: | |
773 memcpy (&sms_data->para.index, para, sizeof (UBYTE)); | |
774 break; | |
775 #endif | |
776 } | |
777 | |
778 /* if call back defined, call it */ | |
779 if (sms_data->handler) | |
780 { | |
781 // PATCH LE 06.06.00 | |
782 // store current mfw elem | |
783 current_mfw_elem = cur_elem; | |
784 // END PATCH LE 06.06.00 | |
785 if ((*(sms_data->handler)) (sms_data->event, (void *)&sms_data->para)) | |
786 { | |
787 TRACE_EVENT("send SMS event"); | |
788 return TRUE; | |
789 } | |
790 } | |
791 } | |
792 } | |
793 cur_elem = cur_elem->next; | |
794 } | |
795 | |
796 return FALSE; | |
797 } | |
798 | |
799 | |
800 /* | |
801 +-------------------------------------------------------------------+ | |
802 | PROJECT : GSM-PS (6147) MODULE : MFW_PHB | | |
803 | STATE : code ROUTINE : sms_read_msg_info | | |
804 +-------------------------------------------------------------------+ | |
805 | |
806 PURPOSE : This function is used to read total information about SMS. | |
807 */ | |
808 | |
809 void sms_read_msg_info() | |
810 { | |
811 int i; | |
812 | |
813 TRACE_FUNCTION("sms_read_msg_info()"); | |
814 | |
815 first_id = 1; | |
816 #ifdef FF_MMI_SMS_DYNAMIC | |
817 for (i=0; i<g_max_messages; i++) | |
818 #else | |
819 for (i=0; i<MAX_MESSAGES; i++) | |
820 #endif | |
821 { | |
822 msg_info[i].index = -1; | |
823 msg_info[i].addr.number[0] = '\0'; | |
824 msg_info[i].addr.tag[0] = '\0'; | |
825 msg_info[i].addr.ton = MFW_TON_UNKNOWN; | |
826 msg_info[i].addr.npi = MFW_NPI_UNKNOWN; | |
827 } | |
828 | |
829 f_update = MFW_SMS_NEW; | |
830 if (sAT_PlusCMGL (CMD_SRC_LCL, SMS_STAT_All, | |
831 #ifdef FF_2TO1_PS | |
832 0, MNSMS_READ_PREVIEW) NEQ AT_EXCT) | |
833 #else | |
834 0, READ_PREVIEW) NEQ AT_EXCT) | |
835 #endif | |
836 { | |
837 TRACE_EVENT("sAT_PlusCMGL error"); | |
838 f_update = MFW_SMS_FREE; | |
839 } | |
840 } | |
841 | |
842 | |
843 /* | |
844 +--------------------------------------------------------------------+ | |
845 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
846 | STATE : code ROUTINE : rAT_PlusCMGL | | |
847 +--------------------------------------------------------------------+ | |
848 | |
849 PURPOSE : Response of read SMS list from ACI | |
850 */ | |
851 | |
852 void rAT_PlusCMGL ( T_ACI_CMGL_SM * smLst ) | |
853 { | |
854 T_SMS_TYPE received_sms_type; | |
855 T_CONC_ASSEMBLY_RETURN concatenated_status; | |
856 T_SM_DATA_EXT conc_data_ext; | |
857 TRACE_FUNCTION ("rAT_PlusCMGL()"); | |
858 | |
859 received_sms_type = SMS_getSMSType( &smLst->udh); | |
860 TRACE_EVENT_P1("SMS Type is = %d", received_sms_type); | |
861 TRACE_EVENT_P1("SMS message status:%d", smLst->stat); | |
862 | |
863 if (received_sms_type == CONCATE) | |
864 { | |
865 if(initialising_flag == TRUE) | |
866 concatenated_status =concSMS_Collect(&conc_data_ext, smLst, FALSE); | |
867 else | |
868 concatenated_status =concSMS_Collect(&conc_data_ext, smLst, TRUE); | |
869 TRACE_EVENT_P2("conc status: %d, conc length: %d", concatenated_status, conc_data_ext.len); | |
870 | |
871 | |
872 | |
873 } | |
874 /*SPR 2260, removed condition, update_mem parameter should be true so that each message is counted*/ | |
875 sms_store_new_msg_info(smLst->msg_ref, smLst, TRUE/*MC SPR 2260*/, concatenated_status); | |
876 | |
877 | |
878 f_update = MFW_SMS_NEW; | |
879 { | |
880 TRACE_EVENT_P4("CMGL Msg table: %d,%d,%d, %d", msg_info[0].index, msg_info[1].index,msg_info[2].index,msg_info[3].index); | |
881 TRACE_EVENT_P4("CMGL Msg table: %d,%d,%d, %d", msg_info[4].index, msg_info[5].index,msg_info[6].index,msg_info[7].index); | |
882 } | |
883 } | |
884 | |
885 | |
886 /* | |
887 +--------------------------------------------------------------------+ | |
888 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
889 | STATE : code ROUTINE : sms_update_ready | | |
890 +--------------------------------------------------------------------+ | |
891 | |
892 PURPOSE : message list update is ready | |
893 */ | |
894 | |
895 void sms_update_ready(void) | |
896 { | |
897 TRACE_FUNCTION("sms_update_ready()"); | |
898 | |
899 sms_signal(E_SMS_MT_RECEIVED, &sms_id); | |
900 sms_id.index = 0; | |
901 | |
902 if (memory.used == memory.total) | |
903 sms_signal(E_SMS_MEM_FULL, 0); | |
904 } | |
905 | |
906 | |
907 /* | |
908 +--------------------------------------------------------------------+ | |
909 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
910 | STATE : code ROUTINE : sms_update_msg_info | | |
911 +--------------------------------------------------------------------+ | |
912 | |
913 PURPOSE : update the SMS information list | |
914 */ | |
915 | |
916 void sms_update_msg_info(T_MFW_SMS_STAT stat) | |
917 { | |
918 int i; | |
919 | |
920 TRACE_FUNCTION("sms_update_msg_info()"); | |
921 #ifdef FF_MMI_SMS_DYNAMIC | |
922 for (i=0; i<g_max_messages; i++) | |
923 #else | |
924 for (i=0; i<MAX_MESSAGES; i++) | |
925 #endif | |
926 { | |
927 if (msg_info[i].index EQ status_change_index) | |
928 { | |
929 msg_info[i].stat = stat; | |
930 } | |
931 } | |
932 | |
933 status_change_index = 0; | |
934 } | |
935 | |
936 | |
937 /* | |
938 +-------------------------------------------------------------------+ | |
939 | PROJECT : GSM-PS (6147) MODULE : MFW_PHB | | |
940 | STATE : code ROUTINE : sms_mem_cvt | | |
941 +-------------------------------------------------------------------+ | |
942 | |
943 PURPOSE : This function is used to convert the type of memory | |
944 used by MFW to the type of memory used by ACI. | |
945 */ | |
946 LOCAL T_ACI_SMS_STOR sms_mem_cvt(UBYTE mem) | |
947 { | |
948 switch ( mem ) | |
949 { | |
950 case ( MFW_MEM_ME ): return SMS_STOR_Me; | |
951 case ( MFW_MEM_SIM ): return SMS_STOR_Sm; | |
952 default: return SMS_STOR_NotPresent; | |
953 } | |
954 } | |
955 | |
956 | |
957 /* | |
958 +--------------------------------------------------------------------+ | |
959 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
960 | STATE : code ROUTINE : sms_set_mt_ind | | |
961 +--------------------------------------------------------------------+ | |
962 | |
963 PURPOSE : MMI selects, how the receiving of new messages | |
964 from the network is indicated. | |
965 | |
966 */ | |
967 | |
968 void sms_set_mt_ind(T_MFW_SMS_MT_IND mt_ind) | |
969 { | |
970 T_ACI_RETURN ret = AT_CMPL; | |
971 TRACE_FUNCTION("sms_set_mt_ind()"); | |
972 | |
973 switch (mt_ind) | |
974 { | |
975 case MT_IND_IDX: | |
976 TRACE_EVENT("MT_IND_IDX"); | |
977 ret = sAT_PlusCNMI ( CMD_SRC_LCL, | |
978 CNMI_MT_SmsDeliverInd, | |
979 CNMI_BM_NotPresent, | |
980 CNMI_DS_SmsStatRpt ); | |
981 break; | |
982 | |
983 case MT_IND_MSG: | |
984 TRACE_EVENT("MT_IND_MSG"); | |
985 ret = sAT_PlusCNMI ( CMD_SRC_LCL, | |
986 CNMI_MT_SmsDeliver, | |
987 CNMI_BM_NotPresent, | |
988 CNMI_DS_SmsStatRpt ); | |
989 break; | |
990 | |
991 case MT_IND_NO_IDX: | |
992 TRACE_EVENT("MT_IND_NO_IDX"); | |
993 ret = sAT_PlusCNMI ( CMD_SRC_LCL, | |
994 CNMI_MT_NoSmsDeliverInd, | |
995 CNMI_BM_NotPresent, | |
996 CNMI_DS_SmsStatRpt ); | |
997 break; | |
998 | |
999 case MT_CB_IDX: | |
1000 TRACE_EVENT("MT_CB_IDX"); | |
1001 ret = sAT_PlusCNMI ( CMD_SRC_LCL, | |
1002 CNMI_MT_NotPresent, | |
1003 CNMI_BM_CbmInd, | |
1004 CNMI_DS_NotPresent ); | |
1005 break; | |
1006 | |
1007 case MT_CB_MSG: | |
1008 TRACE_EVENT("MT_CB_MSG"); | |
1009 ret = sAT_PlusCNMI ( CMD_SRC_LCL, | |
1010 CNMI_MT_NotPresent, | |
1011 CNMI_BM_Cbm, | |
1012 CNMI_DS_NotPresent ); | |
1013 break; | |
1014 | |
1015 case MT_CB_NO_IDX: | |
1016 TRACE_EVENT("MT_CB_NO_IDX"); | |
1017 ret = sAT_PlusCNMI ( CMD_SRC_LCL, | |
1018 CNMI_MT_NotPresent, | |
1019 CNMI_BM_NoCbmInd, | |
1020 CNMI_DS_NotPresent ); | |
1021 break; | |
1022 | |
1023 /* Marcus: Issue 1170: 07/10/2002: Start */ | |
1024 case MT_IND_SRR_ON: | |
1025 TRACE_EVENT("MT_IND_SRR_ON"); | |
1026 ret = sAT_PlusCNMI ( CMD_SRC_LCL, | |
1027 CNMI_BM_NotPresent, | |
1028 CNMI_BM_NotPresent, | |
1029 CNMI_DS_SmsStatRpt ); | |
1030 break; | |
1031 | |
1032 case MT_IND_SRR_OFF: | |
1033 TRACE_EVENT("MT_IND_SRR_OFF"); | |
1034 ret = sAT_PlusCNMI ( CMD_SRC_LCL, | |
1035 CNMI_BM_NotPresent, | |
1036 CNMI_BM_NotPresent, | |
1037 CNMI_DS_NoSmsStatRpt ); | |
1038 break; | |
1039 /* Marcus: Issue 1170: 07/10/2002: End */ | |
1040 | |
1041 default: | |
1042 TRACE_EVENT_P1("default: mt_ind = %d", mt_ind); | |
1043 break; | |
1044 } | |
1045 | |
1046 if (ret != AT_CMPL) | |
1047 TRACE_EVENT_P1("sAT_PlusCNMI: %d", ret); | |
1048 } | |
1049 | |
1050 | |
1051 | |
1052 | |
1053 /* | |
1054 +-------------------------------------------------------------------------+ | |
1055 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
1056 | STATE : code ROUTINE : sms_change_read_status | | |
1057 +-------------------------------------------------------------------------+ | |
1058 | |
1059 PURPOSE : Change SMS status from MFW_SMS_UNREAD to MFW_SMS_READ | |
1060 | |
1061 GW-SPR#779-Modified code to abort if status has already been updated or if no match is found | |
1062 | |
1063 */ | |
1064 | |
1065 T_MFW sms_change_read_status(SHORT index) | |
1066 { | |
1067 SHORT i; | |
1068 //UBYTE fg; | |
1069 T_ACI_RETURN ret; | |
1070 TRACE_FUNCTION("sms_change_read_status()"); | |
1071 | |
1072 fg = 0; | |
1073 #ifdef FF_MMI_SMS_DYNAMIC | |
1074 for (i=0; i<g_max_messages; i++) | |
1075 #else | |
1076 for (i=0; i<MAX_MESSAGES; i++) | |
1077 #endif | |
1078 { | |
1079 if (msg_info[i].index == index) | |
1080 { | |
1081 if ((msg_info[i].stat == MFW_SMS_UNREAD) || | |
1082 (msg_info[i].stat == MFW_SMS_STOR_UNSENT)) | |
1083 { | |
1084 fg = 1; | |
1085 } | |
1086 else | |
1087 { | |
1088 /* status is not unread/unsent - no need to change it*/ | |
1089 return (1); | |
1090 } | |
1091 /* Stop search as soon as the index matches */ | |
1092 break; | |
1093 } | |
1094 } | |
1095 | |
1096 /* This change is no completely right, because the SIM will be always updated, | |
1097 but it makes possible that the read message doesn't come up as new every time | |
1098 that the mobile is switched on. | |
1099 GW - Replaced code that returns if no match is found | |
1100 */ | |
1101 | |
1102 if (!fg) | |
1103 { | |
1104 TRACE_EVENT("sms_change_read_status No index match-ERROR"); | |
1105 return 0; | |
1106 } | |
1107 | |
1108 sms_type = MFW_NO_MESSAGE;/* SPR 2260 Don't do anything scary in rAT_PlusCMGR callback func*/ | |
1109 /*CONQUEST 5991- MC- Changed third parameter in function call*/ | |
1110 ret = sAT_PlusCMGR(CMD_SRC_LCL, (UBYTE)index, SMS_READ_StatusChange); | |
1111 | |
1112 if (ret NEQ AT_CMPL AND ret NEQ AT_EXCT) | |
1113 { | |
1114 TRACE_EVENT("sms_change_read_status ERROR"); | |
1115 fg = 0; | |
1116 return 0; | |
1117 } | |
1118 /*CONQUEST 5991- MC- Added line to set current message to "read" status*/ | |
1119 if ( msg_info[i].stat == MFW_SMS_STOR_UNSENT) | |
1120 msg_info[i].stat = MFW_SMS_STOR_SENT; | |
1121 else | |
1122 msg_info[i].stat = MFW_SMS_READ;//MC | |
1123 status_change_index = index; | |
1124 return 1; | |
1125 } | |
1126 | |
1127 | |
1128 /* | |
1129 +--------------------------------------------------------------------+ | |
1130 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
1131 | STATE : code ROUTINE : sms_submit | | |
1132 +--------------------------------------------------------------------+ | |
1133 | |
1134 PURPOSE : Send a mobile originated short massage. | |
1135 | |
1136 GW 09/10/01 - Modified code to always copy entire (possible) message length | |
1137 */ | |
1138 | |
1139 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
1140 /* NM, 27.5.04 | |
1141 | |
1142 the sms_submit function with the parameters : addr_type and sca | |
1143 has been taken out as it does not send SMS ?! | |
1144 | |
1145 */ | |
1146 #endif | |
1147 | |
1148 #ifdef NO_ASCIIZ | |
1149 T_MFW sms_submit(T_MFW_SMS_MO_TYPE type, | |
1150 CHAR *dest_addr, | |
1151 UBYTE *msg, | |
1152 USHORT msg_len, | |
1153 CHAR *sca) | |
1154 #else | |
1155 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
1156 T_MFW sms_submit(T_MFW_SMS_MO_TYPE type, | |
1157 CHAR *dest_addr, | |
1158 T_MFW_PHB_TON addr_type, | |
1159 UBYTE *msg, | |
1160 USHORT msg_len, | |
1161 CHAR *sca, | |
1162 T_MFW_PHB_TON sc_type) | |
1163 #else | |
1164 T_MFW sms_submit(T_MFW_SMS_MO_TYPE type, | |
1165 CHAR *dest_addr, | |
1166 | |
1167 UBYTE *msg, | |
1168 USHORT msg_len, | |
1169 CHAR *sca) | |
1170 // sbh - added length to the above definition, since '@' characters stored as NULL & will stop | |
1171 // strlen from working properly. | |
1172 | |
1173 #endif | |
1174 #endif | |
1175 { | |
1176 | |
1177 T_SM_DATA_EXT conc_data_ext; | |
1178 | |
1179 SHORT rp; | |
1180 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
1181 T_ACI_TOA toa; | |
1182 T_ACI_TOA tosca; | |
1183 #endif | |
1184 | |
1185 TRACE_FUNCTION ("sms_submit()"); | |
1186 //March 2, 2005 REF: CRR 11536 x0018858 | |
1187 //Modified the condition for setting the reply path. | |
1188 if (reply_path_bit ==1) | |
1189 { | |
1190 rp = 1; /* reply path = 0 */ | |
1191 } | |
1192 else | |
1193 { | |
1194 rp = 0; /* reply path = default */ | |
1195 } | |
1196 | |
1197 | |
1198 conc_data_ext.len = msg_len; | |
1199 conc_data_ext.data = msg; | |
1200 | |
1201 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
1202 //NM toa.ton = phb_ncvtTon(addr_type); | |
1203 //NM toa.npi = NPI_IsdnTelephony; | |
1204 //NM tosca.ton = phb_ncvtTon(sc_type); | |
1205 //NM tosca.npi = NPI_IsdnTelephony; | |
1206 #endif | |
1207 | |
1208 if (sAT_PlusCMGS(CMD_SRC_LCL, dest_addr, NULL, &conc_data_ext, sca, NULL, rp) NEQ AT_EXCT) | |
1209 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
1210 //NM if (sAT_PlusCMGS(CMD_SRC_LCL, dest_addr, &toa, &conc_data_ext, sca, &tosca, rp) NEQ AT_EXCT) | |
1211 #endif | |
1212 return MFW_SMS_FAIL; | |
1213 | |
1214 | |
1215 flag = 0; | |
1216 return MFW_SMS_OK; | |
1217 } | |
1218 | |
1219 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
1220 | |
1221 | |
1222 /* | |
1223 +--------------------------------------------------------------------+ | |
1224 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
1225 | STATE : code ROUTINE : sms_submit | | |
1226 +--------------------------------------------------------------------+ | |
1227 | |
1228 PURPOSE : Send a mobile originated short message for WAP. | |
1229 - Sets a flag so that success or failure of send can be reported | |
1230 to MMI. | |
1231 */ | |
1232 T_MFW sms_submit_wap_sms(T_MFW_SMS_MO_TYPE type, | |
1233 CHAR *dest_addr, | |
1234 T_MFW_PHB_TON addr_type, | |
1235 UBYTE *msg, | |
1236 USHORT msg_len, | |
1237 CHAR *sca, | |
1238 T_MFW_PHB_TON sc_type) | |
1239 { | |
1240 TRACE_FUNCTION ("sms_submit_wap_sms()"); | |
1241 | |
1242 sms_wap_sent_flag = TRUE; | |
1243 | |
1244 /* NM, 27.5.04 | |
1245 | |
1246 the sms_submit function with the parameters : addr_type and sca | |
1247 has been taken out as it does not send SMS ?! | |
1248 | |
1249 */ | |
1250 | |
1251 //NM return sms_submit(type, dest_addr, addr_type, msg, msg_len, sca, sc_type); | |
1252 } | |
1253 | |
1254 #endif /* #if defined (FF_WAP) && defined (FF_GPF_TCPIP) */ | |
1255 | |
1256 /* | |
1257 +--------------------------------------------------------------------+ | |
1258 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
1259 | STATE : code ROUTINE : sms_stored_submit | | |
1260 +--------------------------------------------------------------------+ | |
1261 | |
1262 PURPOSE : Send a stored mobile originated short massage. | |
1263 | |
1264 */ | |
1265 | |
1266 T_MFW sms_stored_submit(CHAR *dest_addr, UBYTE index) | |
1267 { | |
1268 TRACE_FUNCTION ("sms_stored_submit()"); | |
1269 | |
1270 if (sAT_PlusCMSS(CMD_SRC_LCL, index, dest_addr, NULL) NEQ AT_EXCT) | |
1271 { | |
1272 return MFW_SMS_FAIL; | |
1273 } | |
1274 storage_index = index; | |
1275 | |
1276 return MFW_SMS_OK; | |
1277 } | |
1278 | |
1279 | |
1280 /* | |
1281 +--------------------------------------------------------------------+ | |
1282 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
1283 | STATE : code ROUTINE : rAT_PlusCMSS | | |
1284 +--------------------------------------------------------------------+ | |
1285 | |
1286 PURPOSE : Response of Send a stored mobile originated | |
1287 short massage. | |
1288 | |
1289 */ | |
1290 | |
1291 void rAT_PlusCMSS (UBYTE mr, UBYTE numSeg) | |
1292 { | |
1293 TRACE_FUNCTION ("rAT_PlusCMSS()"); | |
1294 | |
1295 sms_update_msg_info(MFW_SMS_STOR_SENT); | |
1296 sms_signal(E_SMS_MO_AVAIL, &mr); | |
1297 | |
1298 } | |
1299 | |
1300 | |
1301 /* | |
1302 +--------------------------------------------------------------------+ | |
1303 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
1304 | STATE : code ROUTINE : rAT_PlusCMT | | |
1305 +--------------------------------------------------------------------+ | |
1306 | |
1307 PURPOSE : Receive a new short message. | |
1308 | |
1309 */ | |
1310 | |
1311 void rAT_PlusCMT(T_ACI_CMGL_SM* sm) | |
1312 { T_SMS_TYPE received_sms_type; | |
1313 T_CONC_ASSEMBLY_RETURN concatenated_status; | |
1314 T_SM_DATA_EXT conc_data_ext; | |
1315 int i; | |
1316 TRACE_FUNCTION ("rAT_PlusCMT()"); | |
1317 | |
1318 TRACE_EVENT_P1("CMT, sm->data.len: %d", sm->data.len); | |
1319 | |
1320 | |
1321 received_sms_type = SMS_getSMSType( &sm->udh); | |
1322 | |
1323 if (received_sms_type == CONCATE) | |
1324 { | |
1325 concatenated_status =concSMS_Collect(&conc_data_ext, sm, FALSE); | |
1326 TRACE_EVENT_P2("conc status: %d, conc length: %d", concatenated_status, conc_data_ext.len); | |
1327 for(i=0;i<conc_data_ext.len;i++) | |
1328 { | |
1329 TRACE_EVENT_P2("%02x, %c", conc_data_ext.data[i],conc_data_ext.data[i]); | |
1330 } | |
1331 switch (concatenated_status) | |
1332 { | |
1333 case CONC_ERR_UNKN: | |
1334 TRACE_EVENT("Concatenated SMS error");break; | |
1335 case CONC_ERR_BUF_FULL: | |
1336 TRACE_EVENT("Concatented SMS buffer Full Error");break; | |
1337 case CONC_CONTINUED: //not last SMS | |
1338 TRACE_EVENT("Concatenated Continued!"); | |
1339 break; | |
1340 case CONC_COMPLETED: | |
1341 { | |
1342 TRACE_EVENT("COncatenation Completed!"); | |
1343 memset(&sms_mt, 0, sizeof(sms_mt)); | |
1344 | |
1345 #ifdef NO_ASCIIZ | |
1346 memcpy(sms_mt.orig_addr.tag, | |
1347 sm->alpha.data, | |
1348 sm->alpha.len); | |
1349 sms_mt.orig_addr.len = sm->alpha.len; | |
1350 #else | |
1351 phb_Alpha2Gsm(sm->alpha, (UBYTE *)sms_mt.orig_addr.tag); | |
1352 #endif | |
1353 strcpy(sms_mt.orig_addr.number, sm->adress); | |
1354 sms_mt.orig_addr.ton = | |
1355 phb_cvtTon(sm->toa.ton); | |
1356 sms_mt.orig_addr.npi = (T_MFW_PHB_NPI)phb_cvtNpi(sm->toa.npi); | |
1357 if (sm->tosca.ton == TON_International) | |
1358 sprintf(sms_mt.sc_addr, "+%s", sm->sca); | |
1359 else | |
1360 strcpy(sms_mt.sc_addr, sm->sca); | |
1361 sms_mt.prot_id = (UBYTE)sm->pid; | |
1362 sms_mt.dcs = (UBYTE)sm->dcs & 0xFC; /* Ignore message class */ | |
1363 | |
1364 sms_mt.rp = sm->fo >> 7 & 1; | |
1365 | |
1366 /* SBH */ | |
1367 if (sm->dcs & 0x10) /* Bit 5 indicates that we should get message class from bits 0 & 1 */ | |
1368 { | |
1369 sms_mt.ti = sm->dcs & 3; | |
1370 } | |
1371 else /* Otherwise, set to default value */ | |
1372 { | |
1373 sms_mt.ti = 1; | |
1374 } | |
1375 TRACE_EVENT_P2("dcs: %d, ti: %d", sms_mt.dcs, sms_mt.ti); | |
1376 /* SBH end */ | |
1377 | |
1378 memcpy((char *)sms_mt.sctp.year, (char *)sm->scts.year, MAX_SCTP_DIGITS); | |
1379 memcpy((char *)sms_mt.sctp.month, (char *)sm->scts.month, MAX_SCTP_DIGITS); | |
1380 memcpy((char *)sms_mt.sctp.day, (char *)sm->scts.day, MAX_SCTP_DIGITS); | |
1381 memcpy((char *)sms_mt.sctp.hour, (char *)sm->scts.hour, MAX_SCTP_DIGITS); | |
1382 memcpy((char *)sms_mt.sctp.minute, (char *)sm->scts.minute, MAX_SCTP_DIGITS); | |
1383 memcpy((char *)sms_mt.sctp.second, (char *)sm->scts.second, MAX_SCTP_DIGITS); | |
1384 sms_mt.sctp.timezone = sm->scts.timezone; | |
1385 | |
1386 /* copy length of whole concat SMS*/ | |
1387 sms_mt.msg_len = conc_data_ext.len; | |
1388 memset(sms_mt.sms_msg, 0, sm->data.len); | |
1389 /*copy all data from concat SMS*/ | |
1390 memcpy(sms_mt.sms_msg, (char*)conc_data_ext.data, conc_data_ext.len); | |
1391 sms_mt.udh_len = sm->udh.len; | |
1392 memcpy((char *)sms_mt.udh, (char *)sm->udh.data, sm->udh.len); | |
1393 | |
1394 /*SPR#1408 - DS - Now done at end of function | |
1395 *sms_signal(E_SMS_MT, &sms_mt); | |
1396 */ | |
1397 | |
1398 } | |
1399 | |
1400 } | |
1401 } | |
1402 else | |
1403 { | |
1404 | |
1405 | |
1406 memset(&sms_mt, 0, sizeof(sms_mt)); | |
1407 | |
1408 #ifdef NO_ASCIIZ | |
1409 memcpy(sms_mt.orig_addr.tag, | |
1410 sm->alpha.data, | |
1411 sm->alpha.len); | |
1412 sms_mt.orig_addr.len = sm->alpha.len; | |
1413 #else | |
1414 phb_Alpha2Gsm(sm->alpha, (UBYTE *)sms_mt.orig_addr.tag); | |
1415 #endif | |
1416 strcpy(sms_mt.orig_addr.number, sm->adress); | |
1417 sms_mt.orig_addr.ton = | |
1418 phb_cvtTon(sm->toa.ton); | |
1419 sms_mt.orig_addr.npi = (T_MFW_PHB_NPI)phb_cvtNpi(sm->toa.npi); | |
1420 if (sm->tosca.ton == TON_International) | |
1421 sprintf(sms_mt.sc_addr, "+%s", sm->sca); | |
1422 else | |
1423 strcpy(sms_mt.sc_addr, sm->sca); | |
1424 sms_mt.prot_id = (UBYTE)sm->pid; | |
1425 sms_mt.dcs = (UBYTE)sm->dcs & 0xFC; /* Ignore message class */ | |
1426 sms_mt.rp = sm->fo >> 7 & 1; | |
1427 /* PATCH JPS 04.10 END */ | |
1428 | |
1429 /* SBH */ | |
1430 if (sm->dcs & 0x10) /* Bit 5 indicates that we should get message class from bits 0 & 1 */ | |
1431 { | |
1432 sms_mt.ti = sm->dcs & 3; | |
1433 } | |
1434 else /* Otherwise, set to default value */ | |
1435 { | |
1436 sms_mt.ti = 1; | |
1437 } | |
1438 TRACE_EVENT_P2("dcs: %d, ti: %d", sms_mt.dcs, sms_mt.ti); | |
1439 /* SBH end */ | |
1440 | |
1441 memcpy((char *)sms_mt.sctp.year, (char *)sm->scts.year, MAX_SCTP_DIGITS); | |
1442 memcpy((char *)sms_mt.sctp.month, (char *)sm->scts.month, MAX_SCTP_DIGITS); | |
1443 memcpy((char *)sms_mt.sctp.day, (char *)sm->scts.day, MAX_SCTP_DIGITS); | |
1444 memcpy((char *)sms_mt.sctp.hour, (char *)sm->scts.hour, MAX_SCTP_DIGITS); | |
1445 memcpy((char *)sms_mt.sctp.minute, (char *)sm->scts.minute, MAX_SCTP_DIGITS); | |
1446 memcpy((char *)sms_mt.sctp.second, (char *)sm->scts.second, MAX_SCTP_DIGITS); | |
1447 sms_mt.sctp.timezone = sm->scts.timezone; | |
1448 | |
1449 sms_mt.msg_len = sm->data.len; | |
1450 memcpy(sms_mt.sms_msg, (char *)sm->data.data, sm->data.len); | |
1451 sms_mt.udh_len = sm->udh.len; | |
1452 memcpy((char *)sms_mt.udh, (char *)sm->udh.data, sm->udh.len); | |
1453 | |
1454 /*SPR#1408 - DS - Now done at end of function | |
1455 *sms_signal(E_SMS_MT, &sms_mt); | |
1456 */ | |
1457 } | |
1458 | |
1459 /*MC SPR 1364, need to call this function to update CPHS voicemail data*/ | |
1460 /*SPR#1408 - DS - Modified to store voicemail status in SMS structure. Port of 1669 */ | |
1461 if (sms_check_voice_mail(sm->pid, sm->dcs, sm->adress, | |
1462 &sm->toa, &sm->udh) == MFW_SMS_VOICE) | |
1463 { | |
1464 sms_mt.voicemail = TRUE; | |
1465 TRACE_EVENT("MT SMS is a voicemail message"); | |
1466 } | |
1467 else | |
1468 { | |
1469 sms_mt.voicemail = FALSE; | |
1470 } | |
1471 sms_signal(E_SMS_MT, &sms_mt); | |
1472 | |
1473 } | |
1474 | |
1475 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
1476 #define SMS_PUSH_PDU_OFFSET 1 | |
1477 #define PUSH_METHOD_PDU 0x06 | |
1478 | |
1479 static UBYTE *MMS_pdu=NULL; | |
1480 static UBYTE id_no,seq_no; | |
1481 static int pdu_len; | |
1482 | |
1483 void redirectMMSNotification(T_ACI_CMGL_SM * sm) | |
1484 { | |
1485 int header_len; | |
1486 char buf[80]; | |
1487 int idx; | |
1488 | |
1489 TRACE_FUNCTION ("redirectMMSNotification()"); | |
1490 | |
1491 if(MMS_pdu) | |
1492 { | |
1493 if(id_no!=sm->udh.data[8] || sm->udh.data[10]!=2) /*had lost packet*/ | |
1494 { | |
1495 TRACE_EVENT("-----MMS_pdu something------"); | |
1496 mfwFree(MMS_pdu,MAX_SM_LEN<<1); | |
1497 MMS_pdu=NULL; | |
1498 } | |
1499 else | |
1500 { | |
1501 memcpy(MMS_pdu+pdu_len, sm->data.data, sm->data.len); | |
1502 | |
1503 TRACE_EVENT("Second SMS been recorded"); | |
1504 TRACE_EVENT_P3("bgein=%x,end=%x,len=%d",MMS_pdu[pdu_len],MMS_pdu[pdu_len+sm->data.len-1],sm->data.len); | |
1505 | |
1506 pdu_len+=(sm->data.len); | |
1507 | |
1508 /*deliver PDU to WAP*/ | |
1509 TRACE_EVENT("Deliver PDU to WAP"); | |
1510 | |
1511 /* MWSmsNotification.data=MMS_pdu; | |
1512 MWSmsNotification.data_length=pdu_len; | |
1513 M_MMS_WAP_SMS_NOTIFICATION_IND(&MWSmsNotification); | |
1514 */ | |
1515 //WMPush.data=MMS_pdu; | |
1516 //WMPush.data_length=pdu_len; | |
1517 //WMPush.is_sms_bearer=TRUE; | |
1518 //M_WAP_MMS_PUSH_IND(&WMPush); | |
1519 | |
1520 ////////////////////////////////////////////////////////////////// | |
1521 ////////////////////////////////////////////////////////////////// | |
1522 | |
1523 mfwFree(MMS_pdu,MAX_SM_LEN<<1); | |
1524 MMS_pdu=NULL; | |
1525 return; | |
1526 } | |
1527 } | |
1528 | |
1529 id_no=sm->udh.data[8]; | |
1530 seq_no=sm->udh.data[10]; | |
1531 | |
1532 if(seq_no!=1){ | |
1533 return; | |
1534 } | |
1535 | |
1536 /*identify pdu*/ | |
1537 if(sm->data.data[SMS_PUSH_PDU_OFFSET]!=PUSH_METHOD_PDU){ | |
1538 return; | |
1539 } | |
1540 | |
1541 if(!(MMS_pdu=mfwAlloc(MAX_SM_LEN<<1))) | |
1542 return; | |
1543 | |
1544 header_len=sm->data.data[SMS_PUSH_PDU_OFFSET+1]; | |
1545 | |
1546 pdu_len=sm->data.len-(header_len+1)-(SMS_PUSH_PDU_OFFSET+1); | |
1547 memcpy(MMS_pdu,sm->data.data+SMS_PUSH_PDU_OFFSET+2+header_len,pdu_len); | |
1548 | |
1549 TRACE_EVENT("First SMS been recorded"); | |
1550 TRACE_EVENT_P3("bgein=%x,end=%x,len=%d",MMS_pdu[0],MMS_pdu[pdu_len-1],pdu_len); | |
1551 } | |
1552 | |
1553 | |
1554 #endif /* #if defined (FF_WAP) && defined (FF_GPF_TCPIP) */ | |
1555 /* | |
1556 +--------------------------------------------------------------------+ | |
1557 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
1558 | STATE : code ROUTINE : rAT_PlusCMTI | | |
1559 +--------------------------------------------------------------------+ | |
1560 | |
1561 PURPOSE : Receive a new short message identifier. | |
1562 | |
1563 */ | |
1564 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
1565 #else | |
1566 void rAT_PlusCMTI(T_ACI_SMS_STOR mem, UBYTE index, T_ACI_CMGL_SM* sm) | |
1567 { | |
1568 /* MZ 2260 Handset displays Message Full on receiving an SMS. */ | |
1569 //T_MFW_MEM_INFO memory; | |
1570 #ifndef MMI_LITE | |
1571 // T_ACI_RETURN ret; // RAVI | |
1572 // int i, j; // RAVI | |
1573 #endif | |
1574 T_SMS_TYPE received_sms_type; | |
1575 T_CONC_ASSEMBLY_RETURN concatenated_status; | |
1576 T_SM_DATA_EXT conc_data_ext; | |
1577 | |
1578 if (initialising_flag == FALSE) | |
1579 { | |
1580 /* Ignore CMTI if initialising */ | |
1581 | |
1582 | |
1583 TRACE_FUNCTION ("rAT_PlusCMTI()"); | |
1584 TRACE_EVENT_P1("f_update is = % in CMTI", f_update); | |
1585 | |
1586 received_sms_type = SMS_getSMSType( &sm->udh); | |
1587 TRACE_EVENT_P1("SMS Type is = %d", received_sms_type); | |
1588 TRACE_EVENT_P2("msg_ref: %d, index: %d", sm->msg_ref, index); | |
1589 | |
1590 | |
1591 if (received_sms_type == CONCATE) | |
1592 { | |
1593 if(initialising_flag == TRUE) | |
1594 concatenated_status =concSMS_Collect(&conc_data_ext, sm, FALSE); | |
1595 else | |
1596 concatenated_status =concSMS_Collect(&conc_data_ext, sm, TRUE); | |
1597 TRACE_EVENT_P2("conc status: %d, conc length: %d", concatenated_status, conc_data_ext.len); | |
1598 | |
1599 | |
1600 | |
1601 } | |
1602 // July 7, 2005 REF: CRR MMI-SPR-32179 x0018858 | |
1603 // Added a check to free the variable only when CONC_COMPLETED status is encountered. | |
1604 if (concatenated_status EQ CONC_COMPLETED) | |
1605 { | |
1606 if(conc_data_ext.data != NULL) | |
1607 { | |
1608 MFREE(conc_data_ext.data); | |
1609 } | |
1610 } | |
1611 | |
1612 | |
1613 sms_store_new_msg_info(index,sm,TRUE, concatenated_status); | |
1614 | |
1615 if (f_update EQ MFW_SMS_UPDATE OR | |
1616 coll_sms_send EQ MFW_SMS_WAIT OR | |
1617 coll_sms_read EQ MFW_SMS_WAIT OR | |
1618 coll_sms_delete EQ MFW_SMS_WAIT OR | |
1619 coll_sms_req EQ MFW_SMS_WAIT) | |
1620 { | |
1621 if (sms_id_wait.index <= 0) | |
1622 { | |
1623 sms_id_wait.index = index; | |
1624 sms_id_wait.mem = (mem EQ SMS_STOR_Me)? MFW_MEM_ME: MFW_MEM_SIM; | |
1625 sms_id_wait.concat_status = concatenated_status; | |
1626 sms_id_wait.received_sms_type = received_sms_type; | |
1627 } | |
1628 else | |
1629 { | |
1630 TRACE_EVENT("Indication Overrun"); | |
1631 } | |
1632 f_update = MFW_SMS_UPDATE; | |
1633 } | |
1634 else | |
1635 { | |
1636 sms_send_new_msg_ind(sm,index, mem, received_sms_type, concatenated_status); | |
1637 } | |
1638 f_update = MFW_SMS_FREE; | |
1639 if(memory.total == memory.used) | |
1640 { | |
1641 TRACE_EVENT_P2("memory used is = %d, of %d", memory.used, memory.total); | |
1642 sms_signal(E_SMS_MEM_FULL, NULL); | |
1643 } | |
1644 } | |
1645 if(msg_info != NULL) | |
1646 { | |
1647 TRACE_EVENT_P4("CMTI Msg table: %d,%d,%d, %d", msg_info[0].index, msg_info[1].index,msg_info[2].index,msg_info[3].index); | |
1648 TRACE_EVENT_P4("CMTI Msg table: %d,%d,%d, %d", msg_info[4].index, msg_info[5].index,msg_info[6].index,msg_info[7].index); | |
1649 } | |
1650 /*MC SPR 1364, need to call this function to update CPHS voicemail data*/ | |
1651 sms_check_voice_mail(sm->pid, sm->dcs, sm->adress, | |
1652 &sm->toa, &sm->udh); | |
1653 /*SPR 2260, this is already called in sms_store_new_msg_info, BUT we need it in for initialisation*/ | |
1654 } | |
1655 #endif | |
1656 | |
1657 | |
1658 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
1659 //TISHMMS Project | |
1660 /* | |
1661 use UDH data to caculate destinator port and originator port id if any | |
1662 If not port id, the out put id will be 0 | |
1663 */ | |
1664 void sms_getPortId(UBYTE* data, UBYTE length, USHORT * destinatorPort, USHORT *originatorPort) | |
1665 { | |
1666 UBYTE ucOffset = 0; | |
1667 USHORT usTempOffset; | |
1668 UBYTE i; | |
1669 | |
1670 *destinatorPort = 0; | |
1671 *originatorPort = 0; | |
1672 | |
1673 if (length == 0) | |
1674 { | |
1675 return; | |
1676 } | |
1677 | |
1678 for (i = 0 ; i < 47; i++)//140/3=47 | |
1679 { | |
1680 /*3GPP protocal 23040 clause 9.2.3.24*/ | |
1681 //0x05 the IE is port id, length should be 4 | |
1682 if ((data[ucOffset] == 0x05) && (data[ucOffset + 1] == 4)) | |
1683 { | |
1684 *destinatorPort = data[ucOffset + 3] + data[ucOffset + 2]*0x100; | |
1685 *originatorPort = data[ucOffset + 5] + data[ucOffset + 4]*0x100; | |
1686 //do not return here because the last is the valid one | |
1687 } | |
1688 else | |
1689 { | |
1690 usTempOffset = ucOffset + data[ucOffset + 1] + 2; | |
1691 | |
1692 //port information 6 bytes | |
1693 if (((usTempOffset + 6) > MAX_SM_LEN) ||((usTempOffset + 6) > length)) | |
1694 { | |
1695 break; | |
1696 } | |
1697 | |
1698 ucOffset = usTempOffset; | |
1699 } | |
1700 } | |
1701 | |
1702 return; | |
1703 } | |
1704 | |
1705 | |
1706 /* | |
1707 Search in UDH data to see if it is a EMS SMS | |
1708 */ | |
1709 BOOL sms_is_ems_type(UBYTE* UdhData, UBYTE UdhLength) | |
1710 { | |
1711 BOOL Ret = FALSE; | |
1712 UBYTE ucOffset = 0; | |
1713 USHORT usTempOffset; | |
1714 | |
1715 UBYTE i; | |
1716 | |
1717 if (UdhLength == 0) | |
1718 { | |
1719 return Ret; | |
1720 } | |
1721 | |
1722 for (i = 0 ; i < 47; i++) | |
1723 { | |
1724 /*3GPP protocal 23040 clause 9.2.3.24*/ | |
1725 if ( (UdhData[ucOffset] >= 0X0A) && (UdhData[ucOffset] <= 0X1F) ) | |
1726 { | |
1727 if ( (UdhData[ucOffset] >= 0X1B) && (UdhData[ucOffset] <= 0X1F) ) | |
1728 { | |
1729 //xmzhou_trace_string_value("sms_is_ems_type Reserved for future EMS features: ", UdhData[ucOffset]); | |
1730 } | |
1731 | |
1732 Ret = TRUE; | |
1733 break; | |
1734 } | |
1735 else | |
1736 { | |
1737 usTempOffset = ucOffset + UdhData[ucOffset + 1] + 2; | |
1738 | |
1739 if ((usTempOffset >= MAX_SM_LEN) ||(usTempOffset >= UdhLength)) | |
1740 { | |
1741 break; | |
1742 } | |
1743 | |
1744 ucOffset = usTempOffset; | |
1745 } | |
1746 } | |
1747 | |
1748 return Ret; | |
1749 } | |
1750 | |
1751 //TISHMMS Project | |
1752 T_MNSMS_MESSAGE_IND gTpduData; | |
1753 void rAT_PlusCMTPdu (T_MNSMS_MESSAGE_IND* pTpdu) | |
1754 { | |
1755 //xmzhou_trace_string("rAT_PlusCMTPdu called"); | |
1756 memcpy(&gTpduData, pTpdu, sizeof(T_MNSMS_MESSAGE_IND)); | |
1757 return; | |
1758 } | |
1759 | |
1760 | |
1761 | |
1762 #if defined (FF_MMI_MMS) || defined (FF_MMI_EMS) | |
1763 EXTERN void sms_save_to_m4(U8* pSmsPud); | |
1764 #endif | |
1765 | |
1766 BOOL sms_save_to_m4_in_Mfw( T_MNSMS_MESSAGE_IND *mnsms_message_ind ) | |
1767 { | |
1768 T_sms_sdu * sms_sdu = &mnsms_message_ind->sms_sdu; | |
1769 U8 align_pdu[SIM_PDU_LEN]; | |
1770 U8* pSmsPud; | |
1771 U8 *pAligned = align_pdu; | |
1772 U8 *pData = sms_sdu->buf; | |
1773 U8 offset; | |
1774 U16 i; | |
1775 U16 ByteLength; | |
1776 #if 0 | |
1777 /* First align data on byte boundry */ | |
1778 pData += sms_sdu->o_buf / EIGHT_BITS; | |
1779 offset = sms_sdu->o_buf % EIGHT_BITS; | |
1780 | |
1781 | |
1782 | |
1783 if (offset) | |
1784 { | |
1785 for ( i=0; i < sms_sdu->l_buf; i += EIGHT_BITS) | |
1786 { | |
1787 *pAligned = *pData++ << offset; | |
1788 *pAligned++ |= *pData >> (EIGHT_BITS - offset); | |
1789 } | |
1790 /* Point back to the start of the data */ | |
1791 pAligned = align_pdu; | |
1792 } | |
1793 else | |
1794 pAligned = pData; | |
1795 #endif | |
1796 pSmsPud = sms_sdu->buf; | |
1797 if ((sms_sdu->l_buf & 0x07) == 0) | |
1798 { | |
1799 ByteLength = sms_sdu->l_buf/8; | |
1800 } | |
1801 else | |
1802 { | |
1803 ByteLength = (sms_sdu->l_buf/8) + 1; | |
1804 } | |
1805 | |
1806 //NM sms_save_tpdu_ffs(pSmsPud, ByteLength); | |
1807 | |
1808 #if defined (FF_MMI_MMS) || defined (FF_MMI_EMS) | |
1809 sms_save_to_m4(pSmsPud); | |
1810 #endif | |
1811 | |
1812 return TRUE; | |
1813 } | |
1814 | |
1815 | |
1816 | |
1817 /* | |
1818 +--------------------------------------------------------------------+ | |
1819 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
1820 | STATE : code ROUTINE : rAT_PlusCMTI | | |
1821 +--------------------------------------------------------------------+ | |
1822 | |
1823 PURPOSE : Receive a new short message identifier. | |
1824 | |
1825 */ | |
1826 | |
1827 void rAT_PlusCMTI(T_ACI_SMS_STOR mem, UBYTE index, T_ACI_CMGL_SM* sm) | |
1828 { | |
1829 /* MZ 2007 Handset displays Message Full on receiving an SMS. */ | |
1830 //T_MFW_MEM_INFO memory; | |
1831 T_ACI_RETURN ret; | |
1832 T_SMS_TYPE received_sms_type; | |
1833 T_CONC_ASSEMBLY_RETURN concatenated_status; | |
1834 T_SM_DATA_EXT conc_data_ext; | |
1835 int i, j; | |
1836 static int fileid=0; | |
1837 | |
1838 if (initialising_flag == FALSE) | |
1839 { | |
1840 /* Ignore CMTI if initialising */ | |
1841 | |
1842 | |
1843 TRACE_FUNCTION ("rAT_PlusCMTI()"); | |
1844 | |
1845 #if 0 | |
1846 /////////////////////////////////////////////////////////added by ellen | |
1847 { | |
1848 char temp[120]; | |
1849 char* temp2; | |
1850 int i,i_sum=0; | |
1851 | |
1852 TRACE_EVENT("=== SMS Received ==="); | |
1853 TRACE_EVENT_P2("fo %02X, msg_ref %02X",sm->fo, sm->msg_ref); | |
1854 sprintf(temp," %d bytes of UDH", sm->udh.len); | |
1855 TRACE_EVENT(temp); | |
1856 | |
1857 | |
1858 temp2 = (char*)temp; | |
1859 sprintf(temp2,"udh "); | |
1860 temp2+=4; | |
1861 | |
1862 for(i=0; i<sm->udh.len; i++) | |
1863 { | |
1864 sprintf(temp2,"%02X ",sm->udh.data[i]); | |
1865 temp2+=3; | |
1866 i_sum ++; | |
1867 if(i_sum > 30) break; | |
1868 | |
1869 } | |
1870 TRACE_EVENT(temp); | |
1871 | |
1872 sprintf(temp," %d bytes of DATA", sm->data.len); | |
1873 TRACE_EVENT(temp); | |
1874 | |
1875 | |
1876 temp2 = (char*)temp; | |
1877 sprintf(temp2,"data "); | |
1878 temp2+=5; | |
1879 | |
1880 for(i=0; i<sm->data.len; i++) | |
1881 { | |
1882 sprintf(temp2,"%02X ",sm->data.data[i]); | |
1883 temp2+=3; | |
1884 i_sum ++; | |
1885 if(i_sum > 30) break; | |
1886 | |
1887 } | |
1888 TRACE_EVENT(temp); | |
1889 | |
1890 } | |
1891 ///////////////////////////////////////////////////////// | |
1892 #endif | |
1893 | |
1894 /* SPR#2086 - SH - Intercept a WAP SMS *///TISHMMS Project | |
1895 { | |
1896 | |
1897 USHORT destinatorPort; | |
1898 USHORT originatorPort; | |
1899 | |
1900 sms_getPortId(sm->udh.data, sm->udh.len, &destinatorPort, &originatorPort); | |
1901 | |
1902 //xmzhou_trace_string_value("New Msg arrived,desti port=",destinatorPort); | |
1903 //xmzhou_trace_string_value("New Msg arrived,orig port=",originatorPort); | |
1904 | |
1905 //xmzhou_trace_string_value("CMTI new msg udh length=",sm->udh.len); | |
1906 //xmzhou_trace_n_bytes(sm->udh.data,sm->udh.len); | |
1907 | |
1908 TRACE_EVENT_P2("+++++ In rAT_PlusCMTI ready to judge PUSH or not DestP=%d,OrgP=%d +++++",destinatorPort,originatorPort); | |
1909 if (destinatorPort==2948 | |
1910 || destinatorPort==2949 | |
1911 || destinatorPort==49999 /*OTA Provisioning*/ | |
1912 || destinatorPort==49996 /*OTA SyncML*/ | |
1913 || originatorPort==9200 | |
1914 || originatorPort==9201 | |
1915 || originatorPort==9202 | |
1916 || originatorPort==9203) | |
1917 | |
1918 { | |
1919 USHORT index_i; | |
1920 | |
1921 //xmzhou_trace_string_value("CMTI new msg data length=",sm->data.len); | |
1922 //xmzhou_trace_string("WAP SMS be identified!!!!!!!"); | |
1923 //xmzhou_trace_n_bytes(sm->data.data,sm->data.len); | |
1924 #if 0 | |
1925 fileid++; | |
1926 | |
1927 if(fileid==1){ | |
1928 xmzhou_trace_string_value("CMTI new msg data1 length=",sm->data.len); | |
1929 if((sm->data.len)<2048) ffs_fwrite("/mms/data1", sm->data.data, sm->data.len); | |
1930 | |
1931 rvf_delay(500); | |
1932 | |
1933 xmzhou_trace_string_value("CMTI new msg udh1 length=",sm->udh.len); | |
1934 if((sm->udh.len)<2048) ffs_fwrite("/mms/udh1", sm->udh.data, sm->udh.len); | |
1935 | |
1936 } | |
1937 | |
1938 if(fileid==2){ | |
1939 xmzhou_trace_string_value("CMTI new msg data2 length=",sm->data.len); | |
1940 if((sm->data.len)<2048) ffs_fwrite("/mms/data2", sm->data.data, sm->data.len); | |
1941 | |
1942 rvf_delay(500); | |
1943 | |
1944 xmzhou_trace_string_value("CMTI new msg udh2 length=",sm->udh.len); | |
1945 if((sm->udh.len)<2048) ffs_fwrite("/mms/udh2", sm->udh.data, sm->udh.len); | |
1946 } | |
1947 | |
1948 rvf_delay(1000); | |
1949 #endif | |
1950 sms_msg_delete(index); | |
1951 #if 0 | |
1952 ////////////////////////////////////////////////////////////////////////////////// | |
1953 TRACE_EVENT("MMS Notification"); | |
1954 if(sm->udh.len > 8){ | |
1955 redirectMMSNotification(sm); | |
1956 } | |
1957 else { | |
1958 ///////////////////////////////////////////////////////////////////////////////// | |
1959 #endif | |
1960 memset(&sms_mt, 0, sizeof(sms_mt)); | |
1961 | |
1962 for (index_i=0; index_i<12; index_i++) | |
1963 { | |
1964 TRACE_EVENT_P2("Adress: %X (%c)", sm->adress[index_i], sm->adress[index_i]); | |
1965 } | |
1966 | |
1967 memcpy(sms_mt.orig_addr.tag, sm->alpha.data, sm->alpha.len); | |
1968 sms_mt.orig_addr.len = sm->alpha.len; | |
1969 strcpy(sms_mt.orig_addr.number, sm->adress); | |
1970 sms_mt.orig_addr.ton = phb_cvtTon(sm->toa.ton); | |
1971 sms_mt.orig_addr.npi = phb_cvtNpi(sm->toa.npi); | |
1972 if (sm->tosca.ton == TON_International) | |
1973 sprintf(sms_mt.sc_addr, "+%s", sm->sca); | |
1974 else | |
1975 strcpy(sms_mt.sc_addr, sm->sca); | |
1976 sms_mt.prot_id = (UBYTE)sm->pid; | |
1977 sms_mt.dcs = (UBYTE)sm->dcs & 0xFC; /* Ignore message class */ | |
1978 sms_mt.msg_len = sm->data.len; | |
1979 memset(sms_mt.sms_msg, 0, sm->data.len); | |
1980 memcpy(sms_mt.sms_msg, (char*)sm->data.data, sm->data.len); | |
1981 sms_mt.udh_len = sm->udh.len; | |
1982 | |
1983 memcpy((char *)sms_mt.udh, (char *)sm->udh.data, sm->udh.len); | |
1984 | |
1985 //xrashmic 9 May, 2005 MMI-SPR-30159 | |
1986 memcpy(&sms_mt.sctp,&sm->scts,sizeof(T_ACI_VP_ABS)); | |
1987 | |
1988 sms_signal(E_SMS_WAP_MT_RECEIVED, &sms_mt); | |
1989 | |
1990 /* Delete the message */ | |
1991 | |
1992 return; | |
1993 #if 0 | |
1994 }/*end of else*/ | |
1995 #endif | |
1996 } | |
1997 } | |
1998 | |
1999 { | |
2000 //BOOL sms_is_ems_type(UBYTE* UdhData, UBYTE UdhLength) | |
2001 BOOL bIsEms = FALSE; | |
2002 | |
2003 bIsEms = sms_is_ems_type(sm->udh.data, sm->udh.len); | |
2004 | |
2005 if (bIsEms == TRUE) | |
2006 { | |
2007 //xmzhou_trace_string("EMS SMS received!!!!!!!!!!!!");//proc EMS message | |
2008 sms_msg_delete(index); | |
2009 sms_save_to_m4_in_Mfw( &gTpduData ); | |
2010 } | |
2011 | |
2012 | |
2013 } | |
2014 | |
2015 TRACE_EVENT_P1("f_update is = % in CMTI", f_update); | |
2016 | |
2017 received_sms_type = SMS_getSMSType( &sm->udh); | |
2018 TRACE_EVENT_P1("SMS Type is = %d", received_sms_type); | |
2019 TRACE_EVENT_P2("msg_ref: %d, index: %d", sm->msg_ref, index); | |
2020 | |
2021 | |
2022 if (received_sms_type == CONCATE) | |
2023 { | |
2024 if(initialising_flag == TRUE) | |
2025 concatenated_status =concSMS_Collect(&conc_data_ext, sm, FALSE); | |
2026 else | |
2027 concatenated_status =concSMS_Collect(&conc_data_ext, sm, TRUE); | |
2028 TRACE_EVENT_P2("conc status: %d, conc length: %d", concatenated_status, conc_data_ext.len); | |
2029 | |
2030 | |
2031 | |
2032 } | |
2033 | |
2034 sms_store_new_msg_info(index,sm,TRUE, concatenated_status); | |
2035 | |
2036 if (f_update EQ MFW_SMS_UPDATE OR | |
2037 coll_sms_send EQ MFW_SMS_WAIT OR | |
2038 coll_sms_read EQ MFW_SMS_WAIT OR | |
2039 coll_sms_delete EQ MFW_SMS_WAIT OR | |
2040 coll_sms_req EQ MFW_SMS_WAIT) | |
2041 { | |
2042 if (sms_id_wait.index <= 0) | |
2043 { | |
2044 sms_id_wait.index = index; | |
2045 sms_id_wait.mem = (mem EQ SMS_STOR_Me)? MFW_MEM_ME: MFW_MEM_SIM; | |
2046 sms_id_wait.concat_status = concatenated_status; | |
2047 sms_id_wait.received_sms_type = received_sms_type; | |
2048 } | |
2049 else | |
2050 { | |
2051 TRACE_EVENT("Indication Overrun"); | |
2052 } | |
2053 f_update = MFW_SMS_UPDATE; | |
2054 } | |
2055 else | |
2056 { | |
2057 sms_send_new_msg_ind(sm,index, mem, received_sms_type, concatenated_status); | |
2058 } | |
2059 f_update = MFW_SMS_FREE; | |
2060 if(memory.total == memory.used) | |
2061 { | |
2062 TRACE_EVENT_P2("memory used is = %d, of %d", memory.used, memory.total); | |
2063 sms_signal(E_SMS_MEM_FULL, NULL); | |
2064 } | |
2065 } | |
2066 if(msg_info != NULL) | |
2067 { | |
2068 TRACE_EVENT_P4("CMTI Msg table: %d,%d,%d, %d", msg_info[0].index, msg_info[1].index,msg_info[2].index,msg_info[3].index); | |
2069 TRACE_EVENT_P4("CMTI Msg table: %d,%d,%d, %d", msg_info[4].index, msg_info[5].index,msg_info[6].index,msg_info[7].index); | |
2070 } | |
2071 /*MC SPR 1366, need to call this function to update CPHS voicemail data*/ | |
2072 sms_check_voice_mail(sm->pid, sm->dcs, sm->adress, | |
2073 &sm->toa, &sm->udh); | |
2074 /*SPR 1833, this is already called in sms_store_new_msg_info, BUT we need it in for initialisation*/ | |
2075 } | |
2076 | |
2077 #endif /* #if defined (FF_WAP) && defined (FF_GPF_TCPIP) */ | |
2078 /* | |
2079 +------------------------------------------------------------------------+ | |
2080 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
2081 | STATE : code ROUTINE : find_slot_in_msg_info | | |
2082 +------------------------------------------------------------------------+ | |
2083 | |
2084 PURPOSE : Find a slot in msg_info for the index of the SMS supplied | |
2085 | |
2086 */ | |
2087 | |
2088 static int find_slot_in_msg_info(UBYTE index, UBYTE update_mem) | |
2089 { | |
2090 int ret = -1; | |
2091 int i; | |
2092 | |
2093 TRACE_FUNCTION("find_slot_in_msg_info"); | |
2094 | |
2095 if (index >= 1) | |
2096 { | |
2097 /* A valid index, so look for it already being in msg_info */ | |
2098 #ifdef FF_MMI_SMS_DYNAMIC | |
2099 for (i = 0; (i < g_max_messages) && (ret == -1); i++) | |
2100 #else | |
2101 for (i = 0; (i < MAX_MESSAGES) && (ret == -1); i++) | |
2102 #endif | |
2103 { | |
2104 if (msg_info[i].index == index) | |
2105 { | |
2106 /* Index already in msg_info, so replace */ | |
2107 ret = i; | |
2108 } | |
2109 } | |
2110 | |
2111 if (ret == -1) | |
2112 { | |
2113 /* Index was not already in msg_info, so look for unused slot */ | |
2114 #ifdef FF_MMI_SMS_DYNAMIC | |
2115 for (i = 0; (i < g_max_messages) && (ret == -1); i++) | |
2116 #else | |
2117 for (i = 0; (i < MAX_MESSAGES) && (ret == -1); i++) | |
2118 #endif | |
2119 { | |
2120 if (msg_info[i].index == -1) | |
2121 { | |
2122 /* First unused slot in msg_info found */ | |
2123 ret = i; | |
2124 if (update_mem) | |
2125 memory.used++; | |
2126 } | |
2127 } | |
2128 } | |
2129 } | |
2130 | |
2131 TRACE_EVENT_P1("find_slot_in_msg_info returning %d", ret); | |
2132 | |
2133 return ret; | |
2134 } | |
2135 | |
2136 /* | |
2137 +--------------------------------------------------------------------+ | |
2138 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
2139 | STATE : code ROUTINE : sms_store_new_msg_info | | |
2140 +--------------------------------------------------------------------+ | |
2141 | |
2142 PURPOSE : Store message information | |
2143 | |
2144 */ | |
2145 | |
2146 T_MFW sms_store_new_msg_info(UBYTE index, T_ACI_CMGL_SM* sm, UBYTE update_mem, T_CONC_ASSEMBLY_RETURN conc_stat) | |
2147 { | |
2148 int j; | |
2149 T_SMS_TYPE received_sms_type; | |
2150 // Feb 16, 2005 REF: CRR MMI-SPR-27900 xnkulkar | |
2151 // Added this variable to store the voice mail status | |
2152 T_MFW status; | |
2153 | |
2154 #ifndef MMI_LITE | |
2155 //T_CONC_ASSEMBLY_RETURN concatenated_status; // RAVI | |
2156 // T_SM_DATA_EXT conc_data_ext; // RAVI | |
2157 #endif | |
2158 int i; | |
2159 | |
2160 | |
2161 TRACE_EVENT("sms_store_new_msg_info"); | |
2162 | |
2163 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
2164 sms_type = MFW_SMS_MESSAGE; | |
2165 #else | |
2166 /*SPR 2530 removed setting of sms_type flag*/ | |
2167 #endif | |
2168 if ((j = find_slot_in_msg_info(index, update_mem)) != -1) | |
2169 { | |
2170 //x0pleela 07 Feb, 2006 DR: OMAPS00059261 | |
2171 //Initial value of msg_type is set to not voice | |
2172 msg_info[j].msg_type = MFW_SMS_NotVOICE; | |
2173 | |
2174 received_sms_type = SMS_getSMSType(&sm->udh); | |
2175 TRACE_EVENT_P1("SMS Type is = %d", received_sms_type); | |
2176 | |
2177 | |
2178 | |
2179 /*SPR 2260*/ | |
2180 if (received_sms_type == CONCATE) | |
2181 { | |
2182 | |
2183 if (conc_stat == CONC_COMPLETED) | |
2184 { /*replace index withat of first message*/ | |
2185 index = concSMS_GetFirstIndex(concSMS_GetMsgRef ( sm ), sm->adress); | |
2186 msg_info[j].concat_status = MFW_SMS_CONC_WHOLE; | |
2187 TRACE_EVENT("Setting to WHOLE"); | |
2188 | |
2189 } | |
2190 else /*otherwise leave index as it is*/ | |
2191 { /*check if message already complete*/ | |
2192 #ifdef FF_MMI_SMS_DYNAMIC | |
2193 for (i=0; i<g_max_messages; i++) | |
2194 #else | |
2195 for (i=0; i<MAX_MESSAGES; i++) | |
2196 #endif | |
2197 { if (msg_info[i].index != -1) | |
2198 { if (msg_info[i].first_index == concSMS_GetFirstIndex(concSMS_GetMsgRef ( sm ), sm->adress) | |
2199 && msg_info[i].concat_status == MFW_SMS_CONC_WHOLE) | |
2200 return 1;/*don't bother copying this message into the table*/ // RAVI - Changed return to return 1 | |
2201 } | |
2202 } | |
2203 | |
2204 msg_info[j].concat_status = MFW_SMS_CONC_PART; | |
2205 TRACE_EVENT("Setting to PART"); | |
2206 } | |
2207 | |
2208 TRACE_EVENT_P1("index = %d",index); | |
2209 | |
2210 msg_info[j].first_index =concSMS_GetFirstIndex(concSMS_GetMsgRef ( sm ), sm->adress); | |
2211 | |
2212 | |
2213 /*if complete SMS, delete old fragments*/ | |
2214 if (conc_stat == CONC_COMPLETED) | |
2215 #ifdef FF_MMI_SMS_DYNAMIC | |
2216 for (i=0; i<g_max_messages; i++) | |
2217 #else | |
2218 for (i=0; i<MAX_MESSAGES; i++) | |
2219 #endif | |
2220 { | |
2221 if (msg_info[i].index != -1) | |
2222 { | |
2223 // March 31, 2005 REF: CRR MMI-SPR-24511 x0012852 | |
2224 // One more Check added for first_index to delete old fragments completely | |
2225 | |
2226 if ((msg_info[i].first_index == concSMS_GetFirstIndex(concSMS_GetMsgRef ( sm ), sm->adress)||(msg_info[i].first_index == 0)) | |
2227 &&(msg_info[i].concat_status == MFW_SMS_CONC_PART )) | |
2228 { TRACE_EVENT_P1("Deleting index number:%d", msg_info[i].index); | |
2229 delete_sms_from_table(msg_info[i].index);; | |
2230 } | |
2231 } | |
2232 | |
2233 } | |
2234 } | |
2235 else | |
2236 { msg_info[j].first_index = 0xFF;/*invalid index*/ | |
2237 msg_info[j].concat_status = MFW_SMS_NO_CONC; | |
2238 TRACE_EVENT("Setting to NO CONC"); | |
2239 } | |
2240 | |
2241 | |
2242 sm->index = index; | |
2243 msg_info[j].index = index; | |
2244 | |
2245 //x0pleela 08 Feb, 2006 DR: OMAPS00059261 | |
2246 //Replacing MT_STATUS_RPT with MFW_SMS_STATRPT as MT_STATUS_RPT is removed | |
2247 | |
2248 //x0pleela 07 Feb, 2006 DR: OMAPS00059261 | |
2249 //Update msg_info's message type for STATUS REPORT | |
2250 if(( 0x03 & sm->fo ) EQ MFW_MSG_STATUS_REPORT ) | |
2251 { | |
2252 msg_info[j].msg_type = MFW_SMS_STATRPT; | |
2253 } | |
2254 msg_info[j].stat = sms_decodeStatus(sm->stat); | |
2255 | |
2256 strcpy((char *)msg_info[j].addr.number, sm->adress); | |
2257 msg_info[j].addr.ton = phb_cvtTon(sm->toa.ton); | |
2258 msg_info[j].addr.npi = (T_MFW_PHB_NPI)phb_cvtNpi(sm->toa.npi); | |
2259 | |
2260 | |
2261 #ifdef NO_ASCIIZ | |
2262 memcpy(msg_info[j].addr.tag, | |
2263 sm->alpha.data, | |
2264 sm->alpha.len); | |
2265 msg_info[j].addr.len = sm->alpha.len; | |
2266 #else | |
2267 phb_Alpha2Gsm(&sm->alpha, | |
2268 (UBYTE *)msg_info[j].addr.tag); | |
2269 #endif | |
2270 | |
2271 memcpy(&msg_info[j].rctp, &sm->scts, sizeof(T_MFW_SMS_SCTP)); | |
2272 | |
2273 // check voice mail status | |
2274 // Feb 16, 2005 REF: CRR MMI-SPR-27900 xnkulkar | |
2275 // Commented the 'if' condition below. | |
2276 /* if (sms_check_voice_mail(sm->pid, sm->dcs, sm->adress, | |
2277 &sm->toa, &sm->udh) EQ MFW_SMS_VOICE) | |
2278 msg_info[j].msg_type = MFW_SMS_VOICE;*/ | |
2279 status = sms_check_voice_mail(sm->pid, sm->dcs, sm->adress, | |
2280 &sm->toa, &sm->udh); | |
2281 // Check if it is a voice mail message | |
2282 if(status == MFW_SMS_VOICE || status == MFW_SMS_VOICEMSG_DELETE) | |
2283 { | |
2284 // If voicemail message is from group "1100" | |
2285 if(status == MFW_SMS_VOICEMSG_DELETE) | |
2286 { | |
2287 // Mark this message for deletion | |
2288 msg_info[j].stat= MFW_SMS_VOICEMSG_DELETE; | |
2289 } | |
2290 msg_info[j].msg_type = MFW_SMS_VOICE; | |
2291 } | |
2292 | |
2293 coll_sms_read = MFW_SMS_FREE; | |
2294 f_update = MFW_SMS_FREE; | |
2295 TRACE_EVENT_P1("UDH Length is = %d", sm->udh.len); | |
2296 } | |
2297 /*SPR 2260, check if memory full*/ | |
2298 TRACE_EVENT_P2("memory used is = %d, of %d", memory.used, memory.total); | |
2299 if(memory.total == memory.used) | |
2300 { | |
2301 | |
2302 sms_signal(E_SMS_MEM_FULL, NULL); | |
2303 } | |
2304 return 1; // RAVI | |
2305 } | |
2306 | |
2307 | |
2308 | |
2309 /* | |
2310 +--------------------------------------------------------------------+ | |
2311 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
2312 | STATE : code ROUTINE : sms_stored_submit | | |
2313 +--------------------------------------------------------------------+ | |
2314 | |
2315 PURPOSE : Send a new message indication to the MMI | |
2316 | |
2317 */ | |
2318 | |
2319 T_MFW sms_send_new_msg_ind(T_ACI_CMGL_SM* sm,UBYTE index, UBYTE mem, UBYTE received_sms_type, UBYTE concatenated_status) | |
2320 { | |
2321 TRACE_FUNCTION("sms_send_new_msg_ind"); | |
2322 | |
2323 if (received_sms_type == CONCATE) | |
2324 { | |
2325 switch (concatenated_status) | |
2326 { | |
2327 case CONC_ERR_UNKN: | |
2328 TRACE_EVENT("Concatenated SMS error");break; | |
2329 case CONC_ERR_BUF_FULL: | |
2330 TRACE_EVENT("Concatented SMS buffer Full Error");break; | |
2331 case CONC_CONTINUED: //not last SMS | |
2332 TRACE_EVENT("Concatenation Continued"); | |
2333 break; | |
2334 case CONC_COMPLETED: | |
2335 { | |
2336 TRACE_EVENT("Concatenation Completed"); | |
2337 memset(&sms_mt, 0, sizeof(sms_mt)); | |
2338 /*SPR 2260*/ | |
2339 if (sms_check_voice_mail(sm->pid, sm->dcs, sm->adress, | |
2340 &sm->toa, &sm->udh) == MFW_SMS_VOICE) | |
2341 sms_mt.voicemail = TRUE; | |
2342 else | |
2343 sms_mt.voicemail = FALSE; | |
2344 if(initialising_flag == TRUE) | |
2345 sms_signal(E_SMS_MT, &sms_mt); | |
2346 else | |
2347 { | |
2348 //Aug 26, 2004 REF: CRR 23287 Deepa M.D | |
2349 //The second parameter is not used in case of | |
2350 //E_SMS_MT_RECEIVED event.sms_id_wait is the variable | |
2351 //used for MT SMS, which is ignored anyway. | |
2352 sms_signal(E_SMS_MT_RECEIVED, &sms_id_wait); | |
2353 } | |
2354 } | |
2355 } | |
2356 } | |
2357 else | |
2358 { | |
2359 memset(&sms_mt, 0, sizeof(sms_mt)); | |
2360 | |
2361 if(initialising_flag == TRUE) | |
2362 sms_signal(E_SMS_MT, &sms_mt); | |
2363 else | |
2364 { | |
2365 //Aug 26, 2004 REF: CRR 23287 Deepa M.D | |
2366 //The second parameter is not used in case of | |
2367 //E_SMS_MT_RECEIVED event.sms_id_wait is the variable | |
2368 //used for MT SMS, which is ignored anyway. | |
2369 sms_signal(E_SMS_MT_RECEIVED, &sms_id_wait); | |
2370 } | |
2371 } | |
2372 } | |
2373 | |
2374 /* | |
2375 +--------------------------------------------------------------------+ | |
2376 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
2377 | STATE : code ROUTINE : rAT_PlusCBM | | |
2378 +--------------------------------------------------------------------+ | |
2379 | |
2380 PURPOSE : Receive a new cell broadcast message. | |
2381 | |
2382 */ | |
2383 | |
2384 void rAT_PlusCBM(SHORT sn, | |
2385 SHORT mid, | |
2386 SHORT dcs, | |
2387 UBYTE page, | |
2388 UBYTE pages, | |
2389 T_ACI_CBM_DATA* data) | |
2390 { | |
2391 TRACE_FUNCTION ("rAT_PlusCBM()"); | |
2392 | |
2393 /* copy parameter */ | |
2394 sms_cb.sn = sn; | |
2395 sms_cb.msg_id = mid; | |
2396 sms_cb.dcs = (UBYTE)dcs; | |
2397 sms_cb.page = page; | |
2398 sms_cb.pages = pages; | |
2399 sms_cb.msg_len = data->len; | |
2400 memcpy((char *)sms_cb.cb_msg, (char *)data->data, data->len); | |
2401 /* send cell broadcast message event */ | |
2402 // Oct 18, 2005 REF: SPR 34678 xdeepadh | |
2403 //The CB messages with DCS 242(class-2,default alphabet) are discarded | |
2404 if(dcs!=0xF2) | |
2405 { | |
2406 sms_signal(E_SMS_CB, &sms_cb); | |
2407 } | |
2408 } | |
2409 | |
2410 | |
2411 /* | |
2412 +--------------------------------------------------------------------+ | |
2413 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
2414 | STATE : code ROUTINE : rAT_PlusCBMI | | |
2415 +--------------------------------------------------------------------+ | |
2416 | |
2417 PURPOSE : Receive a new cell broadcast message identifier. | |
2418 | |
2419 */ | |
2420 | |
2421 void rAT_PlusCBMI(T_ACI_SMS_STOR mem, UBYTE index) | |
2422 { | |
2423 TRACE_EVENT ("rAT_PlusCBMI()"); | |
2424 | |
2425 switch ( mem ) | |
2426 { | |
2427 case ( SMS_STOR_Me ): | |
2428 sms_id.mem = MFW_MEM_ME; | |
2429 break; | |
2430 case ( SMS_STOR_Sm ): | |
2431 sms_id.mem = MFW_MEM_SIM; | |
2432 break; | |
2433 default: | |
2434 break; | |
2435 } | |
2436 | |
2437 sms_id.index = index; | |
2438 | |
2439 /* send a short message identifier event */ | |
2440 sms_signal(E_SMS_CB_RECEIVED, &sms_id); | |
2441 } | |
2442 | |
2443 | |
2444 /* | |
2445 +--------------------------------------------------------------------+ | |
2446 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
2447 | STATE : code ROUTINE : rAT_PlusCDS | | |
2448 +--------------------------------------------------------------------+ | |
2449 | |
2450 PURPOSE : Receive a status report message. | |
2451 | |
2452 */ | |
2453 | |
2454 void rAT_PlusCDS(T_ACI_CDS_SM *st) | |
2455 { | |
2456 T_MFW_SMS_STATUS sms_status; | |
2457 T_MFW_PHB_ENTRY phb_entry; | |
2458 T_MFW_PHB_LIST phb_list; | |
2459 SHORT phb_index; | |
2460 #ifdef NO_ASCIIZ | |
2461 T_MFW_PHB_TEXT findText; | |
2462 #endif | |
2463 | |
2464 TRACE_FUNCTION ("rAT_PlusCDS()"); | |
2465 | |
2466 memset(&phb_entry, 0, sizeof(phb_entry)); | |
2467 memset(&phb_list, 0, sizeof(phb_list)); | |
2468 phb_list.entry = &phb_entry; | |
2469 | |
2470 sms_status.msg_id = 0x03 & (UBYTE)st->fo; | |
2471 sms_status.msg_ref = st->msg_ref; | |
2472 strcpy(sms_status.addr.number, st->addr); | |
2473 sms_status.addr.ton = phb_cvtTon(st->toa.ton); | |
2474 sms_status.addr.npi = (T_MFW_PHB_NPI)phb_cvtNpi(st->toa.npi); | |
2475 | |
2476 #ifdef NO_ASCIIZ | |
2477 strcpy((char *)findText.data, st->addr); | |
2478 findText.len = (UBYTE)strlen(st->addr); | |
2479 if (phb_find_entries (PHB_ADN, &phb_index, | |
2480 MFW_PHB_NUMBER, | |
2481 1, &findText, | |
2482 &phb_list) EQ MFW_PHB_OK) | |
2483 { | |
2484 if (phb_list.num_entries) | |
2485 { | |
2486 memcpy(sms_status.addr.tag, | |
2487 phb_list.entry->name.data, | |
2488 phb_list.entry->name.len); | |
2489 sms_status.addr.len = phb_list.entry->name.len; | |
2490 | |
2491 } | |
2492 // Apr 12, 2004 REF: CRR 13370 Deepa M.D | |
2493 else | |
2494 { | |
2495 sms_status.addr.tag[0]='\0'; | |
2496 sms_status.addr.len = 0; | |
2497 | |
2498 } | |
2499 } | |
2500 #else | |
2501 if (phb_find_entries (PHB_ADN, &phb_index, | |
2502 MFW_PHB_NUMBER, | |
2503 1, | |
2504 st->ra, | |
2505 &phb_list) EQ MFW_PHB_OK) | |
2506 { | |
2507 | |
2508 if (phb_list.num_entries) | |
2509 { | |
2510 strcpy((char *)sms_status.addr.tag, (char *)phb_list.entry->name); | |
2511 | |
2512 } | |
2513 } | |
2514 #endif | |
2515 | |
2516 sms_status.status = st->tp_status; | |
2517 | |
2518 memcpy((char *)sms_status.rctp.year, (char *)st->vpabs_scts.year, MAX_SCTP_DIGITS); | |
2519 memcpy((char *)sms_status.rctp.month, (char *)st->vpabs_scts.month, MAX_SCTP_DIGITS); | |
2520 memcpy((char *)sms_status.rctp.day, (char *)st->vpabs_scts.day, MAX_SCTP_DIGITS); | |
2521 memcpy((char *)sms_status.rctp.hour, (char *)st->vpabs_scts.hour, MAX_SCTP_DIGITS); | |
2522 memcpy((char *)sms_status.rctp.minute, (char *)st->vpabs_scts.minute, MAX_SCTP_DIGITS); | |
2523 memcpy((char *)sms_status.rctp.second, (char *)st->vpabs_scts.second, MAX_SCTP_DIGITS); | |
2524 sms_status.rctp.timezone = st->vpabs_scts.timezone; | |
2525 | |
2526 /* send status report message event */ | |
2527 sms_signal(E_SMS_STATUS, &sms_status); | |
2528 } | |
2529 | |
2530 | |
2531 /* | |
2532 +------------------------------------------------------------------+ | |
2533 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
2534 | STATE : code ROUTINE : sms_set_pref_memory| | |
2535 +------------------------------------------------------------------+ | |
2536 | |
2537 PURPOSE : Set preferred message storage. | |
2538 | |
2539 */ | |
2540 | |
2541 T_MFW sms_set_pref_memory(UBYTE mem) | |
2542 { | |
2543 TRACE_FUNCTION ("sms_set_pref_memory()"); | |
2544 | |
2545 int_init_req = FALSE; | |
2546 | |
2547 if (sAT_PlusCPMS(CMD_SRC_LCL, | |
2548 sms_mem_cvt(mem), | |
2549 sms_mem_cvt(mem), | |
2550 sms_mem_cvt(mem)) NEQ AT_EXCT) | |
2551 return MFW_SMS_FAIL; | |
2552 return MFW_SMS_OK; | |
2553 } | |
2554 | |
2555 | |
2556 /* | |
2557 +--------------------------------------------------------------------+ | |
2558 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
2559 | STATE : code ROUTINE : sms_read | | |
2560 +--------------------------------------------------------------------+ | |
2561 | |
2562 PURPOSE : Read a SMS message. | |
2563 | |
2564 */ | |
2565 | |
2566 T_MFW sms_read(UBYTE type, UBYTE index) | |
2567 { | |
2568 TRACE_EVENT_P1("sms_read():%d",index); | |
2569 | |
2570 coll_sms_read = MFW_SMS_WAIT; | |
2571 | |
2572 if (sAT_PlusCMGR(CMD_SRC_LCL, index, SMS_READ_Preview) NEQ AT_EXCT) | |
2573 return MFW_SMS_FAIL; | |
2574 /*SPR 2260, set sms type so we get event from rAT_plusCMGR*/ | |
2575 sms_type = MFW_SMS_MESSAGE; | |
2576 | |
2577 flag = index; | |
2578 memset(&sms_mt, 0, sizeof(sms_mt)); | |
2579 sms_mt.index = index; | |
2580 cmgr_awaiting_ok = FALSE; // Marcus: Issue 2260: 03/10/2002 | |
2581 | |
2582 return MFW_SMS_OK; | |
2583 } | |
2584 | |
2585 | |
2586 /* | |
2587 +--------------------------------------------------------------------+ | |
2588 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
2589 | STATE : code ROUTINE : rAT_PlusCMGR | | |
2590 +--------------------------------------------------------------------+ | |
2591 | |
2592 | |
2593 PURPOSE : Call back for read message. | |
2594 | |
2595 */ | |
2596 | |
2597 //Feb 28, 2004 REF: CRR 28809 Deepa M.D | |
2598 /*The Optimization changes done for golite build have been incorpaorated to color build. | |
2599 The MMI_LITE flag used for rAT_PlusCMGR has been removed.*/ | |
2600 void rAT_PlusCMGR(T_ACI_CMGL_SM * sm, T_ACI_CMGR_CBM * cbm) | |
2601 { | |
2602 T_SMS_TYPE received_sms_type; | |
2603 T_CONC_ASSEMBLY_RETURN concatenated_status; | |
2604 T_SM_DATA_EXT conc_data_ext; | |
2605 //Feb 28, 2004 REF: CRR 28809 Deepa M.D | |
2606 //sms_mo is made a local variable.It will be allocated /deallocated dynamically. | |
2607 T_MFW_SMS_MO *sms_mo=NULL; | |
2608 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
2609 UBYTE wap_sms = FALSE; | |
2610 #endif | |
2611 TRACE_FUNCTION ("rAT_PlusCMGR()"); | |
2612 TRACE_EVENT_P2("messagepointer:%d, Cellbroadcast pointer:%d", sm, cbm); | |
2613 cmgr_awaiting_ok = TRUE; // Marcus: Issue 2260: 03/10/2002 | |
2614 conc_data_ext.data = NULL; // Jul 07, 2004 REF: CRR 15846 Deepa M.D | |
2615 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
2616 /* SPR#2086 - SH - Intercept a WAP SMS */ | |
2617 { | |
2618 USHORT destinatorPort = sm->udh.data[3]+sm->udh.data[2]*0x100; | |
2619 USHORT originatorPort = sm->udh.data[5]+sm->udh.data[4]*0x100; | |
2620 | |
2621 if (destinatorPort==2948 | |
2622 || destinatorPort==2949 | |
2623 || originatorPort==9200 | |
2624 || originatorPort==9201 | |
2625 || originatorPort==9202 | |
2626 || originatorPort==9203) | |
2627 { | |
2628 wap_sms = TRUE; | |
2629 } | |
2630 } | |
2631 #endif | |
2632 switch (sms_type) | |
2633 { | |
2634 case MFW_SMS_MESSAGE: | |
2635 { if (sm != NULL) /*SPR2260 make sure we have a valid pointer*/ | |
2636 { switch (0x03 & sm->fo) | |
2637 { | |
2638 case MFW_MSG_DELIVER: //x0pleela 01 Feb, 2006 DR: OMAPS00059261 /* SMS type: MT */ | |
2639 { USHORT conc_msg_ref; | |
2640 UBYTE conc_index; | |
2641 int i;/*SPR2260*/ | |
2642 BOOL continue_flag=FALSE;/*SPR2260*/ | |
2643 TRACE_EVENT_P1("UDH Length is = %d", sm->udh.len); | |
2644 received_sms_type = SMS_getSMSType( &sm->udh); | |
2645 TRACE_EVENT_P1("SMS Type is = %d", received_sms_type); | |
2646 | |
2647 if (received_sms_type == CONCATE) | |
2648 { | |
2649 concatenated_status =concSMS_Collect(&conc_data_ext, sm, FALSE); | |
2650 TRACE_EVENT_P2("conc status: %d, conc length: %d", concatenated_status, conc_data_ext.len); | |
2651 } | |
2652 | |
2653 | |
2654 if (received_sms_type == CONCATE) | |
2655 { | |
2656 switch (concatenated_status) | |
2657 { | |
2658 | |
2659 case CONC_ERR_BUF_FULL: | |
2660 TRACE_EVENT("Concatented SMS buffer Full Error"); | |
2661 sms_signal(E_SMS_ERR, NULL); | |
2662 break; | |
2663 case CONC_ERR_UNKN: | |
2664 TRACE_EVENT("Concatenated SMS error"); | |
2665 case CONC_CONTINUED: //not last SMS | |
2666 TRACE_EVENT("Concatenation Continued"); | |
2667 /*SPR 2260*/ | |
2668 cmgr_awaiting_ok = FALSE; // Marcus: Issue 2260: 03/10/2002 | |
2669 | |
2670 /*if the index exists in the message table, process the message*/ | |
2671 #ifdef FF_MMI_SMS_DYNAMIC | |
2672 for (i=0; i <g_max_messages;i++) | |
2673 #else | |
2674 for (i=0; i <MAX_MESSAGES;i++) | |
2675 #endif | |
2676 if (msg_info[i].index == sm->msg_ref && msg_info[i].concat_status == MFW_SMS_CONC_PART) | |
2677 continue_flag = TRUE; | |
2678 if (!continue_flag) | |
2679 break; | |
2680 | |
2681 case CONC_COMPLETED: | |
2682 { | |
2683 TRACE_EVENT("Concatenation Completed"); | |
2684 memset(&sms_mt, 0, sizeof(sms_mt)); | |
2685 conc_msg_ref =concSMS_GetMsgRef ( sm ); | |
2686 conc_index = concSMS_GetFirstIndex(conc_msg_ref, sm->adress); | |
2687 | |
2688 #ifdef NO_ASCIIZ | |
2689 memcpy(sms_mt.orig_addr.tag, | |
2690 sm->alpha.data, | |
2691 sm->alpha.len); | |
2692 sms_mt.orig_addr.len = sm->alpha.len; | |
2693 #else | |
2694 phb_Alpha2Gsm(sm->alpha, (UBYTE *)sms_mt.orig_addr.tag); | |
2695 #endif | |
2696 strcpy(sms_mt.orig_addr.number, sm->adress); | |
2697 sms_mt.orig_addr.ton = | |
2698 phb_cvtTon(sm->toa.ton); | |
2699 sms_mt.orig_addr.npi = (T_MFW_PHB_NPI)phb_cvtNpi(sm->toa.npi); | |
2700 if (sm->tosca.ton == TON_International) | |
2701 sprintf(sms_mt.sc_addr, "+%s", sm->sca); | |
2702 else | |
2703 strcpy(sms_mt.sc_addr, sm->sca); | |
2704 sms_mt.prot_id = (UBYTE)sm->pid; | |
2705 sms_mt.dcs = (UBYTE)sm->dcs & 0xFC; /* Ignore message class */ | |
2706 | |
2707 /*MC SPR 2260, message index should be set to that of first index in | |
2708 concatenated message if this is a complete message*/ | |
2709 if (concatenated_status == CONC_COMPLETED) | |
2710 sms_mt.index = conc_index; | |
2711 else | |
2712 sms_mt.index = sm->msg_ref; | |
2713 | |
2714 sms_mt.rp = sm->fo >> 7 & 1; | |
2715 | |
2716 /* SBH */ | |
2717 if (sm->dcs & 0x10) /* Bit 5 indicates that we should get message class from bits 0 & 1 */ | |
2718 { | |
2719 sms_mt.ti = sm->dcs & 3; | |
2720 } | |
2721 else /* Otherwise, set to default value */ | |
2722 { | |
2723 sms_mt.ti = 1; | |
2724 } | |
2725 /* SBH end */ | |
2726 | |
2727 memcpy((char *)sms_mt.sctp.year, (char *)sm->scts.year, MAX_SCTP_DIGITS); | |
2728 memcpy((char *)sms_mt.sctp.month, (char *)sm->scts.month, MAX_SCTP_DIGITS); | |
2729 memcpy((char *)sms_mt.sctp.day, (char *)sm->scts.day, MAX_SCTP_DIGITS); | |
2730 memcpy((char *)sms_mt.sctp.hour, (char *)sm->scts.hour, MAX_SCTP_DIGITS); | |
2731 memcpy((char *)sms_mt.sctp.minute, (char *)sm->scts.minute, MAX_SCTP_DIGITS); | |
2732 memcpy((char *)sms_mt.sctp.second, (char *)sm->scts.second, MAX_SCTP_DIGITS); | |
2733 sms_mt.sctp.timezone = sm->scts.timezone; | |
2734 | |
2735 /* copy length of whole concat SMS*/ | |
2736 if (conc_data_ext.len > MAX_MSG_LEN) | |
2737 sms_mt.msg_len = MAX_MSG_LEN; | |
2738 else | |
2739 sms_mt.msg_len = conc_data_ext.len; | |
2740 /*copy all data from concat SMS*/ | |
2741 /*SPR 2260*/ | |
2742 if (sm->stat == SMS_STAT_Invalid) | |
2743 memset(sms_mt.sms_msg, NULL, MAX_MSG_LEN_ARRAY); | |
2744 else /*SPR2260 */ | |
2745 { if (concatenated_status == CONC_COMPLETED) | |
2746 { memcpy(sms_mt.sms_msg, (char*)conc_data_ext.data, sms_mt.msg_len);} | |
2747 else/*copy data from sm pointer if message not complete*/ | |
2748 { memcpy(sms_mt.sms_msg, (char*)sm->data.data, sm->data.len); | |
2749 sms_mt.msg_len = sm->data.len; | |
2750 } | |
2751 } | |
2752 /* Free memory allocated by the ACI */ | |
2753 // Jul 07, 2004 REF: CRR 15846 Deepa M.D | |
2754 //Free the memory only if conc_data_ext.data is not NULL. | |
2755 if(conc_data_ext.data != NULL) | |
2756 { | |
2757 MFREE(conc_data_ext.data); | |
2758 } | |
2759 sms_mt.udh_len = sm->udh.len; | |
2760 memcpy((char *)sms_mt.udh, (char *)sm->udh.data, sm->udh.len); | |
2761 | |
2762 /*MC SPR 2260, need to call this function to update CPHS voicemail data*/ | |
2763 if (sms_check_voice_mail(sm->pid, sm->dcs, sm->adress, | |
2764 &sm->toa, &sm->udh) == MFW_SMS_VOICE) | |
2765 sms_mt.voicemail = TRUE; | |
2766 else | |
2767 sms_mt.voicemail = FALSE; | |
2768 | |
2769 sms_type = MFW_NO_MESSAGE; | |
2770 | |
2771 coll_sms_read = MFW_SMS_FREE; | |
2772 sms_signal(E_SMS_MT, &sms_mt); | |
2773 } | |
2774 } | |
2775 } | |
2776 else | |
2777 { | |
2778 #ifdef NO_ASCIIZ | |
2779 memcpy(sms_mt.orig_addr.tag, | |
2780 sm->alpha.data, | |
2781 sm->alpha.len); | |
2782 | |
2783 sms_mt.orig_addr.len = sm->alpha.len; | |
2784 #else | |
2785 phb_Alpha2Gsm(&sm->alpha, (UBYTE *)sms_mt.orig_addr.tag); | |
2786 #endif | |
2787 | |
2788 if (sm->toa.ton == TON_International) | |
2789 sprintf(sms_mt.orig_addr.number, "+%s", sm->adress); | |
2790 else | |
2791 strcpy(sms_mt.orig_addr.number, sm->adress); | |
2792 | |
2793 sms_mt.orig_addr.ton = phb_cvtTon(sm->toa.ton); | |
2794 sms_mt.orig_addr.npi = (T_MFW_PHB_NPI)phb_cvtNpi(sm->toa.npi); | |
2795 | |
2796 if (sm->tosca.ton == TON_International) | |
2797 sprintf(sms_mt.sc_addr, "+%s", sm->sca); | |
2798 else | |
2799 strcpy(sms_mt.sc_addr, sm->sca); | |
2800 | |
2801 sms_mt.prot_id = (UBYTE)sm->pid; | |
2802 sms_mt.dcs = (UBYTE)sm->dcs & 0xFC; /* Ignore message class */ | |
2803 sms_mt.rp = sm->fo >> 7 & 1; | |
2804 | |
2805 // PATCH JPS 04.10 END | |
2806 /* SBH */ | |
2807 if (sm->dcs & 0x10) /* Bit 5 indicates that we should get message class from bits 0 & 1 */ | |
2808 { | |
2809 sms_mt.ti = sm->dcs & 3; | |
2810 } | |
2811 else /* Otherwise, set to default value */ | |
2812 { | |
2813 sms_mt.ti = 1; | |
2814 } | |
2815 /* SBH end */ | |
2816 | |
2817 TRACE_EVENT_P2("dcs: %d, ti: %d", sms_mt.dcs, sms_mt.ti); | |
2818 | |
2819 memcpy((char *)sms_mt.sctp.year, (char *)sm->scts.year, MAX_SCTP_DIGITS); | |
2820 memcpy((char *)sms_mt.sctp.month, (char *)sm->scts.month, MAX_SCTP_DIGITS); | |
2821 memcpy((char *)sms_mt.sctp.day, (char *)sm->scts.day, MAX_SCTP_DIGITS); | |
2822 memcpy((char *)sms_mt.sctp.hour, (char *)sm->scts.hour, MAX_SCTP_DIGITS); | |
2823 memcpy((char *)sms_mt.sctp.minute, (char *)sm->scts.minute, MAX_SCTP_DIGITS); | |
2824 memcpy((char *)sms_mt.sctp.second, (char *)sm->scts.second, MAX_SCTP_DIGITS); | |
2825 sms_mt.sctp.timezone = sm->scts.timezone; | |
2826 sms_mt.msg_len = sm->data.len; | |
2827 TRACE_EVENT_P2("msg_len %d, data.len %d", sms_mt.msg_len, sm->data.len); | |
2828 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
2829 /* SPR#2086 - SH - If we've got a WAP SMS, replace the message | |
2830 * with a string */ | |
2831 | |
2832 if (wap_sms) | |
2833 { | |
2834 char *message = "WAP SMS"; | |
2835 | |
2836 strcpy(sms_mt.sms_msg, message); | |
2837 sms_mt.msg_len = strlen(message); | |
2838 } | |
2839 else | |
2840 { | |
2841 | |
2842 /*SPR 2260, if invalid message just set text to NULL*/ | |
2843 #endif | |
2844 if (sm->stat == SMS_STAT_Invalid) | |
2845 memset(sms_mt.sms_msg, NULL, MAX_MSG_LEN_ARRAY); | |
2846 else | |
2847 { | |
2848 memcpy(sms_mt.sms_msg, (char*)sm->data.data, sm->data.len); | |
2849 sms_mt.msg_len = sm->data.len; | |
2850 | |
2851 } | |
2852 /*SPR 2260 end*/ | |
2853 sms_mt.udh_len = sm->udh.len; | |
2854 memcpy((char *)sms_mt.udh, (char *)sm->udh.data, sm->udh.len); | |
2855 sms_type = MFW_NO_MESSAGE; | |
2856 TRACE_EVENT("read=free1"); | |
2857 coll_sms_read = MFW_SMS_FREE; | |
2858 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
2859 } | |
2860 #endif | |
2861 | |
2862 /*MC SPR 2260, need to call this function to update CPHS voicemail data*/ | |
2863 if (sms_check_voice_mail(sm->pid, sm->dcs, sm->adress, | |
2864 &sm->toa, &sm->udh) == MFW_SMS_VOICE) | |
2865 sms_mt.voicemail = TRUE; | |
2866 else | |
2867 sms_mt.voicemail = FALSE; | |
2868 sms_signal(E_SMS_MT, &sms_mt); | |
2869 } | |
2870 } | |
2871 break; | |
2872 | |
2873 case MFW_MSG_SUBMIT://x0pleela 01 Feb, 2006 DR: OMAPS00059261 /* SMS type: MO */ | |
2874 { int i;/*SPR2260*/ | |
2875 BOOL continue_flag=FALSE; | |
2876 USHORT conc_msg_ref;/*SPR 2260*/ | |
2877 UBYTE conc_index; | |
2878 | |
2879 //Feb 28, 2004 REF: CRR 28809 Deepa M.D | |
2880 //Allocate sms_mo dynamically | |
2881 sms_mo = (T_MFW_SMS_MO*)mfwAlloc(sizeof(T_MFW_SMS_MO)); | |
2882 if (sms_mo == NULL) | |
2883 { | |
2884 TRACE_EVENT("sms_mo alloc failed"); | |
2885 return ; | |
2886 } | |
2887 | |
2888 received_sms_type = SMS_getSMSType( &sm->udh); | |
2889 TRACE_EVENT_P1("SMS Type is = %d", received_sms_type); | |
2890 if (received_sms_type == CONCATE) | |
2891 { | |
2892 concatenated_status =concSMS_Collect(&conc_data_ext, sm, FALSE); | |
2893 TRACE_EVENT_P2("conc status: %d, conc length: %d", concatenated_status, conc_data_ext.len); | |
2894 } | |
2895 | |
2896 TRACE_EVENT_P1("UDH Length is = %d", sm->udh.len); | |
2897 | |
2898 if (received_sms_type == CONCATE) | |
2899 { | |
2900 switch (concatenated_status) | |
2901 { | |
2902 | |
2903 case CONC_ERR_BUF_FULL: | |
2904 TRACE_EVENT("Concatented SMS buffer Full Error"); | |
2905 sms_signal(E_SMS_ERR, NULL); | |
2906 break; | |
2907 case CONC_ERR_UNKN: | |
2908 TRACE_EVENT("Concatenated SMS error"); | |
2909 case CONC_CONTINUED: //not last SMS | |
2910 TRACE_EVENT("Concatenation Continued"); | |
2911 cmgr_awaiting_ok = FALSE; // Marcus: Issue 2260: 03/10/2002 | |
2912 /*SPR 2260,if the index exists in the message table, continue processing message*/ | |
2913 #ifdef FF_MMI_SMS_DYNAMIC | |
2914 for (i=0; i <g_max_messages;i++) | |
2915 #else | |
2916 for (i=0; i <MAX_MESSAGES;i++) | |
2917 #endif | |
2918 if (msg_info[i].index == sm->msg_ref && msg_info[i].concat_status == MFW_SMS_CONC_PART) | |
2919 continue_flag = TRUE; | |
2920 if (!continue_flag) | |
2921 break; | |
2922 case CONC_COMPLETED: | |
2923 { | |
2924 | |
2925 TRACE_EVENT("Concatenation Completed"); | |
2926 | |
2927 memset(sms_mo, 0, sizeof(T_MFW_SMS_MO)); | |
2928 /*SPR 2260*/ | |
2929 conc_msg_ref =concSMS_GetMsgRef ( sm ); | |
2930 conc_index = concSMS_GetFirstIndex(conc_msg_ref, sm->adress); | |
2931 TRACE_EVENT_P2("msg_len: %d conc len: %d", sms_mo->msg_len, conc_data_ext.len); | |
2932 | |
2933 #ifdef NO_ASCIIZ | |
2934 memcpy(sms_mo->dest_addr.tag, | |
2935 sm->alpha.data, | |
2936 sm->alpha.len); | |
2937 sms_mo->dest_addr.len = sm->alpha.len; | |
2938 #else | |
2939 phb_Alpha2Gsm(&sm->alpha, (UBYTE *)sms_mo->dest_addr.tag); | |
2940 #endif | |
2941 strcpy(sms_mo->dest_addr.number, sm->adress); | |
2942 sms_mo->dest_addr.ton = phb_cvtTon(sm->toa.ton); | |
2943 sms_mo->dest_addr.npi = (T_MFW_PHB_NPI)phb_cvtNpi(sm->toa.npi); | |
2944 if (sm->tosca.ton == TON_International) | |
2945 sprintf(sms_mo->sc_addr, "+%s", sm->sca); | |
2946 else | |
2947 strcpy((char *)sms_mo->sc_addr, sm->sca); | |
2948 | |
2949 sms_mo->prot_id = (UBYTE)sm->pid; | |
2950 sms_mo->dcs = sm->dcs; | |
2951 | |
2952 /*MC SPR 2260, message index should be set to that of first index in | |
2953 concatenated message if this is a complete message*/ | |
2954 if (concatenated_status == CONC_COMPLETED) | |
2955 sms_mo->msg_ref = conc_index; | |
2956 else | |
2957 sms_mo->msg_ref = sm->msg_ref; | |
2958 | |
2959 | |
2960 sms_mo->vp_mode = 0x03 & sm->fo << 2; | |
2961 sms_mo->vp_rel = (UBYTE)sm->vp_rel; | |
2962 | |
2963 memcpy((char *)sms_mo->vp_abs.year, (char *)sm->scts.year, MAX_SCTP_DIGITS); | |
2964 memcpy((char *)sms_mo->vp_abs.month, (char *)sm->scts.month, MAX_SCTP_DIGITS); | |
2965 memcpy((char *)sms_mo->vp_abs.day, (char *)sm->scts.day, MAX_SCTP_DIGITS); | |
2966 memcpy((char *)sms_mo->vp_abs.hour, (char *)sm->scts.hour, MAX_SCTP_DIGITS); | |
2967 memcpy((char *)sms_mo->vp_abs.minute, (char *)sm->scts.minute, MAX_SCTP_DIGITS); | |
2968 memcpy((char *)sms_mo->vp_abs.second, (char *)sm->scts.second, MAX_SCTP_DIGITS); | |
2969 sms_mo->vp_abs.timezone = sm->scts.timezone; | |
2970 | |
2971 /* copy length of whole concat SMS*/ | |
2972 if (conc_data_ext.len > MAX_MSG_LEN) | |
2973 sms_mo->msg_len = MAX_MSG_LEN; | |
2974 else | |
2975 sms_mo->msg_len = conc_data_ext.len; | |
2976 /*SPR 2260 if invalid message just set text to NULL*/ | |
2977 if (sm->stat == SMS_STAT_Invalid) | |
2978 memset(sms_mo->sms_msg, NULL, MAX_MSG_LEN_ARRAY); | |
2979 else | |
2980 { if (concatenated_status == CONC_COMPLETED) | |
2981 { memcpy(sms_mo->sms_msg, (char*)conc_data_ext.data, sms_mo->msg_len);} | |
2982 else | |
2983 { memcpy(sms_mo->sms_msg, (char*)sm->data.data, sm->data.len); | |
2984 sms_mo->msg_len = sm->data.len; | |
2985 } | |
2986 } | |
2987 | |
2988 /* Free memory allocated by the ACI */ | |
2989 // Jul 07, 2004 REF: CRR 15846 Deepa M.D | |
2990 //Free the memory only if conc_data_ext.data is not NULL. | |
2991 if(conc_data_ext.data != NULL) | |
2992 { | |
2993 MFREE(conc_data_ext.data); | |
2994 } | |
2995 sms_type = MFW_NO_MESSAGE; | |
2996 sms_signal(E_SMS_MO, sms_mo); | |
2997 } | |
2998 } | |
2999 } | |
3000 else | |
3001 { | |
3002 #ifdef NO_ASCIIZ | |
3003 memcpy(sms_mo->dest_addr.tag, | |
3004 sm->alpha.data, | |
3005 sm->alpha.len); | |
3006 sms_mo->dest_addr.len = sm->alpha.len; | |
3007 #else | |
3008 phb_Alpha2Gsm(&sm->alpha, (UBYTE *)sms_mo->dest_addr.tag); | |
3009 #endif | |
3010 strcpy(sms_mo->dest_addr.number, sm->adress); | |
3011 sms_mo->dest_addr.ton = phb_cvtTon(sm->toa.ton); | |
3012 sms_mo->dest_addr.npi = (T_MFW_PHB_NPI)phb_cvtNpi(sm->toa.npi); | |
3013 if (sm->tosca.ton == TON_International) | |
3014 sprintf(sms_mo->sc_addr, "+%s", sm->sca); | |
3015 else | |
3016 strcpy((char *)sms_mo->sc_addr, sm->sca); | |
3017 | |
3018 sms_mo->prot_id = (UBYTE)sm->pid; | |
3019 sms_mo->dcs = sm->dcs; | |
3020 sms_mo->msg_ref = sm->msg_ref; | |
3021 sms_mo->vp_mode = 0x03 & sm->fo << 2; | |
3022 sms_mo->vp_rel = (UBYTE)sm->vp_rel; | |
3023 | |
3024 memcpy((char *)sms_mo->vp_abs.year, (char *)sm->scts.year, MAX_SCTP_DIGITS); | |
3025 memcpy((char *)sms_mo->vp_abs.month, (char *)sm->scts.month, MAX_SCTP_DIGITS); | |
3026 memcpy((char *)sms_mo->vp_abs.day, (char *)sm->scts.day, MAX_SCTP_DIGITS); | |
3027 memcpy((char *)sms_mo->vp_abs.hour, (char *)sm->scts.hour, MAX_SCTP_DIGITS); | |
3028 memcpy((char *)sms_mo->vp_abs.minute, (char *)sm->scts.minute, MAX_SCTP_DIGITS); | |
3029 memcpy((char *)sms_mo->vp_abs.second, (char *)sm->scts.second, MAX_SCTP_DIGITS); | |
3030 sms_mo->vp_abs.timezone = sm->scts.timezone; | |
3031 | |
3032 TRACE_EVENT("Normal MO Message"); | |
3033 sms_mo->msg_len = sm->data.len; | |
3034 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
3035 /* SPR#2086 - SH - If we've got a WAP SMS, replace the message | |
3036 * with a string */ | |
3037 if (wap_sms) | |
3038 { | |
3039 char *message = "WAP SMS"; | |
3040 strcpy(sms_mt.sms_msg, message); | |
3041 sms_mt.msg_len = strlen(message); | |
3042 } | |
3043 else | |
3044 { | |
3045 #endif | |
3046 /* CQ:16780 clear the buffer before reading in the retrieved SMS, prevents residual characters | |
3047 from previous message being displayed. 15-01-04 MZ*/ | |
3048 | |
3049 memset(sms_mo->sms_msg, NULL, MAX_MSG_LEN_ARRAY); | |
3050 | |
3051 /*SPR 2260 if invalid message just set text to NULL*/ | |
3052 if (sm->stat != SMS_STAT_Invalid) | |
3053 memcpy(sms_mo->sms_msg, (char *)sm->data.data, sm->data.len); | |
3054 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
3055 } | |
3056 #endif | |
3057 sms_type = MFW_NO_MESSAGE; | |
3058 sms_signal(E_SMS_MO, sms_mo); | |
3059 } | |
3060 } | |
3061 //Feb 28, 2004 REF: CRR 28809 Deepa M.D | |
3062 //Deallocate the variable | |
3063 if(sms_mo!=NULL) | |
3064 { | |
3065 mfwFree((U8*)sms_mo, sizeof(T_MFW_SMS_MO)); | |
3066 sms_mo=NULL; | |
3067 } | |
3068 | |
3069 break; | |
3070 | |
3071 //x0pleela 30 Jan, 2006 DR: OMAPS00059261 | |
3072 //Store the status report message into sms_mt | |
3073 #ifndef NEPTUNE_BOARD | |
3074 case MFW_MSG_STATUS_REPORT://x0pleela 01 Feb, 2006 DR: OMAPS00059261 /* SMS type: STATUS REPORT */ | |
3075 { | |
3076 char sms_str[MAX_STAT_MSG_LEN]; | |
3077 TRACE_EVENT("Status report"); | |
3078 #ifdef NO_ASCIIZ | |
3079 memcpy(sms_mt.orig_addr.tag, | |
3080 sm->alpha.data, | |
3081 sm->alpha.len); | |
3082 sms_mt.orig_addr.len = sm->alpha.len; | |
3083 #else | |
3084 phb_Alpha2Gsm(&sm->alpha, (UBYTE *)sms_mt.orig_addr.tag); | |
3085 #endif | |
3086 if (sm->toa.ton == TON_International) | |
3087 sprintf(sms_mt.orig_addr.number, "+%s", sm->adress); | |
3088 else | |
3089 strcpy(sms_mt.orig_addr.number, sm->adress); | |
3090 | |
3091 sms_mt.orig_addr.ton = phb_cvtTon(sm->toa.ton); | |
3092 sms_mt.orig_addr.npi = (T_MFW_PHB_NPI)phb_cvtNpi(sm->toa.npi); | |
3093 | |
3094 if (sm->tosca.ton == TON_International) | |
3095 sprintf(sms_mt.sc_addr, "+%s", sm->sca); | |
3096 else | |
3097 strcpy(sms_mt.sc_addr, sm->sca); | |
3098 | |
3099 sms_mt.prot_id = (UBYTE)sm->pid; | |
3100 sms_mt.dcs = (UBYTE)sm->dcs & 0xFC; /* Ignore message class */ | |
3101 sms_mt.rp = sm->fo >> 7 & 1; | |
3102 | |
3103 // PATCH JPS 04.10 END | |
3104 /* SBH */ | |
3105 if (sm->dcs & 0x10) /* Bit 5 indicates that we should get message class from bits 0 & 1 */ | |
3106 { | |
3107 sms_mt.ti = sm->dcs & 3; | |
3108 } | |
3109 else /* Otherwise, set to default value */ | |
3110 { | |
3111 sms_mt.ti = 1; | |
3112 } | |
3113 /* SBH end */ | |
3114 | |
3115 TRACE_EVENT_P2("dcs: %d, ti: %d", sms_mt.dcs, sms_mt.ti); | |
3116 | |
3117 memcpy((char *)sms_mt.sctp.year, (char *)sm->scts.year, MAX_SCTP_DIGITS); | |
3118 memcpy((char *)sms_mt.sctp.month, (char *)sm->scts.month, MAX_SCTP_DIGITS); | |
3119 memcpy((char *)sms_mt.sctp.day, (char *)sm->scts.day, MAX_SCTP_DIGITS); | |
3120 memcpy((char *)sms_mt.sctp.hour, (char *)sm->scts.hour, MAX_SCTP_DIGITS); | |
3121 memcpy((char *)sms_mt.sctp.minute, (char *)sm->scts.minute, MAX_SCTP_DIGITS); | |
3122 memcpy((char *)sms_mt.sctp.second, (char *)sm->scts.second, MAX_SCTP_DIGITS); | |
3123 sms_mt.sctp.timezone = sm->scts.timezone; | |
3124 sms_mt.msg_len = sm->data.len; | |
3125 TRACE_EVENT_P2("msg_len %d, data.len %d", sms_mt.msg_len, sm->data.len); | |
3126 | |
3127 memset(sms_str, 0, MAX_STAT_MSG_LEN); | |
3128 memset(sms_mt.sms_msg, NULL, MAX_MSG_LEN_ARRAY); | |
3129 | |
3130 //x0pleela 01 Feb, 2006 DR: OMAPS00059261 | |
3131 //To display the message as "Delivered" or "Pending" as per the status | |
3132 TRACE_EVENT_P1("sm->stat: %d", sm->tp_status); | |
3133 //x0pleela 06 Feb, 2006 DR: OMAPS00059261 | |
3134 //To display the message as "Delivered" or "Pending" as per the tp_status | |
3135 if( !sm->tp_status ) | |
3136 { | |
3137 strcpy(sms_str, "Delivered:"); | |
3138 } | |
3139 else | |
3140 { | |
3141 strcpy(sms_str, "Pending:"); | |
3142 } | |
3143 strcat(sms_str, sm->adress); | |
3144 memcpy(sms_mt.sms_msg, sms_str, strlen(sms_str)); | |
3145 sms_mt.msg_len = strlen(sms_str); | |
3146 TRACE_EVENT_P2("sm->adress:%s, sms_str:%s ",sm->adress,sms_str); | |
3147 | |
3148 /*SPR 2260 end*/ | |
3149 sms_mt.udh_len = sm->udh.len; | |
3150 memcpy((char *)sms_mt.udh, (char *)sm->udh.data, sm->udh.len); | |
3151 sms_type = MFW_NO_MESSAGE; | |
3152 TRACE_EVENT("read=free1"); | |
3153 coll_sms_read = MFW_SMS_FREE; | |
3154 | |
3155 //x0pleela 08 Feb, 2006 DR: OMAPS00059261 | |
3156 //Replacing MT_STATUS_RPT with MFW_SMS_STATRPT as MT_STATUS_RPT is removed | |
3157 | |
3158 //x0pleela 30 Jan, 2006 DR: OMAPS00059261 | |
3159 //Store sms message type | |
3160 sms_mt.sms_msg_type = MFW_SMS_STATRPT; | |
3161 sms_mt.voicemail = FALSE; | |
3162 sms_signal(E_SMS_MT, &sms_mt); | |
3163 } | |
3164 break; | |
3165 #endif | |
3166 default: | |
3167 sms_signal(E_SMS_ERR, NULL); | |
3168 } | |
3169 } | |
3170 | |
3171 else | |
3172 { TRACE_EVENT("rAT_plusCMGR: SMS pointer error"); | |
3173 | |
3174 } | |
3175 } | |
3176 break; | |
3177 | |
3178 case MFW_CB_MESSAGE: | |
3179 if (cbm != NULL) /*SPR2260 make sure we have a valid pointer*/ | |
3180 { | |
3181 sms_cb.sn = cbm->sn; | |
3182 sms_cb.msg_id = cbm->mid; | |
3183 sms_cb.dcs = cbm->dcs; | |
3184 sms_cb.page = cbm->page; | |
3185 sms_cb.pages = cbm->pages; | |
3186 sms_cb.msg_len = cbm->data.len; | |
3187 memcpy((char *)sms_cb.cb_msg, (char *)cbm->data.data, cbm->data.len); | |
3188 | |
3189 /* send cell broadcast message event */ | |
3190 sms_type = MFW_NO_MESSAGE; | |
3191 sms_signal(E_SMS_CB, &sms_cb); | |
3192 } | |
3193 else | |
3194 TRACE_EVENT("rAT_plusCMGR: SMS CB pointer error"); | |
3195 break; | |
3196 | |
3197 case MFW_NO_MESSAGE: | |
3198 TRACE_EVENT("read=free no msg"); | |
3199 coll_sms_read = MFW_SMS_FREE; | |
3200 if(coll_sms_read EQ MFW_SMS_WAIT) | |
3201 coll_sms_read = MFW_SMS_FREE; | |
3202 break; | |
3203 } | |
3204 | |
3205 sms_check_mt_update(); | |
3206 | |
3207 { | |
3208 TRACE_EVENT_P4("CMGR Msg table: %d,%d,%d, %d", msg_info[0].index, msg_info[1].index,msg_info[2].index,msg_info[3].index); | |
3209 TRACE_EVENT_P4("CMGR Msg table: %d,%d,%d, %d", msg_info[4].index, msg_info[5].index,msg_info[6].index,msg_info[7].index); | |
3210 } | |
3211 } | |
3212 | |
3213 /* | |
3214 +--------------------------------------------------------------------+ | |
3215 | PROJECT : GSM-PS (6147) MODULE : MFW_SMS | | |
3216 | STATE : code ROUTINE : rAT_PlusCMGD | | |
3217 +--------------------------------------------------------------------+ | |
3218 | |
3219 PURPOSE : | |
3220 */ | |
3221 GLOBAL void rAT_PlusCMGD () | |
3222 { | |
3223 TRACE_FUNCTION ("rAT_PlusCMGD"); | |
3224 //July 7, 2005 REF: CRR MMI-SPR-32179 x0018858 | |
3225 //Clears the incompleted message buffers. | |
3226 #ifndef NEPTUNE_BOARD //a0876501 - Shashi - Guarded the below function call for Neptune. | |
3227 concSMS_clearIncompleteMsg(); | |
3228 #endif | |
3229 } | |
3230 | |
3231 | |
3232 /* | |
3233 +--------------------------------------------------------------------+ | |
3234 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
3235 | STATE : code ROUTINE : sms_store | | |
3236 +--------------------------------------------------------------------+ | |
3237 | |
3238 PURPOSE : Save a short message. | |
3239 | |
3240 GW 09/10/01 - Modified code to always save the maximum message length | |
3241 */ | |
3242 #ifdef NO_ASCIIZ | |
3243 T_MFW sms_store(T_MFW_SMS_MO_TYPE type, | |
3244 CHAR *addr, | |
3245 UBYTE *msg, | |
3246 USHORT msg_len, | |
3247 CHAR *sca) | |
3248 #else | |
3249 T_MFW sms_store(T_MFW_SMS_MO_TYPE type, | |
3250 CHAR *addr, | |
3251 UBYTE *msg, | |
3252 USHORT msg_len, | |
3253 CHAR *sca) | |
3254 // sbh - added length to the above definition, since '@' characters stored as NULL & will stop | |
3255 // strlen from working properly. | |
3256 #endif | |
3257 { | |
3258 | |
3259 T_SM_DATA_EXT conc_data_ext; | |
3260 | |
3261 SHORT rp; | |
3262 | |
3263 | |
3264 TRACE_FUNCTION ("sms_store()"); | |
3265 | |
3266 | |
3267 /* check whether memory is full */ | |
3268 if (memory.used == memory.total) | |
3269 { | |
3270 sms_signal(E_SMS_MEM_FULL, 0); | |
3271 return MFW_SMS_FAIL; | |
3272 } | |
3273 | |
3274 if (type == MFW_SMS_REPLY OR | |
3275 type == MFW_SMS_REPLY_SENT ) | |
3276 rp = 0; /* reply path = 0 */ | |
3277 else | |
3278 rp = -1; /* reply path = default */ | |
3279 | |
3280 | |
3281 conc_data_ext.len = msg_len; | |
3282 conc_data_ext.data = msg; | |
3283 | |
3284 | |
3285 if (type == MFW_SMS_REPLY_SENT OR | |
3286 type == MFW_SMS_SUBMIT_SENT ) | |
3287 sentStatus = SMS_STAT_StoSent; | |
3288 else | |
3289 sentStatus = SMS_STAT_StoUnsent; | |
3290 | |
3291 | |
3292 if (sAT_PlusCMGW(CMD_SRC_LCL, 0, addr, NULL, /* => addr analysed by ACI */ | |
3293 sentStatus, 0xFF, /* unknown message reference */ | |
3294 &conc_data_ext, sca, | |
3295 NULL, rp) NEQ AT_EXCT) | |
3296 | |
3297 { | |
3298 TRACE_EVENT("sAT_PlusCMGW error"); | |
3299 return MFW_SMS_FAIL; | |
3300 } | |
3301 | |
3302 wr_addr = addr; | |
3303 sms_type = MFW_WR_NEW_MESSAGE; | |
3304 return MFW_SMS_OK; | |
3305 } | |
3306 | |
3307 | |
3308 | |
3309 | |
3310 /* | |
3311 +--------------------------------------------------------------------+ | |
3312 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
3313 | STATE : code ROUTINE : sms_mt_store | | |
3314 +--------------------------------------------------------------------+ | |
3315 | |
3316 PURPOSE : Save a MT message. | |
3317 | |
3318 */ | |
3319 | |
3320 T_MFW sms_mt_store(T_MFW_SMS_MT *mt_msg, T_MFW_SMS_STAT stat) | |
3321 { | |
3322 | |
3323 T_SM_DATA_EXT conc_data_ext; | |
3324 T_ACI_TOA toa; | |
3325 | |
3326 TRACE_FUNCTION ("sms_mt_store()"); | |
3327 | |
3328 /* check whether memory is full */ | |
3329 if (memory.used == memory.total) | |
3330 { | |
3331 sms_signal(E_SMS_MEM_FULL, 0); | |
3332 return MFW_SMS_FAIL; | |
3333 } | |
3334 | |
3335 | |
3336 conc_data_ext.len = mt_msg->msg_len; | |
3337 conc_data_ext.data = (UBYTE *)mt_msg->sms_msg; | |
3338 | |
3339 | |
3340 toa.ton = phb_ncvtTon(mt_msg->orig_addr.ton); | |
3341 toa.npi = phb_ncvtNpi((T_ACI_TOA_NPI)mt_msg->orig_addr.npi); | |
3342 | |
3343 | |
3344 if (sAT_PlusCMGW(CMD_SRC_LCL, 0, mt_msg->orig_addr.number, | |
3345 &toa, sms_codeStatus(stat), 0, /* no message reference */ | |
3346 &conc_data_ext, | |
3347 mt_msg->sc_addr, NULL, -1) NEQ AT_EXCT) | |
3348 | |
3349 { | |
3350 TRACE_EVENT("sAT_PlusCMGW error"); | |
3351 return MFW_SMS_FAIL; | |
3352 } | |
3353 | |
3354 sms_type = MFW_WR_NEW_MESSAGE; | |
3355 return MFW_SMS_OK; | |
3356 } | |
3357 | |
3358 | |
3359 /* | |
3360 +--------------------------------------------------------------------+ | |
3361 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
3362 | STATE : code ROUTINE: sms_change | | |
3363 +--------------------------------------------------------------------+ | |
3364 | |
3365 | |
3366 PURPOSE : Save a changed short message. | |
3367 | |
3368 GW 09/10/01 - Copy entire message length. | |
3369 | |
3370 */ | |
3371 | |
3372 #ifdef NO_ASCIIZ | |
3373 T_MFW sms_change(CHAR *addr, UBYTE *msg, | |
3374 USHORT msg_len, UBYTE index) | |
3375 #else | |
3376 T_MFW sms_change(CHAR *addr, USHORT *msg, USHORT msg_len, UBYTE index) | |
3377 // sbh - added length to the above function call, since '@' characters stored as NULL & will stop | |
3378 // strlen from working properly. | |
3379 #endif | |
3380 { | |
3381 | |
3382 T_SM_DATA_EXT conc_data_ext; | |
3383 | |
3384 | |
3385 TRACE_FUNCTION ("sms_change()"); | |
3386 | |
3387 | |
3388 conc_data_ext.len = msg_len; | |
3389 conc_data_ext.data = (UBYTE *)msg; | |
3390 if (sAT_PlusCMGW(CMD_SRC_LCL, index, addr, NULL, | |
3391 SMS_STAT_StoUnsent, 0xFF, /* message reference */ | |
3392 &conc_data_ext, | |
3393 NULL, NULL, -1) NEQ AT_EXCT) | |
3394 return MFW_SMS_FAIL; | |
3395 | |
3396 | |
3397 | |
3398 sms_type = MFW_WR_CHG_MESSAGE; | |
3399 return MFW_SMS_OK; | |
3400 } | |
3401 | |
3402 | |
3403 /* | |
3404 +--------------------------------------------------------------------+ | |
3405 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
3406 | STATE : code ROUTINE: rAT_PlusCMGW | | |
3407 +--------------------------------------------------------------------+ | |
3408 | |
3409 | |
3410 PURPOSE : Call back for saving a short message. | |
3411 | |
3412 */ | |
3413 | |
3414 void rAT_PlusCMGW(UBYTE index, UBYTE numSeg) | |
3415 { | |
3416 int i; | |
3417 T_MFW_PHB_ENTRY phb_entry; | |
3418 T_MFW_PHB_LIST phb_list; | |
3419 SHORT phb_index; | |
3420 #ifdef NO_ASCIIZ | |
3421 T_MFW_PHB_TEXT findText; | |
3422 #endif | |
3423 | |
3424 TRACE_FUNCTION ("rAT_PlusCMGW()"); | |
3425 TRACE_EVENT_P2("Index: %d, numseg: %d", index, numSeg); | |
3426 | |
3427 memset(&phb_entry, 0, sizeof(phb_entry)); | |
3428 memset(&phb_list, 0, sizeof(phb_list)); | |
3429 phb_list.entry = &phb_entry; | |
3430 | |
3431 if (sms_type == MFW_WR_NEW_MESSAGE) | |
3432 { | |
3433 #ifdef FF_MMI_SMS_DYNAMIC | |
3434 for (i=0; i<g_max_messages; i++) | |
3435 #else | |
3436 for (i=0; i<MAX_MESSAGES; i++) | |
3437 #endif | |
3438 { | |
3439 if (msg_info[i].index == -1) | |
3440 break; | |
3441 } | |
3442 #ifdef FF_MMI_SMS_DYNAMIC | |
3443 if (i < g_max_messages) | |
3444 #else | |
3445 if (i < MAX_MESSAGES) | |
3446 #endif | |
3447 { | |
3448 msg_info[i].index = index; | |
3449 strncpy (msg_info[i].addr.number, wr_addr, MFW_NUM_LEN-1); | |
3450 msg_info[i].addr.number[MFW_NUM_LEN-1] = 0; | |
3451 /* search the name in phonebook */ | |
3452 #ifdef NO_ASCIIZ | |
3453 strcpy((char *)findText.data, wr_addr); | |
3454 findText.len = strlen(wr_addr); | |
3455 if (phb_find_entries (PHB_ADN, &phb_index, | |
3456 MFW_PHB_NUMBER, | |
3457 1, &findText, | |
3458 &phb_list) EQ MFW_PHB_OK) | |
3459 { | |
3460 if (phb_list.num_entries == 1) | |
3461 { | |
3462 memcpy((char *)msg_info[i].addr.tag, | |
3463 (char *)phb_list.entry->name.data, | |
3464 phb_list.entry->name.len); | |
3465 msg_info[i].addr.len = phb_list.entry->name.len; | |
3466 } | |
3467 } | |
3468 #else | |
3469 if (phb_find_entries (PHB_ADN, &phb_index, | |
3470 MFW_PHB_NUMBER, | |
3471 1, (CHAR *)wr_addr, | |
3472 &phb_list) EQ MFW_PHB_OK) | |
3473 { | |
3474 if (phb_list.num_entries == 1) | |
3475 { | |
3476 strcpy((char *)msg_info[i].addr.tag, (char *)phb_list.entry->name); | |
3477 } | |
3478 } | |
3479 #endif | |
3480 | |
3481 if (sentStatus EQ SMS_STAT_StoUnsent) | |
3482 msg_info[i].stat = MFW_SMS_STOR_UNSENT; | |
3483 else | |
3484 msg_info[i].stat = MFW_SMS_STOR_SENT; | |
3485 /*SPR 2260, we're making the assumption that only complete concat SMSs or single SMSs | |
3486 can be saved successfully*/ | |
3487 if (numSeg == 1) | |
3488 msg_info[i].concat_status = MFW_SMS_NO_CONC; | |
3489 else | |
3490 msg_info[i].concat_status = MFW_SMS_CONC_WHOLE; | |
3491 | |
3492 msg_info[i].first_index = index;/*SPR 2260*/ | |
3493 msg_info[i].msg_type = MFW_SMS_NotVOICE; // ??? | |
3494 memory.used +=numSeg;/*SPR2260*/ | |
3495 } | |
3496 } | |
3497 /*SPR 2260*/ | |
3498 TRACE_EVENT_P2("memory used is = %d, of %d", memory.used, memory.total); | |
3499 if(memory.total == memory.used) | |
3500 { | |
3501 | |
3502 sms_signal(E_SMS_MEM_FULL, NULL); | |
3503 } | |
3504 sms_type = MFW_NO_MESSAGE; | |
3505 | |
3506 sms_check_mt_update(); | |
3507 | |
3508 sms_signal(E_SMS_SAVE_AVAIL, &index); | |
3509 } | |
3510 | |
3511 | |
3512 /* | |
3513 +--------------------------------------------------------------------+ | |
3514 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
3515 | STATE : code ROUTINE: sms_msg_delete | | |
3516 +--------------------------------------------------------------------+ | |
3517 | |
3518 | |
3519 PURPOSE : Delete a short message. | |
3520 | |
3521 */ | |
3522 | |
3523 T_MFW sms_msg_delete(UBYTE index) | |
3524 { | |
3525 TRACE_FUNCTION ("sms_msg_delete()"); | |
3526 | |
3527 coll_sms_delete = MFW_SMS_WAIT; | |
3528 | |
3529 #ifdef FF_2TO1_PS | |
3530 if (sAT_PlusCMGD(CMD_SRC_LCL, index, MNSMS_CMGD_DEL_INDEX) NEQ AT_EXCT) | |
3531 #else | |
3532 /* a0876501 (Shashi), 08-Nov-2005, OMAPS00050772. | |
3533 Added new parameter to be passed (3rd Parameter is set to 0). */ | |
3534 if (sAT_PlusCMGD(CMD_SRC_LCL, index,0) NEQ AT_EXCT) | |
3535 #endif | |
3536 return MFW_SMS_FAIL; | |
3537 /*MC*/ | |
3538 deleting_index = index; | |
3539 return MFW_SMS_OK; | |
3540 } | |
3541 | |
3542 /* | |
3543 +--------------------------------------------------------------------+ | |
3544 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
3545 | STATE : code ROUTINE: sms_ok_change | | |
3546 +--------------------------------------------------------------------+ | |
3547 | |
3548 PURPOSE : Call back for the status change of a short message.form | |
3549 UNREAD to READ | |
3550 | |
3551 */ | |
3552 | |
3553 void sms_ok_change() | |
3554 { | |
3555 | |
3556 | |
3557 | |
3558 // Dec 23, 2004 REF: CRR MMI-SPR-27741 xkundadu | |
3559 // Issue description: BMI: crashing when using the function : sms_index_list() located in mfw | |
3560 // Solution: Changed the msg_list variable to array of T_MFW_SMS_IDX. | |
3561 | |
3562 // May 27, 2005 MMI-FIX-29869 x0018858 - Modified from static to dynamic variable | |
3563 #ifdef FF_MMI_SMS_DYNAMIC | |
3564 T_MFW_SMS_IDX* msg_list; | |
3565 #else | |
3566 T_MFW_SMS_IDX msg_list[MAX_MESSAGES]; | |
3567 #endif | |
3568 int noOfVMSMS = 0; // stores number of VM sms | |
3569 int i; | |
3570 // May 27, 2005 MMI-FIX-29869 x0018858 - Modified from static to dynamic variable | |
3571 #ifdef FF_MMI_SMS_DYNAMIC | |
3572 msg_list = (T_MFW_SMS_IDX*)ALLOC_MEMORY(g_max_messages*sizeof(T_MFW_SMS_IDX)); | |
3573 #endif | |
3574 | |
3575 TRACE_FUNCTION ("sms_ok_change()"); | |
3576 | |
3577 /* Marcus: Issue 2260: 03/10/2002: Start */ | |
3578 if (cmgr_awaiting_ok == TRUE) | |
3579 { | |
3580 cmgr_awaiting_ok = FALSE; | |
3581 /* Marcus: Issue 2260: 03/10/2002: End */ | |
3582 | |
3583 if (fg) | |
3584 { | |
3585 fg = 0; | |
3586 sms_update_msg_info(MFW_SMS_READ); | |
3587 sms_signal(E_SMS_OK, 0); | |
3588 } | |
3589 | |
3590 sms_check_mt_update(); | |
3591 | |
3592 | |
3593 // Dec 23, 2004 REF: CRR MMI-SPR-27741 xkundadu | |
3594 // Issue description: BMI: crashing when using the function : sms_index_list() located in mfw | |
3595 // Solution: Changed the msg_list variable to array of T_MFW_SMS_IDX. | |
3596 #ifdef FF_MMI_SMS_DYNAMIC | |
3597 noOfVMSMS = sms_index_list(MFW_SMS_VOICE, msg_list, g_max_messages) ; | |
3598 #else | |
3599 noOfVMSMS = sms_index_list(MFW_SMS_VOICE, msg_list, MAX_MESSAGES) ; | |
3600 #endif | |
3601 TRACE_EVENT_P1("No of VM sms:%d", noOfVMSMS); | |
3602 // Checking the number of VM sms. | |
3603 if( noOfVMSMS > 0) | |
3604 { | |
3605 //Delete the vm sms which is read. | |
3606 for(i=0;i<noOfVMSMS;i++) | |
3607 { | |
3608 //Find out the VM sms which is already read and delete it. | |
3609 if(msg_list[i].stat == MFW_SMS_READ) | |
3610 { | |
3611 sms_msg_delete(msg_list[i].index); | |
3612 break; | |
3613 } | |
3614 } | |
3615 } | |
3616 | |
3617 /* Marcus: Issue 2260: 03/10/2002: Start */ | |
3618 } | |
3619 else | |
3620 { | |
3621 TRACE_EVENT("Ignoring unexpected OK"); | |
3622 } | |
3623 #ifdef FF_MMI_SMS_DYNAMIC | |
3624 // May 27, 2005 MMI-FIX-29869 x0018858 - Freeing the memory. | |
3625 FREE_MEMORY((U8*)msg_list, g_max_messages*sizeof(T_MFW_SMS_IDX)); | |
3626 #endif | |
3627 /* Marcus: Issue 2260: 03/10/2002: End */ | |
3628 } | |
3629 | |
3630 /* | |
3631 +--------------------------------------------------------------------+ | |
3632 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
3633 | STATE : code ROUTINE: sms_ok_delete | | |
3634 +--------------------------------------------------------------------+ | |
3635 | |
3636 | |
3637 PURPOSE : Call back for deleting a short message. | |
3638 | |
3639 */ | |
3640 | |
3641 void sms_ok_delete() | |
3642 { | |
3643 | |
3644 TRACE_FUNCTION ("sms_ok_delete()"); | |
3645 /*SPR2530, moved flag claering code here from delete_sms_from_table*/ | |
3646 | |
3647 if(coll_sms_delete EQ MFW_SMS_WAIT) | |
3648 coll_sms_delete = MFW_SMS_FREE; | |
3649 /*SPR 1833, replaces section of code with function call*/ | |
3650 if (delete_sms_from_table (deleting_index)) | |
3651 { | |
3652 deleting_index = -1; /*Hope this fixes multiple deletions*/ | |
3653 /*SPR 2260, we have to request the SMS storage status to update memory.used*/ | |
3654 /*as we have no idea how many segments the deleted SMS had*/ | |
3655 int_req = POST_DELETE_CHECK;/*update memory variable, don't send an event to MMI*/ | |
3656 | |
3657 /* cq16875 If the SIM Entity is busy then don't send an E_SmS_OK event to the MMI | |
3658 12-02-04 MZ.*/ | |
3659 if(AT_BUSY != qAT_PlusCPMS(CMD_SRC_LCL)) | |
3660 sms_signal(E_SMS_OK, 0); | |
3661 | |
3662 sms_signal(E_SMS_MEM_FREE, 0); | |
3663 | |
3664 sms_check_mt_update(); | |
3665 } | |
3666 { | |
3667 TRACE_EVENT_P4("CMGD Msg table: %d,%d,%d, %d", msg_info[0].index, msg_info[1].index,msg_info[2].index,msg_info[3].index); | |
3668 TRACE_EVENT_P4("CMGD Msg table: %d,%d,%d, %d", msg_info[4].index, msg_info[5].index,msg_info[6].index,msg_info[7].index); | |
3669 } | |
3670 } | |
3671 /* | |
3672 +--------------------------------------------------------------------+ | |
3673 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
3674 | STATE : code ROUTINE: delete_sms_from_table | | |
3675 +--------------------------------------------------------------------+ | |
3676 | |
3677 | |
3678 PURPOSE : deletes a message from the MFW message table | |
3679 created for SPR2260 | |
3680 | |
3681 */ | |
3682 | |
3683 BOOL delete_sms_from_table (SHORT index) | |
3684 { | |
3685 int i; | |
3686 | |
3687 TRACE_FUNCTION ("delete_sms_from_table()"); | |
3688 | |
3689 /*SPR2530, removed flag clearing code*/ | |
3690 #ifdef FF_MMI_SMS_DYNAMIC | |
3691 for (i=0; i<g_max_messages; i++) | |
3692 #else | |
3693 for (i=0; i<MAX_MESSAGES; i++) | |
3694 #endif | |
3695 { | |
3696 if (msg_info[i].index == index) | |
3697 { | |
3698 msg_info[i].index = -1; | |
3699 msg_info[i].stat = MFW_SMS_UNKNOWN; | |
3700 msg_info[i].msg_type = MFW_SMS_UNKNOWN; | |
3701 msg_info[i].addr.number[0] = '\0'; | |
3702 msg_info[i].addr.tag[0] = '\0'; | |
3703 msg_info[i].addr.ton = MFW_TON_UNKNOWN; | |
3704 msg_info[i].addr.npi = MFW_NPI_UNKNOWN; | |
3705 /*SPR 2260, reset new elements*/ | |
3706 msg_info[i].first_index = -1; | |
3707 msg_info[i].concat_status = MFW_SMS_NO_CONC; | |
3708 return TRUE; | |
3709 } | |
3710 } | |
3711 | |
3712 return FALSE; | |
3713 } | |
3714 /* | |
3715 +--------------------------------------------------------------------+ | |
3716 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
3717 | STATE : code ROUTINE: sms_command | | |
3718 +--------------------------------------------------------------------+ | |
3719 | |
3720 | |
3721 PURPOSE : Send a mobile originated short massage command. | |
3722 | |
3723 */ | |
3724 | |
3725 T_MFW sms_command(CHAR *dest_addr, UBYTE command, UBYTE msg_ref) | |
3726 { | |
3727 TRACE_FUNCTION ("sms_command()"); | |
3728 | |
3729 switch (command) | |
3730 { | |
3731 case SMS_ENQ_PREV_SMS: | |
3732 if (sAT_PlusCMGC(CMD_SRC_LCL, | |
3733 0x22, // SMS command with Status Report Request | |
3734 0x00, // Command Type | |
3735 0x00, // Protocol Identifier | |
3736 msg_ref, // message reference of previous SMS | |
3737 dest_addr, // destination address | |
3738 NULL, // type of destination address | |
3739 NULL) // command data | |
3740 NEQ AT_EXCT) | |
3741 return MFW_SMS_FAIL; | |
3742 break; | |
3743 | |
3744 case SMS_CAN_STAT_REQ: | |
3745 if (sAT_PlusCMGC(CMD_SRC_LCL, | |
3746 0x02, // SMS command without Status Report Request | |
3747 0x01, // Command Type | |
3748 0x00, // Protocol Identifier | |
3749 msg_ref, // message reference of previous SMS | |
3750 dest_addr, // destination address | |
3751 NULL, // type of destination address | |
3752 NULL) // command data | |
3753 NEQ AT_EXCT) | |
3754 return MFW_SMS_FAIL; | |
3755 break; | |
3756 | |
3757 case SMS_DEL_PREV_SMS: | |
3758 if (sAT_PlusCMGC(CMD_SRC_LCL, | |
3759 0x02, // SMS command without Status Report Request | |
3760 0x02, // Command Type | |
3761 0x00, // Protocol Identifier | |
3762 msg_ref, // message reference of previous SMS | |
3763 dest_addr, // destination address | |
3764 NULL, // type of destination address | |
3765 NULL) // command data | |
3766 NEQ AT_EXCT) | |
3767 return MFW_SMS_FAIL; | |
3768 break; | |
3769 | |
3770 case SMS_REQ_STAT_REP: | |
3771 if (sAT_PlusCMGC(CMD_SRC_LCL, | |
3772 0x02, // SMS command without Status Report Request | |
3773 0x03, // Command Type | |
3774 0x00, // Protocol Identifier | |
3775 msg_ref, // message reference of previous SMS | |
3776 dest_addr, // destination address | |
3777 NULL, // type of destination address | |
3778 NULL) // command data | |
3779 NEQ AT_EXCT) | |
3780 return MFW_SMS_FAIL; | |
3781 break; | |
3782 default: | |
3783 /* | |
3784 * non-supported command type | |
3785 */ | |
3786 return MFW_SMS_FAIL; | |
3787 } | |
3788 return MFW_SMS_OK; | |
3789 } | |
3790 | |
3791 /* | |
3792 +-------------------------------------------------------------------------------+ | |
3793 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
3794 | STATE : code ROUTINE: sms_set_SrvCntr_number | | |
3795 +-------------------------------------------------------------------------------+ | |
3796 | |
3797 PURPOSE : MMI sets the Service Center Number on the SIM | |
3798 | |
3799 */ | |
3800 | |
3801 T_MFW sms_set_SrvCntr_number(T_MFW_SMS_INFO *sms_info) | |
3802 { | |
3803 T_ACI_RETURN res; | |
3804 | |
3805 TRACE_FUNCTION ("sms_set_SrvCntr_Nmbr_parameter()"); | |
3806 | |
3807 | |
3808 if(sms_info == 0) | |
3809 return MFW_SMS_FAIL; | |
3810 | |
3811 if (sAT_PlusCSCA(CMD_SRC_LCL, (char *)sms_info->sc_addr, 0) NEQ AT_CMPL) | |
3812 return MFW_SMS_FAIL; | |
3813 /* Send text mode parameters to ACI */ | |
3814 | |
3815 | |
3816 if (sAT_PlusCSMP(CMD_SRC_LCL, ACI_NumParmNotPresent, ACI_NumParmNotPresent, | |
3817 NULL, NULL, ACI_NumParmNotPresent, | |
3818 ACI_NumParmNotPresent) NEQ AT_CMPL) | |
3819 return MFW_SMS_FAIL; | |
3820 | |
3821 res = sAT_PlusCSAS(CMD_SRC_LCL, (SHORT) 1); | |
3822 switch (res) | |
3823 { | |
3824 case AT_FAIL: | |
3825 return MFW_SMS_FAIL; | |
3826 case AT_CMPL: | |
3827 sms_signal(E_SMS_OK, 0); | |
3828 return MFW_SMS_OK; | |
3829 case AT_EXCT: | |
3830 return MFW_SMS_OK; | |
3831 default: | |
3832 return MFW_SMS_FAIL; | |
3833 } | |
3834 | |
3835 return MFW_SMS_OK; | |
3836 } | |
3837 | |
3838 /* | |
3839 +-------------------------------------------------------------------------------+ | |
3840 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
3841 | STATE : code ROUTINE: sms_set_dcs_number | | |
3842 +-------------------------------------------------------------------------------+ | |
3843 | |
3844 PURPOSE : MMI sends the dcs data to the sim (control 7bit ascii (compressed), | |
3845 8bit or 16bit (unicode) uncompressed data | |
3846 | |
3847 | |
3848 */ | |
3849 T_MFW sms_set_dcs_number(T_MFW_SMS_INFO *sms_info) | |
3850 { | |
3851 | |
3852 TRACE_FUNCTION ("sms_set_dcs_parameter()"); | |
3853 | |
3854 | |
3855 if(sms_info == 0) | |
3856 return MFW_SMS_FAIL; | |
3857 | |
3858 | |
3859 if (sAT_PlusCSMP(CMD_SRC_LCL, ACI_NumParmNotPresent, ACI_NumParmNotPresent, | |
3860 NULL, NULL, ACI_NumParmNotPresent, | |
3861 sms_info->dcs ) NEQ AT_CMPL) | |
3862 return MFW_SMS_FAIL; | |
3863 | |
3864 return MFW_SMS_OK; | |
3865 } | |
3866 | |
3867 | |
3868 /* | |
3869 +-------------------------------------------------------------------------------+ | |
3870 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
3871 | STATE : code ROUTINE: sms_set_val_period | | |
3872 +-------------------------------------------------------------------------------+ | |
3873 | |
3874 PURPOSE : MMI sends the Validity Period to the ACI | |
3875 | |
3876 | |
3877 */ | |
3878 T_MFW sms_set_val_period(T_MFW_SMS_INFO *sms_info) | |
3879 { | |
3880 | |
3881 TRACE_FUNCTION ("sms_set_val_period()"); | |
3882 | |
3883 if(sms_info == 0) | |
3884 return MFW_SMS_FAIL; | |
3885 | |
3886 /*Jan 20, 2006 REF: DRT OMAPS00053377 xdeepadh | |
3887 MMI supports only the relative validity period format. | |
3888 Hence, set the validity period format to relative for all the cases*/ | |
3889 if ((sms_info->vp_mode EQ SMS_VPF_NUMERICAL) ||(sms_info->vp_mode EQ SMS_VPF_STRING) ||(sms_info->vp_mode EQ SMS_VPF_NOTPRESENT)) | |
3890 { | |
3891 | |
3892 TRACE_EVENT_P1("sms_info->vp_mode %d",sms_info->vp_mode); | |
3893 TRACE_EVENT("MMI supports only the relative validity period format "); | |
3894 | |
3895 /*Set the TP-Validity-Period-Format (TP-VPF) bits to relative format */ | |
3896 sms_info->first_oct = sms_info->first_oct | 0x10 ; | |
3897 | |
3898 } | |
3899 | |
3900 TRACE_EVENT_P1("first_oct is %d",sms_info->first_oct); | |
3901 | |
3902 //Send text mode parameters to ACI | |
3903 if (sAT_PlusCSMP(CMD_SRC_LCL, sms_info->first_oct, sms_info->vp_rel, | |
3904 NULL, NULL, ACI_NumParmNotPresent, | |
3905 ACI_NumParmNotPresent) NEQ AT_CMPL) | |
3906 return MFW_SMS_FAIL; | |
3907 | |
3908 return MFW_SMS_OK; | |
3909 } | |
3910 | |
3911 //Feb 22, 2006 DR:OMAPS00068268 x0035544 | |
3912 BOOL Sms_Check_PID(SHORT pid) | |
3913 { | |
3914 TRACE_FUNCTION("Sms_Check_PID()"); | |
3915 | |
3916 if(pid & BIT_7) | |
3917 { | |
3918 if(!(pid & BIT_6)) // Bit 7 = 1 and Bit 6 = 0 | |
3919 return TRUE; | |
3920 } | |
3921 else | |
3922 { | |
3923 if(pid & BIT_6) // Bit 7 = 0 and Bit 6 = 1, Bits 5...0 some values are reserved | |
3924 { | |
3925 if(((pid >= 0x48) AND (pid <= 0x5E)) OR | |
3926 ((pid >= 0x60) AND (pid <= 0x7B))) | |
3927 return TRUE; | |
3928 } | |
3929 else | |
3930 { | |
3931 if(pid & BIT_5) // Bit 7 = 0, Bit 6 = 0 and Bit 5 = 1, Bits 4...0 some values are reserved | |
3932 { | |
3933 if((pid EQ 0x2E) OR (pid EQ 0x2F) OR | |
3934 ((pid >= 0x33) AND (pid <= 0x37))) | |
3935 return TRUE; | |
3936 } | |
3937 } | |
3938 } | |
3939 | |
3940 return FALSE; | |
3941 } | |
3942 | |
3943 | |
3944 /* | |
3945 +--------------------------------------------------------------------+ | |
3946 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
3947 | STATE : code ROUTINE: sms_parameter | | |
3948 +--------------------------------------------------------------------+ | |
3949 | |
3950 | |
3951 PURPOSE : MMI sets SMS parameters. | |
3952 | |
3953 */ | |
3954 | |
3955 | |
3956 T_MFW sms_parameter(T_MFW_SMS_INFO *sms_info, BOOL fGet) | |
3957 { | |
3958 T_ACI_TOA sc_typ; | |
3959 | |
3960 CHAR sca[MAX_LEN]; | |
3961 SHORT first_oct; | |
3962 | |
3963 SHORT vprel; | |
3964 T_ACI_VP_ABS vpabs; | |
3965 SHORT pid; | |
3966 SHORT dcs; | |
3967 T_ACI_RETURN res; | |
3968 //x0035544 Feb 22, 2006 DR:OMAPS00068268 | |
3969 BOOL PIDReserved; | |
3970 | |
3971 TRACE_FUNCTION ("sms_parameter()"); | |
3972 | |
3973 if(sms_info == 0) | |
3974 return MFW_SMS_FAIL; | |
3975 | |
3976 if(fGet) { | |
3977 | |
3978 memset(sms_info, 0, sizeof(T_MFW_SMS_INFO)); | |
3979 | |
3980 if (qAT_PlusCSCA(CMD_SRC_LCL, | |
3981 sca, | |
3982 &sc_typ) EQ AT_FAIL | |
3983 OR qAT_PlusCSMP(CMD_SRC_LCL, | |
3984 &first_oct, | |
3985 &vprel, | |
3986 &vpabs, | |
3987 NULL, | |
3988 &pid, | |
3989 &dcs ) EQ AT_FAIL) | |
3990 { | |
3991 | |
3992 return MFW_SMS_FAIL; | |
3993 } | |
3994 | |
3995 if (sc_typ.ton == TON_International) | |
3996 sprintf(sms_info->sc_addr, "+%s", sca); | |
3997 else | |
3998 strcpy((char *)sms_info->sc_addr, (char *)sca); | |
3999 //x0035544 Feb 22, 2006 DR:OMAPS00068268 | |
4000 PIDReserved = Sms_Check_PID(pid); | |
4001 /* If pid value falls in to any of Reserved category then set it to 0 */ | |
4002 if(PIDReserved) | |
4003 pid = 0; | |
4004 sms_info->prot_id = pid; | |
4005 sms_info->dcs = dcs; | |
4006 sms_info->vp_rel = (UBYTE)vprel; | |
4007 memcpy(&sms_info->vp_abs, &vpabs, sizeof(T_MFW_SMS_SCTP)); | |
4008 | |
4009 if ((first_oct & 0x18) EQ 0x10) | |
4010 sms_info->vp_mode = SMS_VPF_NUMERICAL; | |
4011 if ((first_oct & 0x18) EQ 0x18) | |
4012 sms_info->vp_mode = SMS_VPF_STRING; | |
4013 if ((first_oct & 0x18) EQ 0x00) | |
4014 sms_info->vp_mode = SMS_VPF_NOTPRESENT; | |
4015 | |
4016 sms_info->rd = first_oct >> 2 & 1; | |
4017 sms_info->rp = first_oct >> 7 & 1; | |
4018 sms_info->srr = first_oct >> 5 & 1; | |
4019 /*Jan 20, 2006 REF: DRT OMAPS00053377 xdeepadh | |
4020 Store the first octet details in the structure.*/ | |
4021 sms_info->first_oct = first_oct; | |
4022 | |
4023 } else { | |
4024 | |
4025 if (sAT_PlusCSCA(CMD_SRC_LCL, (char *)sms_info->sc_addr, 0) NEQ AT_CMPL) | |
4026 { | |
4027 return MFW_SMS_FAIL; | |
4028 } | |
4029 /* Send text mode parameters to ACI */ | |
4030 if (sms_info->vp_mode EQ SMS_VPF_NUMERICAL) | |
4031 first_oct = 0x11; | |
4032 if (sms_info->vp_mode EQ SMS_VPF_STRING) | |
4033 first_oct = 0x19; | |
4034 if (sms_info->vp_mode EQ SMS_VPF_NOTPRESENT) | |
4035 first_oct = 0x01; | |
4036 | |
4037 first_oct |= sms_info->rd << 2; | |
4038 first_oct |= sms_info->rp << 7; | |
4039 first_oct |= sms_info->srr << 5; | |
4040 | |
4041 if (sAT_PlusCSMP(CMD_SRC_LCL, first_oct, sms_info->vp_rel, | |
4042 (T_ACI_VP_ABS *)&sms_info->vp_abs, NULL, sms_info->prot_id, | |
4043 sms_info->dcs) NEQ AT_CMPL) | |
4044 { | |
4045 return MFW_SMS_FAIL; | |
4046 } | |
4047 res = sAT_PlusCSAS(CMD_SRC_LCL, (SHORT) 1); | |
4048 switch (res) | |
4049 { | |
4050 case AT_FAIL: | |
4051 return MFW_SMS_FAIL; | |
4052 case AT_CMPL: | |
4053 sms_signal(E_SMS_OK, 0); | |
4054 return MFW_SMS_OK; | |
4055 case AT_EXCT: | |
4056 return MFW_SMS_OK; | |
4057 default: | |
4058 return MFW_SMS_FAIL; | |
4059 } | |
4060 } | |
4061 | |
4062 return MFW_SMS_OK; | |
4063 } | |
4064 | |
4065 | |
4066 /* | |
4067 +--------------------------------------------------------------------+ | |
4068 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
4069 | STATE : code ROUTINE: sms_busy_ind | | |
4070 +--------------------------------------------------------------------+ | |
4071 | |
4072 | |
4073 PURPOSE : SMS busy indication to MMI. | |
4074 | |
4075 */ | |
4076 | |
4077 void sms_busy_ind(void) // bugfix for SIM refresh | |
4078 { | |
4079 int_req = 0; | |
4080 sms_signal(E_SMS_BUSY, 0); | |
4081 } | |
4082 | |
4083 | |
4084 /* | |
4085 +----------------------------------------------------------------------------+ | |
4086 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
4087 | STATE : code ROUTINE: sms_set_cell_broadcast_info | | |
4088 +----------------------------------------------------------------------------+ | |
4089 | |
4090 | |
4091 PURPOSE : MMI sets SMS cell broadcast parameters. | |
4092 | |
4093 */ | |
4094 | |
4095 T_MFW sms_set_cell_broadcast_info(UBYTE mode, T_MFW_SMS_CB_INFO *sms_cb_info) | |
4096 { | |
4097 T_ACI_RETURN res; | |
4098 | |
4099 TRACE_FUNCTION ("sms_set_cell_broadcast_info()"); | |
4100 /*SPR 2470, if the Channel ID list is empty, the mode logic is inverted due to the warped logic of | |
4101 AT commands*/ | |
4102 | |
4103 /*if we are disabling cell broadcast*/ | |
4104 if (mode == 1) | |
4105 { /* and the channel ID list is empty*/ | |
4106 if (sms_cb_info->msg_id[0] == 0xFFFF) | |
4107 mode =0; | |
4108 } | |
4109 /*if we are enabling cell broadcast*/ | |
4110 else | |
4111 { /* and the channel ID list is empty*/ | |
4112 if (sms_cb_info->msg_id[0] == 0xFFFF) | |
4113 mode =1; | |
4114 } | |
4115 | |
4116 if (sAT_PlusCSCB(CMD_SRC_LCL, mode, sms_cb_info->msg_id, sms_cb_info->dcs) NEQ AT_CMPL) | |
4117 return MFW_SMS_FAIL; | |
4118 | |
4119 res = sAT_PlusCSAS(CMD_SRC_LCL, (SHORT) 1); | |
4120 switch (res) | |
4121 { | |
4122 case AT_FAIL: | |
4123 return MFW_SMS_FAIL; | |
4124 case AT_CMPL: | |
4125 sms_signal(E_SMS_OK, 0); | |
4126 return MFW_SMS_OK; | |
4127 case AT_EXCT: | |
4128 return MFW_SMS_OK; | |
4129 default: | |
4130 return MFW_SMS_FAIL; | |
4131 } | |
4132 | |
4133 return MFW_SMS_OK; | |
4134 } | |
4135 | |
4136 /* | |
4137 +----------------------------------------------------------------------------+ | |
4138 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
4139 | STATE : code ROUTINE: sms_get_cell_broadcast_info | | |
4140 +----------------------------------------------------------------------------+ | |
4141 | |
4142 | |
4143 PURPOSE : MMI gets SMS cell broadcast parameters. | |
4144 | |
4145 */ | |
4146 #ifdef FF_2TO1_PS | |
4147 T_MFW sms_get_cell_broadcast_info(T_MFW_SMS_CB_INFO *sms_cb_info) | |
4148 { | |
4149 T_ACI_CSCB_MOD mode; | |
4150 USHORT mids[CBM_MAX_RANGE_NUMBER]; | |
4151 UBYTE dcss[CBM_MAX_RANGE_NUMBER]; | |
4152 UBYTE c_mids, c_dcss; | |
4153 TRACE_FUNCTION ("sms_get_cell_broadcast_info()"); | |
4154 | |
4155 memset(dcss,0xFF,CBM_MAX_RANGE_NUMBER); | |
4156 memset(mids,0xFFFF,CBM_MAX_RANGE_NUMBER); | |
4157 | |
4158 if (qAT_PlusCSCB(CMD_SRC_LCL, &mode, &c_mids, mids, &c_dcss, dcss) EQ AT_CMPL) | |
4159 { | |
4160 | |
4161 sms_cb_info->mode = mode; | |
4162 memcpy((char *)sms_cb_info->dcs, (char *)dcss, CBM_MAX_RANGE_NUMBER); | |
4163 | |
4164 memcpy((char *)sms_cb_info->msg_id, (char *)mids, sizeof(mids)); | |
4165 | |
4166 return MFW_SMS_OK; | |
4167 } | |
4168 else | |
4169 return MFW_SMS_FAIL; | |
4170 } | |
4171 #else | |
4172 T_MFW sms_get_cell_broadcast_info(T_MFW_SMS_CB_INFO *sms_cb_info) | |
4173 { | |
4174 T_ACI_CSCB_MOD mode; | |
4175 USHORT mids[MAX_IDENTS]; | |
4176 UBYTE dcss[MAX_IDENTS]; | |
4177 | |
4178 TRACE_FUNCTION ("sms_get_cell_broadcast_info()"); | |
4179 | |
4180 memset(dcss,0xFF,MAX_IDENTS); | |
4181 memset(mids,0xFFFF,MAX_IDENTS); | |
4182 | |
4183 if (qAT_PlusCSCB(CMD_SRC_LCL, &mode, mids, dcss) EQ AT_CMPL) | |
4184 { | |
4185 | |
4186 sms_cb_info->mode = mode; | |
4187 memcpy((char *)sms_cb_info->dcs, (char *)dcss, MAX_IDENTS); | |
4188 | |
4189 memcpy((char *)sms_cb_info->msg_id, (char *)mids, sizeof(mids)); | |
4190 | |
4191 return MFW_SMS_OK; | |
4192 } | |
4193 else | |
4194 return MFW_SMS_FAIL; | |
4195 } | |
4196 | |
4197 | |
4198 #endif | |
4199 | |
4200 /* | |
4201 +--------------------------------------------------------------------+ | |
4202 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
4203 | STATE : code ROUTINE: rAT_PlusCMGS | | |
4204 +--------------------------------------------------------------------+ | |
4205 | |
4206 | |
4207 PURPOSE : Call back to inform about the successful sending of | |
4208 a mobile originated short massage. | |
4209 | |
4210 */ | |
4211 | |
4212 void rAT_PlusCMGS(UBYTE mr, UBYTE numSeg) | |
4213 { | |
4214 TRACE_FUNCTION ("rAT_PlusCMGS()"); | |
4215 | |
4216 if(coll_sms_send EQ MFW_SMS_WAIT) | |
4217 coll_sms_send = MFW_SMS_FREE; | |
4218 | |
4219 sms_check_mt_update(); | |
4220 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
4221 | |
4222 /* SPR#2086 - SH - Check if it's a WAP SMS */ | |
4223 if (sms_wap_sent_flag) | |
4224 { | |
4225 sms_wap_sent_flag = FALSE; | |
4226 sms_signal(E_SMS_WAP_MO_SENT, &mr); | |
4227 } | |
4228 else | |
4229 { | |
4230 sms_signal(E_SMS_MO_AVAIL, &mr); | |
4231 } | |
4232 #else | |
4233 sms_signal(E_SMS_MO_AVAIL, &mr); | |
4234 #endif | |
4235 } | |
4236 | |
4237 | |
4238 /* | |
4239 +--------------------------------------------------------------------+ | |
4240 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
4241 | STATE : code ROUTINE: rAT_PlusCMGC | | |
4242 +--------------------------------------------------------------------+ | |
4243 | |
4244 | |
4245 PURPOSE : Call back to inform about the successful sending of a | |
4246 mobile originated short massage command. | |
4247 | |
4248 */ | |
4249 | |
4250 void rAT_PlusCMGC(UBYTE mr) | |
4251 { | |
4252 TRACE_FUNCTION ("rAT_PlusCMGC()"); | |
4253 | |
4254 sms_check_mt_update(); | |
4255 | |
4256 sms_signal(E_SMS_CMD_AVAIL, &mr); | |
4257 } | |
4258 | |
4259 | |
4260 /* | |
4261 +--------------------------------------------------------------------+ | |
4262 | PROJECT: MMI-Framework (8417) MODULE: MFW_SMS | | |
4263 | STATE : code ROUTINE: rAT_PlusCMS | | |
4264 +--------------------------------------------------------------------+ | |
4265 | |
4266 | |
4267 PURPOSE : Report the error result on failures of the last | |
4268 executed functions | |
4269 | |
4270 */ | |
4271 | |
4272 void rAT_PlusCMS (T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err, T_EXT_CMS_ERROR *ce) | |
4273 { | |
4274 T_MFW_SMS_CMD_IND cmd_ind; | |
4275 | |
4276 TRACE_FUNCTION ("rAT_PlusCMS()"); | |
4277 TRACE_EVENT_P1("Error: %d",cmdId); | |
4278 | |
4279 switch (cmdId) | |
4280 { | |
4281 case AT_CMD_CMGS: | |
4282 case AT_CMD_CMSS: | |
4283 cmd_ind = CMD_SMS_SUBMIT; | |
4284 coll_sms_send = MFW_SMS_FREE; | |
4285 | |
4286 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
4287 | |
4288 /* SPR#2086 - SH - Check if it's a WAP SMS */ | |
4289 if (sms_wap_sent_flag) | |
4290 { | |
4291 sms_wap_sent_flag = FALSE; | |
4292 sms_signal(E_SMS_WAP_ERR, &cmd_ind); | |
4293 } | |
4294 else | |
4295 { | |
4296 sms_signal(E_SMS_ERR, &cmd_ind); | |
4297 } | |
4298 #else | |
4299 sms_signal(E_SMS_ERR, &cmd_ind); | |
4300 #endif | |
4301 break; | |
4302 | |
4303 case AT_CMD_CMGC: | |
4304 cmd_ind = CMD_SMS_COMMAND; | |
4305 coll_sms_req = MFW_SMS_FREE; | |
4306 sms_signal(E_SMS_ERR, &cmd_ind); | |
4307 break; | |
4308 | |
4309 case AT_CMD_CPMS: | |
4310 cmd_ind = CMD_SMS_MEMORY; | |
4311 sms_signal(E_SMS_ERR, &cmd_ind); | |
4312 break; | |
4313 | |
4314 case AT_CMD_CMGR: | |
4315 cmd_ind = CMD_SMS_READ; | |
4316 coll_sms_read = MFW_SMS_FREE; | |
4317 sms_signal(E_SMS_ERR, &cmd_ind); | |
4318 break; | |
4319 | |
4320 case AT_CMD_CMGL: | |
4321 cmd_ind = CMD_SMS_READ; | |
4322 coll_sms_read = MFW_SMS_FREE; | |
4323 sms_signal(E_SMS_ERR, &cmd_ind); | |
4324 sms_ok_CMGL(); /*JVJ SPR1118 This case has been added to handle the Error of CMGL | |
4325 when the SIM Card has no messages. Even without SMS in the SIM card, | |
4326 the call to qAT_PlusCPMS to query the memory status is still needed */ | |
4327 break; | |
4328 | |
4329 case AT_CMD_CMGW: | |
4330 sms_type = MFW_NO_MESSAGE; | |
4331 cmd_ind = CMD_SMS_STORE; | |
4332 coll_sms_send = MFW_SMS_FREE; | |
4333 sms_signal(E_SMS_ERR, &cmd_ind); | |
4334 break; | |
4335 | |
4336 case AT_CMD_CMGD: | |
4337 cmd_ind = CMD_SMS_SET_PARA; | |
4338 coll_sms_delete = MFW_SMS_FREE; | |
4339 sms_signal(E_SMS_ERR, &cmd_ind); | |
4340 break; | |
4341 | |
4342 case AT_CMD_CSAS: | |
4343 cmd_ind = CMD_SMS_DELETE; | |
4344 sms_signal(E_SMS_ERR, &cmd_ind); | |
4345 break; | |
4346 } | |
4347 | |
4348 sms_check_mt_update(); | |
4349 } | |
4350 | |
4351 | |
4352 /* | |
4353 +--------------------------------------------------------------------+ | |
4354 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
4355 | STATE : code ROUTINE : sms_get_memset | | |
4356 +--------------------------------------------------------------------+ | |
4357 | |
4358 PURPOSE : This function is used to request the preferred SMS memory | |
4359 */ | |
4360 T_MFW sms_get_memset(void) | |
4361 { | |
4362 TRACE_FUNCTION ("sms_get_memset()"); | |
4363 | |
4364 coll_sms_req = MFW_SMS_WAIT; | |
4365 | |
4366 if (qAT_PlusCPMS(CMD_SRC_LCL) EQ AT_EXCT) | |
4367 return MFW_SMS_OK; | |
4368 return MFW_SMS_FAIL; | |
4369 } | |
4370 | |
4371 | |
4372 /* | |
4373 +---------------------------------------------------------------------------+ | |
4374 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
4375 | STATE : code ROUTINE : rAT_PlusCPMS | | |
4376 +---------------------------------------------------------------------------+ | |
4377 | |
4378 PURPOSE : Call back for request of preferred SMS memory. | |
4379 */ | |
4380 | |
4381 GLOBAL void rAT_PlusCPMS (T_ACI_SMS_STOR_OCC * mem1, | |
4382 T_ACI_SMS_STOR_OCC * mem2, | |
4383 T_ACI_SMS_STOR_OCC * mem3) | |
4384 { | |
4385 T_MFW_SMS_MEM_INFO sms_mem; | |
4386 | |
4387 TRACE_FUNCTION ("rAT_PlusCPMS"); | |
4388 | |
4389 sms_mem.mem = mem1->mem; | |
4390 sms_mem.used = (UBYTE)mem1->used; | |
4391 sms_mem.total = (UBYTE)mem1->total; | |
4392 | |
4393 memory.total = (UBYTE)mem1->total; | |
4394 memory.used = (UBYTE)mem1->used; | |
4395 /* HLE temp for testing iface and for WIN32 simulation */ | |
4396 | |
4397 #if defined (WIN32) | |
4398 mem1->total = 10; | |
4399 #endif | |
4400 | |
4401 if(coll_sms_req EQ MFW_SMS_WAIT) | |
4402 coll_sms_req = MFW_SMS_FREE; | |
4403 | |
4404 if (int_req || int_init_req) | |
4405 { TRACE_EVENT_P2("memory.used:%d,memory.total:%d",mem1->used, mem1->total); | |
4406 memory.mem = mem1->mem; | |
4407 memory.used = (UBYTE)mem1->used; | |
4408 memory.total = (UBYTE)mem1->total; | |
4409 if (int_req ==FIRST_READ_OF_MEMORY_USE) | |
4410 sms_signal(E_SMS_READY, 0); | |
4411 int_req = 0; | |
4412 int_init_req = 0; | |
4413 | |
4414 if (mem1->used == mem1->total) | |
4415 sms_signal(E_SMS_MEM_FULL, 0); | |
4416 | |
4417 #ifdef SIM_TOOLKIT | |
4418 if (sms_update) | |
4419 { | |
4420 sms_update = FALSE; | |
4421 sms_sat_update_cnf(); | |
4422 } | |
4423 #endif | |
4424 return; | |
4425 } | |
4426 else | |
4427 sms_signal(E_SMS_MEM, &sms_mem); | |
4428 | |
4429 sms_check_mt_update(); | |
4430 } | |
4431 | |
4432 | |
4433 /* | |
4434 +---------------------------------------------------------------------------+ | |
4435 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
4436 | STATE : code ROUTINE : sms_message_count | | |
4437 +---------------------------------------------------------------------------+ | |
4438 | |
4439 PURPOSE : Request number of SMS message | |
4440 | |
4441 */ | |
4442 | |
4443 SHORT sms_message_count (T_MFW_SMS_STAT stat) | |
4444 { | |
4445 SHORT count; | |
4446 int i; | |
4447 TRACE_FUNCTION("sms_message_count"); | |
4448 | |
4449 count = 0; | |
4450 if ((stat == MFW_SMS_UNREAD) | |
4451 OR (stat == MFW_SMS_READ) | |
4452 OR (stat == MFW_SMS_STOR_UNSENT) | |
4453 OR (stat == MFW_SMS_STOR_SENT)) | |
4454 { | |
4455 #ifdef FF_MMI_SMS_DYNAMIC | |
4456 for (i=0; i<g_max_messages; i++) | |
4457 #else | |
4458 for (i=0; i<MAX_MESSAGES; i++) | |
4459 #endif | |
4460 { | |
4461 // PATCH JPS 20.09 - Don't look at SMS with index -1 because it means it is deleted | |
4462 if (msg_info[i].index != -1) | |
4463 { | |
4464 | |
4465 if (msg_info[i].stat == stat) | |
4466 count++; | |
4467 } | |
4468 // PATCH JPS 20.09 END - Don't look at SMS with index -1 because it means it is deleted | |
4469 } | |
4470 return count; | |
4471 } | |
4472 | |
4473 if (stat == MFW_SMS_ALL) | |
4474 { | |
4475 #ifdef FF_MMI_SMS_DYNAMIC | |
4476 for (i=0; i<g_max_messages; i++) | |
4477 #else | |
4478 for (i=0; i<MAX_MESSAGES; i++) | |
4479 #endif | |
4480 { | |
4481 if (msg_info[i].index != -1) | |
4482 count++; | |
4483 } | |
4484 return count; | |
4485 } | |
4486 | |
4487 if (stat == MFW_SMS_MO) | |
4488 { | |
4489 #ifdef FF_MMI_SMS_DYNAMIC | |
4490 for (i=0; i<g_max_messages; i++) | |
4491 #else | |
4492 for (i=0; i<MAX_MESSAGES; i++) | |
4493 #endif | |
4494 { | |
4495 // PATCH JPS 20.09 - Don't look at SMS with index -1 because it means it is deleted | |
4496 if (msg_info[i].index != -1) | |
4497 { | |
4498 if ((msg_info[i].stat == MFW_SMS_STOR_UNSENT) | |
4499 OR (msg_info[i].stat == MFW_SMS_STOR_SENT)) | |
4500 count++; | |
4501 } | |
4502 // PATCH JPS 20.09 END - Don't look at SMS with index -1 because it means it is deleted | |
4503 } | |
4504 return count; | |
4505 } | |
4506 if (stat == MFW_SMS_MT) | |
4507 { | |
4508 #ifdef FF_MMI_SMS_DYNAMIC | |
4509 for (i=0; i<g_max_messages; i++) | |
4510 #else | |
4511 for (i=0; i<MAX_MESSAGES; i++) | |
4512 #endif | |
4513 { | |
4514 // PATCH JPS 20.09 - Don't look at SMS with index -1 because it means it is deleted | |
4515 if (msg_info[i].index != -1) | |
4516 { | |
4517 if ((msg_info[i].stat == MFW_SMS_UNREAD) | |
4518 OR (msg_info[i].stat == MFW_SMS_READ)) | |
4519 count++; | |
4520 } | |
4521 // PATCH JPS 20.09 END - Don't look at SMS with index -1 because it means it is deleted | |
4522 } | |
4523 return count; | |
4524 } | |
4525 if (stat == MFW_SMS_VOICE) | |
4526 { | |
4527 #ifdef FF_MMI_SMS_DYNAMIC | |
4528 for (i=0; i<g_max_messages; i++) | |
4529 #else | |
4530 for (i=0; i<MAX_MESSAGES; i++) | |
4531 #endif | |
4532 { | |
4533 // PATCH JPS 20.09 - Don't look at SMS with index -1 because it means it is deleted | |
4534 if (msg_info[i].index != -1) | |
4535 { | |
4536 if (msg_info[i].msg_type == stat) | |
4537 count++; | |
4538 } | |
4539 // PATCH JPS 20.09 END - Don't look at SMS with index -1 because it means it is deleted | |
4540 } | |
4541 return count; | |
4542 } | |
4543 return 0; | |
4544 } | |
4545 | |
4546 | |
4547 /* | |
4548 +---------------------------------------------------------------------------+ | |
4549 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
4550 | STATE : code ROUTINE : sms_message_list | | |
4551 +---------------------------------------------------------------------------+ | |
4552 | |
4553 PURPOSE : Request a stored message list | |
4554 | |
4555 Note: msg_type is not used in this implementation | |
4556 */ | |
4557 | |
4558 SHORT sms_message_list(T_MFW_SMS_STAT stat, | |
4559 T_MFW_SMS_MSG * msg_list, | |
4560 int max_entries) | |
4561 { | |
4562 SHORT count; | |
4563 int i; | |
4564 | |
4565 TRACE_FUNCTION("sms_message_list()"); | |
4566 | |
4567 count = 0; | |
4568 switch (stat) | |
4569 { | |
4570 case MFW_SMS_ALL: | |
4571 #ifdef FF_MMI_SMS_DYNAMIC | |
4572 for (i=0; i<g_max_messages; i++) | |
4573 #else | |
4574 for (i=0; i<MAX_MESSAGES; i++) | |
4575 #endif | |
4576 { | |
4577 if (count >= max_entries) | |
4578 return count; | |
4579 | |
4580 if (msg_info[i].index != -1) | |
4581 { | |
4582 sms_copy_msg_list(i, &msg_list[count]); | |
4583 count++; | |
4584 } | |
4585 } | |
4586 return count; | |
4587 | |
4588 case MFW_SMS_MO: | |
4589 #ifdef FF_MMI_SMS_DYNAMIC | |
4590 for (i=0; i<g_max_messages; i++) | |
4591 | |
4592 #else | |
4593 for (i=0; i<MAX_MESSAGES; i++) | |
4594 #endif | |
4595 { | |
4596 if (count >= max_entries) | |
4597 return count; | |
4598 | |
4599 if ((msg_info[i].index != -1) | |
4600 AND ((msg_info[i].stat == MFW_SMS_STOR_UNSENT) | |
4601 OR (msg_info[i].stat == MFW_SMS_STOR_SENT))) | |
4602 { | |
4603 sms_copy_msg_list(i, &msg_list[count]); | |
4604 count++; | |
4605 } | |
4606 } | |
4607 return count; | |
4608 | |
4609 case MFW_SMS_STOR_UNSENT: | |
4610 #ifdef FF_MMI_SMS_DYNAMIC | |
4611 for (i=0; i<g_max_messages; i++) | |
4612 #else | |
4613 for (i=0; i<MAX_MESSAGES; i++) | |
4614 #endif | |
4615 { | |
4616 if (count >= max_entries) | |
4617 return count; | |
4618 | |
4619 if ((msg_info[i].index != -1) | |
4620 AND (msg_info[i].stat == MFW_SMS_STOR_UNSENT)) | |
4621 { | |
4622 sms_copy_msg_list(i, &msg_list[count]); | |
4623 count++; | |
4624 } | |
4625 } | |
4626 return count; | |
4627 | |
4628 case MFW_SMS_STOR_SENT: | |
4629 #ifdef FF_MMI_SMS_DYNAMIC | |
4630 for (i=0; i<g_max_messages; i++) | |
4631 #else | |
4632 for (i=0; i<MAX_MESSAGES; i++) | |
4633 #endif | |
4634 { | |
4635 if (count >= max_entries) | |
4636 return count; | |
4637 | |
4638 if ((msg_info[i].index != -1) | |
4639 AND (msg_info[i].stat == MFW_SMS_STOR_SENT)) | |
4640 { | |
4641 sms_copy_msg_list(i, &msg_list[count]); | |
4642 count++; | |
4643 } | |
4644 } | |
4645 return count; | |
4646 | |
4647 case MFW_SMS_MT: | |
4648 #ifdef FF_MMI_SMS_DYNAMIC | |
4649 for (i=0; i<g_max_messages; i++) | |
4650 #else | |
4651 for (i=0; i<MAX_MESSAGES; i++) | |
4652 #endif | |
4653 { | |
4654 if (count >= max_entries) | |
4655 return count; | |
4656 | |
4657 if ((msg_info[i].index != -1) | |
4658 AND ((msg_info[i].stat == MFW_SMS_UNREAD) | |
4659 OR (msg_info[i].stat == MFW_SMS_READ))) | |
4660 { | |
4661 sms_copy_msg_list(i, &msg_list[count]); | |
4662 count++; | |
4663 } | |
4664 } | |
4665 return count; | |
4666 | |
4667 case MFW_SMS_UNREAD: | |
4668 #ifdef FF_MMI_SMS_DYNAMIC | |
4669 for (i=0; i<g_max_messages; i++) | |
4670 #else | |
4671 for (i=0; i<MAX_MESSAGES; i++) | |
4672 #endif | |
4673 { | |
4674 if (count >= max_entries) | |
4675 return count; | |
4676 | |
4677 if ((msg_info[i].index != -1) | |
4678 AND (msg_info[i].stat == MFW_SMS_UNREAD)) | |
4679 { | |
4680 sms_copy_msg_list(i, &msg_list[count]); | |
4681 count++; | |
4682 } | |
4683 } | |
4684 return count; | |
4685 | |
4686 case MFW_SMS_READ: | |
4687 #ifdef FF_MMI_SMS_DYNAMIC | |
4688 for (i=0; i<g_max_messages; i++) | |
4689 #else | |
4690 for (i=0; i<MAX_MESSAGES; i++) | |
4691 #endif | |
4692 { | |
4693 if (count >= max_entries) | |
4694 return count; | |
4695 | |
4696 if ((msg_info[i].index != -1) | |
4697 AND (msg_info[i].stat == MFW_SMS_READ)) | |
4698 { | |
4699 sms_copy_msg_list(i, &msg_list[count]); | |
4700 count++; | |
4701 } | |
4702 } | |
4703 return count; | |
4704 | |
4705 case MFW_SMS_VOICE: | |
4706 #ifdef FF_MMI_SMS_DYNAMIC | |
4707 for (i=0; i<g_max_messages; i++) | |
4708 #else | |
4709 for (i=0; i<MAX_MESSAGES; i++) | |
4710 #endif | |
4711 { | |
4712 if (count >= max_entries) | |
4713 return count; | |
4714 | |
4715 if ((msg_info[i].index != -1) | |
4716 AND (msg_info[i].msg_type == MFW_SMS_VOICE)) | |
4717 { | |
4718 sms_copy_msg_list(i, &msg_list[count]); | |
4719 count++; | |
4720 } | |
4721 } | |
4722 return count; | |
4723 | |
4724 default: | |
4725 return count; | |
4726 } | |
4727 } | |
4728 | |
4729 | |
4730 /* | |
4731 +---------------------------------------------------------------------------+ | |
4732 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
4733 | STATE : code ROUTINE : sms_copy_msg_list | | |
4734 +---------------------------------------------------------------------------+ | |
4735 | |
4736 PURPOSE : copy a stored message list | |
4737 | |
4738 */ | |
4739 | |
4740 void sms_copy_msg_list(int num, T_MFW_SMS_MSG *msg_list) | |
4741 { | |
4742 TRACE_FUNCTION("sms_copy_msg_list()"); | |
4743 | |
4744 msg_list->index = msg_info[num].index; | |
4745 /* | |
4746 * forward message reference to MMI | |
4747 */ | |
4748 msg_list->msg_ref = msg_info[num].msg_ref; | |
4749 msg_list->stat = msg_info[num].stat; | |
4750 msg_list->msg_type = msg_info[num].msg_type; | |
4751 strcpy(msg_list->addr.number, msg_info[num].addr.number); | |
4752 msg_list->addr.ton = msg_info[num].addr.ton; | |
4753 msg_list->addr.npi = msg_info[num].addr.npi; | |
4754 // March 31, 2005 REF: CRR MMI-SPR-24511 x0012852 | |
4755 // first_index, concat_status are also added to use it later on. | |
4756 msg_list->concat_status = msg_info[num].concat_status; | |
4757 msg_list->first_index = msg_info[num].first_index; | |
4758 | |
4759 #ifdef NO_ASCIIZ | |
4760 memcpy(msg_list->addr.tag, | |
4761 msg_info[num].addr.tag, | |
4762 msg_info[num].addr.len); | |
4763 msg_list->addr.len = msg_info[num].addr.len; | |
4764 #else | |
4765 strcpy(msg_list->addr.tag, msg_info[num].addr.tag); | |
4766 #endif | |
4767 memcpy(&msg_list->rctp, &msg_info[num].rctp, sizeof(T_MFW_SMS_SCTP)); | |
4768 } | |
4769 | |
4770 /* | |
4771 +---------------------------------------------------------------------------+ | |
4772 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
4773 | STATE : code ROUTINE : sms_ok_csas | | |
4774 +---------------------------------------------------------------------------+ | |
4775 | |
4776 PURPOSE : Setting of SMS parameter/cell broadcast parameter | |
4777 is successful. | |
4778 | |
4779 */ | |
4780 | |
4781 void sms_ok_csas(void) | |
4782 { | |
4783 TRACE_FUNCTION("sms_ok_csas() "); | |
4784 sms_signal(E_SMS_OK, 0); | |
4785 | |
4786 sms_check_mt_update(); | |
4787 } | |
4788 | |
4789 /* | |
4790 +---------------------------------------------------------------------------+ | |
4791 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
4792 | STATE : code ROUTINE : sms_error_csas | | |
4793 +---------------------------------------------------------------------------+ | |
4794 | |
4795 PURPOSE : Setting of SMS parameter/cell broadcast parameter | |
4796 is failed. | |
4797 | |
4798 */ | |
4799 | |
4800 void sms_error_csas(void) | |
4801 { | |
4802 sms_signal(E_SMS_ERR, 0); | |
4803 } | |
4804 | |
4805 /* | |
4806 +--------------------------------------------------------------------+ | |
4807 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
4808 | STATE : code ROUTINE : sms_codeStatus | | |
4809 +--------------------------------------------------------------------+ | |
4810 | |
4811 PURPOSE : This function is used to convert the status | |
4812 used by MFW to the status used by ACI. | |
4813 */ | |
4814 | |
4815 T_ACI_SMS_STAT sms_codeStatus(T_MFW_SMS_STAT stat) | |
4816 { | |
4817 switch (stat) | |
4818 { | |
4819 case MFW_SMS_UNREAD: return SMS_STAT_RecUnread; | |
4820 case MFW_SMS_READ: return SMS_STAT_RecRead; | |
4821 case MFW_SMS_STOR_UNSENT: return SMS_STAT_StoUnsent; | |
4822 case MFW_SMS_STOR_SENT: return SMS_STAT_StoSent; | |
4823 case MFW_SMS_ALL: return SMS_STAT_All; | |
4824 default: return SMS_STAT_NotPresent; | |
4825 } | |
4826 } | |
4827 | |
4828 | |
4829 /* | |
4830 +--------------------------------------------------------------------+ | |
4831 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
4832 | STATE : code ROUTINE : sms_decodeStatus | | |
4833 +--------------------------------------------------------------------+ | |
4834 | |
4835 PURPOSE : This function is used to convert the status | |
4836 used by ACI to the status used by MFW. | |
4837 */ | |
4838 | |
4839 T_MFW_SMS_STAT sms_decodeStatus(T_ACI_SMS_STAT stat) | |
4840 { | |
4841 switch (stat) | |
4842 { case SMS_STAT_Invalid: return MFW_SMS_INVALID;/*SPR 2260*/ | |
4843 case SMS_STAT_RecUnread: return MFW_SMS_UNREAD; | |
4844 case SMS_STAT_RecRead: return MFW_SMS_READ; | |
4845 case SMS_STAT_StoUnsent: return MFW_SMS_STOR_UNSENT; | |
4846 case SMS_STAT_StoSent: return MFW_SMS_STOR_SENT; | |
4847 case SMS_STAT_All: return MFW_SMS_ALL; | |
4848 default: | |
4849 return MFW_SMS_UNKNOWN; | |
4850 } | |
4851 } | |
4852 | |
4853 | |
4854 /* | |
4855 +--------------------------------------------------------------------+ | |
4856 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
4857 | STATE : code ROUTINE : sms_get_cbm_id | | |
4858 +--------------------------------------------------------------------+ | |
4859 | |
4860 PURPOSE : get cell broadcast message identifier | |
4861 cbmid: array for cell broadcast message identifier | |
4862 len: size of array | |
4863 | |
4864 */ | |
4865 | |
4866 void sms_get_cbm_id (USHORT *cbmid, UBYTE len) | |
4867 { | |
4868 UBYTE max; | |
4869 int i; | |
4870 int p; | |
4871 | |
4872 if (len > 6) /* maximal 5 cell broadcast message identifiers + '\0' */ | |
4873 max = 6; | |
4874 else | |
4875 max = len; | |
4876 | |
4877 p = 0; | |
4878 // from 0-4 | |
4879 for (i=0; i<(max-1); i++) | |
4880 { | |
4881 if (cb_mid[p] == 0xFF AND cb_mid[p+1] == 0xFF) | |
4882 break; | |
4883 cbmid[i] = ( ( SHORT )cb_mid[p] << 8 ) + cb_mid[p+1]; | |
4884 p += 2; | |
4885 } | |
4886 cbmid[i] = '\0'; | |
4887 } | |
4888 | |
4889 | |
4890 /* | |
4891 +--------------------------------------------------------------------+ | |
4892 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
4893 | STATE : code ROUTINE : sms_save_cbm_id | | |
4894 +--------------------------------------------------------------------+ | |
4895 | |
4896 PURPOSE : save cell broadcast message identifier | |
4897 | |
4898 */ | |
4899 | |
4900 void sms_save_cbm_id (USHORT *cbmid, UBYTE len) | |
4901 { | |
4902 int i; | |
4903 UBYTE p; | |
4904 UBYTE max; | |
4905 | |
4906 memset(cb_mid, 0xFF, sizeof(cb_mid)); | |
4907 | |
4908 if (len > 5) | |
4909 max = 5; | |
4910 else | |
4911 max = len; | |
4912 | |
4913 p = 0; | |
4914 for (i=0; i<max; i++) | |
4915 { | |
4916 if (!cbmid[i]) | |
4917 break; | |
4918 | |
4919 cb_mid[p++] = (UBYTE)(cbmid[i] >> 8); | |
4920 cb_mid[p++] = (UBYTE)cbmid[i]; | |
4921 } | |
4922 | |
4923 memset(data, 0xFF, sizeof(data)); | |
4924 | |
4925 memcpy(data, cb_mid, 10); | |
4926 | |
4927 sim_write_sim(SIM_CBMI, data, 10); | |
4928 } | |
4929 | |
4930 | |
4931 /* | |
4932 +--------------------------------------------------------------------+ | |
4933 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
4934 | STATE : code ROUTINE : sms_check_mt_update| | |
4935 +--------------------------------------------------------------------+ | |
4936 | |
4937 PURPOSE : save cell broadcast message identifier | |
4938 | |
4939 */ | |
4940 | |
4941 void sms_check_mt_update() | |
4942 { | |
4943 TRACE_EVENT("sms_check_mt_update() "); | |
4944 | |
4945 if (sms_id.index > 0) | |
4946 { | |
4947 sms_send_new_msg_ind(NULL,sms_id.index, sms_id.mem, sms_id.received_sms_type, sms_id.concat_status); | |
4948 | |
4949 sms_id.index = 0; | |
4950 } | |
4951 if (sms_id_wait.index > 0) | |
4952 { | |
4953 sms_send_new_msg_ind(NULL,sms_id_wait.index, sms_id_wait.mem, sms_id_wait.received_sms_type, sms_id_wait.concat_status); | |
4954 | |
4955 sms_id_wait.index = 0; | |
4956 | |
4957 } | |
4958 | |
4959 | |
4960 } | |
4961 | |
4962 /* | |
4963 +--------------------------------------------------------------------+ | |
4964 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
4965 | STATE : code ROUTINE : sms_check_voice_mail| | |
4966 +--------------------------------------------------------------------+ | |
4967 | |
4968 PURPOSE : Check voice mail. | |
4969 | |
4970 */ | |
4971 | |
4972 T_MFW sms_check_voice_mail(UBYTE pid, UBYTE dcs, char *addr, | |
4973 T_ACI_TOA *toa, T_ACI_UDH_DATA *udh) | |
4974 { T_MFW status =MFW_SMS_UNKNOWN;//MC | |
4975 TRACE_FUNCTION("sms_check_voice_mail()"); | |
4976 | |
4977 if (dcs == 0xC0 /* check data coding scheme */ | |
4978 OR dcs == 0xC8 | |
4979 OR dcs == 0xD0 | |
4980 OR dcs == 0xD8 | |
4981 OR dcs == 0xE0 | |
4982 OR dcs == 0xE8) | |
4983 { | |
4984 | |
4985 status = MFW_SMS_VOICE; | |
4986 } | |
4987 else if (udh->len > 0 | |
4988 AND udh->data[0] == 0x01 | |
4989 AND (udh->data[2] == 0x80 OR udh->data[2] == 0x00)) /* check user data header */ | |
4990 { | |
4991 status = MFW_SMS_VOICE; | |
4992 | |
4993 } | |
4994 | |
4995 // Feb 16, 2005 REF: CRR MMI-SPR-27900 xnkulkar | |
4996 // Voice mail identification is already done using dcs. Identification should not be done using pid. Check commented | |
4997 // else if (pid == 0x5F OR pid ==0x42 /*On power-up check pid to determine SMS VM */) /* check message identifier */ | |
4998 /* { status = MFW_SMS_VOICE; | |
4999 | |
5000 } */ | |
5001 else if (toa->ton == TON_Alphanumeric | |
5002 // 0x30 special case for one-2-one when voice mail has been deleted. | |
5003 AND (addr[0] == 0x10 OR addr[0] == 0x11 OR addr[0]==0x31 OR addr[0]==0x30)) /* check CPHS */ | |
5004 { | |
5005 // Fix for one-2-one VM icon control. 26/6/01 MZ | |
5006 if(addr[0]==0x30) | |
5007 { | |
5008 Delete_1_2_1_vm_icon = TRUE; | |
5009 Display_1_2_1_vm_icon = FALSE; | |
5010 } | |
5011 else if(addr[0]==0x31 && Delete_1_2_1_vm_icon == FALSE) | |
5012 Display_1_2_1_vm_icon = TRUE; | |
5013 | |
5014 status = MFW_SMS_VOICE; | |
5015 | |
5016 } | |
5017 TRACE_EVENT_P2("Addr[0]:%x, Addr[1]:%x", addr[0], addr[1]); | |
5018 TRACE_EVENT_P2("Addr[2]:%x, Addr[3]:%x", addr[2], addr[3]); | |
5019 /*MC1364, improved this to check if voicemail indicator to be set or cleared*/ | |
5020 | |
5021 // Feb 16, 2005 REF: CRR MMI-SPR-27900 xnkulkar | |
5022 // Instead of identifying voice mail ON (indication)/OFF(deletion) using addr[0], we use dcs. | |
5023 // (addr[0]&0x01) condition replaced with (dcs & 0x08) | |
5024 if ((status == MFW_SMS_VOICE) && (dcs & 0x08)) //if a voicemail indication | |
5025 { | |
5026 Delete_1_2_1_vm_icon = FALSE;/*SPR2260*/ | |
5027 Display_1_2_1_vm_icon = TRUE; | |
5028 /*MC, if MSB set, bit 0 of second char in 7-bit encoding)*/ | |
5029 if (addr[1] & 0x08) /*SPR 2260 experimentally, bit set by orange*/ | |
5030 cphs_set_mailbox_status(0,MFW_CFLAG_SET , 0, 0);/*set line2*/ | |
5031 else | |
5032 cphs_set_mailbox_status(MFW_CFLAG_SET, 0, 0, 0);/*set line1*/ | |
5033 } | |
5034 if ((status == MFW_SMS_VOICE) && !(dcs & 0x08)) //if a voicemail deletion | |
5035 { | |
5036 Delete_1_2_1_vm_icon = TRUE;/*SPR2260*/ | |
5037 Display_1_2_1_vm_icon = FALSE; | |
5038 /*MC, if MSB set, bit 0 of second char in 7-bit encoding)*/ | |
5039 if (addr[1] & 0x08) /*SPR 2260 experimentally, bit set by orange*/ | |
5040 cphs_set_mailbox_status(0,MFW_CFLAG_NOTSet , 0, 0);/*clear line2*/ | |
5041 else | |
5042 cphs_set_mailbox_status(MFW_CFLAG_NOTSet, 0, 0, 0);/*clear line1*/ | |
5043 } | |
5044 // Feb 16, 2005 REF: CRR MMI-SPR-27900 xnkulkar | |
5045 // If voicemail message is from group "1100", update status as MFW_SMS_VOICEMSG_DELETE | |
5046 if ((status == MFW_SMS_VOICE) && ((dcs & 0xF0) == 0xC0)) | |
5047 { | |
5048 status = MFW_SMS_VOICEMSG_DELETE; | |
5049 invalidVm = TRUE; // set this flag to TRUE to indicate that this voice mail sms is to be deleted | |
5050 } | |
5051 | |
5052 return status; | |
5053 } | |
5054 | |
5055 #ifdef SIM_TOOLKIT | |
5056 /* | |
5057 +---------------------------------------------------------------------+ | |
5058 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
5059 | STATE : code ROUTINE : sms_sat_file_update | | |
5060 +---------------------------------------------------------------------+ | |
5061 | |
5062 PURPOSE : SIM file change indication | |
5063 | |
5064 */ | |
5065 | |
5066 void sms_sat_file_update(USHORT dataId) | |
5067 { | |
5068 TRACE_FUNCTION("sms_sat_file_update()"); | |
5069 | |
5070 sms_update = TRUE; | |
5071 switch (dataId) | |
5072 { | |
5073 case SIM_SMS: | |
5074 sms_read_msg_info(); | |
5075 break; | |
5076 default: | |
5077 break; | |
5078 } | |
5079 } | |
5080 #endif | |
5081 | |
5082 #ifdef SIM_TOOLKIT | |
5083 /* | |
5084 +---------------------------------------------------------------------+ | |
5085 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
5086 | STATE : code ROUTINE : sms_sat_update_cnf | | |
5087 +---------------------------------------------------------------------+ | |
5088 | |
5089 PURPOSE : SIM file change indication | |
5090 | |
5091 */ | |
5092 | |
5093 void sms_sat_update_cnf (void) | |
5094 { | |
5095 TRACE_FUNCTION("sms_sat_update_cnf()"); | |
5096 satUpdateFiles ( TRUE, SIM_SMS ); | |
5097 } | |
5098 #endif | |
5099 | |
5100 /* PATCH JPS 29.09: like sms_message_list but returns only index and status */ | |
5101 | |
5102 /* | |
5103 +---------------------------------------------------------------------------+ | |
5104 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
5105 | STATE : code ROUTINE : sms_index_list | | |
5106 +---------------------------------------------------------------------------+ | |
5107 | |
5108 PURPOSE : Request a stored message index and status | |
5109 */ | |
5110 | |
5111 SHORT sms_index_list(T_MFW_SMS_STAT stat, | |
5112 T_MFW_SMS_IDX * msg_list, | |
5113 int max_entries) | |
5114 { | |
5115 SHORT count; | |
5116 int i; | |
5117 | |
5118 TRACE_FUNCTION("sms_index_list()"); | |
5119 | |
5120 count = 0; | |
5121 switch (stat) | |
5122 { | |
5123 case MFW_SMS_ALL: | |
5124 #ifdef FF_MMI_SMS_DYNAMIC | |
5125 for (i=0; i<g_max_messages; i++) | |
5126 #else | |
5127 for (i=0; i<MAX_MESSAGES; i++) | |
5128 #endif | |
5129 { | |
5130 if (count >= max_entries) | |
5131 return count; | |
5132 | |
5133 if (msg_info[i].index != -1) | |
5134 { | |
5135 sms_copy_idx_list(i, &msg_list[count]); | |
5136 count++; | |
5137 } | |
5138 } | |
5139 return count; | |
5140 | |
5141 case MFW_SMS_MO: | |
5142 #ifdef FF_MMI_SMS_DYNAMIC | |
5143 for (i=0; i<g_max_messages; i++) | |
5144 #else | |
5145 for (i=0; i<MAX_MESSAGES; i++) | |
5146 #endif | |
5147 { | |
5148 if (count >= max_entries) | |
5149 return count; | |
5150 | |
5151 if ((msg_info[i].index != -1) | |
5152 AND ((msg_info[i].stat == MFW_SMS_STOR_UNSENT) | |
5153 OR (msg_info[i].stat == MFW_SMS_STOR_SENT))) | |
5154 { | |
5155 sms_copy_idx_list(i, &msg_list[count]); | |
5156 count++; | |
5157 } | |
5158 } | |
5159 return count; | |
5160 | |
5161 case MFW_SMS_STOR_UNSENT: | |
5162 #ifdef FF_MMI_SMS_DYNAMIC | |
5163 for (i=0; i<g_max_messages; i++) | |
5164 #else | |
5165 for (i=0; i<MAX_MESSAGES; i++) | |
5166 #endif | |
5167 { | |
5168 if (count >= max_entries) | |
5169 return count; | |
5170 | |
5171 if ((msg_info[i].index != -1) | |
5172 AND (msg_info[i].stat == MFW_SMS_STOR_UNSENT)) | |
5173 { | |
5174 sms_copy_idx_list(i, &msg_list[count]); | |
5175 count++; | |
5176 } | |
5177 } | |
5178 return count; | |
5179 | |
5180 case MFW_SMS_STOR_SENT: | |
5181 #ifdef FF_MMI_SMS_DYNAMIC | |
5182 for (i=0; i<g_max_messages; i++) | |
5183 #else | |
5184 for (i=0; i<MAX_MESSAGES; i++) | |
5185 #endif | |
5186 { | |
5187 if (count >= max_entries) | |
5188 return count; | |
5189 | |
5190 if ((msg_info[i].index != -1) | |
5191 AND (msg_info[i].stat == MFW_SMS_STOR_SENT)) | |
5192 { | |
5193 sms_copy_idx_list(i, &msg_list[count]); | |
5194 count++; | |
5195 } | |
5196 } | |
5197 return count; | |
5198 | |
5199 case MFW_SMS_MT: | |
5200 #ifdef FF_MMI_SMS_DYNAMIC | |
5201 for (i=0; i<g_max_messages; i++) | |
5202 #else | |
5203 for (i=0; i<MAX_MESSAGES; i++) | |
5204 #endif | |
5205 { | |
5206 if (count >= max_entries) | |
5207 return count; | |
5208 | |
5209 if ((msg_info[i].index != -1) | |
5210 AND ((msg_info[i].stat == MFW_SMS_UNREAD) | |
5211 OR (msg_info[i].stat == MFW_SMS_READ))) | |
5212 { | |
5213 sms_copy_idx_list(i, &msg_list[count]); | |
5214 count++; | |
5215 } | |
5216 } | |
5217 return count; | |
5218 | |
5219 case MFW_SMS_UNREAD: | |
5220 #ifdef FF_MMI_SMS_DYNAMIC | |
5221 for (i=0; i<g_max_messages; i++) | |
5222 #else | |
5223 for (i=0; i<MAX_MESSAGES; i++) | |
5224 #endif | |
5225 { | |
5226 if (count >= max_entries) | |
5227 return count; | |
5228 | |
5229 if ((msg_info[i].index != -1) | |
5230 AND (msg_info[i].stat == MFW_SMS_UNREAD)) | |
5231 { | |
5232 sms_copy_idx_list(i, &msg_list[count]); | |
5233 count++; | |
5234 } | |
5235 } | |
5236 return count; | |
5237 | |
5238 case MFW_SMS_READ: | |
5239 #ifdef FF_MMI_SMS_DYNAMIC | |
5240 for (i=0; i<g_max_messages; i++) | |
5241 #else | |
5242 for (i=0; i<MAX_MESSAGES; i++) | |
5243 #endif | |
5244 { | |
5245 if (count >= max_entries) | |
5246 return count; | |
5247 | |
5248 if ((msg_info[i].index != -1) | |
5249 AND (msg_info[i].stat == MFW_SMS_READ)) | |
5250 { | |
5251 sms_copy_idx_list(i, &msg_list[count]); | |
5252 count++; | |
5253 } | |
5254 } | |
5255 return count; | |
5256 | |
5257 case MFW_SMS_VOICE: | |
5258 #ifdef FF_MMI_SMS_DYNAMIC | |
5259 for (i=0; i<g_max_messages; i++) | |
5260 #else | |
5261 for (i=0; i<MAX_MESSAGES; i++) | |
5262 #endif | |
5263 { | |
5264 if (count >= max_entries) | |
5265 return count; | |
5266 | |
5267 if ((msg_info[i].index != -1) | |
5268 AND (msg_info[i].msg_type == MFW_SMS_VOICE)) | |
5269 { | |
5270 sms_copy_idx_list(i, &msg_list[count]); | |
5271 count++; | |
5272 } | |
5273 } | |
5274 return count; | |
5275 | |
5276 default: | |
5277 return count; | |
5278 } | |
5279 } | |
5280 | |
5281 | |
5282 /* | |
5283 +---------------------------------------------------------------------------+ | |
5284 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
5285 | STATE : code ROUTINE : sms_copy_idx_list | | |
5286 +---------------------------------------------------------------------------+ | |
5287 | |
5288 PURPOSE : copy the index and status of a short message | |
5289 | |
5290 */ | |
5291 | |
5292 void sms_copy_idx_list(int num, T_MFW_SMS_IDX *msg_list) | |
5293 { | |
5294 TRACE_FUNCTION("sms_copy_idx_list()"); | |
5295 | |
5296 msg_list->index = msg_info[num].index; | |
5297 /* | |
5298 * forward message reference to MMI | |
5299 */ | |
5300 msg_list->stat = msg_info[num].stat; | |
5301 msg_list->msg_type = msg_info[num].msg_type; | |
5302 | |
5303 } | |
5304 void sms_copy_idx(UBYTE index, T_MFW_SMS_IDX *msg_list) | |
5305 {int i; | |
5306 TRACE_FUNCTION("sms_copy_idx()"); | |
5307 | |
5308 #ifdef FF_MMI_SMS_DYNAMIC | |
5309 for (i=0; i<g_max_messages; i++) | |
5310 #else | |
5311 for (i=0;i<MAX_MESSAGES; i++) | |
5312 #endif | |
5313 { | |
5314 if (index==msg_info[i].index) | |
5315 /* | |
5316 * forward message reference to MMI | |
5317 */ | |
5318 { | |
5319 msg_list->concat_status = msg_info[i].concat_status;/*SPR 2260*/ | |
5320 msg_list->stat = msg_info[i].stat; | |
5321 msg_list->msg_type = msg_info[i].msg_type; | |
5322 break; | |
5323 } | |
5324 } | |
5325 } | |
5326 | |
5327 //GW-SPR#780 - Removed procedure - status is already updated by 'sms_change_read_status' | |
5328 /* PATCH JPS 29.09 END */ | |
5329 /* | |
5330 +---------------------------------------------------------------------------+ | |
5331 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
5332 | STATE : code ROUTINE : sms_ok_CMGL | | |
5333 +---------------------------------------------------------------------------+ | |
5334 | |
5335 PURPOSE : End of the rAT_PlusCMGL() | |
5336 | |
5337 */ | |
5338 void sms_ok_CMGL (void) | |
5339 { | |
5340 TRACE_FUNCTION("sms_ok_CMGL: rAT_PlusCMGL cmpl"); | |
5341 /* request default memory */ | |
5342 f_update = MFW_SMS_FREE; | |
5343 int_req = FIRST_READ_OF_MEMORY_USE;/*SPR2260*/ | |
5344 | |
5345 qAT_PlusCPMS(CMD_SRC_LCL); | |
5346 } | |
5347 | |
5348 | |
5349 | |
5350 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 | |
5351 //begin 30439 | |
5352 /* | |
5353 +---------------------------------------------------------------------------+ | |
5354 | PROJECT : MMI-Framework (8417) MODULE : MFW_SMS | | |
5355 | STATE : code ROUTINE : sms_homezoneCBToggle | | |
5356 +---------------------------------------------------------------------------+ | |
5357 | |
5358 PURPOSE : | |
5359 | |
5360 */ | |
5361 #ifndef NEPTUNE_BOARD | |
5362 | |
5363 //Dec 14, 2005 REF: MMI-FIX-OMAPS00058684 x0035544 | |
5364 #ifdef FF_HOMEZONE | |
5365 void sms_homezoneCBToggle(U8 Activate_CB) | |
5366 { | |
5367 T_ACI_RETURN ret; | |
5368 T_ACI_CBHZ_MOD mode; | |
5369 T_ACI_CS dcs; | |
5370 UBYTE timeout; | |
5371 int def_dcs = 0; | |
5372 int def_timeout = 60; | |
5373 | |
5374 TRACE_FUNCTION("sms_homezoneCBToggle()"); | |
5375 | |
5376 ret = qAT_PercentCBHZ(CMD_SRC_LCL , &mode, &dcs, &timeout); | |
5377 | |
5378 if (ret EQ AT_FAIL) | |
5379 { | |
5380 //Aug 16, 2005 REF: MMI-FIX-30439 x0018858 | |
5381 //Incase the querying fails, we still wil have to activate/ de-activate with default | |
5382 //values for dcs and timeout | |
5383 if(1 == Activate_CB ) | |
5384 { | |
5385 TRACE_FUNCTION("ACTIVATING HOMEZONE"); | |
5386 ret = sAT_PercentCBHZ(CMD_SRC_LCL , CBHZ_MOD_Active,def_dcs,def_timeout); | |
5387 } | |
5388 else | |
5389 { | |
5390 TRACE_FUNCTION("DE-ACTIVATING HOMEZONE"); | |
5391 ret = sAT_PercentCBHZ(CMD_SRC_LCL , CBHZ_MOD_NotActive,def_dcs,def_timeout); | |
5392 } | |
5393 | |
5394 return; | |
5395 } | |
5396 | |
5397 | |
5398 if(1 == Activate_CB ) | |
5399 { | |
5400 TRACE_FUNCTION("ACTIVATING HOMEZONE"); | |
5401 ret = sAT_PercentCBHZ(CMD_SRC_LCL , CBHZ_MOD_Active,dcs,timeout); | |
5402 } | |
5403 else | |
5404 { | |
5405 TRACE_FUNCTION("DE-ACTIVATING HOMEZONE"); | |
5406 ret = sAT_PercentCBHZ(CMD_SRC_LCL , CBHZ_MOD_NotActive,dcs,timeout); | |
5407 } | |
5408 return; | |
5409 | |
5410 } | |
5411 //end 30439 | |
5412 #endif | |
5413 #endif | |
5414 |