FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/mmiSmsIdle.c @ 3:67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:33:10 +0000 |
parents | |
children | 718ede6f6f1f |
comparison
equal
deleted
inserted
replaced
2:3a14ee9a9843 | 3:67bfe9f274f6 |
---|---|
1 /******************************************************************************* | |
2 | |
3 CONDAT (UK) | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Condat (UK) Ltd and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: Basic MMI | |
13 $Project code: BMI | |
14 $Module: SMS | |
15 $File: MmiSmsIdle.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 25/10/00 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: Implementation for MMI smsidle unsolicited event handling | |
24 | |
25 | |
26 | |
27 ******************************************************************************** | |
28 | |
29 $History: MmiSmsIdle.c | |
30 | |
31 25/10/00 Original Condat(UK) BMI version. | |
32 | |
33 May 7, 2007 OMAPS00130278 a0393213(R.Prabakar) | |
34 Description : CT-GCF[34.2.5.1] - MS fails to display class 0 MT SMS when it contains alphanumeric and special characters | |
35 Solution : Decoding of DCS was not done according to GSM spec | |
36 | |
37 Feb 28, 2007 OMAPS00109953 a0393213(R.Prabakar) | |
38 Description : Need to be able to store SMS in SIM/ME | |
39 Solution : Earlier, index alone was sufficient to identify messages. Now memory should also be taken care of. | |
40 | |
41 Sep 04, 2006 REF:OMAPS00092060 x0039928 | |
42 Description: COMBO : MIDI ringer not played for incoming alarm or SMS during voice call on N5.16 | |
43 Solution: A tone is played for an incoming SMS during voice call. | |
44 | |
45 July 06, 2006 REF:OMAPS00084767 x0039928 | |
46 Description: Locosto N5.14/N12.9- Configuration without MIDI does not build | |
47 Solution: extern T_call call_dat is moved out of FF_MIDI_RINGER flag | |
48 | |
49 May 10, 2006 DR: OMAPS00075379 x0021334 | |
50 Descripton: SMS - Status Request in idle mode - using Menu - no status in pending state | |
51 Solution: The display of pending status is network dependent. In some networks this | |
52 status is not given. When available, it used to display 'Temp Error'. This has now been | |
53 replaced with 'Pending'. | |
54 | |
55 Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | |
56 Description: Mp3 Ringer Implementation | |
57 Solution: The Midi Ringer application has been enhanced to support mp3 as ringer. | |
58 The interface function names have been modified. | |
59 | |
60 May 27, 2005 MMI-FIX-29869 x0018858 | |
61 Description: There is a limitation on the number of messages that can be downloaded from | |
62 server even though there is space on the sim. | |
63 Solution: The limitation has been removed and the number of messages that can be dowloaded | |
64 has been modified to the maximum number that can be stored. | |
65 | |
66 Jun 14, 2005 REF: MMI-FIX-30439 x0018858 | |
67 Description: The homezone/cityzone tags were not being displayed properly. | |
68 Solution: Modified to save the tags properly in caches and also made the | |
69 appropriate modifications to update the same properly during mobility. | |
70 | |
71 Apr 05, 2005 REF: ENH 29994 xdeepadh | |
72 Description: Implementation of Generic Midi Ringer and Modification of existing Midi Test Application | |
73 Solution: Generic Midi Ringer and Midi Test Application were implemented. | |
74 | |
75 x0018858 24 Mar, 2005 MMI-FIX-11321 | |
76 Issue Description :- If the inbox is full and a new message is receivd, no indication is received. | |
77 Fix: Added support for handling indication when message box is full and | |
78 there is a pending message. | |
79 | |
80 Feb 16, 2005 REF: CRR MMI-SPR-27900 xnkulkar | |
81 Issue description: BMI: using the tool nowSMS the voicemail indication via sms does not work | |
82 Solution: Instead of identifying voice using addr[0] and pid, we use dcs. Also, messages belonging | |
83 to group "1100" are deleted when voicemail icon is displayed. | |
84 | |
85 Apr 27, 2004 REF: CRR 21336 Deepa M.D | |
86 Bug:SMSMT UCS2 Class0 message content not displayed. | |
87 Fix:The alphabet bits(UCS2) of DCS were not decoded properly. | |
88 | |
89 $End | |
90 | |
91 *******************************************************************************/ | |
92 | |
93 #define ENTITY_MFW | |
94 | |
95 /* includes */ | |
96 #include <string.h> | |
97 #include <stdio.h> | |
98 #include <stdlib.h> | |
99 | |
100 #if defined (NEW_FRAME) | |
101 | |
102 #include "typedefs.h" | |
103 #include "vsi.h" | |
104 #include "pei.h" | |
105 #include "custom.h" | |
106 #include "gsm.h" | |
107 | |
108 #else | |
109 | |
110 #include "STDDEFS.H" | |
111 #include "custom.h" | |
112 #include "gsm.h" | |
113 #include "vsi.h" | |
114 | |
115 #endif | |
116 | |
117 #include "gdi.h" | |
118 #include "audio.h" | |
119 | |
120 | |
121 #include "prim.h" | |
122 | |
123 | |
124 #include "mfw_sys.h" | |
125 | |
126 #include "mfw_mfw.h" | |
127 #include "mfw_win.h" | |
128 #include "mfw_kbd.h" | |
129 /* SPR#1428 - SH - New Editor changes */ | |
130 #ifndef NEW_EDITOR | |
131 #include "mfw_edt.h" | |
132 #endif | |
133 #include "mfw_lng.h" | |
134 #include "mfw_icn.h" | |
135 #include "mfw_phb.h" | |
136 #include "mfw_sim.h" | |
137 #include "mfw_nm.h" | |
138 | |
139 #include "ksd.h" | |
140 #include "psa.h" | |
141 #include "mfw_sms.h" | |
142 #include "mfw_smsi.h" | |
143 #include "mfw_mnu.h" | |
144 #include "mfw_sat.h" | |
145 #include "mfw_tim.h" | |
146 #include "mfw_mme.h" | |
147 | |
148 #include "dspl.h" | |
149 | |
150 #include "MmiMmi.h" | |
151 #include "MmiDummy.h" | |
152 #include "MmiDialogs.h" | |
153 #include "MmiLists.h" | |
154 | |
155 #include "MmiMain.h" | |
156 #include "MmiStart.h" | |
157 #include "MmiPins.h" | |
158 #include "MmiMenu.h" | |
159 #include "MmiSoftKeys.h" | |
160 #include "MmiSounds.h" | |
161 #include "mmiCall.h" | |
162 | |
163 #include "MmiBookController.h" | |
164 | |
165 | |
166 #include "MmiIdle.h" | |
167 #include "Mmiicons.h" | |
168 #include "mmiSmsIdle.h" | |
169 #include "mmiSmsBroadcast.h" | |
170 | |
171 /* SPR759 - SH */ | |
172 #ifdef MMI_HOMEZONE_ENABLED | |
173 #include "MmiHomezone.h" | |
174 #endif | |
175 #include "mmiSmsRead.h" /*SPR 2512*/ | |
176 #include "cus_aci.h" | |
177 | |
178 #include "prim.h" | |
179 #ifndef PCM_2_FFS | |
180 #include "pcm.h" | |
181 #endif | |
182 | |
183 | |
184 // Feb 16, 2005 REF: CRR MMI-SPR-27900 xnkulkar | |
185 extern BOOL invalidVm; | |
186 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
187 #ifdef FF_MIDI_RINGER | |
188 #include "mfw_midi.h" | |
189 #endif | |
190 | |
191 /* SMS arrival Setting */ | |
192 #ifdef NEPTUNE_BOARD | |
193 #ifdef MMI_POWER_MANAGEMENT_TEST | |
194 int iSmsArrival = 0; | |
195 #endif | |
196 #endif | |
197 | |
198 /********************************************************************* | |
199 ********************************************************************** | |
200 | |
201 STATIC MENU WINDOW. DECLARATION | |
202 | |
203 ********************************************************************* | |
204 **********************************************************************/ | |
205 | |
206 typedef struct | |
207 { | |
208 /* administrative data */ | |
209 | |
210 T_MMI_CONTROL mmi_control; | |
211 T_MFW_HND win; | |
212 SHORT id; | |
213 T_MFW_HND parent; | |
214 | |
215 /* associated handlers */ | |
216 | |
217 T_MFW_HND sms; | |
218 | |
219 /* internal data */ | |
220 | |
221 BOOL sms_initialised; | |
222 BOOL sms_store_free; | |
223 } T_smsidle; | |
224 #ifdef NEPTUNE_BOARD | |
225 extern T_call call_data; | |
226 #else | |
227 // July 06, 2006 REF:OMAPS00084767 x0039928 | |
228 extern T_call call_data; | |
229 #endif | |
230 | |
231 /********************************************************************* | |
232 | |
233 External Function Prototypes | |
234 | |
235 **********************************************************************/ | |
236 extern UBYTE getcurrentSMSTone(void); | |
237 extern UBYTE getcurrentVoiceTone(void); | |
238 extern UBYTE Delete_1_2_1_vm_icon; | |
239 extern UBYTE Display_1_2_1_vm_icon; | |
240 /* cq15633 Access function returning incoming call alert window status. 23-03-04. MZ */ | |
241 extern BOOL call_IsAlertScreenActive( void ); | |
242 // May 27, 2005 MMI-FIX-29869 x0018858 - Extern function | |
243 #ifdef FF_MMI_SMS_DYNAMIC | |
244 extern Check_max_sms_allowed(void); | |
245 #endif | |
246 /********************************************************************* | |
247 | |
248 Function Prototypes | |
249 | |
250 **********************************************************************/ | |
251 // ADDED BY RAVI - 28-11-2005 | |
252 EXTERN UBYTE getCurrentRingerSettings(void); | |
253 extern UBYTE sms_check_message_pending(void); | |
254 // END RAVI - 28-11-2005 | |
255 | |
256 static SHORT smsidle_get_new_cb_messages_count(void); | |
257 static T_smsidle smsidle_data; | |
258 static int smsidle_sr_status_to_text_id(UBYTE status); /* Marcus: Issue 1170: 07/10/2002 */ | |
259 | |
260 | |
261 // Used to count the number of deleted messages in delete all | |
262 SHORT g_ListLength2; | |
263 static char status_report[160]; /* Marcus: Issue 1170: 07/10/2002 */ | |
264 | |
265 static T_MFW_HND smsidle_create (T_MFW_HND parent); | |
266 static void smsidle_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
267 int smsidle_sms_cb (MfwEvt e, MfwWin *w); | |
268 | |
269 /******************************************************************************* | |
270 | |
271 $Function: smsidle_start | |
272 | |
273 $Description: This function will be call once.It is create a static sms handle | |
274 | |
275 $Returns: mfw window handler | |
276 | |
277 $Arguments: parent_window - Parent window handler | |
278 param - optional data | |
279 | |
280 *******************************************************************************/ | |
281 | |
282 T_MFW_HND smsidle_start(T_MFW_HND parent_window, void *param) | |
283 { | |
284 T_MFW_HND win; | |
285 | |
286 TRACE_FUNCTION ("smsidle_start()"); | |
287 | |
288 win = smsidle_create (parent_window); | |
289 | |
290 if (win NEQ NULL) | |
291 { | |
292 SEND_EVENT (win, E_INIT, 0, NULL); | |
293 } | |
294 return win; | |
295 } | |
296 | |
297 /******************************************************************************* | |
298 | |
299 $Function: smsidle_create | |
300 | |
301 $Description: Create sms Idle window | |
302 | |
303 $Returns: mfw window handler | |
304 | |
305 $Arguments: parent_window - Parent window handler | |
306 | |
307 *******************************************************************************/ | |
308 static T_MFW_HND smsidle_create(MfwHnd parent_window) | |
309 { | |
310 T_smsidle * data = &smsidle_data; | |
311 T_MFW_WIN * win; | |
312 | |
313 TRACE_FUNCTION ("smsidle_create()"); | |
314 | |
315 /* | |
316 * Create window handler | |
317 */ | |
318 | |
319 if (data->win EQ NULL) | |
320 { | |
321 data->win = | |
322 win_create (parent_window, 0, 0, NULL); | |
323 if (data->win EQ NULL) | |
324 { | |
325 return NULL; | |
326 } | |
327 } | |
328 else | |
329 { | |
330 TRACE_EVENT ("smsidle_create() called twice"); | |
331 return NULL; | |
332 } | |
333 | |
334 /* | |
335 * connect the dialog data to the MFW-window | |
336 */ | |
337 | |
338 data->mmi_control.dialog = (T_DIALOG_FUNC)smsidle_exec_cb; | |
339 data->mmi_control.data = data; | |
340 win = (T_MFW_WIN *)((T_MFW_HDR *)data->win)->data; | |
341 win->user = (void *)data; | |
342 data->parent = parent_window; | |
343 | |
344 /* | |
345 * return window handle | |
346 */ | |
347 | |
348 win_show(data->win); | |
349 return data->win; | |
350 } | |
351 | |
352 /******************************************************************************* | |
353 | |
354 $Function: smsidle_destroy | |
355 | |
356 $Description: Destroy the sms Idle window. | |
357 | |
358 $Returns: none | |
359 | |
360 $Arguments: none | |
361 | |
362 *******************************************************************************/ | |
363 void smsidle_destroy(void) | |
364 { | |
365 T_MFW_WIN * win_data; | |
366 MfwHnd own_window; | |
367 T_smsidle * data; | |
368 | |
369 own_window = smsidle_data.win; | |
370 | |
371 TRACE_FUNCTION ("smsidle_destroy()"); | |
372 | |
373 if (own_window) | |
374 { | |
375 win_data = (T_MFW_WIN *)((T_MFW_HDR *)own_window)->data; | |
376 data = (T_smsidle *)win_data->user; | |
377 | |
378 if (data) | |
379 { | |
380 /* | |
381 * Delete WIN handler | |
382 */ | |
383 win_delete (data->win); | |
384 | |
385 /* | |
386 * Free Memory | |
387 */ | |
388 /* Memory is static! */ | |
389 } | |
390 else | |
391 { | |
392 TRACE_EVENT ("smsidle_destroy() called twice"); | |
393 return; | |
394 } | |
395 } | |
396 } | |
397 | |
398 | |
399 | |
400 /******************************************************************************* | |
401 | |
402 $Function: smsidle_exec_cb | |
403 | |
404 $Description: Call back function for the sms Idle window. | |
405 | |
406 $Returns: none | |
407 | |
408 $Arguments: win - current window | |
409 event - window event | |
410 value - unique id | |
411 parameter - pointer to optional data. | |
412 | |
413 *******************************************************************************/ | |
414 | |
415 void smsidle_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
416 /* callback handler for events sent to to trigger execution */ | |
417 { | |
418 T_MFW_WIN * win_data = (T_MFW_WIN *)((T_MFW_HDR *) win)->data; | |
419 T_smsidle * data = (T_smsidle *)win_data->user; | |
420 T_MFW_EVENT smsEvents; | |
421 | |
422 TRACE_FUNCTION ("smsidle_exec_cb()"); | |
423 | |
424 switch (event) | |
425 { | |
426 case E_INIT: | |
427 /* initialization of administrative data */ | |
428 data->id = value; | |
429 | |
430 /* initialization of the dialog data */ | |
431 | |
432 sms_init(); /* startup sms in MFW */ | |
433 | |
434 smsEvents = | |
435 E_SMS_MO_AVAIL | E_SMS_CMD_AVAIL | E_SMS_SAVE_AVAIL | |
436 | E_SMS_MT | E_SMS_MO | E_SMS_MT_RECEIVED | E_SMS_STATUS | |
437 | E_SMS_MEM | E_SMS_OK | E_SMS_ERR | E_SMS_BUSY | |
438 | E_SMS_MEM_FULL | E_SMS_MEM_FREE | E_SMS_RECEIVED | E_SMS_CB | |
439 | E_SMS_READY | E_SMS_CB_RECEIVED; | |
440 | |
441 | |
442 data->sms = sms_create(win, smsEvents, (T_MFW_CB) smsidle_sms_cb); | |
443 | |
444 /* "sms_initialised" indicates that the SMS is ready or not */ | |
445 /*api - 10-05-02 - Set To True so the SMS can be recieved (Event not Generated) */ | |
446 data->sms_initialised = FALSE; /* SMS not ready yet */ | |
447 | |
448 /* "sms_store_free" indicates that the SMS Memory is full or not */ | |
449 /* Set default to True !*/ | |
450 data->sms_store_free = TRUE; // ??? | |
451 | |
452 break; | |
453 case E_BACK: | |
454 case E_ABORT: | |
455 case E_EXIT: | |
456 smsidle_destroy(); /* there's no default reaction */ | |
457 sms_delete(data->sms); | |
458 sms_exit(); /* ??? implementation of routine is actually empty */ | |
459 break; | |
460 default: | |
461 TRACE_EVENT("unhandled event in smsidle_exec_cb()"); | |
462 return; | |
463 } | |
464 } | |
465 /******************************************************************************* | |
466 | |
467 $Function: smsidle_message_to_text | |
468 | |
469 $Description: function to format message information into a text string. SPR2363 | |
470 | |
471 $Returns: none | |
472 | |
473 $Arguments: message data structure, text buffer(should be at least MAX_EDITOR_LEN | |
474 chars long) | |
475 | |
476 *******************************************************************************/ | |
477 | |
478 void smsidle_message_to_text(T_MFW_SMS_MT* SmsMt, char* text_buffer) | |
479 { | |
480 T_MFW_PHB_ENTRY pb_entry; | |
481 // UBYTE input_type, output_type; // RAVI | |
482 char sms_text_buffer[STANDARD_EDITOR_SIZE]; | |
483 UBYTE index=0; | |
484 // UBYTE msg_len; // RAVI | |
485 T_ATB_TEXT main_text, temp_text; | |
486 char msg_buffer[MAX_MSG_LEN_ARRAY]; /*msg buffer which is used while converting 7-bit encoded system to ASCII*/ | |
487 | |
488 | |
489 /*clear buffers*/ | |
490 memset(sms_text_buffer, 0, STANDARD_EDITOR_SIZE); | |
491 memset(text_buffer, 0, MAX_EDITOR_LEN); | |
492 | |
493 | |
494 | |
495 | |
496 | |
497 /*, if new editor use nice string-handling functions*/ | |
498 | |
499 main_text.data = (UBYTE*)text_buffer; | |
500 /*set up text data stucture for main display string*/ | |
501 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
502 main_text.dcs = ATB_DCS_UNICODE; | |
503 else | |
504 main_text.dcs = ATB_DCS_ASCII; | |
505 ATB_string_Length(&main_text); | |
506 | |
507 | |
508 /*SPR 2539, if new editor use nice string-handling functions*/ | |
509 /*see if the sender is in the phonebook*/ | |
510 if (bookFindNameInPhonebook((const char*)SmsMt->orig_addr.number, &pb_entry) !=0) | |
511 { char temp_string[PHB_MAX_LEN]; | |
512 | |
513 memset(temp_string, 0, PHB_MAX_LEN); | |
514 /*copy name into a text data structure*/ | |
515 if ((pb_entry.name.dcs&0xC0) == MFW_DCS_UCS2 ||pb_entry.name.data[0] == 0x80 ) | |
516 temp_text.dcs = ATB_DCS_UNICODE; | |
517 else | |
518 temp_text.dcs = ATB_DCS_ASCII; | |
519 if (temp_text.dcs != ATB_DCS_UNICODE) | |
520 { | |
521 temp_text.data = (UBYTE*)pb_entry.name.data; | |
522 } | |
523 | |
524 else | |
525 { pb_entry.name.len-=2; | |
526 memcpy(temp_string, &pb_entry.name.data[2], pb_entry.name.len); | |
527 temp_text.data = (UBYTE*)temp_string; | |
528 } | |
529 ATB_string_Length(&temp_text); | |
530 /*add name text into main display string*/ | |
531 ATB_string_Concat(&main_text, &temp_text); | |
532 } | |
533 | |
534 | |
535 | |
536 sms_text_buffer[index++]='\n'; | |
537 | |
538 sms_text_buffer[index++]='0'+SmsMt->sctp.day[0]; | |
539 sms_text_buffer[index++]='0'+SmsMt->sctp.day[1]; | |
540 sms_text_buffer[index++]='/'; | |
541 sms_text_buffer[index++]='0'+SmsMt->sctp.month[0]; | |
542 sms_text_buffer[index++]='0'+SmsMt->sctp.month[1]; | |
543 sms_text_buffer[index++]='/'; | |
544 sms_text_buffer[index++]='0'+SmsMt->sctp.year[0]; | |
545 sms_text_buffer[index++]='0'+SmsMt->sctp.year[1]; | |
546 sms_text_buffer[index++]=','; | |
547 sms_text_buffer[index++]='\n'; | |
548 | |
549 sms_text_buffer[index++] ='0'+SmsMt->sctp.hour[0]; | |
550 sms_text_buffer[index++]='0'+SmsMt->sctp.hour[1]; | |
551 sms_text_buffer[index++]=':'; | |
552 sms_text_buffer[index++]='0'+SmsMt->sctp.minute[0]; | |
553 sms_text_buffer[index++]='0'+SmsMt->sctp.minute[1]; | |
554 sms_text_buffer[index++]='\n'; | |
555 | |
556 /* if new editor use nice string-handling functions*/ | |
557 | |
558 temp_text.dcs = ATB_DCS_ASCII; | |
559 temp_text.data = (UBYTE*)sms_text_buffer; | |
560 ATB_string_Length(&temp_text); | |
561 ATB_string_Concat(&main_text, &temp_text); | |
562 // Apr 27, 2004 REF: CRR 21336 Deepa M.D | |
563 //Check for the Alphabet bits(2nd and 3rd bits) in the DCS.(GSM 03.38 version 5.6.1,Section 4) | |
564 //Bit 3 and 2 are equal to 1 &0 indicates UCS2 coding | |
565 /*a0393213(R.Prabakar) OMAPS00130278 - MS fails to display class 0 MT SMS when it contains alphanumeric and special characters. | |
566 DCS was not properly interpreted. Now its' done according to GSM 03.38 ver 7.2.0*/ | |
567 | |
568 if((SmsMt->dcs & 0xC0) == 0x00) | |
569 { | |
570 switch(SmsMt->dcs & 0x0C) | |
571 { | |
572 case 0x08: | |
573 temp_text.dcs = ATB_DCS_UNICODE; | |
574 temp_text.data = (UBYTE*)SmsMt->sms_msg; | |
575 break; | |
576 case 0x04: | |
577 temp_text.dcs=ATB_DCS_ASCII; | |
578 temp_text.data = (UBYTE*)SmsMt->sms_msg; | |
579 break; | |
580 case 0x00: | |
581 { | |
582 /*default alphabet (7 bit) - convert to ASCII*/ | |
583 convertUnpacked7To8(SmsMt->sms_msg, SmsMt->msg_len, | |
584 msg_buffer, sizeof(msg_buffer)); | |
585 temp_text.dcs=ATB_DCS_ASCII; | |
586 temp_text.data = (UBYTE*)msg_buffer; | |
587 } | |
588 break; | |
589 default: | |
590 TRACE_ERROR("smsidle_message_to_text() : Unknown DCS"); | |
591 } | |
592 | |
593 } | |
594 else if((SmsMt->dcs & 0xF0) == 0xF0) | |
595 { | |
596 switch(SmsMt->dcs & 0x04) | |
597 { | |
598 case 0x04: | |
599 temp_text.dcs=ATB_DCS_ASCII; | |
600 temp_text.data = (UBYTE*)SmsMt->sms_msg; | |
601 break; | |
602 case 0x00: | |
603 { | |
604 /*default alphabet (7 bit) - convert to ASCII*/ | |
605 convertUnpacked7To8(SmsMt->sms_msg, SmsMt->msg_len, | |
606 msg_buffer, sizeof(msg_buffer)); | |
607 temp_text.dcs=ATB_DCS_ASCII; | |
608 temp_text.data = (UBYTE*)msg_buffer; | |
609 } | |
610 break; | |
611 default: | |
612 TRACE_ERROR("smsidle_message_to_text() : Unknown DCS"); | |
613 | |
614 } | |
615 } | |
616 else | |
617 { | |
618 TRACE_ERROR("smsidle_message_to_text() : Unknown DCS"); | |
619 } | |
620 | |
621 /*if ((SmsMt->dcs&0x0C) == MFW_DCS_UCS2) | |
622 temp_text.dcs = ATB_DCS_UNICODE; | |
623 else | |
624 temp_text.dcs = ATB_DCS_ASCII;*/ | |
625 | |
626 ATB_string_Length(&temp_text); | |
627 /*Add date and time to main display string*/ | |
628 ATB_string_Concat(&main_text, &temp_text); | |
629 | |
630 | |
631 | |
632 } | |
633 | |
634 | |
635 /******************************************************************************* | |
636 | |
637 $Function: smsidle_sms_cb | |
638 | |
639 $Description: Call back function for the sms Idle window. | |
640 | |
641 $Returns: none | |
642 | |
643 $Arguments: event - window event | |
644 w - current window | |
645 *******************************************************************************/ | |
646 int smsidle_sms_cb (MfwEvt event, MfwWin *w) | |
647 /* smsidle's sms event handler */ | |
648 { | |
649 T_MFW_HND win = mfwParent((MfwHdr *)mfw_header()); | |
650 T_MFW_WIN * win_data = (T_MFW_WIN *)((T_MFW_HDR *)win)->data; | |
651 T_smsidle * data = (T_smsidle *)win_data->user; | |
652 /*cq 15633 get current ringer settings */ | |
653 UBYTE currentRinger = getCurrentRingerSettings(); | |
654 | |
655 /*JVJ SPR1298 Converted to dynamic variable */ | |
656 //May 27, 2005 MMI-FIX-29869 x0018858 | |
657 #ifdef FF_MMI_SMS_DYNAMIC | |
658 T_MFW_SMS_IDX* msg_list; | |
659 T_MFW_SMS_IDX* urd_msg_list; | |
660 #else | |
661 T_MFW_SMS_IDX* msg_list= (T_MFW_SMS_IDX*)ALLOC_MEMORY(MAX_MESSAGES*sizeof(T_MFW_SMS_IDX)); | |
662 T_MFW_SMS_IDX* urd_msg_list= (T_MFW_SMS_IDX*)ALLOC_MEMORY(MAX_MESSAGES*sizeof(T_MFW_SMS_IDX)); | |
663 #endif | |
664 SHORT urd_count; | |
665 // UBYTE alphabet; // RAVI | |
666 /*JVJ SPR1298 Converted to dynamic variable */ | |
667 char* temp_buffer = NULL; | |
668 int result = MFW_EVENT_CONSUMED; | |
669 | |
670 //May 27, 2005 MMI-FIX-29869 x0018858 | |
671 #ifdef FF_MMI_SMS_DYNAMIC | |
672 Check_max_sms_allowed(); | |
673 | |
674 msg_list = (T_MFW_SMS_IDX*)ALLOC_MEMORY(g_max_messages*sizeof(T_MFW_SMS_IDX)); | |
675 urd_msg_list = (T_MFW_SMS_IDX*)ALLOC_MEMORY(g_max_messages*sizeof(T_MFW_SMS_IDX)); | |
676 #endif | |
677 | |
678 TRACE_EVENT ("smsidle_sms_cb()"); | |
679 | |
680 switch (event) | |
681 { | |
682 case E_SMS_READY: | |
683 TRACE_EVENT ("E_SMS_READY"); | |
684 /* now sms is now ready for using */ | |
685 data->sms_initialised = TRUE; | |
686 sms_set_mt_ind(MT_IND_IDX); /* MMI-FIX-17223. Needed for class 0 messages not to be stored in SIM */ | |
687 sms_cb_init(); /*SPR 2470 initialise cell broadcast now SMS has initialised*/ | |
688 smscb_getCBsettings(); /* Get CB info from SIM or phone */ | |
689 #ifdef MMI_HOMEZONE_ENABLED | |
690 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 | |
691 //Commented the function call, | |
692 //homezoneActivateCB(); /* SPR759 - SH - Activate Cell Broadcast channel for homezone */ | |
693 #endif | |
694 | |
695 break; | |
696 case E_SMS_MT_RECEIVED: /* new SMS received, automatically saved */ | |
697 case E_SMS_MT: /* new SMS received, NOT automatically saved */ | |
698 { | |
699 | |
700 /*SPR#1408 - DS - Take the SMS data from MFW. Port of 1669 */ | |
701 T_MFW_SMS_MT *Message = (T_MFW_SMS_MT *) w; | |
702 | |
703 // check for SMS indicating voice mail. | |
704 //May 27, 2005 MMI-FIX-29869 x0018858 | |
705 #ifdef FF_MMI_SMS_DYNAMIC | |
706 urd_count = sms_index_list(MFW_SMS_UNREAD,urd_msg_list,g_max_messages); | |
707 | |
708 sms_index_list(MFW_SMS_VOICE,msg_list,g_max_messages); | |
709 #else | |
710 urd_count=sms_index_list(MFW_SMS_UNREAD,urd_msg_list,MAX_MESSAGES); | |
711 | |
712 sms_index_list(MFW_SMS_VOICE,msg_list,MAX_MESSAGES); | |
713 #endif | |
714 TRACE_EVENT_P4("urd_count %d urd_msg_list-> index %d stat %d msg_type %d", | |
715 urd_count,urd_msg_list[0].index,urd_msg_list[0].stat,urd_msg_list[0].msg_type); | |
716 | |
717 TRACE_EVENT_P2("msg_type: %d, Message->voicemail: %d", msg_list[0].msg_type, Message->voicemail); | |
718 | |
719 //Check SMS indicating voice mail is the received SMS, by checking index is the same. | |
720 /*SPR#1408 - DS - Added check for voicemail flag. | |
721 *For E_SMS_MT_RECEIVED messages the MFW flags the message as a voicemail by setting the | |
722 *msg_type to MFW_SMS_VOICE. For E_SMS_MT messages the MFW flags as a voicemail by | |
723 *setting a boolean in the SMS MT structure. Port of 1669 (then modified). | |
724 */ | |
725 if ( ( (event == E_SMS_MT_RECEIVED) && (msg_list[0].msg_type == MFW_SMS_VOICE) ) || | |
726 ( (event == E_SMS_MT) && (Message->voicemail == TRUE) ) ) | |
727 { | |
728 if(iconsGetState(iconIdVoice) == ICON_VISIBLE || (Delete_1_2_1_vm_icon == TRUE)) | |
729 { | |
730 if (iconsGetState(iconIdVoice) == ICON_VISIBLE && Display_1_2_1_vm_icon == TRUE) | |
731 { | |
732 // one-2-one only functionality, do nothing as icon is already being displayed. | |
733 break; | |
734 } | |
735 else | |
736 { | |
737 Delete_1_2_1_vm_icon = FALSE; | |
738 Display_1_2_1_vm_icon = FALSE; | |
739 iconsDeleteState(iconIdVoice); | |
740 } | |
741 } | |
742 else | |
743 { | |
744 iconsSetState(iconIdVoice); /* display voice mail icon.*/ | |
745 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
746 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | |
747 //Play the SMS tone alert | |
748 #ifdef FF_MIDI_RINGER | |
749 mfw_ringer_start(AS_RINGER_MODE_SMS,false,sounds_midi_ringer_start_cb); | |
750 #else | |
751 | |
752 #ifdef FF_MMI_RINGTONE /* MSL SMS Tone Play */ | |
753 audio_PlaySoundID( AUDIO_BUZZER, SMSTONE_SELECT, 200, AUDIO_PLAY_ONCE ); | |
754 #else | |
755 /* RAVI - 20-1-2006 */ | |
756 #ifdef NEPTUNE_BOARD | |
757 { | |
758 UBYTE currentVoiceTone; | |
759 currentVoiceTone = getcurrentVoiceTone(); | |
760 audio_PlaySoundID( AUDIO_BUZZER, currentVoiceTone, 200, | |
761 AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
762 } | |
763 #else | |
764 { | |
765 UBYTE currentVoiceTone; | |
766 currentVoiceTone = getcurrentVoiceTone(); | |
767 audio_PlaySoundID( AUDIO_BUZZER, currentVoiceTone, 200, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
768 } | |
769 #endif | |
770 | |
771 #endif | |
772 #endif | |
773 mme_backlightEvent(BL_INCOMING_SMS); | |
774 } | |
775 | |
776 /* Set */ | |
777 #ifdef NEPTUNE_BOARD | |
778 #ifdef MMI_POWER_MANAGEMENT_TEST | |
779 iSmsArrival = 1; | |
780 #endif | |
781 #endif | |
782 idleEvent(IdleUpdate); /* update the idle screen.*/ | |
783 | |
784 | |
785 | |
786 // Feb 16, 2005 REF: CRR MMI-SPR-27900 xnkulkar | |
787 // Check if this voice mail sms is marked for deletion (belonging to group "1100") | |
788 if(msg_list[0].stat == MFW_SMS_VOICEMSG_DELETE) | |
789 { | |
790 //Delete this voice mail sms and set 'invalidVm' flag to FALSE | |
791 /*a0393213 OMAPS00109953 - memory passed as parameter*/ | |
792 sms_msg_delete(msg_list[0].index,msg_list[0].memory); | |
793 invalidVm = FALSE; | |
794 } | |
795 } | |
796 else if(urd_count > 0 && urd_msg_list[0].stat == MFW_SMS_UNREAD && (event != E_SMS_MT)) | |
797 { | |
798 | |
799 /* Set */ | |
800 #ifdef NEPTUNE_BOARD | |
801 #ifdef MMI_POWER_MANAGEMENT_TEST | |
802 iSmsArrival = 1; | |
803 #endif | |
804 #endif | |
805 | |
806 /* set the status: The sms icon and the string*/ | |
807 /* "message(s) received" will be displayed */ | |
808 iconsSetState(iconIdSMS); /* Indicate SMS delivery to MS-User. */ | |
809 idleEvent(IdleNewSmsMessage); | |
810 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
811 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | |
812 //Play the SMS tone alert | |
813 //If SMS is recieved , while in call screen,dont play the tone. | |
814 | |
815 | |
816 /* Added Condtion( if((!(call_data.calls.numCalls))) ) to stop the | |
817 SMS tone when call is active - OMAPS00066134 | |
818 */ | |
819 if((!(call_data.calls.numCalls))) | |
820 { | |
821 #ifdef FF_MIDI_RINGER | |
822 mfw_ringer_start(AS_RINGER_MODE_SMS,false,sounds_midi_ringer_start_cb); | |
823 #else | |
824 | |
825 #ifdef NEPTUNE_BOARD | |
826 | |
827 #ifdef FF_MMI_RINGTONE /* MSL SMS Tone Play */ | |
828 audio_PlaySoundID( AUDIO_BUZZER, SMSTONE_SELECT, 200, AUDIO_PLAY_ONCE ); | |
829 #else | |
830 { | |
831 UBYTE currentSMSTone; | |
832 currentSMSTone = getcurrentSMSTone(); | |
833 audio_PlaySoundID( AUDIO_BUZZER, currentSMSTone, | |
834 getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
835 } | |
836 #endif | |
837 #else | |
838 { | |
839 UBYTE currentSMSTone; | |
840 currentSMSTone = getcurrentSMSTone(); | |
841 audio_PlaySoundID( AUDIO_BUZZER, currentSMSTone, 200, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
842 } | |
843 #endif | |
844 #endif | |
845 } | |
846 // Sep 04, 2006 REF:OMAPS00092060 x0039928 | |
847 // Fix: A tone is played for incoming SMS during a call. | |
848 else | |
849 { | |
850 #ifdef FF_MIDI_RINGER | |
851 audio_PlaySoundID( AUDIO_SPEAKER, TONES_RINGING_TONE, 0 , AUDIO_PLAY_ONCE); | |
852 #endif | |
853 } | |
854 /* cq15633 If the Incoming call alert screen is active continue with the incoming call ringer after playing the | |
855 the SMS received tone. 23-03-04 MZ. */ | |
856 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
857 #ifndef FF_MIDI_RINGER | |
858 if(TRUE == call_IsAlertScreenActive()) | |
859 { | |
860 #ifdef FF_MMI_RINGTONE /* MSL SMS Tone Play */ | |
861 audio_PlaySoundID(AUDIO_BUZZER, SMSTONE_SELECT, 0 , AUDIO_PLAY_INFINITE); | |
862 #else | |
863 /* RAVI - 20-1-2006 */ | |
864 /* Silent Implementation */ | |
865 #ifdef NEPTUNE_BOARD | |
866 audio_PlaySoundID(AUDIO_BUZZER, currentRinger, | |
867 getCurrentVoulmeSettings(), AUDIO_PLAY_INFINITE); | |
868 #else | |
869 audio_PlaySoundID(AUDIO_BUZZER, currentRinger, 0 , AUDIO_PLAY_INFINITE); | |
870 #endif | |
871 /* END RAVI */ | |
872 | |
873 #endif | |
874 } | |
875 #endif | |
876 | |
877 mme_backlightEvent(BL_INCOMING_SMS); | |
878 } | |
879 /*NM p029*/ | |
880 /* API - Implemented NM changes from 3.3.3 mainline to show class 0 SMS on idle screen */ | |
881 else if(event == E_SMS_MT) /* this sms identifier "E_SMS_MT" is not saved on the SIM */ | |
882 { | |
883 /* take the SMS data from MFW */ | |
884 T_MFW_SMS_MT *Message = (T_MFW_SMS_MT *) w; | |
885 char* temp_buffer_sms = (char*)ALLOC_MEMORY(MAX_EDITOR_LEN); | |
886 /* Marcus: Issue 1650: 28/01/2003: Start */ | |
887 TRACE_EVENT ("E_SMS_MT"); | |
888 /* check for the class 0 message */ | |
889 TRACE_EVENT_P1("dcs: 0x%02X", Message->dcs); | |
890 /*if memory allocation successful*/ | |
891 | |
892 if (temp_buffer_sms != NULL) | |
893 { | |
894 if ((Message->dcs & TEXT_CLASS_GIVEN) && | |
895 ((Message->dcs & TEXT_CLASS_MASK) == TEXT_CLASS_0)) | |
896 { | |
897 TRACE_EVENT ("Class 0 message"); | |
898 | |
899 /* | |
900 ** SPR#1745 NDH Text from ACI may be compressed. if so | |
901 ** the text will need to be converted to ASCII before it can | |
902 ** be displayed properly | |
903 */ | |
904 if (Message->dcs & TEXT_COMPRESSED) | |
905 { | |
906 | |
907 TRACE_EVENT ("text_compressed"); | |
908 | |
909 /* | |
910 ACI already (in case of 7bit-dcs!) extract the 7 bit to 8 bit, | |
911 so this is what we get and we have just only to decode from | |
912 7Bit-Default to ASCII | |
913 */ | |
914 | |
915 /*SPR 2512, convert message into a text string and then send to idle for display*/ | |
916 smsidle_message_to_text(Message, temp_buffer_sms); | |
917 addCBCH(temp_buffer_sms, IdleNewSmsMessage); | |
918 | |
919 | |
920 | |
921 | |
922 } | |
923 else | |
924 { | |
925 TRACE_EVENT ("text_uncompressed"); | |
926 | |
927 | |
928 /*SPR 2512, convert message into a text string and then send to idle for display*/ | |
929 smsidle_message_to_text(Message, temp_buffer_sms); | |
930 addCBCH(temp_buffer_sms, IdleNewSmsMessage); | |
931 | |
932 | |
933 } | |
934 /* | |
935 ** SPR#1745 - End | |
936 */ | |
937 /* Added Condtion( if((!(call_data.calls.numCalls))) ) to stop the | |
938 ring tone when call is active - OMAPS00066134 | |
939 */ | |
940 #ifdef NEPTUNE_BOARD | |
941 if((!(call_data.calls.numCalls))) | |
942 { | |
943 #endif | |
944 /*CQ10826 - API - 27/06/03 - Add audio indication for class 0 SMS*/ | |
945 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
946 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | |
947 #ifdef FF_MIDI_RINGER | |
948 mfw_ringer_start(AS_RINGER_MODE_SMS,false,sounds_midi_ringer_start_cb); | |
949 #else | |
950 | |
951 #ifdef FF_MMI_RINGTONE /* MSL SMS Tone Play */ | |
952 audio_PlaySoundID( AUDIO_BUZZER, SMSTONE_SELECT, 200, AUDIO_PLAY_ONCE ); | |
953 #else | |
954 /* RAVI - 20-1-2006 */ | |
955 #ifdef NEPTUNE_BOARD | |
956 { | |
957 UBYTE currentSMSTone; | |
958 currentSMSTone = getcurrentSMSTone(); | |
959 audio_PlaySoundID( AUDIO_BUZZER, currentSMSTone, | |
960 getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
961 } | |
962 #else | |
963 { | |
964 UBYTE currentSMSTone; | |
965 currentSMSTone = getcurrentSMSTone(); | |
966 audio_PlaySoundID( AUDIO_BUZZER, currentSMSTone, 200, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
967 } | |
968 #endif | |
969 | |
970 #endif | |
971 #endif | |
972 mme_backlightEvent(BL_INCOMING_SMS); | |
973 /*CQ10826 - END*/ | |
974 | |
975 /* Added Condtion( if((!(call_data.calls.numCalls))) ) to stop the | |
976 SMS tone when call is active - OMAPS00066134 | |
977 */ | |
978 #ifdef NEPTUNE_BOARD | |
979 } | |
980 #endif | |
981 | |
982 } | |
983 | |
984 | |
985 /*temp_buffer_sms will be freed in editor callback*/ | |
986 | |
987 } | |
988 } | |
989 /*NM p029 end*/ | |
990 } | |
991 | |
992 /* Re-Set */ | |
993 #ifdef NEPTUNE_BOARD | |
994 #ifdef MMI_POWER_MANAGEMENT_TEST | |
995 iSmsArrival = 0; | |
996 #endif | |
997 #endif | |
998 | |
999 break; | |
1000 case E_SMS_CB: /* new CBCH received */ | |
1001 { | |
1002 // USHORT i; // RAVI | |
1003 SHORT geograhical_scope = (SHORT)0xC000; | |
1004 | |
1005 T_MFW_SMS_CB *Message = (T_MFW_SMS_CB *)w; | |
1006 | |
1007 TRACE_EVENT ("E_SMS_CB"); | |
1008 | |
1009 temp_buffer = (char*)ALLOC_MEMORY(MAX_CBMSG_LEN); | |
1010 memset(temp_buffer, '\0', MAX_CBMSG_LEN); | |
1011 | |
1012 //check: does the incoming CB indicates a immediate scope | |
1013 if (! (Message->sn & geograhical_scope) ) | |
1014 { | |
1015 //Immediate scope | |
1016 // API - 859 - German characters were not visable in the CB message | |
1017 TRACE_EVENT("Immediate Scope"); | |
1018 | |
1019 // API - 859 - Convert the the incoming GSM Text to ASCII | |
1020 /*SPR2175, use new function for conversion*/ | |
1021 ATB_convert_String(Message->cb_msg, MFW_DCS_8bits, Message->msg_len, | |
1022 temp_buffer, MFW_ASCII, MAX_CBMSG_LEN, FALSE); | |
1023 | |
1024 /* SPR 2429, removed search for terminating character*/ | |
1025 | |
1026 #ifdef MMI_HOMEZONE_ENABLED // SH 11/12/01 | |
1027 /* SPR759 - SH - Homezone: check to see if CB gives us the coordinates of the centre of the current cell */ | |
1028 | |
1029 if (Message->msg_id==HZ_IDENTIFIER) | |
1030 { | |
1031 homezoneCBData(Message->cb_msg); | |
1032 } | |
1033 else | |
1034 { | |
1035 #endif // HOMEZONE | |
1036 | |
1037 //display now on the idle screen | |
1038 | |
1039 addCBCH(temp_buffer, IdleNewCBImmediateMessage); | |
1040 statusCBCH(TRUE); | |
1041 #ifdef MMI_HOMEZONE_ENABLED | |
1042 } /* SPR759 - SH */ | |
1043 #endif | |
1044 } | |
1045 else //Normal scope | |
1046 { | |
1047 TRACE_EVENT("Normal Scope"); | |
1048 //only for single- and the last page of mulitpages | |
1049 //other pages have not the termination "0x00D" | |
1050 | |
1051 // API - 859 - Convert the the incoming GSM Text to ASCII | |
1052 /*SPR2175, use new function for conversion*/ | |
1053 ATB_convert_String(Message->cb_msg, MFW_DCS_8bits, Message->msg_len, | |
1054 temp_buffer, MFW_ASCII, MAX_MSG_LEN, FALSE); | |
1055 | |
1056 memcpy(Message->cb_msg, temp_buffer, MAX_CBMSG_LEN); | |
1057 | |
1058 /* SPR 2429, removed search for terminating character*/ | |
1059 { | |
1060 Message->cb_msg[MAX_CBMSG_LEN - 1 ]='\0'; // RAVI - Changed as MAX_CBMSG_LEN - 1. | |
1061 } | |
1062 | |
1063 //indicate on the idle screen the new incoming cb | |
1064 addCBCH( NULL, IdleNewCBNormalMessage ); | |
1065 statusCBCH(TRUE); | |
1066 | |
1067 //save the incoming cb messages in the fifo | |
1068 sms_new_incoming_cb (Message); | |
1069 | |
1070 } | |
1071 FREE_MEMORY((void*)temp_buffer,MAX_CBMSG_LEN); | |
1072 } | |
1073 break; | |
1074 | |
1075 case E_SMS_MEM_FULL: | |
1076 /* the memory of SMS is FULL !!*/ | |
1077 data->sms_store_free = FALSE; | |
1078 | |
1079 /* sendevent IDLE_UPDATE; */ | |
1080 SEND_EVENT(idle_get_window(),IDLE_UPDATE,0,0); | |
1081 break; | |
1082 case E_SMS_MEM_FREE: | |
1083 /* the memory of SMS is FREE */ | |
1084 data->sms_store_free = TRUE; | |
1085 | |
1086 /* sendevent IDLE_UPDATE; */ | |
1087 SEND_EVENT(idle_get_window(),IDLE_UPDATE,0,0); | |
1088 /* ??? */ | |
1089 | |
1090 break; | |
1091 case E_SMS_STATUS: /* status report from service center */ | |
1092 /* Marcus: Issue 1170: 07/10/2002: Start */ | |
1093 { | |
1094 T_MFW_SMS_STATUS *sms_status = (T_MFW_SMS_STATUS *)w; | |
1095 TRACE_EVENT("E_SMS_STATUS"); | |
1096 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
1097 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | |
1098 //Play the SMS tone alert for status report indication | |
1099 #ifdef FF_MIDI_RINGER | |
1100 mfw_ringer_start(AS_RINGER_MODE_SMS,false,sounds_midi_ringer_start_cb); | |
1101 #else | |
1102 | |
1103 #ifdef FF_MMI_RINGTONE /* MSL SMS Tone Play */ | |
1104 audio_PlaySoundID( AUDIO_BUZZER, SMSTONE_SELECT, 200, AUDIO_PLAY_ONCE ); | |
1105 #else | |
1106 /* RAVI - 20-1-2006 */ | |
1107 #ifdef NEPTUNE_BOARD | |
1108 { | |
1109 UBYTE currentSMSTone; | |
1110 currentSMSTone = getcurrentSMSTone(); | |
1111 audio_PlaySoundID( AUDIO_BUZZER, currentSMSTone, | |
1112 getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); | |
1113 } | |
1114 #else | |
1115 { | |
1116 UBYTE currentSMSTone; | |
1117 currentSMSTone = getcurrentSMSTone(); | |
1118 audio_PlaySoundID( AUDIO_BUZZER, currentSMSTone, 200, AUDIO_PLAY_ONCE ); | |
1119 } | |
1120 #endif | |
1121 /* END RAVI */ | |
1122 | |
1123 #endif | |
1124 #endif | |
1125 | |
1126 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
1127 { | |
1128 /* | |
1129 * There is no support for Chinese in the addCBCH function, | |
1130 * so will be problems with class 0 SMS messages and with cell | |
1131 * broadcast messages that need to be addressed anyway. | |
1132 * A new issue will be raised to handle this problem. | |
1133 */ | |
1134 } | |
1135 else | |
1136 { | |
1137 memset(status_report, '\0', sizeof(status_report)); | |
1138 strcpy(status_report, MmiRsrcGetText(TxtSRR)); | |
1139 strcat(status_report, ": "); | |
1140 strcat(status_report, MmiRsrcGetText(TxtStatus)); | |
1141 strcat(status_report, ": "); | |
1142 strcat(status_report, MmiRsrcGetText(smsidle_sr_status_to_text_id(sms_status->status))); | |
1143 sprintf(&status_report[strlen(status_report)], " (%u): ", sms_status->status); | |
1144 #ifdef NO_ASCIIZ | |
1145 if (sms_status->addr.len) | |
1146 { | |
1147 memcpy(&status_report[strlen(status_report)], sms_status->addr.tag, sms_status->addr.len); | |
1148 strcat(status_report, " "); | |
1149 } | |
1150 #else | |
1151 if (strlen(sms_status->addr.tag)) | |
1152 { | |
1153 strcat(status_report, sms_status->addr.tag); | |
1154 strcat(status_report, " "); | |
1155 } | |
1156 #endif | |
1157 if (sms_status->addr.ton == MFW_TON_INTERNATIONAL) | |
1158 strcat(status_report, "+"); | |
1159 | |
1160 strcat(status_report, sms_status->addr.number); | |
1161 sprintf(&status_report[strlen(status_report)], | |
1162 ": %1u%1u/%1u%1u/%1u%1u %1u%1u:%1u%1u:%1u%1u (%s %u)", /*a0393213 lint warnings removal-%0u changed to%1u*/ | |
1163 sms_status->rctp.day[0], | |
1164 sms_status->rctp.day[1], | |
1165 sms_status->rctp.month[0], | |
1166 sms_status->rctp.month[1], | |
1167 sms_status->rctp.year[0], | |
1168 sms_status->rctp.year[1], | |
1169 sms_status->rctp.hour[0], | |
1170 sms_status->rctp.hour[1], | |
1171 sms_status->rctp.minute[0], | |
1172 sms_status->rctp.minute[1], | |
1173 sms_status->rctp.second[0], | |
1174 sms_status->rctp.second[1], | |
1175 MmiRsrcGetText(TxtMessage), | |
1176 sms_status->msg_ref); | |
1177 | |
1178 addCBCH(status_report, IdleNewSmsMessage); | |
1179 | |
1180 //display now on the idle screen | |
1181 statusCBCH(TRUE); | |
1182 } | |
1183 } | |
1184 /* Marcus: Issue 1170: 07/10/2002: End */ | |
1185 | |
1186 break; | |
1187 case E_SMS_MEM: /* indicates status of memory */ | |
1188 /* not used */ | |
1189 break; | |
1190 case E_SMS_MO: /* SMS sending has started */ | |
1191 /* not used */ | |
1192 case E_SMS_OK: | |
1193 /* Only happens when an SMS message is deleted. */ | |
1194 | |
1195 break; | |
1196 case E_SMS_BUSY: | |
1197 TRACE_EVENT ("E_SMS_BUSY"); | |
1198 break; | |
1199 case E_SMS_SAVE_AVAIL: | |
1200 break; | |
1201 case E_SMS_CMD_AVAIL: | |
1202 break; | |
1203 case E_SMS_ERR: | |
1204 TRACE_EVENT ("E_SMS_ERR"); | |
1205 break; | |
1206 default: | |
1207 TRACE_EVENT("unhandled event in smsidle_sms_cb()"); | |
1208 result = MFW_EVENT_PASSED; | |
1209 break; | |
1210 } | |
1211 //May 27, 2005 MMI-FIX-29869 x0018858 | |
1212 #ifdef FF_MMI_SMS_DYNAMIC | |
1213 FREE_MEMORY((void*)msg_list,g_max_messages*sizeof(T_MFW_SMS_IDX)); | |
1214 FREE_MEMORY((void*)urd_msg_list,g_max_messages*sizeof(T_MFW_SMS_IDX)); | |
1215 #else | |
1216 FREE_MEMORY((void*)msg_list,MAX_MESSAGES*sizeof(T_MFW_SMS_IDX)); | |
1217 FREE_MEMORY((void*)urd_msg_list,MAX_MESSAGES*sizeof(T_MFW_SMS_IDX)); | |
1218 #endif | |
1219 | |
1220 return result; | |
1221 } | |
1222 | |
1223 /******************************************************************************* | |
1224 | |
1225 $Function: smsidle_get_memory_full | |
1226 | |
1227 $Description: Call back function for the sms Idle window. | |
1228 | |
1229 $Returns: sms memory status. | |
1230 | |
1231 $Arguments: none | |
1232 | |
1233 *******************************************************************************/ | |
1234 | |
1235 BOOL smsidle_get_memory_full(void) | |
1236 { | |
1237 return (!smsidle_data.sms_store_free); | |
1238 } | |
1239 | |
1240 /******************************************************************************* | |
1241 | |
1242 $Function: smsidle_get_new_cb_messages_count | |
1243 | |
1244 $Description: Call back function for the sms Idle window. | |
1245 | |
1246 $Returns: sms count. | |
1247 | |
1248 $Arguments: none | |
1249 *******************************************************************************/ | |
1250 | |
1251 SHORT smsidle_get_new_cb_messages_count(void) | |
1252 { | |
1253 if (smsidle_get_ready_state()) | |
1254 { | |
1255 return smscb_get_new_cb_messages_count(); | |
1256 } | |
1257 else | |
1258 { | |
1259 return 0; | |
1260 } | |
1261 } | |
1262 | |
1263 | |
1264 /******************************************************************************* | |
1265 | |
1266 $Function: smsidle_get_ready_state | |
1267 | |
1268 $Description: This function can be call from anywhere to get the information | |
1269 about the "sms_initialised" | |
1270 | |
1271 $Returns: sms status | |
1272 | |
1273 $Arguments: none | |
1274 | |
1275 *******************************************************************************/ | |
1276 BOOL smsidle_get_ready_state(void) | |
1277 { | |
1278 return (smsidle_data.sms_initialised); | |
1279 } | |
1280 | |
1281 //GW SPR#1035 - Added SAT changes | |
1282 /******************************************************************************* | |
1283 | |
1284 $Function: smsidle_unset_ready_state | |
1285 | |
1286 $Description: this unset the flat "sms_initialised" | |
1287 | |
1288 $Returns: sms status | |
1289 | |
1290 $Arguments: none | |
1291 | |
1292 *******************************************************************************/ | |
1293 void smsidle_unset_ready_state(void) | |
1294 { | |
1295 smsidle_data.sms_initialised = FALSE; | |
1296 } | |
1297 | |
1298 /******************************************************************************* | |
1299 | |
1300 $Function: smsidle_get_unread_sms_available | |
1301 | |
1302 $Description: This function allows an external process to determine the | |
1303 received and unread SMS PP message status. | |
1304 | |
1305 $Returns: sms status. | |
1306 | |
1307 $Arguments: none | |
1308 | |
1309 *******************************************************************************/ | |
1310 BOOL smsidle_get_unread_sms_available(void) | |
1311 { SHORT unread_sms_count; | |
1312 | |
1313 //May 27, 2005 MMI-FIX-29869 x0018858 | |
1314 #ifdef FF_MMI_SMS_DYNAMIC | |
1315 //begin | |
1316 qAT_PlusCPMS(CMD_SRC_LCL); | |
1317 Check_max_sms_allowed(); | |
1318 //End | |
1319 #endif | |
1320 TRACE_FUNCTION("smsidle_get_unread_sms_available() "); | |
1321 if (smsidle_get_ready_state()) | |
1322 { | |
1323 //API - 14-01-03 - 1403 - Remove the call to iconsSetState(iconIdSMS) to indicate new SMS incall | |
1324 unread_sms_count = sms_message_count(MFW_SMS_UNREAD); | |
1325 | |
1326 return (unread_sms_count > 0 && (unread_sms_count > sms_message_count(MFW_SMS_VOICE))); | |
1327 } | |
1328 else | |
1329 { | |
1330 | |
1331 iconsDeleteState(iconIdSMS); | |
1332 return FALSE; | |
1333 } | |
1334 } | |
1335 | |
1336 /******************************************************************************* | |
1337 | |
1338 $Function: smsidle_display_sms_status | |
1339 | |
1340 $Description: Interogates the SMS unread message count and displays | |
1341 the result using the SMS icon and an information text. | |
1342 | |
1343 $Returns: id of text string to be displayed | |
1344 | |
1345 $Arguments: noOfMsgs - returns number of unread messages (or 0 if there are no | |
1346 messages or the memory is full). | |
1347 | |
1348 GW 02/10/01 - Modified code to work with chinese unicode text. | |
1349 *******************************************************************************/ | |
1350 int smsidle_display_sms_status(int* noOfMsgs) | |
1351 { | |
1352 SHORT SmsMsgCount; | |
1353 SHORT SmsVmailCount; | |
1354 int txtMsg; | |
1355 | |
1356 TRACE_FUNCTION("smsidle_display_sms_status() "); | |
1357 *noOfMsgs = 0; | |
1358 txtMsg = TxtNull; | |
1359 | |
1360 if (smsidle_get_ready_state()) | |
1361 { | |
1362 SmsVmailCount = sms_message_count(MFW_SMS_VOICE); | |
1363 | |
1364 | |
1365 SmsMsgCount = sms_message_count (MFW_SMS_UNREAD); | |
1366 | |
1367 /* Envelope icon and text only appear if a non-Voicemail SMS exists. */ | |
1368 | |
1369 if (smsidle_get_memory_full()) | |
1370 { | |
1371 /* x0018858 24 Mar, 2005 MMI-FIX-11321 | |
1372 Added a condition to check for any pending message. | |
1373 */ | |
1374 //begin -x0018858 24 Mar, 2005 MMI-FIX-11321 | |
1375 if( TRUE == sms_check_message_pending()) | |
1376 { | |
1377 txtMsg = TxtSmsWaiting; | |
1378 }//end. x0018858 24 Mar, 2005 MMI-FIX-11321 | |
1379 else | |
1380 { | |
1381 txtMsg = TxtSmsListFull; | |
1382 } | |
1383 } | |
1384 else if ((SmsMsgCount > 0) && (SmsMsgCount > SmsVmailCount)) | |
1385 { | |
1386 txtMsg = TxtNewMessage; | |
1387 *noOfMsgs = SmsMsgCount; | |
1388 | |
1389 } | |
1390 else | |
1391 { | |
1392 iconsDeleteState(iconIdSMS); /* Turn off SMS icon. */ | |
1393 txtMsg = TxtNull; | |
1394 } | |
1395 | |
1396 iconsShow(); | |
1397 } | |
1398 return (txtMsg); | |
1399 } | |
1400 | |
1401 /******************************************************************************* | |
1402 | |
1403 $Function: smsidle_get_unread_smscb_available | |
1404 | |
1405 $Description: This function allows an external process to determine the | |
1406 received SMS CB message status. | |
1407 | |
1408 $Returns: execution status | |
1409 | |
1410 $Arguments: none | |
1411 | |
1412 *******************************************************************************/ | |
1413 BOOL smsidle_get_unread_smscb_available(void) | |
1414 { | |
1415 if (smsidle_get_ready_state()) | |
1416 return (smsidle_get_new_cb_messages_count() > 0); | |
1417 else | |
1418 return FALSE; | |
1419 } | |
1420 | |
1421 /******************************************************************************* | |
1422 | |
1423 $Function: smsidle_display_smscb_status | |
1424 | |
1425 $Description: Interogates the SMS CB message received status and | |
1426 returns the resulting string to the caller. | |
1427 | |
1428 $Returns: none | |
1429 | |
1430 $Arguments: TextString - Text String | |
1431 *******************************************************************************/ | |
1432 void smsidle_display_smscb_status(char *TextString) | |
1433 { | |
1434 SHORT count; | |
1435 | |
1436 /* count the unread cb messagesc */ | |
1437 count = smsidle_get_new_cb_messages_count(); | |
1438 | |
1439 | |
1440 /* the unread CB should have a high priority than */ | |
1441 /* the class 0 CB */ | |
1442 if (count > 0) | |
1443 { | |
1444 sprintf(TextString, "%d %s\0",count, GET_TEXT(TxtNewCbMessage)); | |
1445 iconsSetState(iconIdSMS); /* Indicate SMS delivery to MS-User. */ | |
1446 | |
1447 } | |
1448 } | |
1449 /* Marcus: Issue 1170: 07/10/2002: Start */ | |
1450 /******************************************************************************* | |
1451 | |
1452 $Function: smsidle_sr_status_to_text_id | |
1453 | |
1454 $Description: Returns the text ID for the given status report status | |
1455 | |
1456 $Returns: int : text ID | |
1457 | |
1458 $Arguments: UBYTE: SMS-STATUS-REPORT status | |
1459 *******************************************************************************/ | |
1460 static int smsidle_sr_status_to_text_id(UBYTE status) | |
1461 { | |
1462 int ret = TxtError; | |
1463 UBYTE group = ((status & 0x60) >> 5); | |
1464 UBYTE value = (status & 0x1F); | |
1465 switch (group) | |
1466 { | |
1467 case 0: // Short message transaction completed | |
1468 if ((value >= 3) && (value <= 0x0F)) | |
1469 ret = TxtError; | |
1470 else | |
1471 ret = TxtDelivered; | |
1472 break; | |
1473 | |
1474 case 1: // Temporary error, SC still trying to transfer SM | |
1475 if ((value >= 6) && (value <= 0x0F)) | |
1476 ret = TxtError; | |
1477 else // x0021334 10 May, 2006 DR: OMAPS00075379 | |
1478 ret = TxtPending; // replaced TxtTempError with TxtPending | |
1479 break; | |
1480 | |
1481 case 2: // Permanent error, SC is not making any more transfer attempts | |
1482 case 3: // Temporary error, SC is not making any more transfer attempts | |
1483 ret = TxtError; | |
1484 break; | |
1485 } | |
1486 return ret; | |
1487 } | |
1488 /* Marcus: Issue 1170: 07/10/2002: End */ | |
1489 | |
1490 | |
1491 | |
1492 | |
1493 | |
1494 |