FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/mmiSmsBroadcast.c @ 170:6125210a379b
mmiSmsBroadcast.c: formatting fixes and dead code elimination
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 18 Jan 2021 01:27:49 +0000 |
parents | c0052fe355d3 |
children |
comparison
equal
deleted
inserted
replaced
169:adae850f9857 | 170:6125210a379b |
---|---|
1 | 1 /******************************************************************************* |
2 /******************************************************************************* | 2 |
3 | 3 CONDAT (UK) |
4 CONDAT (UK) | |
5 | 4 |
6 ******************************************************************************** | 5 ******************************************************************************** |
7 | 6 |
8 This software product is the property of Condat (UK) Ltd and may not be | 7 This software product is the property of Condat (UK) Ltd and may not be |
9 disclosed to any third party without the express permission of the owner. | 8 disclosed to any third party without the express permission of the owner. |
10 | 9 |
11 ******************************************************************************** | 10 ******************************************************************************** |
12 | 11 |
13 $Project name: Basic MMI | 12 $Project name: Basic MMI |
14 $Project code: BMI (6349) | 13 $Project code: BMI (6349) |
15 $Module: SMS Cell Broadcast | 14 $Module: SMS Cell Broadcast |
16 $File: MmiSmsBroadcast.c | 15 $File: MmiSmsBroadcast.c |
17 $Revision: 1.0 | 16 $Revision: 1.0 |
18 | 17 |
19 $Author: Condat(UK) | 18 $Author: Condat(UK) |
20 $Date: 22/02/01 | 19 $Date: 22/02/01 |
21 | 20 |
22 ******************************************************************************** | 21 ******************************************************************************** |
23 | 22 |
24 Description: | 23 Description: |
25 | 24 |
145 #include "MmiHomezone.h" | 144 #include "MmiHomezone.h" |
146 #endif | 145 #endif |
147 #include "MmiSettings.h" | 146 #include "MmiSettings.h" |
148 | 147 |
149 | 148 |
150 | |
151 #define MENU_TEXT_LENGTH 16 /* count of chars to be displayed in one list entry */ | 149 #define MENU_TEXT_LENGTH 16 /* count of chars to be displayed in one list entry */ |
152 | 150 |
153 /* SH - moved to .h file */ | 151 /* SH - moved to .h file */ |
154 | 152 |
155 /*MC SPR 1920,FFS CB Topic name data structure*/ | 153 /*MC SPR 1920,FFS CB Topic name data structure*/ |
156 typedef struct | 154 typedef struct |
157 { | 155 { |
158 uint8 name[CB_TAG_LENGTH]; | 156 uint8 name[CB_TAG_LENGTH]; |
159 | |
160 } T_SMSCB_TOPIC_TAG; | 157 } T_SMSCB_TOPIC_TAG; |
161 | 158 |
162 /* storage for Cell Broadcast lists */ | 159 /* storage for Cell Broadcast lists */ |
163 typedef struct | 160 typedef struct |
164 { | 161 { |
165 T_SMSCB_ATT cb_attributes[MAX_MIDS]; /* list of attributes of messages stored in fifo */ | 162 T_SMSCB_ATT cb_attributes[MAX_MIDS]; /* list of attributes of messages stored in fifo */ |
166 /*SPR 1920, replaced cb_buffer with an array of dynically allocated strings */ | 163 /*SPR 1920, replaced cb_buffer with an array of dynically allocated strings */ |
167 char* messages[MAX_STORED_PAGES]; | 164 char* messages[MAX_STORED_PAGES]; |
168 ListMenuData *cb_list_attributes; //atttributes for the menu list | 165 ListMenuData *cb_list_attributes; //atttributes for the menu list |
169 | 166 |
170 T_SMSCB_STATUS current_status; /*read status for all messages */ | 167 T_SMSCB_STATUS current_status; /*read status for all messages */ |
171 | 168 |
172 UBYTE found_mid; //indicate the already existing cb in the fifo | 169 UBYTE found_mid; //indicate the already existing cb in the fifo |
173 UBYTE clear_mid; //indicate the deleting process | 170 UBYTE clear_mid; //indicate the deleting process |
174 UBYTE result_used; //to update the used-pointer, after deleting the cb message | 171 UBYTE result_used; //to update the used-pointer, after deleting the cb message |
175 UBYTE total_number; //this include the total number of messages in the fifo; need for Menu-list | 172 UBYTE total_number; //this include the total number of messages in the fifo; need for Menu-list |
176 | 173 |
177 UBYTE multipage_number; //this include the total page of a particular multipage; need for showing msg. | 174 UBYTE multipage_number; //this include the total page of a particular multipage; need for showing msg. |
178 UBYTE *multipage; //pointer to the first page of multipage | 175 UBYTE *multipage; //pointer to the first page of multipage |
179 UBYTE start_used; //indicate the start point of the multipage, used for the searching | 176 UBYTE start_used; //indicate the start point of the multipage, used for the searching |
180 UBYTE end_used; //indicate the end point of the multipage, used for the searching | 177 UBYTE end_used; //indicate the end point of the multipage, used for the searching |
181 | 178 |
182 UBYTE used_pointer; //start point of the free space link list | 179 UBYTE used_pointer; //start point of the free space link list |
183 UBYTE free_pointer; //start point of the data link list | 180 UBYTE free_pointer; //start point of the data link list |
184 | |
185 | |
186 } T_SMSCB_DATA; | 181 } T_SMSCB_DATA; |
187 | |
188 | 182 |
189 | 183 |
190 T_SMSCB_DATASTORE g_smscb_data; /* storage for Cell Broadcast Info lists */ | 184 T_SMSCB_DATASTORE g_smscb_data; /* storage for Cell Broadcast Info lists */ |
191 T_SMSCB_DATA smscb_data; /* storage for Cell Broadcast Message lists */ | 185 T_SMSCB_DATA smscb_data; /* storage for Cell Broadcast Message lists */ |
192 | |
193 | 186 |
194 | 187 |
195 //Attributes of the list menu | 188 //Attributes of the list menu |
196 static const MfwMnuAttr sms_cb_menuAttrib = | 189 static const MfwMnuAttr sms_cb_menuAttrib = |
197 { | 190 { |
200 /* x0045876, 14-Aug-2006 (WR - integer conversion resulted in a change of sign) */ | 193 /* x0045876, 14-Aug-2006 (WR - integer conversion resulted in a change of sign) */ |
201 (U8) -1, /* use default font */ | 194 (U8) -1, /* use default font */ |
202 NULL, /* with these items */ | 195 NULL, /* with these items */ |
203 0, /* number of items */ | 196 0, /* number of items */ |
204 COLOUR_LIST_SMS, TxtNull, NULL, MNUATTRSPARE | 197 COLOUR_LIST_SMS, TxtNull, NULL, MNUATTRSPARE |
205 | |
206 }; | 198 }; |
207 | 199 |
208 | 200 |
209 #define OFFSET(index) (index*CB_PAGE_LENGTH) | 201 #define OFFSET(index) (index*CB_PAGE_LENGTH) |
210 | 202 |
222 UBYTE sms_cb_delete_message (USHORT mid); | 214 UBYTE sms_cb_delete_message (USHORT mid); |
223 UBYTE sms_cb_find_termination (UBYTE *used); | 215 UBYTE sms_cb_find_termination (UBYTE *used); |
224 UBYTE sms_cb_update_free_pointer (UBYTE temp); | 216 UBYTE sms_cb_update_free_pointer (UBYTE temp); |
225 UBYTE sms_cb_search_mid (USHORT mid, SHORT sn); | 217 UBYTE sms_cb_search_mid (USHORT mid, SHORT sn); |
226 UBYTE sms_cb_store_message (T_MFW_SMS_CB *Message); | 218 UBYTE sms_cb_store_message (T_MFW_SMS_CB *Message); |
227 UBYTE sms_cb_find_endpoint (USHORT mid, UBYTE end_used); | 219 UBYTE sms_cb_find_endpoint (USHORT mid, UBYTE end_used); |
228 UBYTE sms_cb_find_startpoint (USHORT mid, UBYTE end_used); | 220 UBYTE sms_cb_find_startpoint (USHORT mid, UBYTE end_used); |
229 UBYTE sms_cb_give_position_of_msg (UBYTE used, UBYTE positon); | 221 UBYTE sms_cb_give_position_of_msg (UBYTE used, UBYTE positon); |
230 UBYTE sms_cb_overwrite_old_message (T_MFW_SMS_CB *Message); | 222 UBYTE sms_cb_overwrite_old_message (T_MFW_SMS_CB *Message); |
231 | 223 |
232 | 224 |
286 smscb_CB_EDT_TEXTEDT_ID, | 278 smscb_CB_EDT_TEXTEDT_ID, |
287 smscb_CB_EDT_MIDEDT_ID | 279 smscb_CB_EDT_MIDEDT_ID |
288 } smscb_ID; | 280 } smscb_ID; |
289 | 281 |
290 | 282 |
291 | |
292 void msgsExtractPhoneNumber(UBYTE *InputString, UBYTE *Buffer); | 283 void msgsExtractPhoneNumber(UBYTE *InputString, UBYTE *Buffer); |
293 /* forward declaration of local start routines */ | 284 /* forward declaration of local start routines */ |
294 /*SPR 1920 removed header for smscb_M_CB_ACT_start()*/ | 285 /*SPR 1920 removed header for smscb_M_CB_ACT_start()*/ |
295 static T_MFW_HND smscb_M_CB_TOP_start(T_MFW_HND parent_window, void *dummy); | 286 static T_MFW_HND smscb_M_CB_TOP_start(T_MFW_HND parent_window, void *dummy); |
296 static T_MFW_HND smscb_M_CB_TOP_CONS_start(T_MFW_HND parent_window, void *dummy); | 287 static T_MFW_HND smscb_M_CB_TOP_CONS_start(T_MFW_HND parent_window, void *dummy); |
304 | 295 |
305 | 296 |
306 void info_screen (T_MFW_HND win, USHORT TextId, USHORT TextId2, T_VOID_FUNC Callback) | 297 void info_screen (T_MFW_HND win, USHORT TextId, USHORT TextId2, T_VOID_FUNC Callback) |
307 /* present info <TextId> for 3 seconds in a simple infoscreen */ | 298 /* present info <TextId> for 3 seconds in a simple infoscreen */ |
308 { | 299 { |
309 | |
310 T_DISPLAY_DATA display_info; | 300 T_DISPLAY_DATA display_info; |
311 | 301 |
312 TRACE_FUNCTION ("info_screen()"); | 302 TRACE_FUNCTION ("info_screen()"); |
313 | 303 |
314 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TextId, TextId2 , COLOUR_STATUS); | 304 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TextId, TextId2 , COLOUR_STATUS); |
315 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)Callback, THREE_SECS, 0 ); | 305 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)Callback, THREE_SECS, 0 ); |
316 display_info.Identifier = 0; | 306 display_info.Identifier = 0; |
317 | 307 |
318 info_dialog (win, &display_info); | 308 info_dialog (win, &display_info); |
319 } | 309 } |
320 | 310 |
327 **********************************************************************/ | 317 **********************************************************************/ |
328 static T_MFW smscb_delete_topic(UBYTE MidOffset); | 318 static T_MFW smscb_delete_topic(UBYTE MidOffset); |
329 /*SPR 1920, removed function temp_smscb_M_CB_ExeRead()*/ | 319 /*SPR 1920, removed function temp_smscb_M_CB_ExeRead()*/ |
330 /* SH moved prototype to header file */ | 320 /* SH moved prototype to header file */ |
331 | 321 |
332 #if(0) /* x0039928 - Lint warning removal */ | |
333 static void listCreate(MfwHnd Parent, MfwMnuAttr *a , MfwEvt e, ListCbFunc cbFunc) | |
334 { | |
335 | |
336 ListMenuData list_menu_data; | |
337 | |
338 /* initialization of the dialog data */ | |
339 list_menu_data.Attr = a; | |
340 list_menu_data.List = a->items; | |
341 list_menu_data.ListLength = a->nItems;/* Number of entries in list menu. */ | |
342 list_menu_data.ListPosition = 1;/* True cursor position in list menu. */ | |
343 list_menu_data.CursorPosition = 1;/* Cursor position in list snapshot. */ | |
344 list_menu_data.SnapshotSize = 4;/* Number of list entries to view. */ | |
345 list_menu_data.Font = 0; | |
346 list_menu_data.LeftSoftKey = TxtSoftSelect; | |
347 list_menu_data.RightSoftKey = TxtSoftBack; | |
348 /* SPR1428 - SH - Accept menu select key */ | |
349 list_menu_data.KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUUP | KEY_MNUDOWN | KEY_MNUSELECT; | |
350 list_menu_data.Reason = 0; | |
351 list_menu_data.Strings = FALSE; | |
352 list_menu_data.autoDestroy = TRUE; | |
353 | |
354 listDisplayListMenu(Parent, &list_menu_data, cbFunc,0); | |
355 | |
356 } | |
357 #endif | |
358 // end c020 rsa | |
359 /*SPR1920, removed declarations and functions for menu-handling*/ | |
360 | |
361 | |
362 | |
363 | 322 |
364 /********************************************************************* | 323 /********************************************************************* |
365 ********************************************************************** | 324 ********************************************************************** |
366 | 325 |
367 M_CB_ACT DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR | 326 M_CB_ACT DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR |
368 | 327 |
369 ********************************************************************* | 328 ********************************************************************* |
370 **********************************************************************/ | 329 **********************************************************************/ |
371 /******************************************************************************* | 330 /******************************************************************************* |
372 | 331 |
380 | 339 |
381 *******************************************************************************/ | 340 *******************************************************************************/ |
382 int smscb_M_CB_ACT_ExeNo(MfwMnu* m, MfwMnuItem* i) | 341 int smscb_M_CB_ACT_ExeNo(MfwMnu* m, MfwMnuItem* i) |
383 { | 342 { |
384 T_MFW_HND win = mfwParent((MfwHdr *)mfw_header()); | 343 T_MFW_HND win = mfwParent((MfwHdr *)mfw_header()); |
385 /*SPR 1920, removed unneccessary variables*/ | 344 /*SPR 1920, removed unneccessary variables*/ |
386 /*GW SPR#2470 Call 'smscb_setCBsettings' so that sAT_PlusCSCB is also called.*/ | 345 /*GW SPR#2470 Call 'smscb_setCBsettings' so that sAT_PlusCSCB is also called.*/ |
387 | 346 |
388 settingsSetStatus(SettingsCBDisable, SET_SETTING );/*Remember settings in FFS*/ | 347 settingsSetStatus(SettingsCBDisable, SET_SETTING );/*Remember settings in FFS*/ |
389 // sms_set_mt_ind(MT_CB_NO_IDX); | 348 // sms_set_mt_ind(MT_CB_NO_IDX); |
390 smscb_setCBsettings(SMSCB_SWITCH_OFF); | 349 smscb_setCBsettings(SMSCB_SWITCH_OFF); |
391 | 350 |
392 info_screen(win, TxtDeActivated,TxtNull, NULL); | 351 info_screen(win, TxtDeActivated,TxtNull, NULL); |
393 | 352 |
394 | |
395 statusCBCH(FALSE); | 353 statusCBCH(FALSE); |
396 | 354 |
397 /* SPR 1920, removed window destruction code*/ | 355 /* SPR 1920, removed window destruction code*/ |
398 return MFW_EVENT_CONSUMED; | 356 return MFW_EVENT_CONSUMED; |
399 } | 357 } |
400 | 358 |
401 #ifdef DEBUG_SMS_CB | 359 #ifdef DEBUG_SMS_CB |
402 T_MFW_HND timer; | 360 T_MFW_HND timer; |
434 | 392 |
435 $Function: smscb_M_CB_ACT_ExeYes | 393 $Function: smscb_M_CB_ACT_ExeYes |
436 | 394 |
437 $Description: | 395 $Description: |
438 | 396 |
439 $Returns: none. | 397 $Returns: none. |
440 | 398 |
441 $Arguments: | 399 $Arguments: |
442 | 400 |
443 *******************************************************************************/ | 401 *******************************************************************************/ |
444 int smscb_M_CB_ACT_ExeYes(MfwMnu* m, MfwMnuItem* i) | 402 int smscb_M_CB_ACT_ExeYes(MfwMnu* m, MfwMnuItem* i) |
445 { | 403 { |
446 T_MFW_HND win = mfwParent((MfwHdr *)mfw_header()); | 404 T_MFW_HND win = mfwParent((MfwHdr *)mfw_header()); |
447 /*SPR 1920, removed unneccessary variables*/ | 405 /*SPR 1920, removed unneccessary variables*/ |
448 /*GW SPR#2470 Call 'smscb_setCBsettings' so that sAT_PlusCSCB is also called.*/ | 406 /*GW SPR#2470 Call 'smscb_setCBsettings' so that sAT_PlusCSCB is also called.*/ |
449 | 407 |
450 settingsSetStatus(SettingsCBDisable, CLEAR_SETTING );/*Remember settings in FFS*/ | 408 settingsSetStatus(SettingsCBDisable, CLEAR_SETTING );/*Remember settings in FFS*/ |
451 //sms_set_mt_ind(MT_CB_MSG); | 409 //sms_set_mt_ind(MT_CB_MSG); |
452 smscb_setCBsettings(SMSCB_SWITCH_ON); | 410 smscb_setCBsettings(SMSCB_SWITCH_ON); |
453 | 411 |
454 info_screen(win, TxtActivated,TxtNull, NULL); | 412 info_screen(win, TxtActivated,TxtNull, NULL); |
455 | |
456 | 413 |
457 /*SPR1959, removed declarations and functions for menu-handling*/ | 414 /*SPR1959, removed declarations and functions for menu-handling*/ |
458 #ifdef DEBUG_SMS_CB | 415 #ifdef DEBUG_SMS_CB |
459 timer = tim_create(NULL, 5000, (MfwCb)test_tim_cb); | 416 timer = tim_create(NULL, 5000, (MfwCb)test_tim_cb); |
460 tim_start(timer); | 417 tim_start(timer); |
461 | |
462 | |
463 | |
464 | |
465 | |
466 #endif //DEBUG_SMS_CB | 418 #endif //DEBUG_SMS_CB |
419 | |
467 return MFW_EVENT_CONSUMED; | 420 return MFW_EVENT_CONSUMED; |
468 } | 421 } |
469 | |
470 | |
471 | |
472 | 422 |
473 | 423 |
474 /********************************************************************* | 424 /********************************************************************* |
475 ********************************************************************** | 425 ********************************************************************** |
476 | 426 |
477 M_CB_TOP DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR | 427 M_CB_TOP DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR |
478 | 428 |
479 ********************************************************************* | 429 ********************************************************************* |
480 **********************************************************************/ | 430 **********************************************************************/ |
481 /******************************************************************************* | 431 /******************************************************************************* |
482 | 432 |
483 $Function: smscb_M_CB_TOP_ExeConsult | 433 $Function: smscb_M_CB_TOP_ExeConsult |
484 | 434 |
485 $Description: | 435 $Description: |
486 | 436 |
487 $Returns: none. | 437 $Returns: none. |
488 | 438 |
489 $Arguments: | 439 $Arguments: |
490 | 440 |
491 *******************************************************************************/ | 441 *******************************************************************************/ |
492 int smscb_M_CB_TOP_ExeConsult(MfwMnu* m, MfwMnuItem* i) | 442 int smscb_M_CB_TOP_ExeConsult(MfwMnu* m, MfwMnuItem* i) |
493 { | 443 { |
494 T_MFW_HND win = mfwParent((MfwHdr *)mfw_header()); | 444 T_MFW_HND win = mfwParent((MfwHdr *)mfw_header()); |
495 /*SPR 1920, removed unneccessary variables*/ | 445 /*SPR 1920, removed unneccessary variables*/ |
496 | 446 |
497 | |
498 #ifdef DEBUG_SMS_CB | 447 #ifdef DEBUG_SMS_CB |
499 UBYTE ii; | 448 UBYTE ii; |
500 for (ii = 0; ii < MAX_MIDS; ii++) | 449 for (ii = 0; ii < MAX_MIDS; ii++) |
501 { | 450 { |
502 /***************************Go-lite Optimization changes Start***********************/ | 451 /***************************Go-lite Optimization changes Start***********************/ |
503 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | 452 // Aug 16, 2004 REF: CRR 24323 Deepa M.D |
504 TRACE_EVENT_P2 ("g_smscb_data.CBTopics.entry[0].msg_id:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); | 453 TRACE_EVENT_P2 ("g_smscb_data.CBTopics.entry[0].msg_id:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); |
505 /***************************Go-lite Optimization changes end***********************/ | 454 /***************************Go-lite Optimization changes end***********************/ |
506 } | 455 } |
507 #endif | 456 #endif |
508 | 457 |
509 | 458 if (!smsidle_get_ready_state()) |
510 if (!smsidle_get_ready_state()) | 459 { |
511 { | 460 info_screen(0, TxtSimNot, TxtReady, NULL); |
512 info_screen(0, TxtSimNot, TxtReady, NULL); | 461 TRACE_EVENT ("SIM is not ready !!"); |
513 TRACE_EVENT ("SIM is not ready !!"); | 462 return MFW_EVENT_CONSUMED; /* x0039928 - Lint warning fix */ |
514 return MFW_EVENT_CONSUMED; /* x0039928 - Lint warning fix */ | 463 } |
515 } | 464 |
516 | 465 if (g_smscb_data.CBTopics.length EQ 0) |
517 if (g_smscb_data.CBTopics.length EQ 0) | 466 { |
518 { | 467 info_screen(0, TxtEmptyList,TxtNull, NULL); |
519 info_screen(0, TxtEmptyList,TxtNull, NULL); | 468 |
520 | 469 TRACE_EVENT ("CellBroadcast Topic-list is empty !!"); |
521 TRACE_EVENT ("CellBroadcast Topic-list is empty !!"); | 470 return MFW_EVENT_CONSUMED; /* x0039928 - Lint warning fix */ |
522 return MFW_EVENT_CONSUMED; /* x0039928 - Lint warning fix */ | 471 } |
523 } | |
524 | 472 |
525 // selection "Consult": menucreate M_CB_TOP_CONS | 473 // selection "Consult": menucreate M_CB_TOP_CONS |
526 return (int)smscb_M_CB_TOP_CONS_start (win, NULL); | 474 return (int)smscb_M_CB_TOP_CONS_start (win, NULL); |
527 } | 475 } |
476 | |
528 T_CB_index_param CB_index_param;/*MC SPR1920 added global variable*/ | 477 T_CB_index_param CB_index_param;/*MC SPR1920 added global variable*/ |
478 | |
529 /******************************************************************************* | 479 /******************************************************************************* |
530 | 480 |
531 $Function: smscb_M_CB_TOP_ExeAddNew | 481 $Function: smscb_M_CB_TOP_ExeAddNew |
532 | 482 |
533 $Description: | 483 $Description: |
545 | 495 |
546 // selection "Add": call sms_cb_edit_topic(List=CBTopics, Index=ADD) | 496 // selection "Add": call sms_cb_edit_topic(List=CBTopics, Index=ADD) |
547 index = g_smscb_data.CBTopics.length;/* get the index of the next free entry in list CBTopics */ | 497 index = g_smscb_data.CBTopics.length;/* get the index of the next free entry in list CBTopics */ |
548 | 498 |
549 if (index > MAX_MIDS) | 499 if (index > MAX_MIDS) |
550 { | 500 { |
551 /* all entries are already used */ | 501 /* all entries are already used */ |
552 info_screen (win, TxtFull /* ??? */,TxtNull, NULL); | 502 info_screen (win, TxtFull /* ??? */,TxtNull, NULL); |
553 return MFW_EVENT_CONSUMED; | 503 return MFW_EVENT_CONSUMED; |
554 } | 504 } |
555 else | 505 else |
556 { | 506 { |
557 | 507 CB_index_param.index = index; |
558 | 508 return (int)smscb_CB_EDT_TEXTEDT_start(win, &CB_index_param); |
559 CB_index_param.index = index; | 509 } |
560 return (int)smscb_CB_EDT_TEXTEDT_start(win, &CB_index_param); | |
561 } | |
562 } | 510 } |
563 | 511 |
564 | 512 |
565 /********************************************************************* | 513 /********************************************************************* |
566 ********************************************************************** | 514 ********************************************************************** |
567 | 515 |
568 M_CB_TOP_CONS DYNAMIC MENU WINDOW. DECLARATION | 516 M_CB_TOP_CONS DYNAMIC MENU WINDOW. DECLARATION |
569 | 517 |
570 ********************************************************************* | 518 ********************************************************************* |
571 **********************************************************************/ | 519 **********************************************************************/ |
572 typedef struct | 520 typedef struct |
573 { | 521 { |
602 /* x0045876, 14-Aug-2006 (WR - integer conversion resulted in a change of sign) */ | 550 /* x0045876, 14-Aug-2006 (WR - integer conversion resulted in a change of sign) */ |
603 (U8) -1, /* use default font */ | 551 (U8) -1, /* use default font */ |
604 | 552 |
605 NULL, /* with these items */ | 553 NULL, /* with these items */ |
606 0, /* number of items */ | 554 0, /* number of items */ |
607 COLOUR_LIST_SMS, TxtNull, NULL, MNUATTRSPARE | 555 COLOUR_LIST_SMS, TxtNull, NULL, MNUATTRSPARE |
608 | |
609 }; | 556 }; |
610 | 557 |
611 /********************************************************************* | 558 /********************************************************************* |
612 ********************************************************************** | 559 ********************************************************************** |
613 | 560 |
614 M_CB_TOP_CONS DYNAMIC MENU WINDOW. IMPLEMENTATION | 561 M_CB_TOP_CONS DYNAMIC MENU WINDOW. IMPLEMENTATION |
615 | 562 |
616 ********************************************************************* | 563 ********************************************************************* |
617 **********************************************************************/ | 564 **********************************************************************/ |
618 | 565 |
619 /******************************************************************************* | 566 /******************************************************************************* |
634 TRACE_FUNCTION ("smscb_M_CB_TOP_CONS_start()"); | 581 TRACE_FUNCTION ("smscb_M_CB_TOP_CONS_start()"); |
635 | 582 |
636 win = smscb_M_CB_TOP_CONS_create (parent_window); | 583 win = smscb_M_CB_TOP_CONS_create (parent_window); |
637 | 584 |
638 if (win NEQ NULL) | 585 if (win NEQ NULL) |
639 { | 586 { |
640 SEND_EVENT (win, E_INIT, smscb_M_CB_TOP_CONS_ID, NULL); | 587 SEND_EVENT (win, E_INIT, smscb_M_CB_TOP_CONS_ID, NULL); |
641 } | 588 } |
642 return win; | 589 return win; |
643 } | 590 } |
644 | 591 |
645 | 592 |
646 /******************************************************************************* | 593 /******************************************************************************* |
666 */ | 613 */ |
667 | 614 |
668 data->win = | 615 data->win = |
669 win_create (parent_window, 0, 0, NULL); | 616 win_create (parent_window, 0, 0, NULL); |
670 if (data->win EQ NULL) | 617 if (data->win EQ NULL) |
671 { | 618 { |
672 return NULL; | 619 return NULL; |
673 } | 620 } |
674 | 621 |
675 /* | 622 /* |
676 * connect the dialog data to the MFW-window | 623 * connect the dialog data to the MFW-window |
677 */ | 624 */ |
678 | 625 |
696 T_M_CB_TOP_CONS * data; | 643 T_M_CB_TOP_CONS * data; |
697 | 644 |
698 TRACE_FUNCTION ("smscb_M_CB_TOP_CONS_destroy()"); | 645 TRACE_FUNCTION ("smscb_M_CB_TOP_CONS_destroy()"); |
699 | 646 |
700 if (own_window) | 647 if (own_window) |
701 { | 648 { |
702 win_data = ((T_MFW_HDR *)own_window)->data; | 649 win_data = ((T_MFW_HDR *)own_window)->data; |
703 data = (T_M_CB_TOP_CONS *)win_data->user; | 650 data = (T_M_CB_TOP_CONS *)win_data->user; |
704 | 651 |
705 if (data) | 652 if (data) |
706 { | 653 { |
707 /* | 654 /* |
708 * Delete WIN handler | 655 * Delete WIN handler |
709 */ | 656 */ |
710 win_delete (data->win); | 657 win_delete (data->win); |
711 | 658 |
712 /* | 659 /* |
713 * Free Memory | 660 * Free Memory |
714 */ | 661 */ |
715 FREE_MEMORY ((void *)data->list_menu_data.List, MAX_MIDS * sizeof (MfwMnuItem)); // c017 rsa | 662 FREE_MEMORY ((void *)data->list_menu_data.List, MAX_MIDS * sizeof (MfwMnuItem)); // c017 rsa |
716 FREE_MEMORY ((void *)data, sizeof (T_M_CB_TOP_CONS)); | 663 FREE_MEMORY ((void *)data, sizeof (T_M_CB_TOP_CONS)); |
717 } | 664 } |
718 else | 665 else |
719 { | 666 { |
720 TRACE_EVENT ("smscb_M_CB_TOP_CONS_destroy() called twice"); | 667 TRACE_EVENT ("smscb_M_CB_TOP_CONS_destroy() called twice"); |
721 } | 668 } |
722 } | 669 } |
723 } | 670 } |
724 | 671 |
725 /******************************************************************************* | 672 /******************************************************************************* |
726 | 673 |
727 $Function: smscb_M_CB_TOP_CONS_recreate | 674 $Function: smscb_M_CB_TOP_CONS_recreate |
738 int i; | 685 int i; |
739 // int len; // RAVI | 686 // int len; // RAVI |
740 | 687 |
741 #ifdef DEBUG_SMS_CB | 688 #ifdef DEBUG_SMS_CB |
742 UBYTE ii; | 689 UBYTE ii; |
743 TRACE_EVENT ("before create a list !"); | 690 TRACE_EVENT ("before create a list !"); |
744 for (ii = 0; ii < MAX_MIDS; ii++) | 691 for (ii = 0; ii < MAX_MIDS; ii++) |
745 { | 692 { |
746 TRACE_EVENT_P2 (" 01 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); | |
747 } | |
748 /***************************Go-lite Optimization changes Start***********************/ | |
749 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
750 TRACE_EVENT_P2 (" 01 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); | 693 TRACE_EVENT_P2 (" 01 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); |
751 /***************************Go-lite Optimization changes end***********************/ | 694 } |
695 /***************************Go-lite Optimization changes Start***********************/ | |
696 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
697 TRACE_EVENT_P2 (" 01 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); | |
698 /***************************Go-lite Optimization changes end***********************/ | |
752 #endif | 699 #endif |
753 | 700 |
754 //on RECREATE|INIT: menucreate dynamiclist (List=CBTopics, SoftLeft=SELECT, SoftRight=BACK) /* show: 1. Name 2. MID */ | 701 //on RECREATE|INIT: menucreate dynamiclist (List=CBTopics, SoftLeft=SELECT, SoftRight=BACK) /* show: 1. Name 2. MID */ |
755 | 702 |
756 // c017 rsa | 703 // c017 rsa |
757 /* allocate sufficient memory to hold the maximum list of menu items */ | 704 /* allocate sufficient memory to hold the maximum list of menu items */ |
758 data->list_menu_data.List = (MfwMnuItem *)ALLOC_MEMORY (MAX_MIDS * sizeof (MfwMnuItem)); | 705 data->list_menu_data.List = (MfwMnuItem *)ALLOC_MEMORY (MAX_MIDS * sizeof (MfwMnuItem)); |
759 // end c017 rsa | 706 // end c017 rsa |
760 | 707 |
761 for (i=0; i < g_smscb_data.CBTopics.length; i++) /* Fill Menu List */ | 708 for (i=0; i < g_smscb_data.CBTopics.length; i++) /* Fill Menu List */ |
762 { | 709 { |
763 mnuInitDataItem(&data->list_menu_data.List[i]); | 710 mnuInitDataItem(&data->list_menu_data.List[i]); |
764 | 711 |
765 | 712 /* get the correct entry in list of CBTopics */ |
766 /* get the correct entry in list of CBTopics */ | 713 data->list_menu_data.List[i].str = g_smscb_data.CBTopics.entry[i].name; |
767 data->list_menu_data.List[i].str = g_smscb_data.CBTopics.entry[i].name; | 714 data->list_menu_data.List[i].flagFunc = item_flag_none; |
768 data->list_menu_data.List[i].flagFunc = item_flag_none; | 715 } |
769 | 716 |
770 | 717 //actual number of entries in list menu |
771 } | 718 data->list_menu_data.ListLength = g_smscb_data.CBTopics.length; |
772 | 719 |
773 //actual number of entries in list menu | 720 data->list_menu_data.autoDestroy = TRUE; |
774 data->list_menu_data.ListLength = g_smscb_data.CBTopics.length; | |
775 | |
776 data->list_menu_data.autoDestroy = TRUE; | |
777 | 721 |
778 listDisplayListMenu(data->win, &data->list_menu_data, (ListCbFunc)smscb_M_CB_TOP_CONS_listmnu_cb,0); | 722 listDisplayListMenu(data->win, &data->list_menu_data, (ListCbFunc)smscb_M_CB_TOP_CONS_listmnu_cb,0); |
779 } | 723 } |
780 | 724 |
781 /******************************************************************************* | 725 /******************************************************************************* |
790 | 734 |
791 *******************************************************************************/ | 735 *******************************************************************************/ |
792 void smscb_M_CB_TOP_CONS_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * dummy) | 736 void smscb_M_CB_TOP_CONS_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * dummy) |
793 /* callback handler for events sent to to trigger execution */ | 737 /* callback handler for events sent to to trigger execution */ |
794 { | 738 { |
795 | |
796 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | 739 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; |
797 T_M_CB_TOP_CONS * data = (T_M_CB_TOP_CONS *)win_data->user; | 740 T_M_CB_TOP_CONS * data = (T_M_CB_TOP_CONS *)win_data->user; |
798 T_MFW_HND * l_parent; | 741 T_MFW_HND * l_parent; |
799 SHORT l_id; | 742 SHORT l_id; |
800 // UBYTE i; // RAVI. | 743 // UBYTE i; // RAVI. |
816 data->list_menu_data.RightSoftKey = TxtSoftBack; | 759 data->list_menu_data.RightSoftKey = TxtSoftBack; |
817 data->list_menu_data.KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUUP | KEY_MNUDOWN; | 760 data->list_menu_data.KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUUP | KEY_MNUDOWN; |
818 data->list_menu_data.Reason = 0; | 761 data->list_menu_data.Reason = 0; |
819 data->list_menu_data.Strings = TRUE; // c020 rsa | 762 data->list_menu_data.Strings = TRUE; // c020 rsa |
820 data->list_menu_data.Attr = (MfwMnuAttr*)&smscb_M_CB_TOP_CONSAttrib; | 763 data->list_menu_data.Attr = (MfwMnuAttr*)&smscb_M_CB_TOP_CONSAttrib; |
821 data->list_menu_data.autoDestroy = TRUE; | 764 data->list_menu_data.autoDestroy = TRUE; |
822 | 765 |
823 /* NOBREAK */ | 766 /* NOBREAK */ |
824 case E_RETURN: | 767 case E_RETURN: |
825 case E_EXIT: /* terminate EXIT from CB_EDT_MIDEDT|M_CB_TOP_CONS_SEL here */ | 768 case E_EXIT: /* terminate EXIT from CB_EDT_MIDEDT|M_CB_TOP_CONS_SEL here */ |
826 /* (re)create the dialog handler */ | 769 /* (re)create the dialog handler */ |
827 TRACE_FUNCTION ("EXIT in M_CB_TOP_CONS_exec_cb"); | 770 TRACE_FUNCTION ("EXIT in M_CB_TOP_CONS_exec_cb"); |
828 | 771 |
829 //the special case : if the user deleted the last CB item | 772 //the special case : if the user deleted the last CB item |
830 //check if there is any more CB in the list when not | 773 //check if there is any more CB in the list when not |
831 //give a infoscreen and go back to the CB menu | 774 //give a infoscreen and go back to the CB menu |
832 if (g_smscb_data.CBTopics.length EQ 0) | 775 if (g_smscb_data.CBTopics.length EQ 0) |
833 { | 776 { |
834 info_screen(0, TxtEmptyList,TxtNull, NULL); | 777 info_screen(0, TxtEmptyList,TxtNull, NULL); |
835 l_parent = data->parent; | 778 l_parent = data->parent; |
836 l_id = data->id; | 779 l_id = data->id; |
837 smscb_M_CB_TOP_CONS_destroy(data->win); | 780 smscb_M_CB_TOP_CONS_destroy(data->win); |
838 SEND_EVENT (l_parent, event, l_id, NULL); /* forward event to parent */ | 781 SEND_EVENT (l_parent, event, l_id, NULL); /* forward event to parent */ |
839 | 782 } |
840 } | 783 else |
841 else | 784 { |
842 { | 785 smscb_M_CB_TOP_CONS_recreate(data); |
843 smscb_M_CB_TOP_CONS_recreate(data); | 786 |
844 | 787 /* put the (new) dialog window on top of the window stack */ |
845 /* put the (new) dialog window on top of the window stack */ | 788 /* winUpdate(data->win); c021 rsa */ |
846 /* winUpdate(data->win); c021 rsa */ | 789 } |
847 } | |
848 break; | 790 break; |
849 case E_ABORT: /* defaultreaction */ | 791 case E_ABORT: /* defaultreaction */ |
850 TRACE_EVENT ("ABORT in M_CB_TOP_CONS_exec_cb"); | 792 TRACE_EVENT ("ABORT in M_CB_TOP_CONS_exec_cb"); |
851 | 793 |
852 l_parent = data->parent; | 794 l_parent = data->parent; |
883 { | 825 { |
884 case LISTS_REASON_SELECT: | 826 case LISTS_REASON_SELECT: |
885 //on SELECT: menucreate M_CB_TOP_CONS_SEL(Index=selection) | 827 //on SELECT: menucreate M_CB_TOP_CONS_SEL(Index=selection) |
886 index = ListData->ListPosition; | 828 index = ListData->ListPosition; |
887 data->CB_index_param.index = index; | 829 data->CB_index_param.index = index; |
888 | 830 smscb_M_CB_TOP_CONS_SEL_ExeDelete(win); |
889 smscb_M_CB_TOP_CONS_SEL_ExeDelete(win); | |
890 | |
891 break; | 831 break; |
892 case LISTS_REASON_BACK: /* back to previous menu */ | 832 case LISTS_REASON_BACK: /* back to previous menu */ |
893 smscb_M_CB_TOP_CONS_destroy(data->win); | 833 smscb_M_CB_TOP_CONS_destroy(data->win); |
894 SEND_EVENT (data->parent, E_RETURN, data->id, NULL); // c007 rsa | 834 SEND_EVENT (data->parent, E_RETURN, data->id, NULL); // c007 rsa |
895 break; | 835 break; |
903 void ExeDelete_infoscreen_cb (T_MFW_HND win, USHORT identifier, UBYTE reason); | 843 void ExeDelete_infoscreen_cb (T_MFW_HND win, USHORT identifier, UBYTE reason); |
904 | 844 |
905 /********************************************************************* | 845 /********************************************************************* |
906 ********************************************************************** | 846 ********************************************************************** |
907 | 847 |
908 M_CB_TOP_CONS_SEL DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR | 848 M_CB_TOP_CONS_SEL DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR |
909 | 849 |
910 ********************************************************************* | 850 ********************************************************************* |
911 **********************************************************************/ | 851 **********************************************************************/ |
912 | 852 |
913 | 853 |
937 smscb_delete_topic((UBYTE) index); | 877 smscb_delete_topic((UBYTE) index); |
938 | 878 |
939 //show infoscreen ("Deleted"); | 879 //show infoscreen ("Deleted"); |
940 info_screen(win, TxtDeleted, TxtNull, (T_VOID_FUNC) ExeDelete_infoscreen_cb); | 880 info_screen(win, TxtDeleted, TxtNull, (T_VOID_FUNC) ExeDelete_infoscreen_cb); |
941 | 881 |
942 | 882 //save the updated Topic list on the SIM |
943 //save the updated Topic list on the SIM | 883 smscb_setCBsettings(SMSCB_SWITCH_ON); |
944 smscb_setCBsettings(SMSCB_SWITCH_ON); | |
945 | 884 |
946 //selfdestroy; sendevent EXIT | 885 //selfdestroy; sendevent EXIT |
947 | |
948 | 886 |
949 return MFW_EVENT_CONSUMED; | 887 return MFW_EVENT_CONSUMED; |
950 } | 888 } |
951 | 889 |
952 void ExeDelete_infoscreen_cb (T_MFW_HND win , USHORT identifier, UBYTE reason) | 890 void ExeDelete_infoscreen_cb (T_MFW_HND win , USHORT identifier, UBYTE reason) |
955 T_M_CB_TOP_CONS * data = (T_M_CB_TOP_CONS *)win_data->user; | 893 T_M_CB_TOP_CONS * data = (T_M_CB_TOP_CONS *)win_data->user; |
956 SHORT l_id; | 894 SHORT l_id; |
957 | 895 |
958 l_id = data->id; | 896 l_id = data->id; |
959 | 897 |
960 //nm go back and recreate the CB list | 898 //nm go back and recreate the CB list |
961 SEND_EVENT (win, E_EXIT, l_id, NULL); | 899 SEND_EVENT (win, E_EXIT, l_id, NULL); |
962 | |
963 } | 900 } |
964 | 901 |
965 /********************************************************************* | 902 /********************************************************************* |
966 ********************************************************************** | 903 ********************************************************************** |
967 | 904 |
968 CB_EDT_TEXTEDT DYNAMIC MENU WINDOW. DECLARATION | 905 CB_EDT_TEXTEDT DYNAMIC MENU WINDOW. DECLARATION |
969 | 906 |
970 ********************************************************************* | 907 ********************************************************************* |
971 **********************************************************************/ | 908 **********************************************************************/ |
972 | 909 |
973 typedef struct | 910 typedef struct |
984 T_MFW_HND editor; | 921 T_MFW_HND editor; |
985 | 922 |
986 /* internal data */ | 923 /* internal data */ |
987 T_CB_index_param * param; /* pointer to parameter space in parent (index in list) */ | 924 T_CB_index_param * param; /* pointer to parameter space in parent (index in list) */ |
988 #ifdef NEW_EDITOR | 925 #ifdef NEW_EDITOR |
989 T_AUI_EDITOR_DATA editor_info; /* SPR#1428 - SH - New Editor data */ | 926 T_AUI_EDITOR_DATA editor_info; /* SPR#1428 - SH - New Editor data */ |
990 #else | 927 #else |
991 T_EDITOR_DATA editor_info; /* storage for editor attributes */ | 928 T_EDITOR_DATA editor_info; /* storage for editor attributes */ |
992 #endif | 929 #endif |
993 T_CB_EDT_MIDEDT_param CB_EDT_MIDEDT_param; /* parameter space for buffer for editing */ | 930 T_CB_EDT_MIDEDT_param CB_EDT_MIDEDT_param; /* parameter space for buffer for editing */ |
994 } T_CB_EDT_TEXTEDT; | 931 } T_CB_EDT_TEXTEDT; |
999 static void smscb_CB_EDT_TEXTEDT_editor_cb (T_MFW_HND win, USHORT Identifier, USHORT event); | 936 static void smscb_CB_EDT_TEXTEDT_editor_cb (T_MFW_HND win, USHORT Identifier, USHORT event); |
1000 | 937 |
1001 /********************************************************************* | 938 /********************************************************************* |
1002 ********************************************************************** | 939 ********************************************************************** |
1003 | 940 |
1004 CB_EDT_TEXTEDT DYNAMIC MENU WINDOW. IMPLEMENTATION | 941 CB_EDT_TEXTEDT DYNAMIC MENU WINDOW. IMPLEMENTATION |
1005 | 942 |
1006 ********************************************************************* | 943 ********************************************************************* |
1007 **********************************************************************/ | 944 **********************************************************************/ |
1008 | 945 |
1009 T_MFW_HND smscb_CB_EDT_TEXTEDT_start(T_MFW_HND parent_window, T_CB_index_param * parameter) | 946 T_MFW_HND smscb_CB_EDT_TEXTEDT_start(T_MFW_HND parent_window, T_CB_index_param * parameter) |
1013 TRACE_FUNCTION ("smscb_CB_EDT_TEXTEDT_start()"); | 950 TRACE_FUNCTION ("smscb_CB_EDT_TEXTEDT_start()"); |
1014 | 951 |
1015 win = smscb_CB_EDT_TEXTEDT_create (parent_window); | 952 win = smscb_CB_EDT_TEXTEDT_create (parent_window); |
1016 | 953 |
1017 if (win NEQ NULL) | 954 if (win NEQ NULL) |
1018 { | 955 { |
1019 SEND_EVENT (win, E_INIT, smscb_CB_EDT_TEXTEDT_ID, (void *)parameter); | 956 SEND_EVENT (win, E_INIT, smscb_CB_EDT_TEXTEDT_ID, (void *)parameter); |
1020 } | 957 } |
1021 return win; | 958 return win; |
1022 } | 959 } |
1023 | 960 |
1024 | 961 |
1025 /******************************************************************************* | 962 /******************************************************************************* |
1045 */ | 982 */ |
1046 | 983 |
1047 data->win = | 984 data->win = |
1048 win_create (parent_window, 0, 0, NULL); | 985 win_create (parent_window, 0, 0, NULL); |
1049 if (data->win EQ NULL) | 986 if (data->win EQ NULL) |
1050 { | 987 { |
1051 return NULL; | 988 return NULL; |
1052 } | 989 } |
1053 | 990 |
1054 /* | 991 /* |
1055 * connect the dialog data to the MFW-window | 992 * connect the dialog data to the MFW-window |
1056 */ | 993 */ |
1057 | 994 |
1087 T_CB_EDT_TEXTEDT * data; | 1024 T_CB_EDT_TEXTEDT * data; |
1088 | 1025 |
1089 TRACE_FUNCTION ("smscb_CB_EDT_TEXTEDT_destroy()"); | 1026 TRACE_FUNCTION ("smscb_CB_EDT_TEXTEDT_destroy()"); |
1090 | 1027 |
1091 if (own_window) | 1028 if (own_window) |
1092 { | 1029 { |
1093 win_data = ((T_MFW_HDR *)own_window)->data; | 1030 win_data = ((T_MFW_HDR *)own_window)->data; |
1094 data = (T_CB_EDT_TEXTEDT *)win_data->user; | 1031 data = (T_CB_EDT_TEXTEDT *)win_data->user; |
1095 | 1032 |
1096 if (data) | 1033 if (data) |
1097 { | 1034 { |
1098 /* | 1035 /* |
1099 * Delete WIN handler | 1036 * Delete WIN handler |
1100 */ | 1037 */ |
1101 win_delete (data->win); | 1038 win_delete (data->win); |
1102 | 1039 |
1103 /* | 1040 /* |
1104 * Free Memory | 1041 * Free Memory |
1105 */ | 1042 */ |
1106 FREE_MEMORY ((void *)data, sizeof (T_CB_EDT_TEXTEDT)); | 1043 FREE_MEMORY ((void *)data, sizeof (T_CB_EDT_TEXTEDT)); |
1107 } | 1044 } |
1108 else | 1045 else |
1109 { | 1046 { |
1110 TRACE_EVENT ("smscb_CB_EDT_TEXTEDT_destroy() called twice"); | 1047 TRACE_EVENT ("smscb_CB_EDT_TEXTEDT_destroy() called twice"); |
1111 } | 1048 } |
1112 } | 1049 } |
1113 } | 1050 } |
1114 | 1051 |
1115 /******************************************************************************* | 1052 /******************************************************************************* |
1116 | 1053 |
1117 $Function: smscb_CB_EDT_TEXTEDT_exec_cb | 1054 $Function: smscb_CB_EDT_TEXTEDT_exec_cb |
1124 | 1061 |
1125 *******************************************************************************/ | 1062 *******************************************************************************/ |
1126 void smscb_CB_EDT_TEXTEDT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | 1063 void smscb_CB_EDT_TEXTEDT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) |
1127 /* callback handler for events sent to to trigger execution */ | 1064 /* callback handler for events sent to to trigger execution */ |
1128 { | 1065 { |
1129 | |
1130 | |
1131 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | 1066 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; |
1132 T_CB_EDT_TEXTEDT * data = (T_CB_EDT_TEXTEDT *)win_data->user; | 1067 T_CB_EDT_TEXTEDT * data = (T_CB_EDT_TEXTEDT *)win_data->user; |
1133 int | 1068 int index; |
1134 index; | |
1135 | 1069 |
1136 TRACE_FUNCTION ("smscb_CB_EDT_TEXTEDT_exec_cb()"); | 1070 TRACE_FUNCTION ("smscb_CB_EDT_TEXTEDT_exec_cb()"); |
1137 | 1071 |
1138 switch (event) | 1072 switch (event) |
1139 { | 1073 { |
1142 data->id = value; | 1076 data->id = value; |
1143 data->param = (T_CB_index_param *)parameter; /* store the pointer to the parameter for later use */ | 1077 data->param = (T_CB_index_param *)parameter; /* store the pointer to the parameter for later use */ |
1144 | 1078 |
1145 | 1079 |
1146 #ifdef DEBUG_SMS_CB | 1080 #ifdef DEBUG_SMS_CB |
1147 /***************************Go-lite Optimization changes Start***********************/ | 1081 /***************************Go-lite Optimization changes Start***********************/ |
1148 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | 1082 // Aug 16, 2004 REF: CRR 24323 Deepa M.D |
1149 TRACE_EVENT_P1( "the index is %d", data->param->index); | 1083 TRACE_EVENT_P1( "the index is %d", data->param->index); |
1150 /***************************Go-lite Optimization changes end***********************/ | 1084 /***************************Go-lite Optimization changes end***********************/ |
1151 #endif | 1085 #endif |
1152 | 1086 |
1153 /* initialization of the dialog data */ | 1087 /* initialization of the dialog data */ |
1154 index = data->param->index; | 1088 index = data->param->index; |
1155 data->CB_EDT_MIDEDT_param.index = index; /* copy the index to parameter space of next menu */ | 1089 data->CB_EDT_MIDEDT_param.index = index; /* copy the index to parameter space of next menu */ |
1156 | 1090 |
1157 data->CB_EDT_MIDEDT_param.name[0] = '\0'; /* provide empty entry */ | 1091 data->CB_EDT_MIDEDT_param.name[0] = '\0'; /* provide empty entry */ |
1158 | 1092 |
1159 //on INIT: exec "copy params to dynamic memory <data>"; RECREATE | 1093 //on INIT: exec "copy params to dynamic memory <data>"; RECREATE |
1160 /* NOBREAK */ | 1094 /* NOBREAK */ |
1161 case E_RETURN: //on RETURN: RECREATE // recreate editor if back from options | 1095 case E_RETURN: //on RETURN: RECREATE // recreate editor if back from options |
1162 | 1096 |
1163 /* SPR#1428 - SH - New Editor changes */ | 1097 /* SPR#1428 - SH - New Editor changes */ |
1164 | 1098 |
1165 #ifdef NEW_EDITOR | 1099 #ifdef NEW_EDITOR |
1166 AUI_edit_SetDefault(&data->editor_info); | 1100 AUI_edit_SetDefault(&data->editor_info); |
1167 AUI_edit_SetDisplay(&data->editor_info, ZONE_FULL_SK_TITLE, COLOUR_EDITOR_XX, EDITOR_FONT); | 1101 AUI_edit_SetDisplay(&data->editor_info, ZONE_FULL_SK_TITLE, COLOUR_EDITOR_XX, EDITOR_FONT); |
1168 AUI_edit_SetEvents(&data->editor_info, value, TRUE, TEN_SECS, (T_AUI_EDIT_CB)smscb_CB_EDT_TEXTEDT_editor_cb); | 1102 AUI_edit_SetEvents(&data->editor_info, value, TRUE, TEN_SECS, (T_AUI_EDIT_CB)smscb_CB_EDT_TEXTEDT_editor_cb); |
1169 AUI_edit_SetTextStr(&data->editor_info, TxtSoftOK, TxtDelete, TxtEnterName, NULL); | 1103 AUI_edit_SetTextStr(&data->editor_info, TxtSoftOK, TxtDelete, TxtEnterName, NULL); |
1170 // Change by Sasken ( Deepa M.d) on March 29th 2004 | 1104 // Change by Sasken ( Deepa M.d) on March 29th 2004 |
1171 // Issue Number : MMI-SPR-12722 | 1105 // Issue Number : MMI-SPR-12722 |
1172 // Subject: Right softkey should be "Back" when the editor is empty | 1106 // Subject: Right softkey should be "Back" when the editor is empty |
1173 // Bug : Right softkey should be "Back" when the editor is empty | 1107 // Bug : Right softkey should be "Back" when the editor is empty |
1174 // Solution : Added alternative string for the right softkey tobe displayed when the editor is empty | 1108 // Solution : Added alternative string for the right softkey tobe displayed when the editor is empty |
1175 | 1109 |
1176 AUI_edit_SetAltTextStr(&data->editor_info, 0, NULL, TRUE, TxtSoftBack); | 1110 AUI_edit_SetAltTextStr(&data->editor_info, 0, NULL, TRUE, TxtSoftBack); |
1177 AUI_edit_SetBuffer(&data->editor_info, ATB_DCS_ASCII, (UBYTE *)data->CB_EDT_MIDEDT_param.name, CB_TAG_LENGTH); | 1111 AUI_edit_SetBuffer(&data->editor_info, ATB_DCS_ASCII, (UBYTE *)data->CB_EDT_MIDEDT_param.name, CB_TAG_LENGTH); |
1178 AUI_edit_SetMode(&data->editor_info, ED_MODE_ALPHA, ED_CURSOR_BAR); | 1112 AUI_edit_SetMode(&data->editor_info, ED_MODE_ALPHA, ED_CURSOR_BAR); |
1179 | 1113 |
1180 data->editor = AUI_edit_Start(data->win,&data->editor_info); /* start the editor */ | 1114 data->editor = AUI_edit_Start(data->win,&data->editor_info); /* start the editor */ |
1181 #else /* NEW_EDITOR */ | 1115 #else /* NEW_EDITOR */ |
1182 /*MC SPR 1488, got rid of hardcoded editor dimensions*/ | 1116 /*MC SPR 1488, got rid of hardcoded editor dimensions*/ |
1183 data->editor_info.editor_attr.win.px = 0; | 1117 data->editor_info.editor_attr.win.px = 0; |
1184 data->editor_info.editor_attr.win.py = Mmi_layout_line(2); | 1118 data->editor_info.editor_attr.win.py = Mmi_layout_line(2); |
1185 data->editor_info.editor_attr.win.sx =SCREEN_SIZE_X; | 1119 data->editor_info.editor_attr.win.sx =SCREEN_SIZE_X; |
1186 data->editor_info.editor_attr.win.sy = 2*Mmi_layout_line_height(); | 1120 data->editor_info.editor_attr.win.sy = 2*Mmi_layout_line_height(); |
1187 data->editor_info.editor_attr.edtCol = COLOUR_EDITOR_XX; | 1121 data->editor_info.editor_attr.edtCol = COLOUR_EDITOR_XX; |
1188 data->editor_info.editor_attr.font = 0; | 1122 data->editor_info.editor_attr.font = 0; |
1189 data->editor_info.editor_attr.mode = edtCurBar1; | 1123 data->editor_info.editor_attr.mode = edtCurBar1; |
1190 data->editor_info.editor_attr.controls = 0; | 1124 data->editor_info.editor_attr.controls = 0; |
1191 data->editor_info.editor_attr.text = data->CB_EDT_MIDEDT_param.name; /* buffer to be edited */ | 1125 data->editor_info.editor_attr.text = data->CB_EDT_MIDEDT_param.name; /* buffer to be edited */ |
1192 data->editor_info.editor_attr.size = CB_TAG_LENGTH; | 1126 data->editor_info.editor_attr.size = CB_TAG_LENGTH; |
1194 data->editor_info.RightSoftKey = TxtDelete; | 1128 data->editor_info.RightSoftKey = TxtDelete; |
1195 data->editor_info.TextId = TxtEnterName; | 1129 data->editor_info.TextId = TxtEnterName; |
1196 data->editor_info.Identifier = value; /* optional */ | 1130 data->editor_info.Identifier = value; /* optional */ |
1197 data->editor_info.mode = ALPHA_MODE; | 1131 data->editor_info.mode = ALPHA_MODE; |
1198 data->editor_info.Callback = (T_EDIT_CB)smscb_CB_EDT_TEXTEDT_editor_cb; | 1132 data->editor_info.Callback = (T_EDIT_CB)smscb_CB_EDT_TEXTEDT_editor_cb; |
1199 data->editor_info.destroyEditor = TRUE; | 1133 data->editor_info.destroyEditor = TRUE; |
1200 data->editor_info.hide = FALSE; | 1134 data->editor_info.hide = FALSE; |
1201 // Change by Sasken ( Deepa M.d) on March 29th 2004 | 1135 // Change by Sasken ( Deepa M.d) on March 29th 2004 |
1202 // Issue Number : MMI-SPR-12722 | 1136 // Issue Number : MMI-SPR-12722 |
1203 // Subject: Right softkey should be "Back" when the editor is empty | 1137 // Subject: Right softkey should be "Back" when the editor is empty |
1204 // Bug : Right softkey should be "Back" when the editor is empty | 1138 // Bug : Right softkey should be "Back" when the editor is empty |
1205 // Solution : Added alternative string for the right softkey tobe displayed when the editor is empty | 1139 // Solution : Added alternative string for the right softkey tobe displayed when the editor is empty |
1206 data->editor_info.AlternateLeftSoftKey = TxtSoftBack; | 1140 data->editor_info.AlternateLeftSoftKey = TxtSoftBack; |
1207 data->editor_info.TextString = NULL; | 1141 data->editor_info.TextString = NULL; |
1208 data->editor_info.min_enter = 0; | 1142 data->editor_info.min_enter = 0; |
1209 data->editor_info.timeout = TEN_SECS; | 1143 data->editor_info.timeout = TEN_SECS; |
1210 | 1144 |
1211 /* create the dialog handler */ | 1145 /* create the dialog handler */ |
1214 | 1148 |
1215 break; | 1149 break; |
1216 case E_ABORT: | 1150 case E_ABORT: |
1217 case E_EXIT: /* defaultreaction */ | 1151 case E_EXIT: /* defaultreaction */ |
1218 smscb_CB_EDT_TEXTEDT_destroy(data->win); | 1152 smscb_CB_EDT_TEXTEDT_destroy(data->win); |
1219 /*SPR 1920, removed sending of exit event to parent, no longer needed*/ | 1153 /*SPR 1920, removed sending of exit event to parent, no longer needed*/ |
1220 break; | 1154 break; |
1221 default: | 1155 default: |
1222 return; | 1156 return; |
1223 } | 1157 } |
1224 } | 1158 } |
1263 return; | 1197 return; |
1264 } | 1198 } |
1265 /********************************************************************* | 1199 /********************************************************************* |
1266 ********************************************************************** | 1200 ********************************************************************** |
1267 | 1201 |
1268 CB_EDT_MIDEDT DYNAMIC MENU WINDOW. DECLARATION | 1202 CB_EDT_MIDEDT DYNAMIC MENU WINDOW. DECLARATION |
1269 | 1203 |
1270 ********************************************************************* | 1204 ********************************************************************* |
1271 **********************************************************************/ | 1205 **********************************************************************/ |
1272 | 1206 |
1273 typedef struct | 1207 typedef struct |
1284 T_MFW_HND editor; | 1218 T_MFW_HND editor; |
1285 | 1219 |
1286 /* internal data */ | 1220 /* internal data */ |
1287 T_CB_EDT_MIDEDT_param * param; /* pointer to parameter space in parent (buffer for editing) */ | 1221 T_CB_EDT_MIDEDT_param * param; /* pointer to parameter space in parent (buffer for editing) */ |
1288 #ifdef NEW_EDITOR | 1222 #ifdef NEW_EDITOR |
1289 T_AUI_EDITOR_DATA editor_info; /* SPR#1428 - SH - New Editor data */ | 1223 T_AUI_EDITOR_DATA editor_info; /* SPR#1428 - SH - New Editor data */ |
1290 #else | 1224 #else |
1291 T_EDITOR_DATA editor_info; /* storage for editor attributes */ | 1225 T_EDITOR_DATA editor_info; /* storage for editor attributes */ |
1292 #endif | 1226 #endif |
1293 } T_CB_EDT_MIDEDT; | 1227 } T_CB_EDT_MIDEDT; |
1294 | 1228 |
1298 static void smscb_CB_EDT_MIDEDT_editor_cb (T_MFW_HND win, USHORT Identifier, USHORT event); | 1232 static void smscb_CB_EDT_MIDEDT_editor_cb (T_MFW_HND win, USHORT Identifier, USHORT event); |
1299 | 1233 |
1300 /********************************************************************* | 1234 /********************************************************************* |
1301 ********************************************************************** | 1235 ********************************************************************** |
1302 | 1236 |
1303 CB_EDT_MIDEDT DYNAMIC MENU WINDOW. IMPLEMENTATION | 1237 CB_EDT_MIDEDT DYNAMIC MENU WINDOW. IMPLEMENTATION |
1304 | 1238 |
1305 ********************************************************************* | 1239 ********************************************************************* |
1306 **********************************************************************/ | 1240 **********************************************************************/ |
1307 | 1241 |
1308 T_MFW_HND smscb_CB_EDT_MIDEDT_start(T_MFW_HND parent_window, T_CB_EDT_MIDEDT_param * parameter) | 1242 T_MFW_HND smscb_CB_EDT_MIDEDT_start(T_MFW_HND parent_window, T_CB_EDT_MIDEDT_param * parameter) |
1312 TRACE_FUNCTION ("smscb_CB_EDT_MIDEDT_start()"); | 1246 TRACE_FUNCTION ("smscb_CB_EDT_MIDEDT_start()"); |
1313 | 1247 |
1314 win = smscb_CB_EDT_MIDEDT_create (parent_window); | 1248 win = smscb_CB_EDT_MIDEDT_create (parent_window); |
1315 | 1249 |
1316 if (win NEQ NULL) | 1250 if (win NEQ NULL) |
1317 { | 1251 { |
1318 SEND_EVENT (win, E_INIT, smscb_CB_EDT_MIDEDT_ID, (void *)parameter); | 1252 SEND_EVENT (win, E_INIT, smscb_CB_EDT_MIDEDT_ID, (void *)parameter); |
1319 } | 1253 } |
1320 return win; | 1254 return win; |
1321 } | 1255 } |
1322 | 1256 |
1323 /******************************************************************************* | 1257 /******************************************************************************* |
1324 | 1258 |
1343 */ | 1277 */ |
1344 | 1278 |
1345 data->win = win_create (parent_window, 0, 0, NULL); | 1279 data->win = win_create (parent_window, 0, 0, NULL); |
1346 | 1280 |
1347 if (data->win EQ NULL) | 1281 if (data->win EQ NULL) |
1348 { | 1282 { |
1349 return NULL; | 1283 return NULL; |
1350 } | 1284 } |
1351 | 1285 |
1352 /* | 1286 /* |
1353 * connect the dialog data to the MFW-window | 1287 * connect the dialog data to the MFW-window |
1354 */ | 1288 */ |
1355 | 1289 |
1382 static void smscb_CB_EDT_MIDEDT_destroy(MfwHnd own_window) | 1316 static void smscb_CB_EDT_MIDEDT_destroy(MfwHnd own_window) |
1383 { | 1317 { |
1384 T_MFW_WIN * win_data; | 1318 T_MFW_WIN * win_data; |
1385 T_CB_EDT_MIDEDT * data; | 1319 T_CB_EDT_MIDEDT * data; |
1386 | 1320 |
1387 | |
1388 TRACE_FUNCTION ("smscb_CB_EDT_MIDEDT_destroy()"); | 1321 TRACE_FUNCTION ("smscb_CB_EDT_MIDEDT_destroy()"); |
1389 | 1322 |
1390 if (own_window) | 1323 if (own_window) |
1391 { | 1324 { |
1392 win_data = ((T_MFW_HDR *)own_window)->data; | 1325 win_data = ((T_MFW_HDR *)own_window)->data; |
1393 data = (T_CB_EDT_MIDEDT *)win_data->user; | 1326 data = (T_CB_EDT_MIDEDT *)win_data->user; |
1394 | 1327 |
1395 if (data) | 1328 if (data) |
1396 { | 1329 { |
1397 /* | 1330 /* |
1398 * Delete WIN handler | 1331 * Delete WIN handler |
1399 */ | 1332 */ |
1400 win_delete (data->win); | 1333 win_delete (data->win); |
1401 | 1334 |
1402 /* | 1335 /* |
1403 * Free Memory | 1336 * Free Memory |
1404 */ | 1337 */ |
1405 FREE_MEMORY ((void *)data, sizeof (T_CB_EDT_MIDEDT)); | 1338 FREE_MEMORY ((void *)data, sizeof (T_CB_EDT_MIDEDT)); |
1406 } | 1339 } |
1407 else | 1340 else |
1408 { | 1341 { |
1409 TRACE_EVENT ("smscb_CB_EDT_MIDEDT_destroy() called twice"); | 1342 TRACE_EVENT ("smscb_CB_EDT_MIDEDT_destroy() called twice"); |
1410 } | 1343 } |
1411 } | 1344 } |
1412 } | 1345 } |
1413 | 1346 |
1414 | 1347 |
1415 /******************************************************************************* | 1348 /******************************************************************************* |
1416 | 1349 |
1443 data->param = (T_CB_EDT_MIDEDT_param *)parameter; /* store the pointer to the parameter for later use */ | 1376 data->param = (T_CB_EDT_MIDEDT_param *)parameter; /* store the pointer to the parameter for later use */ |
1444 | 1377 |
1445 /* initialization of the dialog data */ | 1378 /* initialization of the dialog data */ |
1446 index = data->param->index; | 1379 index = data->param->index; |
1447 if (g_smscb_data.CBTopics.entry[index].msg_id NEQ NO_MID) | 1380 if (g_smscb_data.CBTopics.entry[index].msg_id NEQ NO_MID) |
1448 { | 1381 { |
1449 data->param->number[0] = '\0'; /* provide empty entry */ | 1382 data->param->number[0] = '\0'; /* provide empty entry */ |
1450 | 1383 } |
1451 } | |
1452 else | 1384 else |
1453 { | 1385 { |
1454 data->param->number[0] = '\0'; /* provide empty entry */ | 1386 data->param->number[0] = '\0'; /* provide empty entry */ |
1455 } | 1387 } |
1456 //on INIT: call editor (Type=numeric, Length=3, Prompt="Enter MID Number", | 1388 //on INIT: call editor (Type=numeric, Length=3, Prompt="Enter MID Number", |
1457 // Number=data->List.Number[data->ListIndex], SoftLeft=OK, SoftRight=BACK) | 1389 // Number=data->List.Number[data->ListIndex], SoftLeft=OK, SoftRight=BACK) |
1458 | 1390 |
1459 /* SPR#1428 - SH - New Editor changes */ | 1391 /* SPR#1428 - SH - New Editor changes */ |
1460 #ifdef NEW_EDITOR | 1392 #ifdef NEW_EDITOR |
1461 AUI_edit_SetDefault(&data->editor_info); | 1393 AUI_edit_SetDefault(&data->editor_info); |
1462 AUI_edit_SetDisplay(&data->editor_info, ZONE_FULL_SK_TITLE, COLOUR_EDITOR, EDITOR_FONT); | 1394 AUI_edit_SetDisplay(&data->editor_info, ZONE_FULL_SK_TITLE, COLOUR_EDITOR, EDITOR_FONT); |
1463 AUI_edit_SetEvents(&data->editor_info, value, TRUE, TEN_SECS, (T_AUI_EDIT_CB)smscb_CB_EDT_MIDEDT_editor_cb); | 1395 AUI_edit_SetEvents(&data->editor_info, value, TRUE, TEN_SECS, (T_AUI_EDIT_CB)smscb_CB_EDT_MIDEDT_editor_cb); |
1464 AUI_edit_SetTextStr(&data->editor_info, TxtSoftOK, TxtDelete, TxtEnterMid, NULL); | 1396 AUI_edit_SetTextStr(&data->editor_info, TxtSoftOK, TxtDelete, TxtEnterMid, NULL); |
1465 AUI_edit_SetAltTextStr(&data->editor_info, 1, TxtNull, TRUE, TxtSoftBack); | 1397 AUI_edit_SetAltTextStr(&data->editor_info, 1, TxtNull, TRUE, TxtSoftBack); |
1466 AUI_edit_SetBuffer(&data->editor_info, ATB_DCS_ASCII, (UBYTE *)data->param->number, CB_MID_LENGTH); | 1398 AUI_edit_SetBuffer(&data->editor_info, ATB_DCS_ASCII, (UBYTE *)data->param->number, CB_MID_LENGTH); |
1467 AUI_edit_SetMode(&data->editor_info, 0, ED_CURSOR_BAR); | 1399 AUI_edit_SetMode(&data->editor_info, 0, ED_CURSOR_BAR); |
1468 | 1400 |
1469 data->editor = AUI_edit_Start(data->win,&data->editor_info); /* start the editor */ | 1401 data->editor = AUI_edit_Start(data->win,&data->editor_info); /* start the editor */ |
1470 #else /* NEW_EDITOR */ | 1402 #else /* NEW_EDITOR */ |
1471 editor_attr_init(&data->editor_info.editor_attr, ZONE_SMALL_EDITOR, edtCurBar1, 0, data->param->number, CB_MID_LENGTH, COLOUR_EDITOR ); | 1403 editor_attr_init(&data->editor_info.editor_attr, ZONE_SMALL_EDITOR, edtCurBar1, 0, data->param->number, CB_MID_LENGTH, COLOUR_EDITOR ); |
1472 editor_data_init(&data->editor_info,(T_EDIT_CB)smscb_CB_EDT_MIDEDT_editor_cb,TxtSoftOK,TxtDelete,TxtEnterMid,1 ,DIGITS_MODE, TEN_SECS); | 1404 editor_data_init(&data->editor_info,(T_EDIT_CB)smscb_CB_EDT_MIDEDT_editor_cb,TxtSoftOK,TxtDelete,TxtEnterMid,1 ,DIGITS_MODE, TEN_SECS); |
1473 data->editor_info.destroyEditor = TRUE; | 1405 data->editor_info.destroyEditor = TRUE; |
1474 data->editor_info.Identifier = value; | 1406 data->editor_info.Identifier = value; |
1475 data->editor_info.hide = FALSE; | 1407 data->editor_info.hide = FALSE; |
1476 data->editor_info.TextString = NULL; | 1408 data->editor_info.TextString = NULL; |
1477 | 1409 |
1478 /* create the dialog handler */ | 1410 /* create the dialog handler */ |
1479 data->editor = editor_start(data->win,&data->editor_info); /* start the editor */ | 1411 data->editor = editor_start(data->win,&data->editor_info); /* start the editor */ |
1509 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | 1441 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; |
1510 T_CB_EDT_MIDEDT * data = (T_CB_EDT_MIDEDT *)win_data->user; | 1442 T_CB_EDT_MIDEDT * data = (T_CB_EDT_MIDEDT *)win_data->user; |
1511 T_MFW_HND * l_parent; | 1443 T_MFW_HND * l_parent; |
1512 SHORT l_id; | 1444 SHORT l_id; |
1513 int index; | 1445 int index; |
1514 UBYTE ll; | 1446 UBYTE ll; |
1515 T_SMSCB_TOPIC_TAG ffs_tag;/*SPR1920*/ | 1447 T_SMSCB_TOPIC_TAG ffs_tag;/*SPR1920*/ |
1516 char file_name[20]; | 1448 char file_name[20]; |
1517 int val; | 1449 int val; |
1518 #ifdef DEBUG_SMS_CB | 1450 #ifdef DEBUG_SMS_CB |
1519 UBYTE ii; | 1451 UBYTE ii; |
1520 #endif | 1452 #endif |
1521 | 1453 |
1522 TRACE_FUNCTION ("smscb_CB_EDT_MIDEDT_editor_cb()"); | 1454 TRACE_FUNCTION ("smscb_CB_EDT_MIDEDT_editor_cb()"); |
1523 | 1455 |
1524 l_parent = data->parent; | 1456 l_parent = data->parent; |
1525 l_id = data->id; | 1457 l_id = data->id; |
1526 | 1458 |
1527 switch(event) | 1459 switch(event) |
1528 { | 1460 { |
1529 case INFO_KCD_LEFT: | 1461 case INFO_KCD_LEFT: |
1530 index = data->param->index; | 1462 index = data->param->index; |
1531 | 1463 |
1532 //nm "-1"the zero is counted as well | 1464 //nm "-1"the zero is counted as well |
1533 if (index < MAX_MIDS -1 ) | 1465 if (index < MAX_MIDS -1 ) |
1466 { | |
1467 /* add a new entry */ | |
1468 | |
1469 | |
1470 memcpy (g_smscb_data.CBTopics.entry[index].name, data->param->name, CB_TAG_LENGTH); | |
1471 g_smscb_data.CBTopics.entry[index].msg_id = atoi(data->param->number); | |
1472 /*SPR1959, save name to FFS*/ | |
1473 memcpy(ffs_tag.name, data->param->name, CB_TAG_LENGTH); | |
1534 { | 1474 { |
1535 /* add a new entry */ | 1475 val = ffs_fwrite((const char*)ffs_cb_tag_name(g_smscb_data.CBTopics.entry[index].msg_id, file_name), (void*)&ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); |
1536 | 1476 TRACE_EVENT_P1("CB tag name write status:%d", val); |
1537 | |
1538 memcpy (g_smscb_data.CBTopics.entry[index].name, data->param->name, CB_TAG_LENGTH); | |
1539 g_smscb_data.CBTopics.entry[index].msg_id = atoi(data->param->number); | |
1540 /*SPR1959, save name to FFS*/ | |
1541 memcpy(ffs_tag.name, data->param->name, CB_TAG_LENGTH); | |
1542 { val = ffs_fwrite((const char*)ffs_cb_tag_name(g_smscb_data.CBTopics.entry[index].msg_id, file_name), (void*)&ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); | |
1543 | |
1544 TRACE_EVENT_P1("CB tag name write status:%d", val); | |
1545 } | |
1546 | |
1547 #ifdef DEBUG_SMS_CB | |
1548 /***************************Go-lite Optimization changes Start***********************/ | |
1549 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
1550 TRACE_EVENT_P1 ( "the index is %d", index); | |
1551 /***************************Go-lite Optimization changes end***********************/ | |
1552 #endif | |
1553 | |
1554 /* add a new entry */ | |
1555 index += 1; | |
1556 g_smscb_data.CBTopics.length = index; | |
1557 | |
1558 smscb_setCBsettings(SMSCB_SWITCH_ON); /* save in SIM */ | |
1559 | |
1560 info_screen(win, TxtSaved ,TxtNull, NULL); | |
1561 | |
1562 } | 1477 } |
1563 else | |
1564 { | |
1565 info_screen (win, TxtFull, TxtNull, NULL); | |
1566 } | |
1567 | |
1568 // Apr 29, 2004 REF: CRR 11630 Deepa M.D | |
1569 // Refresh the list,so that if a name exists for a channelId in FFS, it is displayed. | |
1570 for(ll = 0; ll < g_smscb_data.CBTopics.length; ll++) | |
1571 { | |
1572 if (g_smscb_data.CBTopics.entry[ll].msg_id EQ NO_MID) | |
1573 { | |
1574 break; | |
1575 } | |
1576 | |
1577 /* Set default tag string, until we get the saved name from PCM */ | |
1578 g_smscb_data.CBTopics.entry[ll].name[0] = '\0'; | |
1579 /*attempt to read channel name from FFS file*/ | |
1580 val = ffs_fread(ffs_cb_tag_name(g_smscb_data.CBTopics.entry[ll].msg_id, file_name), &ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); | |
1581 /*if reading successful, copy name to data structure*/ | |
1582 | |
1583 if (val == sizeof(ffs_tag)) | |
1584 { | |
1585 memcpy(g_smscb_data.CBTopics.entry[ll].name, ffs_tag.name, CB_TAG_LENGTH); | |
1586 } | |
1587 /* update here g_smscb_data.CBTopics.entry[i].name from PCM */ | |
1588 if (g_smscb_data.CBTopics.entry[ll].name[0] EQ '\0') | |
1589 { | |
1590 /* but if it's empty substitute it by the channel number */ | |
1591 sprintf (g_smscb_data.CBTopics.entry[ll].name,"Ch%d,ID:%d",ll,g_smscb_data.CBTopics.entry[ll].msg_id); | |
1592 } | |
1593 | |
1594 } | |
1595 | |
1596 | 1478 |
1597 #ifdef DEBUG_SMS_CB | 1479 #ifdef DEBUG_SMS_CB |
1598 /***************************Go-lite Optimization changes Start***********************/ | 1480 /***************************Go-lite Optimization changes Start***********************/ |
1599 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | 1481 // Aug 16, 2004 REF: CRR 24323 Deepa M.D |
1600 TRACE_EVENT ("after add a new one !"); | 1482 TRACE_EVENT_P1 ( "the index is %d", index); |
1601 for (ii = 0; ii < MAX_MIDS; ii++) | |
1602 { | |
1603 | |
1604 TRACE_EVENT_P2 (" 04 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); | |
1605 } | |
1606 | |
1607 TRACE_EVENT_P1 ("04 midlist:%d", g_smscb_data.CBTopics.length); | |
1608 | |
1609 /***************************Go-lite Optimization changes end***********************/ | 1483 /***************************Go-lite Optimization changes end***********************/ |
1610 #endif | 1484 #endif |
1611 | 1485 |
1612 | 1486 /* add a new entry */ |
1613 | 1487 index += 1; |
1488 g_smscb_data.CBTopics.length = index; | |
1489 | |
1490 smscb_setCBsettings(SMSCB_SWITCH_ON); /* save in SIM */ | |
1491 | |
1492 info_screen(win, TxtSaved ,TxtNull, NULL); | |
1493 | |
1494 } | |
1495 else | |
1496 { | |
1497 info_screen (win, TxtFull, TxtNull, NULL); | |
1498 } | |
1499 | |
1500 // Apr 29, 2004 REF: CRR 11630 Deepa M.D | |
1501 // Refresh the list,so that if a name exists for a channelId in FFS, it is displayed. | |
1502 for(ll = 0; ll < g_smscb_data.CBTopics.length; ll++) | |
1503 { | |
1504 if (g_smscb_data.CBTopics.entry[ll].msg_id EQ NO_MID) | |
1505 { | |
1506 break; | |
1507 } | |
1508 | |
1509 /* Set default tag string, until we get the saved name from PCM */ | |
1510 g_smscb_data.CBTopics.entry[ll].name[0] = '\0'; | |
1511 /*attempt to read channel name from FFS file*/ | |
1512 val = ffs_fread(ffs_cb_tag_name(g_smscb_data.CBTopics.entry[ll].msg_id, file_name), &ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); | |
1513 /*if reading successful, copy name to data structure*/ | |
1514 | |
1515 if (val == sizeof(ffs_tag)) | |
1516 { | |
1517 memcpy(g_smscb_data.CBTopics.entry[ll].name, ffs_tag.name, CB_TAG_LENGTH); | |
1518 } | |
1519 /* update here g_smscb_data.CBTopics.entry[i].name from PCM */ | |
1520 if (g_smscb_data.CBTopics.entry[ll].name[0] EQ '\0') | |
1521 { | |
1522 /* but if it's empty substitute it by the channel number */ | |
1523 sprintf (g_smscb_data.CBTopics.entry[ll].name,"Ch%d,ID:%d",ll,g_smscb_data.CBTopics.entry[ll].msg_id); | |
1524 } | |
1525 | |
1526 } | |
1527 | |
1528 #ifdef DEBUG_SMS_CB | |
1529 /***************************Go-lite Optimization changes Start***********************/ | |
1530 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
1531 TRACE_EVENT ("after add a new one !"); | |
1532 for (ii = 0; ii < MAX_MIDS; ii++) | |
1533 { | |
1534 TRACE_EVENT_P2 (" 04 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); | |
1535 } | |
1536 | |
1537 TRACE_EVENT_P1 ("04 midlist:%d", g_smscb_data.CBTopics.length); | |
1538 | |
1539 /***************************Go-lite Optimization changes end***********************/ | |
1540 #endif | |
1614 | 1541 |
1615 smscb_CB_EDT_MIDEDT_destroy(data->win); | 1542 smscb_CB_EDT_MIDEDT_destroy(data->win); |
1616 SEND_EVENT (l_parent, E_EXIT, l_id, NULL); | 1543 SEND_EVENT (l_parent, E_EXIT, l_id, NULL); |
1617 break; | 1544 break; |
1618 case INFO_KCD_RIGHT: | 1545 case INFO_KCD_RIGHT: |
1620 smscb_CB_EDT_MIDEDT_destroy(data->win); | 1547 smscb_CB_EDT_MIDEDT_destroy(data->win); |
1621 SEND_EVENT (l_parent, E_RETURN, l_id, NULL); // c007 rsa | 1548 SEND_EVENT (l_parent, E_RETURN, l_id, NULL); // c007 rsa |
1622 break; | 1549 break; |
1623 default: | 1550 default: |
1624 break; | 1551 break; |
1625 } | 1552 } |
1626 return; | 1553 return; |
1627 } | 1554 } |
1628 | 1555 |
1629 /********************************************************************* | 1556 /********************************************************************* |
1630 ********************************************************************** | 1557 ********************************************************************** |
1631 | 1558 |
1632 | 1559 cell broadcast routines IMPLEMENTATION |
1633 cell broadcast routines IMPLEMENTATION | |
1634 | 1560 |
1635 ********************************************************************* | 1561 ********************************************************************* |
1636 **********************************************************************/ | 1562 **********************************************************************/ |
1637 | 1563 |
1638 | 1564 |
1640 | 1566 |
1641 $Function: smscb_InitData | 1567 $Function: smscb_InitData |
1642 | 1568 |
1643 $Description: Initialises CB message storage | 1569 $Description: Initialises CB message storage |
1644 | 1570 |
1645 $Returns: none. | 1571 $Returns: none. |
1646 | 1572 |
1647 $Arguments: | 1573 $Arguments: |
1648 | 1574 |
1649 *******************************************************************************/ | 1575 *******************************************************************************/ |
1650 void smscb_InitData (void) | 1576 void smscb_InitData (void) |
1651 { | 1577 { |
1652 UBYTE i; | 1578 UBYTE i; |
1653 | 1579 |
1654 g_smscb_data.CBTopics.length = 0; | 1580 g_smscb_data.CBTopics.length = 0; |
1655 for (i = 0; i < MAX_MIDS; i++) | 1581 for (i = 0; i < MAX_MIDS; i++) |
1656 { | 1582 { |
1657 g_smscb_data.CBTopics.entry[i].msg_id = NO_MID; /* Set MID list default values. */ | 1583 g_smscb_data.CBTopics.entry[i].msg_id = NO_MID; /* Set MID list default values. */ |
1658 g_smscb_data.CBTopics.entry[i].name[0] = '\0'; | 1584 g_smscb_data.CBTopics.entry[i].name[0] = '\0'; |
1659 g_smscb_data.CBTopics.entry[i].dcs = 0; | 1585 g_smscb_data.CBTopics.entry[i].dcs = 0; |
1660 } | 1586 } |
1661 | |
1662 } | 1587 } |
1663 | 1588 |
1664 /******************************************************************************* | 1589 /******************************************************************************* |
1665 | 1590 |
1666 $Function: smscb_delete_topic | 1591 $Function: smscb_delete_topic |
1667 | |
1668 | |
1669 | 1592 |
1670 $Description: : This function is used to delete an MID from the | 1593 $Description: : This function is used to delete an MID from the |
1671 current list <g_smscb_data.CBTopics>. | 1594 current list <g_smscb_data.CBTopics>. |
1672 | |
1673 | 1595 |
1674 $Returns: | 1596 $Returns: |
1675 | 1597 |
1676 $Arguments: | 1598 $Arguments: |
1677 | 1599 |
1690 | 1612 |
1691 /* Find out how many messages are stored. | 1613 /* Find out how many messages are stored. |
1692 * set MidCount to first entry which contains NO_MID or | 1614 * set MidCount to first entry which contains NO_MID or |
1693 * set MidCount to MAX_MIDS if list is full | 1615 * set MidCount to MAX_MIDS if list is full |
1694 */ | 1616 */ |
1695 // | |
1696 MidCount = g_smscb_data.CBTopics.length + 1; | 1617 MidCount = g_smscb_data.CBTopics.length + 1; |
1697 | 1618 |
1698 /* Move the MID data up one. */ | 1619 /* Move the MID data up one. */ |
1699 while (MidOffset < (MidCount)) //c005 rsa avoid copying from behind the array | 1620 while (MidOffset < (MidCount)) //c005 rsa avoid copying from behind the array |
1700 { | 1621 { |
1701 g_smscb_data.CBTopics.entry[MidOffset] = g_smscb_data.CBTopics.entry[MidOffset + 1]; | 1622 g_smscb_data.CBTopics.entry[MidOffset] = g_smscb_data.CBTopics.entry[MidOffset + 1]; |
1702 MidOffset++; | 1623 MidOffset++; |
1703 } | 1624 } |
1704 //c005 rsa but assign NO_MID behind the last entry | 1625 //c005 rsa but assign NO_MID behind the last entry |
1705 if (MidCount > 0) | 1626 if (MidCount > 0) |
1706 g_smscb_data.CBTopics.entry[MidCount].msg_id = NO_MID; | 1627 g_smscb_data.CBTopics.entry[MidCount].msg_id = NO_MID; |
1707 else | 1628 else |
1708 g_smscb_data.CBTopics.entry[0].msg_id = NO_MID; | 1629 g_smscb_data.CBTopics.entry[0].msg_id = NO_MID; |
1715 to removed structure members with references to data stored for topics list*/ | 1636 to removed structure members with references to data stored for topics list*/ |
1716 i = 0; | 1637 i = 0; |
1717 while ((i < MAX_MIDS) && (g_smscb_data.CBTopics.entry[i].msg_id != Mid)) | 1638 while ((i < MAX_MIDS) && (g_smscb_data.CBTopics.entry[i].msg_id != Mid)) |
1718 i++; | 1639 i++; |
1719 | 1640 |
1641 #ifdef DEBUG_SMS_CB | |
1642 /***************************Go-lite Optimization changes Start***********************/ | |
1643 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
1644 TRACE_EVENT_P1 ("i is %d", i); | |
1645 /***************************Go-lite Optimization changes end***********************/ | |
1646 #endif | |
1647 | |
1648 | |
1649 #ifdef DEBUG_SMS_CB | |
1650 /***************************Go-lite Optimization changes Start***********************/ | |
1651 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
1652 TRACE_EVENT ("after deleting !"); | |
1653 for (ii = 0; ii < MAX_MIDS; ii++) | |
1654 { | |
1655 TRACE_EVENT_P2 (" 03 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); | |
1656 } | |
1657 | |
1658 TRACE_EVENT_P1 ("03 midlist:%d", g_smscb_data.CBTopics.length); | |
1659 /***************************Go-lite Optimization changes end***********************/ | |
1660 #endif | |
1661 | |
1662 return 1; | |
1663 } | |
1664 | |
1665 /******************************************************************************* | |
1666 | |
1667 $Function: ffs_cb_tag_name | |
1668 | |
1669 $Description: generates a filename string for the pathname of an FFS CB Topic tag file | |
1670 i.e./MMI/cbtagXX where XX is the channel number. | |
1671 Added for issue1920 | |
1672 | |
1673 $Returns: filename string | |
1674 | |
1675 $Arguments: channel number, pointer to allocated string | |
1676 | |
1677 *******************************************************************************/ | |
1678 char* ffs_cb_tag_name(int channel_num, char* name) | |
1679 { | |
1680 sprintf(name,"/mmi/cbtag%d",channel_num); | |
1681 return name; | |
1682 } | |
1683 | |
1684 /******************************************************************************* | |
1685 | |
1686 $Function: smscb_getCBsettings | |
1687 | |
1688 $Description: This function allows the MS-User to examine the | |
1689 current list of MIDs being used to filter CB messages. | |
1690 | |
1691 $Returns: | |
1692 | |
1693 $Arguments: | |
1694 | |
1695 *******************************************************************************/ | |
1696 T_MFW smscb_getCBsettings(void) | |
1697 { | |
1698 T_MFW status; | |
1699 UBYTE i,d=0; | |
1700 /*MC SPR 1920, need to allocate this as large data structure*/ | |
1701 T_MFW_SMS_CB_INFO* SmsCbInfo = (T_MFW_SMS_CB_INFO*)ALLOC_MEMORY(sizeof(T_MFW_SMS_CB_INFO)); | |
1702 T_SMSCB_TOPIC_TAG ffs_tag;/*SPR1920*/ | |
1703 char file_name[20];/*SPR1920*/ | |
1704 int val;/*SPR1920*/ | |
1705 | |
1706 #ifdef FF_2TO1_PS | |
1707 return MFW_SMS_FAIL; | |
1708 #endif | |
1709 | |
1710 #ifdef DEBUG_SMS_CB | |
1711 TRACE_EVENT (" get the list from sim"); | |
1712 #endif | |
1713 | |
1714 //clear the Topic list | |
1715 smscb_InitData(); | |
1716 | |
1717 //get the Topic list from the SIM | |
1718 status = sms_get_cell_broadcast_info(SmsCbInfo); | |
1719 | |
1720 //set to default | |
1721 g_smscb_data.CBTopics.length = 0xFF; | |
1722 | |
1723 #ifdef DEBUG_SMS_CB | |
1724 /***************************Go-lite Optimization changes Start***********************/ | |
1725 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
1726 for (i = 0; i <= 19; i++) | |
1727 { | |
1728 TRACE_EVENT_P2("DATA from mfw %d i:%d", SmsCbInfo->msg_id[i],i); | |
1729 } | |
1730 /***************************Go-lite Optimization changes end***********************/ | |
1731 #endif | |
1732 | |
1733 for (i = 0; i < MAX_MIDS; i++) | |
1734 { | |
1735 /* Update MID list from SIM data. */ | |
1736 g_smscb_data.CBTopics.entry[i].msg_id = SmsCbInfo->msg_id[d]; | |
1737 | |
1738 g_smscb_data.CBTopics.entry[i].dcs = SmsCbInfo->dcs[d]; | |
1739 | |
1740 if (g_smscb_data.CBTopics.entry[i].msg_id EQ NO_MID) | |
1741 { | |
1742 break; | |
1743 } | |
1744 else | |
1745 { | |
1746 g_smscb_data.CBTopics.length = i; | |
1747 } | |
1748 | |
1749 /* Set default tag string, until we get the saved name form PCM */ | |
1750 g_smscb_data.CBTopics.entry[i].name[0] = '\0'; | |
1751 /*attempt to read channel name from FFS file*/ | |
1752 val = ffs_fread(ffs_cb_tag_name(g_smscb_data.CBTopics.entry[i].msg_id, file_name), &ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); | |
1753 /*if reading successful, copy name to data structure*/ | |
1754 if (val == sizeof(ffs_tag)) | |
1755 { | |
1756 memcpy(g_smscb_data.CBTopics.entry[i].name, ffs_tag.name, CB_TAG_LENGTH); | |
1757 } | |
1758 /*SPR1920, end*/ | |
1759 /* ??? update here g_smscb_data.CBTopics.entry[i].name from PCM */ | |
1760 if (g_smscb_data.CBTopics.entry[i].name[0] EQ '\0') | |
1761 { | |
1762 /* but if it's empty substitute it by the channel number */ | |
1763 sprintf (g_smscb_data.CBTopics.entry[i].name,"Ch%d,ID:%d",i,g_smscb_data.CBTopics.entry[i].msg_id); | |
1764 } | |
1765 //x0pleela 16 Feb, 2007 DR: OMAPS00116175 | |
1766 //Changed the incremental value from 2 to 1 as the successive CB parameters ( message id) was getting skipped while reading back | |
1767 //from cell broadcast parameters | |
1768 d++; | |
1720 | 1769 |
1721 #ifdef DEBUG_SMS_CB | 1770 #ifdef DEBUG_SMS_CB |
1722 /***************************Go-lite Optimization changes Start***********************/ | 1771 /***************************Go-lite Optimization changes Start***********************/ |
1723 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | 1772 // Aug 16, 2004 REF: CRR 24323 Deepa M.D |
1724 TRACE_EVENT_P1 ("i is %d", i); | 1773 TRACE_EVENT_P2 ( "02 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[i].msg_id,i); |
1725 /***************************Go-lite Optimization changes end***********************/ | 1774 /***************************Go-lite Optimization changes end***********************/ |
1726 #endif | 1775 #endif |
1727 | 1776 |
1728 | 1777 } |
1729 #ifdef DEBUG_SMS_CB | 1778 |
1730 /***************************Go-lite Optimization changes Start***********************/ | 1779 if (g_smscb_data.CBTopics.length EQ 0xFF) |
1731 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | 1780 { |
1732 TRACE_EVENT ("after deleting !"); | 1781 //list is empty |
1733 for (ii = 0; ii < MAX_MIDS; ii++) | 1782 g_smscb_data.CBTopics.length = 0; |
1734 { | 1783 } |
1735 | 1784 else |
1736 TRACE_EVENT_P2 (" 03 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); | 1785 { |
1737 } | 1786 //+1 because the "0" was counted as well |
1738 | 1787 g_smscb_data.CBTopics.length +=1; |
1739 TRACE_EVENT_P1 ("03 midlist:%d", g_smscb_data.CBTopics.length); | 1788 } |
1740 /***************************Go-lite Optimization changes end***********************/ | 1789 |
1741 #endif | 1790 /*SPR 1920, end of function, deallocate memory*/ |
1742 | 1791 FREE_MEMORY((void*)SmsCbInfo,sizeof(T_MFW_SMS_CB_INFO)); |
1743 | |
1744 | |
1745 return 1; | |
1746 } | |
1747 | |
1748 /******************************************************************************* | |
1749 | |
1750 $Function: ffs_cb_tag_name | |
1751 | |
1752 $Description: generates a filename string for the pathname of an FFS CB Topic tag file | |
1753 i.e./MMI/cbtagXX where XX is the channel number. | |
1754 Added for issue1920 | |
1755 | |
1756 $Returns: filename string | |
1757 | |
1758 $Arguments: channel number, pointer to allocated string | |
1759 | |
1760 *******************************************************************************/ | |
1761 char* ffs_cb_tag_name(int channel_num, char* name) | |
1762 { | |
1763 sprintf(name,"/mmi/cbtag%d",channel_num); | |
1764 return name; | |
1765 } | |
1766 | |
1767 /******************************************************************************* | |
1768 | |
1769 $Function: smscb_getCBsettings | |
1770 | |
1771 $Description: This function allows the MS-User to examine the | |
1772 current list of MIDs being used to filter CB messages. | |
1773 | |
1774 | |
1775 $Returns: | |
1776 | |
1777 $Arguments: | |
1778 | |
1779 *******************************************************************************/ | |
1780 T_MFW smscb_getCBsettings(void) | |
1781 { | |
1782 T_MFW status; | |
1783 UBYTE i,d=0; | |
1784 /*MC SPR 1920, need to allocate this as large data structure*/ | |
1785 T_MFW_SMS_CB_INFO* SmsCbInfo = (T_MFW_SMS_CB_INFO*)ALLOC_MEMORY(sizeof(T_MFW_SMS_CB_INFO)); | |
1786 T_SMSCB_TOPIC_TAG ffs_tag;/*SPR1920*/ | |
1787 char file_name[20];/*SPR1920*/ | |
1788 int val;/*SPR1920*/ | |
1789 | |
1790 #ifdef FF_2TO1_PS | |
1791 return MFW_SMS_FAIL; | |
1792 #endif | |
1793 | |
1794 #ifdef DEBUG_SMS_CB | |
1795 TRACE_EVENT (" get the list from sim"); | |
1796 #endif | |
1797 | |
1798 //clear the Topic list | |
1799 smscb_InitData(); | |
1800 | |
1801 //get the Topic list from the SIM | |
1802 status = sms_get_cell_broadcast_info(SmsCbInfo); | |
1803 | |
1804 //set to default | |
1805 g_smscb_data.CBTopics.length = 0xFF; | |
1806 | |
1807 | |
1808 #ifdef DEBUG_SMS_CB | |
1809 /***************************Go-lite Optimization changes Start***********************/ | |
1810 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
1811 for (i = 0; i <= 19; i++) | |
1812 { | |
1813 TRACE_EVENT_P2("DATA from mfw %d i:%d", SmsCbInfo->msg_id[i],i); | |
1814 } | |
1815 /***************************Go-lite Optimization changes end***********************/ | |
1816 #endif | |
1817 | |
1818 | |
1819 for (i = 0; i < MAX_MIDS; i++) | |
1820 { | |
1821 /* Update MID list from SIM data. */ | |
1822 g_smscb_data.CBTopics.entry[i].msg_id = SmsCbInfo->msg_id[d]; | |
1823 | |
1824 g_smscb_data.CBTopics.entry[i].dcs = SmsCbInfo->dcs[d]; | |
1825 | |
1826 if (g_smscb_data.CBTopics.entry[i].msg_id EQ NO_MID) | |
1827 { | |
1828 break; | |
1829 } | |
1830 else | |
1831 { | |
1832 g_smscb_data.CBTopics.length = i; | |
1833 } | |
1834 | |
1835 /* Set default tag string, until we get the saved name form PCM */ | |
1836 g_smscb_data.CBTopics.entry[i].name[0] = '\0'; | |
1837 /*SPR1920*/ | |
1838 /*attempt to read channel name from FFS file*/ | |
1839 val = ffs_fread(ffs_cb_tag_name(g_smscb_data.CBTopics.entry[i].msg_id, file_name), &ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); | |
1840 /*if reading successful, copy name to data structure*/ | |
1841 if (val == sizeof(ffs_tag)) | |
1842 { | |
1843 memcpy(g_smscb_data.CBTopics.entry[i].name, ffs_tag.name, CB_TAG_LENGTH); | |
1844 } | |
1845 /*SPR1920, end*/ | |
1846 /* ??? update here g_smscb_data.CBTopics.entry[i].name from PCM */ | |
1847 if (g_smscb_data.CBTopics.entry[i].name[0] EQ '\0') | |
1848 { | |
1849 /* but if it's empty substitute it by the channel number */ | |
1850 sprintf (g_smscb_data.CBTopics.entry[i].name,"Ch%d,ID:%d",i,g_smscb_data.CBTopics.entry[i].msg_id); | |
1851 } | |
1852 //x0pleela 16 Feb, 2007 DR: OMAPS00116175 | |
1853 //Changed the incremental value from 2 to 1 as the successive CB parameters ( message id) was getting skipped while reading back | |
1854 //from cell broadcast parameters | |
1855 d++; | |
1856 | |
1857 #ifdef DEBUG_SMS_CB | |
1858 /***************************Go-lite Optimization changes Start***********************/ | |
1859 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
1860 TRACE_EVENT_P2 ( "02 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[i].msg_id,i); | |
1861 /***************************Go-lite Optimization changes end***********************/ | |
1862 #endif | |
1863 | |
1864 } | |
1865 | |
1866 | |
1867 if (g_smscb_data.CBTopics.length EQ 0xFF) | |
1868 { | |
1869 //list is empty | |
1870 g_smscb_data.CBTopics.length = 0; | |
1871 } | |
1872 else | |
1873 { | |
1874 //+1 because the "0" was counted as well | |
1875 g_smscb_data.CBTopics.length +=1; | |
1876 } | |
1877 | |
1878 | |
1879 | |
1880 /*SPR 1920, end of function, deallocate memory*/ | |
1881 FREE_MEMORY((void*)SmsCbInfo,sizeof(T_MFW_SMS_CB_INFO)); | |
1882 return status; | 1792 return status; |
1883 } | 1793 } |
1884 | 1794 |
1885 /******************************************************************************* | 1795 /******************************************************************************* |
1886 | 1796 |
1923 #endif | 1833 #endif |
1924 #endif | 1834 #endif |
1925 | 1835 |
1926 /* SH - moved up here otherwise does not execute*/ | 1836 /* SH - moved up here otherwise does not execute*/ |
1927 //nm | 1837 //nm |
1928 if (State EQ SMSCB_SWITCH_ON ) | 1838 if (State EQ SMSCB_SWITCH_ON ) |
1929 sms_set_mt_ind(MT_CB_MSG); | 1839 sms_set_mt_ind(MT_CB_MSG); |
1930 else | 1840 else |
1931 sms_set_mt_ind(MT_CB_NO_IDX); | 1841 sms_set_mt_ind(MT_CB_NO_IDX); |
1932 | |
1933 | 1842 |
1934 /* copy local list to SIM */ | 1843 /* copy local list to SIM */ |
1935 SmsCbInfo->mode = State; | 1844 SmsCbInfo->mode = State; |
1936 | 1845 |
1937 | 1846 for (i = 0; i < MAX_MIDS; i++) |
1938 for (i = 0; i < MAX_MIDS; i++) | 1847 { |
1939 { | 1848 SmsCbInfo->msg_id[i] = NO_MID; /* Set MID list default values. */ |
1940 SmsCbInfo->msg_id[i] = NO_MID; /* Set MID list default values. */ | 1849 SmsCbInfo->dcs[i] = 0xFF; |
1941 SmsCbInfo->dcs[i] = 0xFF; | 1850 } |
1942 } | |
1943 | 1851 |
1944 // Dec 22, 2004 REF: CRR MFW-SPR-27847 xnkulkar | 1852 // Dec 22, 2004 REF: CRR MFW-SPR-27847 xnkulkar |
1945 // Description: MFW memory size variable changed from U16 -> U32 | 1853 // Description: MFW memory size variable changed from U16 -> U32 |
1946 // Solution: 'd' is checked against 'MAX_IDENTS' to restrict increment beyond limit | 1854 // Solution: 'd' is checked against 'MAX_IDENTS' to restrict increment beyond limit |
1947 for (i = 0; (i < g_smscb_data.CBTopics.length) && (d < MAX_IDENTS); i++) | 1855 for (i = 0; (i < g_smscb_data.CBTopics.length) && (d < MAX_IDENTS); i++) |
1948 { | 1856 { |
1949 | 1857 |
1950 SmsCbInfo->msg_id[d] = g_smscb_data.CBTopics.entry[i].msg_id; | 1858 SmsCbInfo->msg_id[d] = g_smscb_data.CBTopics.entry[i].msg_id; |
1951 /* ??? update here PCM with g_smscb_data.CBTopics.entry[i].name */ | 1859 /* ??? update here PCM with g_smscb_data.CBTopics.entry[i].name */ |
1952 SmsCbInfo->dcs[d] = (char)g_smscb_data.CBTopics.entry[i].dcs; | 1860 SmsCbInfo->dcs[d] = (char)g_smscb_data.CBTopics.entry[i].dcs; |
1953 | 1861 d++; |
1954 d++; | |
1955 | 1862 |
1956 // Dec 22, 2004 REF: CRR MFW-SPR-27847 xnkulkar | 1863 // Dec 22, 2004 REF: CRR MFW-SPR-27847 xnkulkar |
1957 // Description: MFW memory size variable changed from U16 -> U32 | 1864 // Description: MFW memory size variable changed from U16 -> U32 |
1958 // Solution: Duplication removed | 1865 // Solution: Duplication removed |
1959 | 1866 |
1961 // /* ??? update here PCM with g_smscb_data.CBTopics.entry[i].name */ | 1868 // /* ??? update here PCM with g_smscb_data.CBTopics.entry[i].name */ |
1962 // SmsCbInfo->dcs[d] = (char)g_smscb_data.CBTopics.entry[i].dcs; | 1869 // SmsCbInfo->dcs[d] = (char)g_smscb_data.CBTopics.entry[i].dcs; |
1963 | 1870 |
1964 // d++; | 1871 // d++; |
1965 | 1872 |
1966 | 1873 } |
1967 } | |
1968 | |
1969 | 1874 |
1970 #ifdef DEBUG_SMS_CB | 1875 #ifdef DEBUG_SMS_CB |
1971 /***************************Go-lite Optimization changes Start***********************/ | 1876 /***************************Go-lite Optimization changes Start***********************/ |
1972 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | 1877 // Aug 16, 2004 REF: CRR 24323 Deepa M.D |
1973 for (i = 0; i <= 25; i++) | 1878 for (i = 0; i <= 25; i++) |
1974 { | 1879 { |
1975 TRACE_EVENT_P2 ("SAVING..SmsCbInfo.msg_id[i] %d i:%d", SmsCbInfo->msg_id[i],i); | 1880 TRACE_EVENT_P2 ("SAVING..SmsCbInfo.msg_id[i] %d i:%d", SmsCbInfo->msg_id[i],i); |
1976 } | 1881 } |
1977 /***************************Go-lite Optimization changes end***********************/ | 1882 /***************************Go-lite Optimization changes end***********************/ |
1978 #endif | 1883 #endif |
1979 | 1884 |
1980 Status = sms_set_cell_broadcast_info(State, SmsCbInfo); | 1885 Status = sms_set_cell_broadcast_info(State, SmsCbInfo); |
1981 | 1886 |
1982 #ifdef DEBUG_SMS_CB | 1887 #ifdef DEBUG_SMS_CB |
1983 /***************************Go-lite Optimization changes Start***********************/ | 1888 /***************************Go-lite Optimization changes Start***********************/ |
1984 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | 1889 // Aug 16, 2004 REF: CRR 24323 Deepa M.D |
1985 TRACE_EVENT_P1 ("SAVING.Status is %d", Status); | 1890 TRACE_EVENT_P1 ("SAVING.Status is %d", Status); |
1986 /***************************Go-lite Optimization changes end***********************/ | 1891 /***************************Go-lite Optimization changes end***********************/ |
1987 #endif | 1892 #endif |
1988 /*SPR 1920, end of function, deallocate memory*/ | 1893 |
1989 FREE_MEMORY((void*)SmsCbInfo,sizeof(T_MFW_SMS_CB_INFO)); | 1894 /*SPR 1920, end of function, deallocate memory*/ |
1895 FREE_MEMORY((void*)SmsCbInfo,sizeof(T_MFW_SMS_CB_INFO)); | |
1990 return Status; | 1896 return Status; |
1991 } | 1897 } |
1992 | 1898 |
1993 | 1899 |
1994 /******************************************************************************* | 1900 /******************************************************************************* |
1995 | 1901 |
1996 $Function: smscb_get_new_cb_messages_count | 1902 $Function: smscb_get_new_cb_messages_count |
1997 | 1903 |
1998 $Description: Calls from the MainMenu | 1904 $Description: Calls from the MainMenu |
1999 | 1905 |
2000 $Returns: none. | 1906 $Returns: none. |
2001 | 1907 |
2002 $Arguments: | 1908 $Arguments: |
2003 | 1909 |
2004 *******************************************************************************/ | 1910 *******************************************************************************/ |
2005 SHORT smscb_get_new_cb_messages_count(void) | 1911 SHORT smscb_get_new_cb_messages_count(void) |
2008 int count; | 1914 int count; |
2009 | 1915 |
2010 count = 0; | 1916 count = 0; |
2011 /*SPR 1920, use cb_attributes list as smsCBList removed*/ | 1917 /*SPR 1920, use cb_attributes list as smsCBList removed*/ |
2012 for (j=0; j<MAX_MIDS; j++) | 1918 for (j=0; j<MAX_MIDS; j++) |
2013 { | 1919 { |
2014 if (smscb_data.cb_attributes[j].status== UNREAD_MESSAGE) | 1920 if (smscb_data.cb_attributes[j].status== UNREAD_MESSAGE) |
2015 { | 1921 { |
2016 count++; /* found an unread message */ | 1922 count++; /* found an unread message */ |
2017 } | 1923 } |
2018 } | 1924 } |
2019 return count; | 1925 return count; |
2020 } | 1926 } |
2021 | 1927 |
2022 /******************************************************************************* | 1928 /******************************************************************************* |
2023 | 1929 |
2050 | 1956 |
2051 if (ss_check_ss_string((UBYTE *)Buffer) != MFW_SS_DIAL) | 1957 if (ss_check_ss_string((UBYTE *)Buffer) != MFW_SS_DIAL) |
2052 Buffer[0] = '\0'; | 1958 Buffer[0] = '\0'; |
2053 } | 1959 } |
2054 } | 1960 } |
1961 | |
2055 #ifdef DEBUG_SMS_CB | 1962 #ifdef DEBUG_SMS_CB |
2056 void handle_dummy_message(T_MFW_SMS_CB* Message) | 1963 void handle_dummy_message(T_MFW_SMS_CB* Message) |
2057 { | 1964 { |
2058 USHORT i; | 1965 USHORT i; |
2059 SHORT geograhical_scope = (SHORT)0xC000; | 1966 SHORT geograhical_scope = (SHORT)0xC000; |
2060 char temp_buffer[MAX_CBMSG_LEN]; | 1967 char temp_buffer[MAX_CBMSG_LEN]; |
2061 | 1968 |
2062 TRACE_EVENT ("E_SMS_CB"); | 1969 TRACE_EVENT ("E_SMS_CB"); |
2063 | 1970 |
2064 memset(temp_buffer, '\0', MAX_CBMSG_LEN); | 1971 memset(temp_buffer, '\0', MAX_CBMSG_LEN); |
2065 | 1972 |
2066 //check: does the incoming CB indicates a immediate scope | 1973 //check: does the incoming CB indicates a immediate scope |
2067 if (! (Message->sn & geograhical_scope) ) | 1974 if (! (Message->sn & geograhical_scope) ) |
2068 { | 1975 { |
2069 //Immediate scope | 1976 //Immediate scope |
2070 // API - 859 - German characters were not visable in the CB message | 1977 // API - 859 - German characters were not visable in the CB message |
2071 TRACE_EVENT("Immediate Scope"); | 1978 TRACE_EVENT("Immediate Scope"); |
2072 | 1979 |
2073 | 1980 for (i=0; i <= Message->msg_len; i++) |
2074 | 1981 { |
2075 for(i=0;i <= Message->msg_len;i++) | 1982 //check now for the termination "0x00D" |
2076 { | 1983 //the message is NOT terminated with '\0' |
2077 //check now for the termination "0x00D" | 1984 if (Message->cb_msg[i] EQ 0x0d) |
2078 //the message is NOT terminated with '\0' | 1985 { |
2079 if (Message->cb_msg[i] EQ 0x0d) | 1986 Message->cb_msg[i]='\0'; |
2080 { | 1987 } |
2081 Message->cb_msg[i]='\0'; | 1988 } |
2082 } | 1989 // API - 859 - Convert the the incoming GSM Text to ASCII |
2083 } | 1990 ATB_convert_String(Message->cb_msg, MFW_DCS_8bits, Message->msg_len, |
2084 // API - 859 - Convert the the incoming GSM Text to ASCII | 1991 temp_buffer, MFW_ASCII, MAX_CBMSG_LEN, FALSE); |
2085 ATB_convert_String(Message->cb_msg, MFW_DCS_8bits, Message->msg_len, | |
2086 temp_buffer, MFW_ASCII, MAX_CBMSG_LEN, FALSE); | |
2087 #ifdef MMI_HOMEZONE_ENABLED // SH 11/12/01 | 1992 #ifdef MMI_HOMEZONE_ENABLED // SH 11/12/01 |
2088 /* SPR759 - SH - Homezone: check to see if CB gives us the coordinates of the centre of the current cell */ | 1993 /* SPR759 - SH - Homezone: check to see if CB gives us the coordinates of the centre of the current cell */ |
2089 | 1994 |
2090 if (Message->msg_id==HZ_IDENTIFIER) | 1995 if (Message->msg_id==HZ_IDENTIFIER) |
2091 { | 1996 { |
2092 homezoneCBData(Message->cb_msg); | 1997 homezoneCBData(Message->cb_msg); |
2093 } | 1998 } |
2094 else | 1999 else |
2095 { | 2000 { |
2096 #endif // HOMEZONE | 2001 #endif // HOMEZONE |
2097 | |
2098 //display now on the idle screen | 2002 //display now on the idle screen |
2099 | 2003 |
2100 addCBCH(temp_buffer, IdleNewCBImmediateMessage); | 2004 addCBCH(temp_buffer, IdleNewCBImmediateMessage); |
2101 statusCBCH(TRUE); | 2005 statusCBCH(TRUE); |
2102 #ifdef MMI_HOMEZONE_ENABLED | 2006 #ifdef MMI_HOMEZONE_ENABLED |
2103 } /* SPR759 - SH */ | 2007 } /* SPR759 - SH */ |
2104 #endif | 2008 #endif |
2009 } | |
2010 else //Normal scope | |
2011 { | |
2012 TRACE_EVENT("Normal Scope"); | |
2013 //only for single- and the last page of mulitpages | |
2014 //other pages have not the termination "0x00D" | |
2015 | |
2016 // API - 859 - Convert the the incoming GSM Text to ASCII | |
2017 | |
2018 { | |
2019 Message->cb_msg[MAX_CBMSG_LEN-1]='\0'; | |
2105 } | 2020 } |
2106 | 2021 ATB_convert_String(Message->cb_msg, MFW_DCS_8bits, Message->msg_len, |
2107 else //Normal scope | 2022 temp_buffer, MFW_ASCII, /*MAX_MSG_LEN*/MAX_CBMSG_LEN, FALSE); |
2108 | 2023 memcpy(Message->cb_msg, temp_buffer, MAX_CBMSG_LEN); |
2109 { | 2024 //indicate on the idle screen the new incoming cb |
2110 TRACE_EVENT("Normal Scope"); | 2025 addCBCH( NULL, IdleNewCBNormalMessage ); |
2111 //only for single- and the last page of mulitpages | 2026 statusCBCH(TRUE); |
2112 //other pages have not the termination "0x00D" | 2027 //save the incoming cb messages in the fifo |
2113 | 2028 sms_new_incoming_cb (Message); |
2114 // API - 859 - Convert the the incoming GSM Text to ASCII | 2029 } |
2115 | 2030 } |
2116 { | 2031 |
2117 Message->cb_msg[MAX_CBMSG_LEN-1]='\0'; | |
2118 } | |
2119 ATB_convert_String(Message->cb_msg, MFW_DCS_8bits, Message->msg_len, | |
2120 temp_buffer, MFW_ASCII, /*MAX_MSG_LEN*/MAX_CBMSG_LEN, FALSE); | |
2121 memcpy(Message->cb_msg, temp_buffer, MAX_CBMSG_LEN); | |
2122 //indicate on the idle screen the new incoming cb | |
2123 addCBCH( NULL, IdleNewCBNormalMessage ); | |
2124 statusCBCH(TRUE); | |
2125 //save the incoming cb messages in the fifo | |
2126 sms_new_incoming_cb (Message); | |
2127 | |
2128 } | |
2129 | |
2130 } | |
2131 /******************************************************************************* | 2032 /******************************************************************************* |
2132 | 2033 |
2133 $Function: test_function_to_send_cb | 2034 $Function: test_function_to_send_cb |
2134 | 2035 |
2135 $Description: This function is only for simulation of incoming cb messages | 2036 $Description: This function is only for simulation of incoming cb messages |
2136 | 2037 |
2137 $Returns: | 2038 $Returns: |
2138 $Arguments: | 2039 $Arguments: |
2139 | 2040 |
2140 *******************************************************************************/ | 2041 *******************************************************************************/ |
2141 | |
2142 | 2042 |
2143 void test_function_to_send_cb (void) | 2043 void test_function_to_send_cb (void) |
2144 { | 2044 { |
2145 T_MFW_SMS_CB Message; | 2045 T_MFW_SMS_CB Message; |
2146 UBYTE i; | 2046 UBYTE i; |
2147 | |
2148 | 2047 |
2149 DEBUG = FALSE; | 2048 DEBUG = FALSE; |
2150 | 2049 |
2151 // for testing only | 2050 // for testing only |
2152 //#if 0 | 2051 //#if 0 |
2158 strcpy (Message.cb_msg, "60 Toronto Blue Jays to a 4-0 victory Tuesday "); | 2057 strcpy (Message.cb_msg, "60 Toronto Blue Jays to a 4-0 victory Tuesday "); |
2159 Message.msg_len= strlen(Message.cb_msg); | 2058 Message.msg_len= strlen(Message.cb_msg); |
2160 handle_dummy_message (&Message); | 2059 handle_dummy_message (&Message); |
2161 | 2060 |
2162 | 2061 |
2163 | |
2164 Message.sn = 61; | 2062 Message.sn = 61; |
2165 Message.msg_id = 61; | 2063 Message.msg_id = 61; |
2166 Message.page = 1; | 2064 Message.page = 1; |
2167 Message.pages = 1; | 2065 Message.pages = 1; |
2168 strcpy (Message.cb_msg, "61 Toronto Blue Jays to a 4-0 victory Tuesday"); | 2066 strcpy (Message.cb_msg, "61 Toronto Blue Jays to a 4-0 victory Tuesday"); |
2169 Message.msg_len= strlen(Message.cb_msg); | 2067 Message.msg_len= strlen(Message.cb_msg); |
2170 handle_dummy_message (&Message); | 2068 handle_dummy_message (&Message); |
2171 | 2069 |
2172 | 2070 |
2173 | |
2174 Message.sn = 62; | 2071 Message.sn = 62; |
2175 Message.msg_id = 61; | 2072 Message.msg_id = 61; |
2176 Message.page = 1; | 2073 Message.page = 1; |
2177 Message.pages = 1; | 2074 Message.pages = 1; |
2178 strcpy (Message.cb_msg, "61/2 Toronto Blue Jays to a 4-0 victory Tuesday"); | 2075 strcpy (Message.cb_msg, "61/2 Toronto Blue Jays to a 4-0 victory Tuesday"); |
2187 Message.msg_len= strlen(Message.cb_msg); | 2084 Message.msg_len= strlen(Message.cb_msg); |
2188 Message.dcs = MFW_DCS_8bits; | 2085 Message.dcs = MFW_DCS_8bits; |
2189 handle_dummy_message (&Message); | 2086 handle_dummy_message (&Message); |
2190 | 2087 |
2191 | 2088 |
2192 | |
2193 Message.sn = /*56*/0xC038; | 2089 Message.sn = /*56*/0xC038; |
2194 Message.msg_id = 55; | 2090 Message.msg_id = 55; |
2195 Message.page = 1; | 2091 Message.page = 1; |
2196 Message.pages = 2; | 2092 Message.pages = 2; |
2197 strcpy (Message.cb_msg, "55/2 1/2 Toronto Blue Jays to a 4-0 victory Tuesday Multipage"); | 2093 strcpy (Message.cb_msg, "55/2 1/2 Toronto Blue Jays to a 4-0 victory Tuesday Multipage"); |
2198 Message.msg_len= strlen(Message.cb_msg); | 2094 Message.msg_len= strlen(Message.cb_msg); |
2199 handle_dummy_message (&Message); | 2095 handle_dummy_message (&Message); |
2200 | 2096 |
2201 | 2097 |
2202 | |
2203 Message.sn = /*56*/0xC038; | 2098 Message.sn = /*56*/0xC038; |
2204 Message.msg_id = 56; | 2099 Message.msg_id = 56; |
2205 Message.page = 2; | 2100 Message.page = 2; |
2206 Message.pages = 2; | 2101 Message.pages = 2; |
2207 strcpy (Message.cb_msg, "56 2/2 Toronto Blue Jays to a 4-0 victory Tuesday Multipage"); | 2102 strcpy (Message.cb_msg, "56 2/2 Toronto Blue Jays to a 4-0 victory Tuesday Multipage"); |
2241 strcpy (Message.cb_msg, "58 1/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage***"); | 2136 strcpy (Message.cb_msg, "58 1/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage***"); |
2242 Message.msg_len= strlen(Message.cb_msg); | 2137 Message.msg_len= strlen(Message.cb_msg); |
2243 handle_dummy_message (&Message); | 2138 handle_dummy_message (&Message); |
2244 | 2139 |
2245 | 2140 |
2246 | |
2247 Message.sn = 16384; | 2141 Message.sn = 16384; |
2248 Message.msg_id = 59; | 2142 Message.msg_id = 59; |
2249 Message.page = 2; | 2143 Message.page = 2; |
2250 Message.pages = 15; | 2144 Message.pages = 15; |
2251 strcpy (Message.cb_msg, "59 2/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); | 2145 strcpy (Message.cb_msg, "59 2/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); |
2266 strcpy (Message.cb_msg, "59 4/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage***"); | 2160 strcpy (Message.cb_msg, "59 4/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage***"); |
2267 Message.msg_len= strlen(Message.cb_msg); | 2161 Message.msg_len= strlen(Message.cb_msg); |
2268 handle_dummy_message (&Message); | 2162 handle_dummy_message (&Message); |
2269 | 2163 |
2270 | 2164 |
2271 | |
2272 Message.sn = 16384; | 2165 Message.sn = 16384; |
2273 Message.msg_id = 59; | 2166 Message.msg_id = 59; |
2274 Message.page = 5; | 2167 Message.page = 5; |
2275 Message.pages = 15; | 2168 Message.pages = 15; |
2276 strcpy (Message.cb_msg, "59 5/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); | 2169 strcpy (Message.cb_msg, "59 5/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); |
2291 strcpy (Message.cb_msg, "59 7/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage***"); | 2184 strcpy (Message.cb_msg, "59 7/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage***"); |
2292 Message.msg_len= strlen(Message.cb_msg); | 2185 Message.msg_len= strlen(Message.cb_msg); |
2293 handle_dummy_message (&Message); | 2186 handle_dummy_message (&Message); |
2294 | 2187 |
2295 | 2188 |
2296 | |
2297 Message.sn = 16384; | 2189 Message.sn = 16384; |
2298 Message.msg_id = 59; | 2190 Message.msg_id = 59; |
2299 Message.page = 8; | 2191 Message.page = 8; |
2300 Message.pages = 15; | 2192 Message.pages = 15; |
2301 strcpy (Message.cb_msg, "59 8/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); | 2193 strcpy (Message.cb_msg, "59 8/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); |
2316 strcpy (Message.cb_msg, "59 10/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); | 2208 strcpy (Message.cb_msg, "59 10/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); |
2317 Message.msg_len= strlen(Message.cb_msg); | 2209 Message.msg_len= strlen(Message.cb_msg); |
2318 handle_dummy_message (&Message); | 2210 handle_dummy_message (&Message); |
2319 | 2211 |
2320 | 2212 |
2321 | |
2322 Message.sn = 16384; | 2213 Message.sn = 16384; |
2323 Message.msg_id = 59; | 2214 Message.msg_id = 59; |
2324 Message.page = 11; | 2215 Message.page = 11; |
2325 Message.pages = 15; | 2216 Message.pages = 15; |
2326 strcpy (Message.cb_msg, "59 11/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); | 2217 strcpy (Message.cb_msg, "59 11/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); |
2341 strcpy (Message.cb_msg, "59 13/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); | 2232 strcpy (Message.cb_msg, "59 13/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage ***"); |
2342 Message.msg_len= strlen(Message.cb_msg); | 2233 Message.msg_len= strlen(Message.cb_msg); |
2343 handle_dummy_message (&Message); | 2234 handle_dummy_message (&Message); |
2344 | 2235 |
2345 | 2236 |
2346 | |
2347 Message.sn = 16384; | 2237 Message.sn = 16384; |
2348 Message.msg_id = 59; | 2238 Message.msg_id = 59; |
2349 Message.page = 14; | 2239 Message.page = 14; |
2350 Message.pages = 15; | 2240 Message.pages = 15; |
2351 strcpy (Message.cb_msg, "59 14/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage***"); | 2241 strcpy (Message.cb_msg, "59 14/15 Toronto Blue Jays to a 4-0 victory Tuesday Multipage***"); |
2360 Message.msg_len= strlen(Message.cb_msg); | 2250 Message.msg_len= strlen(Message.cb_msg); |
2361 handle_dummy_message (&Message); | 2251 handle_dummy_message (&Message); |
2362 //#endif | 2252 //#endif |
2363 | 2253 |
2364 #if 0 | 2254 #if 0 |
2365 | |
2366 | |
2367 | |
2368 | 2255 |
2369 Message.sn = 63; | 2256 Message.sn = 63; |
2370 Message.msg_id = 63; | 2257 Message.msg_id = 63; |
2371 Message.page = 1; | 2258 Message.page = 1; |
2372 Message.pages = 1; | 2259 Message.pages = 1; |
2574 $Arguments: | 2461 $Arguments: |
2575 | 2462 |
2576 *******************************************************************************/ | 2463 *******************************************************************************/ |
2577 void sms_cb_init (void) | 2464 void sms_cb_init (void) |
2578 { | 2465 { |
2579 | |
2580 //for tracing | 2466 //for tracing |
2581 #ifdef DEBUG_SMS_CB | 2467 #ifdef DEBUG_SMS_CB |
2582 char buf [100]; | 2468 char buf [100]; |
2583 #endif | 2469 #endif |
2584 | 2470 |
2585 | |
2586 UBYTE i; | 2471 UBYTE i; |
2587 | |
2588 | 2472 |
2589 //set to the default, "FF" -> no CB messages stored | 2473 //set to the default, "FF" -> no CB messages stored |
2590 smscb_data.used_pointer = 0xFF; | 2474 smscb_data.used_pointer = 0xFF; |
2591 | 2475 |
2592 //set to the default, "0" -> free spaces on the first index in fifo | 2476 //set to the default, "0" -> free spaces on the first index in fifo |
2593 smscb_data.free_pointer = 0; | 2477 smscb_data.free_pointer = 0; |
2594 | 2478 |
2595 | |
2596 //set the fifo to the default | 2479 //set the fifo to the default |
2597 for (i=0; i<MAX_STORED_PAGES -1 ; i++) | 2480 for (i=0; i<MAX_STORED_PAGES -1 ; i++) |
2598 { | 2481 { |
2599 smscb_data.cb_attributes[i].next_link = i + 1; | 2482 smscb_data.cb_attributes[i].next_link = i + 1; |
2600 } | 2483 } |
2602 for (i=0; i<MAX_STORED_PAGES ; i++) | 2485 for (i=0; i<MAX_STORED_PAGES ; i++) |
2603 { | 2486 { |
2604 smscb_data.cb_attributes[i].start_page = 0; | 2487 smscb_data.cb_attributes[i].start_page = 0; |
2605 smscb_data.cb_attributes[i].header = NULL;/* SPR 1920,ensure unalloacted pointers set to NULL*/ | 2488 smscb_data.cb_attributes[i].header = NULL;/* SPR 1920,ensure unalloacted pointers set to NULL*/ |
2606 } | 2489 } |
2607 | |
2608 | |
2609 | 2490 |
2610 //"FF" on the last entry means end of the free spaces list | 2491 //"FF" on the last entry means end of the free spaces list |
2611 smscb_data.cb_attributes[MAX_STORED_PAGES-1].next_link = 0xFF; | 2492 smscb_data.cb_attributes[MAX_STORED_PAGES-1].next_link = 0xFF; |
2612 smscb_getCBsettings(); | 2493 smscb_getCBsettings(); |
2613 | 2494 |
2614 if (settingsGetStatus(SettingsCBDisable)) | 2495 if (settingsGetStatus(SettingsCBDisable)) |
2615 smscb_setCBsettings(SMSCB_SWITCH_OFF); | 2496 smscb_setCBsettings(SMSCB_SWITCH_OFF); |
2616 else | 2497 else |
2617 smscb_setCBsettings(SMSCB_SWITCH_ON); | 2498 smscb_setCBsettings(SMSCB_SWITCH_ON); |
2618 //for tracing | 2499 //for tracing |
2619 | |
2620 | |
2621 | |
2622 | |
2623 | |
2624 } | 2500 } |
2625 | 2501 |
2626 /******************************************************************************* | 2502 /******************************************************************************* |
2627 | 2503 |
2628 $Function: sms_cb_exit | 2504 $Function: sms_cb_exit |
2655 /******************************************************************************* | 2531 /******************************************************************************* |
2656 | 2532 |
2657 $Function: sms_new_incoming_cb | 2533 $Function: sms_new_incoming_cb |
2658 | 2534 |
2659 $Description: This function will be call after each NEW incoming cb messages. | 2535 $Description: This function will be call after each NEW incoming cb messages. |
2660 It checks for free spaces and organize to save the cb messages | 2536 It checks for free spaces and organize to save the cb messages |
2661 in the right order. | 2537 in the right order. |
2662 $Returns: | 2538 $Returns: |
2663 | 2539 |
2664 $Arguments: | 2540 $Arguments: |
2665 | 2541 |
2666 *******************************************************************************/ | 2542 *******************************************************************************/ |
2667 void sms_new_incoming_cb (T_MFW_SMS_CB *Message) | 2543 void sms_new_incoming_cb (T_MFW_SMS_CB *Message) |
2668 { | 2544 { |
2669 | |
2670 //only for tracing | 2545 //only for tracing |
2671 #ifdef DEBUG_SMS_CB | 2546 #ifdef DEBUG_SMS_CB |
2672 UBYTE i, test; | 2547 UBYTE i, test; |
2673 #endif | 2548 #endif |
2674 | 2549 |
2675 | |
2676 //set to default | 2550 //set to default |
2677 UBYTE result =0; | 2551 UBYTE result =0; |
2678 smscb_data.found_mid = FALSE; | 2552 smscb_data.found_mid = FALSE; |
2679 smscb_data.clear_mid = FALSE; | 2553 smscb_data.clear_mid = FALSE; |
2680 | 2554 |
2681 | |
2682 //only for tracing | 2555 //only for tracing |
2683 #ifdef DEBUG_SMS_CB | 2556 #ifdef DEBUG_SMS_CB |
2684 TRACE_EVENT("--------------start------------"); | 2557 TRACE_EVENT("--------------start------------"); |
2685 #endif //DEBUG_SMS_CB | 2558 #endif //DEBUG_SMS_CB |
2686 | 2559 |
2687 | |
2688 //search the new MID with the MID's in the fifo. | 2560 //search the new MID with the MID's in the fifo. |
2689 //used_pointer EQ 0xFF means there is no message in the fifo | 2561 //used_pointer EQ 0xFF means there is no message in the fifo |
2690 if (smscb_data.used_pointer NEQ 0xFF) | 2562 if (smscb_data.used_pointer NEQ 0xFF) |
2691 { | 2563 { |
2692 result = sms_cb_search_mid (Message->msg_id, Message->sn); | 2564 result = sms_cb_search_mid (Message->msg_id, Message->sn); |
2693 } | 2565 } |
2694 | 2566 |
2695 | |
2696 //error: in searching mid | 2567 //error: in searching mid |
2697 if (result EQ 0xAA) | 2568 if (result EQ 0xAA) |
2698 { | 2569 { |
2699 TRACE_EVENT("sms cb ERROR, in searching mid"); | 2570 TRACE_EVENT("sms cb ERROR, in searching mid"); |
2700 return; | 2571 return; |
2701 } | 2572 } |
2702 | 2573 |
2703 | |
2704 // does the message with the same MID already exist in the fifo ? | 2574 // does the message with the same MID already exist in the fifo ? |
2705 if(smscb_data.found_mid) | 2575 if(smscb_data.found_mid) |
2706 { | 2576 { |
2707 TRACE_EVENT("MID already exist"); | 2577 TRACE_EVENT("MID already exist"); |
2708 | 2578 |
2709 sms_cb_delete_message (Message->msg_id); | 2579 sms_cb_delete_message (Message->msg_id); |
2710 | 2580 |
2711 | |
2712 smscb_data.clear_mid = TRUE; | 2581 smscb_data.clear_mid = TRUE; |
2713 } | 2582 } |
2714 | |
2715 | 2583 |
2716 // does we have free space ? | 2584 // does we have free space ? |
2717 if (smscb_data.free_pointer EQ 0xFF) | 2585 if (smscb_data.free_pointer EQ 0xFF) |
2718 { | 2586 { |
2719 //no free spaces -> means overwrite the oldest message | 2587 //no free spaces -> means overwrite the oldest message |
2720 sms_cb_overwrite_old_message (Message); | 2588 sms_cb_overwrite_old_message (Message); |
2721 | |
2722 } | 2589 } |
2723 else // does we have free space ? | 2590 else // does we have free space ? |
2724 { | 2591 { |
2725 //still free spaces | 2592 //still free spaces |
2726 sms_cb_store_message (Message); | 2593 sms_cb_store_message (Message); |
2727 | 2594 } |
2728 } | |
2729 | |
2730 | 2595 |
2731 | 2596 |
2732 //only for tracing | 2597 //only for tracing |
2733 #ifdef DEBUG_SMS_CB | 2598 #ifdef DEBUG_SMS_CB |
2734 /***************************Go-lite Optimization changes Start***********************/ | 2599 /***************************Go-lite Optimization changes Start***********************/ |
2737 | 2602 |
2738 TRACE_EVENT_P1("5 smscb_data.free_pointer %d ", smscb_data.free_pointer); | 2603 TRACE_EVENT_P1("5 smscb_data.free_pointer %d ", smscb_data.free_pointer); |
2739 /***************************Go-lite Optimization changes end***********************/ | 2604 /***************************Go-lite Optimization changes end***********************/ |
2740 TRACE_EVENT("--------------finish------------"); | 2605 TRACE_EVENT("--------------finish------------"); |
2741 | 2606 |
2742 | |
2743 #endif //DEBUG_SMS_CB | 2607 #endif //DEBUG_SMS_CB |
2744 | 2608 } |
2745 } | |
2746 | |
2747 | 2609 |
2748 | 2610 |
2749 /******************************************************************************* | 2611 /******************************************************************************* |
2750 | 2612 |
2751 $Function: sms_cb_store_message | 2613 $Function: sms_cb_store_message |
2757 $Arguments: | 2619 $Arguments: |
2758 | 2620 |
2759 *******************************************************************************/ | 2621 *******************************************************************************/ |
2760 UBYTE sms_cb_store_message (T_MFW_SMS_CB *Message) | 2622 UBYTE sms_cb_store_message (T_MFW_SMS_CB *Message) |
2761 { | 2623 { |
2762 | |
2763 TRACE_FUNCTION("sms_cb_store_message"); | 2624 TRACE_FUNCTION("sms_cb_store_message"); |
2764 | |
2765 | 2625 |
2766 //it is only for the first time | 2626 //it is only for the first time |
2767 if (smscb_data.used_pointer EQ 0xFF) | 2627 if (smscb_data.used_pointer EQ 0xFF) |
2768 { | 2628 { |
2769 // request for a free space | 2629 // request for a free space |
2770 smscb_data.used_pointer = smscb_data.free_pointer; | 2630 smscb_data.used_pointer = smscb_data.free_pointer; |
2771 } | 2631 } |
2772 | |
2773 | 2632 |
2774 //save the new message in the fifo | 2633 //save the new message in the fifo |
2775 /*MC SPR 1920 if memory not alloacted for message, allocate some*/ | 2634 /*MC SPR 1920 if memory not alloacted for message, allocate some*/ |
2776 TRACE_EVENT_P1("Allocating memory to slot %d for CB message", smscb_data.free_pointer); | 2635 TRACE_EVENT_P1("Allocating memory to slot %d for CB message", smscb_data.free_pointer); |
2777 | 2636 |
2790 if (smscb_data.cb_attributes[smscb_data.free_pointer].next_link EQ 0xFF) | 2649 if (smscb_data.cb_attributes[smscb_data.free_pointer].next_link EQ 0xFF) |
2791 { | 2650 { |
2792 //no more free space available | 2651 //no more free space available |
2793 | 2652 |
2794 UBYTE temp, result; | 2653 UBYTE temp, result; |
2795 | |
2796 | 2654 |
2797 //keep the link-value for later | 2655 //keep the link-value for later |
2798 temp = smscb_data.used_pointer; | 2656 temp = smscb_data.used_pointer; |
2799 | 2657 |
2800 //find the termination in the link list | 2658 //find the termination in the link list |
2805 { | 2663 { |
2806 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); | 2664 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); |
2807 return 0; // RAVI | 2665 return 0; // RAVI |
2808 } | 2666 } |
2809 | 2667 |
2810 | |
2811 //update the link-list | 2668 //update the link-list |
2812 smscb_data.cb_attributes[smscb_data.used_pointer].next_link = smscb_data.free_pointer; | 2669 smscb_data.cb_attributes[smscb_data.used_pointer].next_link = smscb_data.free_pointer; |
2813 | 2670 |
2814 //no more free space | 2671 //no more free space |
2815 smscb_data.free_pointer = 0xFF; | 2672 smscb_data.free_pointer = 0xFF; |
2821 if (smscb_data.clear_mid) | 2678 if (smscb_data.clear_mid) |
2822 { | 2679 { |
2823 smscb_data.used_pointer = smscb_data.result_used; | 2680 smscb_data.used_pointer = smscb_data.result_used; |
2824 } | 2681 } |
2825 | 2682 |
2826 | |
2827 } | 2683 } |
2828 else //was it the last free space ? | 2684 else //was it the last free space ? |
2829 { | 2685 { |
2830 //no, still free space available | 2686 //no, still free space available |
2831 | 2687 |
2832 UBYTE temp, temp_2, result; | 2688 UBYTE temp, temp_2, result; |
2833 | 2689 |
2834 //keep the usedpointer-value for later | 2690 //keep the usedpointer-value for later |
2835 temp_2 = smscb_data.used_pointer; | 2691 temp_2 = smscb_data.used_pointer; |
2836 | 2692 |
2837 | |
2838 //keep the link-value for later | 2693 //keep the link-value for later |
2839 temp = smscb_data.cb_attributes[smscb_data.free_pointer].next_link; | 2694 temp = smscb_data.cb_attributes[smscb_data.free_pointer].next_link; |
2840 | 2695 |
2841 | |
2842 //terminate the used list | 2696 //terminate the used list |
2843 smscb_data.cb_attributes[smscb_data.free_pointer].next_link = 0xFF; | 2697 smscb_data.cb_attributes[smscb_data.free_pointer].next_link = 0xFF; |
2844 | |
2845 | 2698 |
2846 //find the termination in the link list | 2699 //find the termination in the link list |
2847 result = sms_cb_find_termination (&smscb_data.used_pointer); | 2700 result = sms_cb_find_termination (&smscb_data.used_pointer); |
2848 | 2701 |
2849 //error: couldnt find the termination ?! | 2702 //error: couldnt find the termination ?! |
2851 { | 2704 { |
2852 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); | 2705 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); |
2853 return 0; | 2706 return 0; |
2854 } | 2707 } |
2855 | 2708 |
2856 | |
2857 //update the use pointer | 2709 //update the use pointer |
2858 if (smscb_data.used_pointer NEQ smscb_data.free_pointer) | 2710 if (smscb_data.used_pointer NEQ smscb_data.free_pointer) |
2859 { | 2711 { |
2860 smscb_data.cb_attributes[smscb_data.used_pointer].next_link = smscb_data.free_pointer; | 2712 smscb_data.cb_attributes[smscb_data.used_pointer].next_link = smscb_data.free_pointer; |
2861 } | 2713 } |
2862 | 2714 |
2863 | |
2864 // update the free pointer as well | 2715 // update the free pointer as well |
2865 smscb_data.free_pointer = temp; | 2716 smscb_data.free_pointer = temp; |
2866 | |
2867 | 2717 |
2868 //did it clear before ? | 2718 //did it clear before ? |
2869 if (smscb_data.clear_mid) | 2719 if (smscb_data.clear_mid) |
2870 { | 2720 { |
2871 smscb_data.used_pointer = smscb_data.result_used; | 2721 smscb_data.used_pointer = smscb_data.result_used; |
2874 { | 2724 { |
2875 //update the used pointer | 2725 //update the used pointer |
2876 smscb_data.used_pointer = temp_2 ; | 2726 smscb_data.used_pointer = temp_2 ; |
2877 } | 2727 } |
2878 | 2728 |
2879 | |
2880 } | 2729 } |
2881 //ADDED BY RAVI- 28-11-2005 | 2730 //ADDED BY RAVI- 28-11-2005 |
2882 return 1; | 2731 return 1; |
2883 //END RAVI - 28-11-2005 | 2732 //END RAVI - 28-11-2005 |
2884 } | 2733 } |
2909 TRACE_EVENT_P1("page = %d ", smscb_data.cb_attributes[smscb_data.used_pointer].page); | 2758 TRACE_EVENT_P1("page = %d ", smscb_data.cb_attributes[smscb_data.used_pointer].page); |
2910 TRACE_EVENT_P1( "mid = %d ", smscb_data.cb_attributes[smscb_data.used_pointer].mid); | 2759 TRACE_EVENT_P1( "mid = %d ", smscb_data.cb_attributes[smscb_data.used_pointer].mid); |
2911 /***************************Go-lite Optimization changes end***********************/ | 2760 /***************************Go-lite Optimization changes end***********************/ |
2912 #endif //DEBUG_SMS_CB | 2761 #endif //DEBUG_SMS_CB |
2913 | 2762 |
2914 | |
2915 TRACE_EVENT("sms_cb_overwrite_old_message"); | 2763 TRACE_EVENT("sms_cb_overwrite_old_message"); |
2916 | 2764 |
2917 //keep the value for later | 2765 //keep the value for later |
2918 // temp = smscb_data.used_pointer; | 2766 // temp = smscb_data.used_pointer; |
2919 | 2767 |
2920 | |
2921 //find the page in the fifo with the same MID number & delete them | 2768 //find the page in the fifo with the same MID number & delete them |
2922 sms_cb_delete_message (smscb_data.cb_attributes[smscb_data.used_pointer].mid); | 2769 sms_cb_delete_message (smscb_data.cb_attributes[smscb_data.used_pointer].mid); |
2923 | 2770 |
2924 | |
2925 //now we have free space to store the new incoming cb message | 2771 //now we have free space to store the new incoming cb message |
2926 sms_cb_store_message (Message); | 2772 sms_cb_store_message (Message); |
2927 | 2773 |
2928 return 1; // ADDED BY RAVI - 28-11-2005 | 2774 return 1; // ADDED BY RAVI - 28-11-2005 |
2929 | |
2930 } | 2775 } |
2931 | 2776 |
2932 /******************************************************************************* | 2777 /******************************************************************************* |
2933 | 2778 |
2934 $Function: sms_cb_store_attributes | 2779 $Function: sms_cb_store_attributes |
2935 | 2780 |
2936 $Description: Store the attributes of the new incoming cb | 2781 $Description: Store the attributes of the new incoming cb |
2937 | 2782 |
2938 Attributes are stored seperatly from the message text | 2783 Attributes are stored seperatly from the message text |
2939 $Returns: | 2784 $Returns: |
2940 | 2785 |
2941 $Arguments: | 2786 $Arguments: |
2942 | 2787 |
2943 *******************************************************************************/ | 2788 *******************************************************************************/ |
2948 smscb_data.cb_attributes[position].mid = Message->msg_id; | 2793 smscb_data.cb_attributes[position].mid = Message->msg_id; |
2949 smscb_data.cb_attributes[position].dcs = Message->dcs; | 2794 smscb_data.cb_attributes[position].dcs = Message->dcs; |
2950 smscb_data.cb_attributes[position].page = Message->page; | 2795 smscb_data.cb_attributes[position].page = Message->page; |
2951 smscb_data.cb_attributes[position].pages = Message->pages; | 2796 smscb_data.cb_attributes[position].pages = Message->pages; |
2952 smscb_data.cb_attributes[position].msg_len = Message->msg_len; | 2797 smscb_data.cb_attributes[position].msg_len = Message->msg_len; |
2953 | |
2954 } | 2798 } |
2955 | 2799 |
2956 | 2800 |
2957 /******************************************************************************* | 2801 /******************************************************************************* |
2958 | 2802 |
2971 { | 2815 { |
2972 UBYTE temp, i=0; | 2816 UBYTE temp, i=0; |
2973 SHORT update_number_mask = 0x0F; | 2817 SHORT update_number_mask = 0x0F; |
2974 | 2818 |
2975 temp = smscb_data.used_pointer; | 2819 temp = smscb_data.used_pointer; |
2976 | |
2977 | 2820 |
2978 if (smscb_data.cb_attributes[temp].mid EQ mid) | 2821 if (smscb_data.cb_attributes[temp].mid EQ mid) |
2979 { | 2822 { |
2980 //found the mid in the fifo | 2823 //found the mid in the fifo |
2981 TRACE_EVENT("Matching MID"); | 2824 TRACE_EVENT("Matching MID"); |
2982 if ((smscb_data.cb_attributes[temp].sn & update_number_mask) NEQ | 2825 if ((smscb_data.cb_attributes[temp].sn & update_number_mask) NEQ |
2983 (sn & update_number_mask) ) | 2826 (sn & update_number_mask) ) |
2984 { | 2827 { |
2985 //the new cb is the update of the existing one | 2828 //the new cb is the update of the existing one |
2986 smscb_data.found_mid = TRUE; | 2829 smscb_data.found_mid = TRUE; |
2987 TRACE_EVENT("found = True, return"); | 2830 TRACE_EVENT("found = True, return"); |
2988 return temp; | 2831 return temp; |
2989 } | 2832 } |
2990 /*SPR 2429, return this index as otherwise there will be two | 2833 /*SPR 2429, return this index as otherwise there will be two |
2991 copies of the same message*/ | 2834 copies of the same message*/ |
2992 TRACE_EVENT("Serial numbers match"); | 2835 TRACE_EVENT("Serial numbers match"); |
2993 return temp; | 2836 return temp; |
2994 } | 2837 } |
2995 | 2838 |
2996 | |
2997 while (smscb_data.cb_attributes[temp].next_link NEQ 0xFF) | 2839 while (smscb_data.cb_attributes[temp].next_link NEQ 0xFF) |
2998 { | 2840 { |
2999 | |
3000 // going through the link list | 2841 // going through the link list |
3001 temp = smscb_data.cb_attributes[temp].next_link; | 2842 temp = smscb_data.cb_attributes[temp].next_link; |
3002 | |
3003 | 2843 |
3004 if (smscb_data.cb_attributes[temp].mid EQ mid) | 2844 if (smscb_data.cb_attributes[temp].mid EQ mid) |
3005 { | 2845 { |
3006 //found the mid in the fifo | 2846 //found the mid in the fifo |
3007 TRACE_EVENT_P1("Matching MID at location:%d", temp); | 2847 TRACE_EVENT_P1("Matching MID at location:%d", temp); |
3008 if ((smscb_data.cb_attributes[temp].sn & update_number_mask) NEQ | 2848 if ((smscb_data.cb_attributes[temp].sn & update_number_mask) NEQ |
3009 (sn & update_number_mask) ) | 2849 (sn & update_number_mask) ) |
3010 { | 2850 { |
3011 | |
3012 //the new cb is the update of the existing one in the fifo | 2851 //the new cb is the update of the existing one in the fifo |
3013 smscb_data.found_mid = TRUE; | 2852 smscb_data.found_mid = TRUE; |
3014 return temp; | 2853 return temp; |
3015 | |
3016 | |
3017 } | 2854 } |
3018 /*SPR 2429, return this index as otherwise there will be two | 2855 /*SPR 2429, return this index as otherwise there will be two |
3019 copies of the same message*/ | 2856 copies of the same message*/ |
3020 TRACE_EVENT("Serial numbers match"); | 2857 TRACE_EVENT("Serial numbers match"); |
3021 return temp;/*SHould just replace old one with new one anyway*/ | 2858 return temp;/*SHould just replace old one with new one anyway*/ |
3022 } | 2859 } |
3023 | 2860 |
3024 | |
3025 // only to be sure there is a ever ending loop | 2861 // only to be sure there is a ever ending loop |
3026 i++; | 2862 i++; |
3027 if (i > MAX_STORED_PAGES) | 2863 if (i > MAX_STORED_PAGES) |
3028 return 0xAA; | 2864 return 0xAA; |
3029 } | 2865 } |
3030 | 2866 |
3031 return temp; | 2867 return temp; |
3032 } | 2868 } |
3033 | 2869 |
3034 | 2870 |
3035 | |
3036 /******************************************************************************* | 2871 /******************************************************************************* |
3037 | 2872 |
3038 $Function: sms_cb_delete_message | 2873 $Function: sms_cb_delete_message |
3039 | 2874 |
3040 $Description: This function delete the messages in the fifo, even for multipages | 2875 $Description: This function delete the messages in the fifo, even for multipages |
3044 $Arguments: | 2879 $Arguments: |
3045 | 2880 |
3046 *******************************************************************************/ | 2881 *******************************************************************************/ |
3047 UBYTE sms_cb_delete_message (USHORT mid) | 2882 UBYTE sms_cb_delete_message (USHORT mid) |
3048 { | 2883 { |
3049 | |
3050 //only tracing | 2884 //only tracing |
3051 #ifdef DEBUG_SMS_CB | 2885 #ifdef DEBUG_SMS_CB |
3052 char buf[100]; | 2886 char buf[100]; |
3053 #endif | 2887 #endif |
3054 | 2888 |
3055 UBYTE temp, temp_2, result; // , i=0; // RAVI | 2889 UBYTE temp, temp_2, result; // , i=0; // RAVI |
3056 | 2890 |
3057 TRACE_EVENT("sms_cb_delete_message"); | 2891 TRACE_EVENT("sms_cb_delete_message"); |
3058 | 2892 |
3059 | |
3060 //keep the value for later | 2893 //keep the value for later |
3061 temp_2 = smscb_data.used_pointer; | 2894 temp_2 = smscb_data.used_pointer; |
3062 | 2895 |
3063 | |
3064 // keep the value for later | 2896 // keep the value for later |
3065 smscb_data.start_used = smscb_data.used_pointer; | 2897 smscb_data.start_used = smscb_data.used_pointer; |
3066 | 2898 |
3067 //search for the first page of the multipages | 2899 //search for the first page of the multipages |
3068 smscb_data.start_used = sms_cb_find_startpoint (mid, smscb_data.used_pointer); | 2900 smscb_data.start_used = sms_cb_find_startpoint (mid, smscb_data.used_pointer); |
3072 { | 2904 { |
3073 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); | 2905 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); |
3074 return 0; // RAVI | 2906 return 0; // RAVI |
3075 } | 2907 } |
3076 | 2908 |
3077 | |
3078 //found immediately ? | 2909 //found immediately ? |
3079 if (smscb_data.start_used EQ smscb_data.used_pointer) | 2910 if (smscb_data.start_used EQ smscb_data.used_pointer) |
3080 { | 2911 { |
3081 //is in the OLDEST position in the fifo | 2912 //is in the OLDEST position in the fifo |
3082 | 2913 |
3085 //keep the value for later | 2916 //keep the value for later |
3086 temp = smscb_data.used_pointer; | 2917 temp = smscb_data.used_pointer; |
3087 | 2918 |
3088 //search for the last page | 2919 //search for the last page |
3089 smscb_data.end_used = sms_cb_find_endpoint (mid, smscb_data.used_pointer); | 2920 smscb_data.end_used = sms_cb_find_endpoint (mid, smscb_data.used_pointer); |
3090 | |
3091 | 2921 |
3092 //error: couldnt find the termination ?! | 2922 //error: couldnt find the termination ?! |
3093 if (smscb_data.end_used EQ 0xAA) | 2923 if (smscb_data.end_used EQ 0xAA) |
3094 { | 2924 { |
3095 TRACE_EVENT("sms cb ERROR"); | 2925 TRACE_EVENT("sms cb ERROR"); |
3096 return 0; // RAVI | 2926 return 0; // RAVI |
3097 } | 2927 } |
3098 | 2928 |
3099 | |
3100 | |
3101 if ( (smscb_data.cb_attributes[smscb_data.used_pointer].next_link EQ 0xFF) && | 2929 if ( (smscb_data.cb_attributes[smscb_data.used_pointer].next_link EQ 0xFF) && |
3102 (smscb_data.cb_attributes[smscb_data.used_pointer].mid EQ mid) ) | 2930 (smscb_data.cb_attributes[smscb_data.used_pointer].mid EQ mid) ) |
3103 { | 2931 { |
3104 //it is the oldest cb and also the only one in the fifo | 2932 //it is the oldest cb and also the only one in the fifo |
3105 TRACE_EVENT("oldest position and the only one in the list"); | 2933 TRACE_EVENT("oldest position and the only one in the list"); |
3106 | |
3107 | 2934 |
3108 //deleted messages -> now more space availabe -> update the free pointer | 2935 //deleted messages -> now more space availabe -> update the free pointer |
3109 result = sms_cb_update_free_pointer (temp); | 2936 result = sms_cb_update_free_pointer (temp); |
3110 | 2937 |
3111 //terminate the free pointer list | 2938 //terminate the free pointer list |
3131 result = sms_cb_update_free_pointer (temp); | 2958 result = sms_cb_update_free_pointer (temp); |
3132 | 2959 |
3133 //terminate the free pointer list | 2960 //terminate the free pointer list |
3134 smscb_data.cb_attributes[smscb_data.end_used].next_link = 0xFF; | 2961 smscb_data.cb_attributes[smscb_data.end_used].next_link = 0xFF; |
3135 | 2962 |
3136 | |
3137 //error: couldnt find the termination ?! | 2963 //error: couldnt find the termination ?! |
3138 if (result EQ 0xAA) | 2964 if (result EQ 0xAA) |
3139 { | 2965 { |
3140 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); | 2966 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); |
3141 return 0; | 2967 return 0; |
3142 } | 2968 } |
3143 | 2969 |
3144 } | 2970 } |
3145 | 2971 |
3146 | |
3147 } | 2972 } |
3148 else //found immediately ? | 2973 else //found immediately ? |
3149 { | 2974 { |
3150 | |
3151 //keep the value for later | 2975 //keep the value for later |
3152 temp = smscb_data.used_pointer; | 2976 temp = smscb_data.used_pointer; |
3153 | 2977 |
3154 //search for the last page of the multipages | 2978 //search for the last page of the multipages |
3155 smscb_data.end_used = sms_cb_find_endpoint (mid, smscb_data.used_pointer); | 2979 smscb_data.end_used = sms_cb_find_endpoint (mid, smscb_data.used_pointer); |
3158 { | 2982 { |
3159 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); | 2983 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); |
3160 return 0; | 2984 return 0; |
3161 } | 2985 } |
3162 | 2986 |
3163 | |
3164 if (smscb_data.cb_attributes[smscb_data.used_pointer].next_link EQ 0xFF && | 2987 if (smscb_data.cb_attributes[smscb_data.used_pointer].next_link EQ 0xFF && |
3165 smscb_data.cb_attributes[smscb_data.used_pointer].mid EQ mid) | 2988 smscb_data.cb_attributes[smscb_data.used_pointer].mid EQ mid) |
3166 { | 2989 { |
3167 //is in the the latest position in the fifo | 2990 //is in the the latest position in the fifo |
3168 | 2991 |
3169 TRACE_EVENT("multipage is in the latest position"); | 2992 TRACE_EVENT("multipage is in the latest position"); |
3170 | 2993 |
3171 //terminate the position where the multipage began | 2994 //terminate the position where the multipage began |
3172 smscb_data.cb_attributes[smscb_data.start_used].next_link= 0xFF; | 2995 smscb_data.cb_attributes[smscb_data.start_used].next_link= 0xFF; |
3173 | 2996 |
3174 | |
3175 //deleted messages -> now more space availabe -> update the free pointer | 2997 //deleted messages -> now more space availabe -> update the free pointer |
3176 result = sms_cb_update_free_pointer (temp); | 2998 result = sms_cb_update_free_pointer (temp); |
3177 | 2999 |
3178 //terminate the free pointer list | 3000 //terminate the free pointer list |
3179 smscb_data.cb_attributes[smscb_data.used_pointer].next_link = 0xFF; | 3001 smscb_data.cb_attributes[smscb_data.used_pointer].next_link = 0xFF; |
3180 | |
3181 | 3002 |
3182 //error: couldnt find the termination ?! | 3003 //error: couldnt find the termination ?! |
3183 if (result EQ 0xAA) | 3004 if (result EQ 0xAA) |
3184 { | 3005 { |
3185 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); | 3006 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); |
3187 } | 3008 } |
3188 | 3009 |
3189 smscb_data.result_used = temp_2; | 3010 smscb_data.result_used = temp_2; |
3190 smscb_data.used_pointer = temp_2; | 3011 smscb_data.used_pointer = temp_2; |
3191 | 3012 |
3192 | |
3193 } | 3013 } |
3194 else | 3014 else |
3195 { | 3015 { |
3196 //is in the middle position in the fifo | 3016 //is in the middle position in the fifo |
3197 | 3017 |
3203 //deleted messages -> now more space availabe -> update the free pointer | 3023 //deleted messages -> now more space availabe -> update the free pointer |
3204 result = sms_cb_update_free_pointer (temp); | 3024 result = sms_cb_update_free_pointer (temp); |
3205 | 3025 |
3206 //terminate the free pointer list | 3026 //terminate the free pointer list |
3207 smscb_data.cb_attributes[smscb_data.end_used].next_link = 0xFF; | 3027 smscb_data.cb_attributes[smscb_data.end_used].next_link = 0xFF; |
3208 | |
3209 | |
3210 | |
3211 | |
3212 | |
3213 | 3028 |
3214 //error: couldnt find the termination ?! | 3029 //error: couldnt find the termination ?! |
3215 if (result EQ 0xAA) | 3030 if (result EQ 0xAA) |
3216 { | 3031 { |
3217 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); | 3032 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); |
3218 return 0; | 3033 return 0; |
3219 } | 3034 } |
3220 | 3035 |
3221 | |
3222 smscb_data.result_used = temp_2; | 3036 smscb_data.result_used = temp_2; |
3223 | 3037 |
3224 } | 3038 } |
3225 | 3039 } |
3226 | 3040 return 1; // ADDED BY RAVI - 28-11-2005 |
3227 } | |
3228 return 1; // ADDED BY RAVI - 28-11-2005 | |
3229 | |
3230 } | 3041 } |
3231 | 3042 |
3232 /******************************************************************************* | 3043 /******************************************************************************* |
3233 | 3044 |
3234 $Function: sms_cb_find_startpoint | 3045 $Function: sms_cb_find_startpoint |
3235 | 3046 |
3236 $Description: find the startpoint of the multipage. It is also used for singlepage. | 3047 $Description: find the startpoint of the multipage. It is also used for singlepage. |
3237 | |
3238 | 3048 |
3239 $Returns: | 3049 $Returns: |
3240 | 3050 |
3241 $Arguments: | 3051 $Arguments: |
3242 | 3052 |
3250 // char buf[100]; | 3060 // char buf[100]; |
3251 | 3061 |
3252 TRACE_EVENT("in sms_cb_find_startpoint "); | 3062 TRACE_EVENT("in sms_cb_find_startpoint "); |
3253 #endif //DEBUG_SMS_CB | 3063 #endif //DEBUG_SMS_CB |
3254 | 3064 |
3255 | |
3256 //search for the first page of the multipages | 3065 //search for the first page of the multipages |
3257 while (smscb_data.cb_attributes[smscb_data.used_pointer].mid NEQ mid) | 3066 while (smscb_data.cb_attributes[smscb_data.used_pointer].mid NEQ mid) |
3258 { | 3067 { |
3259 | |
3260 start_used = smscb_data.used_pointer; | 3068 start_used = smscb_data.used_pointer; |
3261 | |
3262 // going through the link list | |
3263 smscb_data.used_pointer = smscb_data.cb_attributes[smscb_data.used_pointer].next_link; | |
3264 | |
3265 // only to be sure there is a ever ending loop | |
3266 i++; | |
3267 if (i > MAX_STORED_PAGES) | |
3268 return 0xAA; | |
3269 } | |
3270 | |
3271 //only tracing | |
3272 TRACE_EVENT_P1("start_used: %d", start_used); | |
3273 | |
3274 return start_used; | |
3275 } | |
3276 | |
3277 /******************************************************************************* | |
3278 | |
3279 $Function: sms_cb_find_startpoint | |
3280 | |
3281 $Description: find the lastpage of the multipage. | |
3282 It is also used for the singlepage but in this case the | |
3283 end_used will be equal to used_pointer | |
3284 | |
3285 $Returns: | |
3286 | |
3287 $Arguments: | |
3288 | |
3289 *******************************************************************************/ | |
3290 UBYTE sms_cb_find_endpoint (USHORT mid, UBYTE end_used) | |
3291 { | |
3292 UBYTE i = 0; | |
3293 | |
3294 | |
3295 | |
3296 //search for the last page of the multipages | |
3297 while (smscb_data.cb_attributes[smscb_data.used_pointer].mid EQ mid && | |
3298 smscb_data.cb_attributes[smscb_data.used_pointer].next_link NEQ 0xFF ) | |
3299 { | |
3300 | |
3301 end_used = smscb_data.used_pointer; | |
3302 | 3069 |
3303 // going through the link list | 3070 // going through the link list |
3304 smscb_data.used_pointer = smscb_data.cb_attributes[smscb_data.used_pointer].next_link; | 3071 smscb_data.used_pointer = smscb_data.cb_attributes[smscb_data.used_pointer].next_link; |
3305 | 3072 |
3306 // only to be sure there is a ever ending loop | 3073 // only to be sure there is a ever ending loop |
3307 i++; | 3074 i++; |
3308 if (i > MAX_STORED_PAGES) | 3075 if (i > MAX_STORED_PAGES) |
3309 return 0xAA; | 3076 return 0xAA; |
3310 } | 3077 } |
3311 | 3078 |
3312 | 3079 //only tracing |
3313 TRACE_EVENT_P1("end_used: %d", end_used); | 3080 TRACE_EVENT_P1("start_used: %d", start_used); |
3081 | |
3082 return start_used; | |
3083 } | |
3084 | |
3085 /******************************************************************************* | |
3086 | |
3087 $Function: sms_cb_find_startpoint | |
3088 | |
3089 $Description: find the lastpage of the multipage. | |
3090 It is also used for the singlepage but in this case the | |
3091 end_used will be equal to used_pointer | |
3092 | |
3093 $Returns: | |
3094 | |
3095 $Arguments: | |
3096 | |
3097 *******************************************************************************/ | |
3098 UBYTE sms_cb_find_endpoint (USHORT mid, UBYTE end_used) | |
3099 { | |
3100 UBYTE i = 0; | |
3101 | |
3102 //search for the last page of the multipages | |
3103 while (smscb_data.cb_attributes[smscb_data.used_pointer].mid EQ mid && | |
3104 smscb_data.cb_attributes[smscb_data.used_pointer].next_link NEQ 0xFF ) | |
3105 { | |
3106 end_used = smscb_data.used_pointer; | |
3107 | |
3108 // going through the link list | |
3109 smscb_data.used_pointer = smscb_data.cb_attributes[smscb_data.used_pointer].next_link; | |
3110 | |
3111 // only to be sure there is a ever ending loop | |
3112 i++; | |
3113 if (i > MAX_STORED_PAGES) | |
3114 return 0xAA; | |
3115 } | |
3116 | |
3117 TRACE_EVENT_P1("end_used: %d", end_used); | |
3314 | 3118 |
3315 return end_used; | 3119 return end_used; |
3316 } | 3120 } |
3317 | 3121 |
3318 /******************************************************************************* | 3122 /******************************************************************************* |
3319 | 3123 |
3320 $Function: sms_cb_update_free_pointer | 3124 $Function: sms_cb_update_free_pointer |
3321 | 3125 |
3322 $Description: This function is updating the free pointer after deleting | 3126 $Description: This function is updating the free pointer after deleting |
3323 cb messages in the fifo (space available !) | 3127 cb messages in the fifo (space available !) |
3324 | |
3325 | 3128 |
3326 $Returns: | 3129 $Returns: |
3327 | 3130 |
3328 $Arguments: | 3131 $Arguments: |
3329 | 3132 |
3330 *******************************************************************************/ | 3133 *******************************************************************************/ |
3331 UBYTE sms_cb_update_free_pointer (UBYTE temp) | 3134 UBYTE sms_cb_update_free_pointer (UBYTE temp) |
3332 { | 3135 { |
3333 UBYTE update=0, i=0; | 3136 UBYTE update=0, i=0; |
3334 | 3137 |
3335 | |
3336 TRACE_EVENT("sms_cb_update_free_pointer"); | 3138 TRACE_EVENT("sms_cb_update_free_pointer"); |
3337 | 3139 |
3338 | 3140 TRACE_EVENT_P1("temp index:%d", temp); |
3339 TRACE_EVENT_P1("temp index:%d", temp); | |
3340 if (smscb_data.free_pointer EQ 0xFF) | 3141 if (smscb_data.free_pointer EQ 0xFF) |
3341 {TRACE_EVENT("free pointer = 0xff"); | 3142 {TRACE_EVENT("free pointer = 0xff"); |
3342 //take the old used_pointer (before of deleting the messages) | 3143 //take the old used_pointer (before of deleting the messages) |
3343 smscb_data.free_pointer = temp; | 3144 smscb_data.free_pointer = temp; |
3344 /*MC SPR 1920, free the message slot*/ | 3145 /*MC SPR 1920, free the message slot*/ |
3366 i++; | 3167 i++; |
3367 if (i > MAX_STORED_PAGES) | 3168 if (i > MAX_STORED_PAGES) |
3368 return 0xAA; | 3169 return 0xAA; |
3369 } | 3170 } |
3370 | 3171 |
3371 | |
3372 //continue the free pointer link list to the new deleted multipage | 3172 //continue the free pointer link list to the new deleted multipage |
3373 smscb_data.cb_attributes[smscb_data.free_pointer].next_link = temp; | 3173 smscb_data.cb_attributes[smscb_data.free_pointer].next_link = temp; |
3374 | 3174 |
3375 | |
3376 //show on the first deleted multipage | 3175 //show on the first deleted multipage |
3377 smscb_data.free_pointer = update; | 3176 smscb_data.free_pointer = update; |
3378 | 3177 |
3379 | 3178 } |
3380 } | |
3381 | |
3382 | 3179 |
3383 //indicate that we deleted cb messages | 3180 //indicate that we deleted cb messages |
3384 smscb_data.clear_mid = TRUE; | 3181 smscb_data.clear_mid = TRUE; |
3385 | 3182 |
3386 | |
3387 //need for later | 3183 //need for later |
3388 smscb_data.result_used = smscb_data.used_pointer; | 3184 smscb_data.result_used = smscb_data.used_pointer; |
3389 | 3185 |
3390 TRACE_EVENT_P1("used pointer: %d", smscb_data.used_pointer); | 3186 TRACE_EVENT_P1("used pointer: %d", smscb_data.used_pointer); |
3391 //only for tracing | 3187 //only for tracing |
3392 | |
3393 | 3188 |
3394 return update; | 3189 return update; |
3395 | |
3396 | |
3397 } | 3190 } |
3398 | 3191 |
3399 | 3192 |
3400 /******************************************************************************* | 3193 /******************************************************************************* |
3401 | 3194 |
3402 $Function: sms_cb_find_termination | 3195 $Function: sms_cb_find_termination |
3403 | 3196 |
3404 $Description: This function search for the termination in the link list. | 3197 $Description: This function search for the termination in the link list. |
3405 It jumps from one link to the another link until he founds | 3198 It jumps from one link to the another link until he founds |
3406 the termination "0xFF" | 3199 the termination "0xFF" |
3407 | 3200 |
3408 $Returns: | 3201 $Returns: |
3409 | 3202 |
3410 $Arguments: | 3203 $Arguments: |
3411 | 3204 |
3421 | 3214 |
3422 // only to be sure there is a ever ending loop | 3215 // only to be sure there is a ever ending loop |
3423 i++; | 3216 i++; |
3424 if (i > MAX_STORED_PAGES) | 3217 if (i > MAX_STORED_PAGES) |
3425 return 0xAA; | 3218 return 0xAA; |
3426 | |
3427 } | 3219 } |
3428 | 3220 |
3429 return *used; | 3221 return *used; |
3430 } | 3222 } |
3431 | 3223 |
3433 /******************************************************************************* | 3225 /******************************************************************************* |
3434 | 3226 |
3435 $Function: sms_cb_count_messages | 3227 $Function: sms_cb_count_messages |
3436 | 3228 |
3437 $Description: This function counts messages in the fifo. | 3229 $Description: This function counts messages in the fifo. |
3438 ! Multipage are counted as one page ! | 3230 ! Multipage are counted as one page ! |
3439 | 3231 |
3440 $Returns: | 3232 $Returns: |
3441 | 3233 |
3442 $Arguments: | 3234 $Arguments: |
3443 | 3235 |
3444 *******************************************************************************/ | 3236 *******************************************************************************/ |
3445 UBYTE sms_cb_count_messages ( void ) | 3237 UBYTE sms_cb_count_messages ( void ) |
3446 { | 3238 { |
3447 UBYTE i=0, count=0, used, page, pages, mid, start_flag = 1; //, temp_used; | 3239 UBYTE i=0, count=0, used, page, pages, mid, start_flag = 1; //, temp_used; |
3448 | 3240 |
3449 | |
3450 for (i=0; i<MAX_STORED_PAGES ; i++) | 3241 for (i=0; i<MAX_STORED_PAGES ; i++) |
3451 { | 3242 { |
3452 smscb_data.cb_attributes[i].start_page = 0; | 3243 smscb_data.cb_attributes[i].start_page = 0; |
3453 } | 3244 } |
3454 i=0; | 3245 i=0; |
3455 | |
3456 | 3246 |
3457 if (smscb_data.used_pointer EQ 0xFF) | 3247 if (smscb_data.used_pointer EQ 0xFF) |
3458 { | 3248 { |
3459 //there are no cb messages in the fifo | 3249 //there are no cb messages in the fifo |
3460 return count; | 3250 return count; |
3462 | 3252 |
3463 used = smscb_data.used_pointer; | 3253 used = smscb_data.used_pointer; |
3464 | 3254 |
3465 while ( i < MAX_STORED_PAGES) | 3255 while ( i < MAX_STORED_PAGES) |
3466 { | 3256 { |
3467 | |
3468 //single or multipage ? | 3257 //single or multipage ? |
3469 if(smscb_data.cb_attributes[used].pages EQ 0x01) | 3258 if(smscb_data.cb_attributes[used].pages EQ 0x01) |
3470 { | 3259 { |
3471 //Singlepage | 3260 //Singlepage |
3472 | 3261 |
3507 | 3296 |
3508 count ++; | 3297 count ++; |
3509 return count; | 3298 return count; |
3510 } | 3299 } |
3511 | 3300 |
3512 | |
3513 } | 3301 } |
3514 else //single or multipage ? | 3302 else //single or multipage ? |
3515 { | 3303 { |
3516 | 3304 |
3517 //Multipage | 3305 //Multipage |
3524 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | 3312 // Aug 16, 2004 REF: CRR 24323 Deepa M.D |
3525 TRACE_EVENT_P1("3 set Flag at %d", used); | 3313 TRACE_EVENT_P1("3 set Flag at %d", used); |
3526 /***************************Go-lite Optimization changes end***********************/ | 3314 /***************************Go-lite Optimization changes end***********************/ |
3527 } | 3315 } |
3528 | 3316 |
3529 | |
3530 page = smscb_data.cb_attributes[used].page; | 3317 page = smscb_data.cb_attributes[used].page; |
3531 pages = smscb_data.cb_attributes[used].pages; | 3318 pages = smscb_data.cb_attributes[used].pages; |
3532 mid = smscb_data.cb_attributes[used].mid; | 3319 mid = smscb_data.cb_attributes[used].mid; |
3533 | 3320 |
3534 //check, is it the last message in the link list | 3321 //check, is it the last message in the link list |
3537 { | 3324 { |
3538 // going through the link list | 3325 // going through the link list |
3539 used = smscb_data.cb_attributes[used].next_link; | 3326 used = smscb_data.cb_attributes[used].next_link; |
3540 } | 3327 } |
3541 | 3328 |
3542 | |
3543 //is it the last message in the fifo ? | 3329 //is it the last message in the fifo ? |
3544 if (smscb_data.cb_attributes[used].next_link EQ 0xFF) | 3330 if (smscb_data.cb_attributes[used].next_link EQ 0xFF) |
3545 { | 3331 { |
3546 | |
3547 //The last page, does it still continue or does it complete | 3332 //The last page, does it still continue or does it complete |
3548 //the multipage ? | 3333 //the multipage ? |
3549 if( smscb_data.cb_attributes[used].pages EQ pages && | 3334 if( smscb_data.cb_attributes[used].pages EQ pages && |
3550 smscb_data.cb_attributes[used].page EQ (page+1) && | 3335 smscb_data.cb_attributes[used].page EQ (page+1) && |
3551 smscb_data.cb_attributes[used].page EQ smscb_data.cb_attributes[used].pages) | 3336 smscb_data.cb_attributes[used].page EQ smscb_data.cb_attributes[used].pages) |
3637 } | 3422 } |
3638 } | 3423 } |
3639 | 3424 |
3640 } | 3425 } |
3641 | 3426 |
3642 | |
3643 // only to be sure there is a ever ending loop | 3427 // only to be sure there is a ever ending loop |
3644 i++; | 3428 i++; |
3645 } | 3429 } |
3646 | 3430 |
3647 /* x0045876, 14-Aug-2006 (WR - missing return statement at end of non-void function "sms_cb_count_messages") */ | 3431 /* x0045876, 14-Aug-2006 (WR - missing return statement at end of non-void function "sms_cb_count_messages") */ |
3661 *******************************************************************************/ | 3445 *******************************************************************************/ |
3662 UBYTE sms_cb_count_unread_messages (void) | 3446 UBYTE sms_cb_count_unread_messages (void) |
3663 { | 3447 { |
3664 UBYTE i=0, m=0, used; | 3448 UBYTE i=0, m=0, used; |
3665 | 3449 |
3666 used = smscb_data.used_pointer; | 3450 used = smscb_data.used_pointer; |
3667 | 3451 |
3668 while (smscb_data.cb_attributes[used].next_link NEQ 0xFF) | 3452 while (smscb_data.cb_attributes[used].next_link NEQ 0xFF) |
3669 { | 3453 { |
3670 // count only the unread messages | 3454 // count only the unread messages |
3671 if (smscb_data.cb_attributes[used].status EQ UNREAD_MESSAGE) | 3455 if (smscb_data.cb_attributes[used].status EQ UNREAD_MESSAGE) |
3676 | 3460 |
3677 // only to be sure there is a ever ending loop | 3461 // only to be sure there is a ever ending loop |
3678 i++; | 3462 i++; |
3679 if (i > MAX_STORED_PAGES) | 3463 if (i > MAX_STORED_PAGES) |
3680 return 0xAA; | 3464 return 0xAA; |
3681 | 3465 } |
3682 } | |
3683 | |
3684 | 3466 |
3685 // have a check of the last one | 3467 // have a check of the last one |
3686 if (smscb_data.cb_attributes[used].status EQ UNREAD_MESSAGE) | 3468 if (smscb_data.cb_attributes[used].status EQ UNREAD_MESSAGE) |
3687 m ++; | 3469 m ++; |
3688 | |
3689 | 3470 |
3690 #ifdef DEBUG_SMS_CB | 3471 #ifdef DEBUG_SMS_CB |
3691 /***************************Go-lite Optimization changes Start***********************/ | 3472 /***************************Go-lite Optimization changes Start***********************/ |
3692 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | 3473 // Aug 16, 2004 REF: CRR 24323 Deepa M.D |
3693 TRACE_EVENT_P1("count unread %d ", m); | 3474 TRACE_EVENT_P1("count unread %d ", m); |
3701 /******************************************************************************* | 3482 /******************************************************************************* |
3702 | 3483 |
3703 $Function: sms_cb_give_position_of_msg | 3484 $Function: sms_cb_give_position_of_msg |
3704 | 3485 |
3705 $Description: You give the position (order of the msg from oldest to the latest) | 3486 $Description: You give the position (order of the msg from oldest to the latest) |
3706 and he gives you the real positon of the link list | 3487 and he gives you the real positon of the link list |
3707 | 3488 |
3708 $Returns: | 3489 $Returns: |
3709 | 3490 |
3710 $Arguments: used : current used_pointer | 3491 $Arguments: used : current used_pointer |
3711 | 3492 |
3715 UBYTE i=0, m=0; | 3496 UBYTE i=0, m=0; |
3716 | 3497 |
3717 while ( (smscb_data.cb_attributes[used].next_link NEQ 0xFF) && | 3498 while ( (smscb_data.cb_attributes[used].next_link NEQ 0xFF) && |
3718 (i NEQ positon) ) | 3499 (i NEQ positon) ) |
3719 { | 3500 { |
3720 | |
3721 // going through the link list | 3501 // going through the link list |
3722 used= smscb_data.cb_attributes[used].next_link; | 3502 used= smscb_data.cb_attributes[used].next_link; |
3723 | 3503 |
3724 // only to be sure there is a ever ending loop | 3504 // only to be sure there is a ever ending loop |
3725 if (smscb_data.cb_attributes[used].start_page EQ 0x55) | 3505 if (smscb_data.cb_attributes[used].start_page EQ 0x55) |
3726 { | 3506 { |
3727 i++; | 3507 i++; |
3728 } | 3508 } |
3729 | 3509 |
3730 | |
3731 | |
3732 if (m > MAX_STORED_PAGES) | 3510 if (m > MAX_STORED_PAGES) |
3733 return 0xAA; | 3511 return 0xAA; |
3734 | 3512 |
3735 m++; | 3513 m++; |
3736 | |
3737 } | 3514 } |
3738 | 3515 |
3739 //return the positon in the link list | 3516 //return the positon in the link list |
3740 return used; | 3517 return used; |
3741 } | 3518 } |
3748 | 3525 |
3749 $Returns: | 3526 $Returns: |
3750 | 3527 |
3751 $Arguments: | 3528 $Arguments: |
3752 | 3529 |
3753 | |
3754 *******************************************************************************/ | 3530 *******************************************************************************/ |
3755 int sms_cb_select_read (MfwMnu* m, MfwMnuItem* i) | 3531 int sms_cb_select_read (MfwMnu* m, MfwMnuItem* i) |
3756 { | 3532 { |
3757 | 3533 sms_cb_read_msg (ALL_MESSAGE); |
3758 sms_cb_read_msg (ALL_MESSAGE); | |
3759 return 1; | 3534 return 1; |
3760 } | 3535 } |
3761 | 3536 |
3762 /******************************************************************************* | 3537 /******************************************************************************* |
3763 | 3538 |
3764 $Function: sms_cb_read_msg | 3539 $Function: sms_cb_read_msg |
3765 | 3540 |
3766 $Description: This function prepare to read the cb messages | 3541 $Description: This function prepare to read the cb messages |
3767 It could be call from everywhere. | 3542 It could be call from everywhere. |
3768 | 3543 |
3769 $Returns: | 3544 $Returns: |
3770 | 3545 |
3771 $Arguments: | 3546 $Arguments: |
3772 | 3547 |
3773 | 3548 |
3774 *******************************************************************************/ | 3549 *******************************************************************************/ |
3775 int sms_cb_read_msg (T_SMSCB_STATUS status) | 3550 int sms_cb_read_msg (T_SMSCB_STATUS status) |
3776 { | 3551 { |
3777 UBYTE result; //, i; // RAVI | 3552 UBYTE result; //, i; // RAVI |
3778 | |
3779 | 3553 |
3780 T_MFW_HND win = mfwParent(mfw_header()); | 3554 T_MFW_HND win = mfwParent(mfw_header()); |
3781 | 3555 |
3782 TRACE_FUNCTION("sms_cb_read_msg"); | 3556 TRACE_FUNCTION("sms_cb_read_msg"); |
3783 | 3557 |
3784 | 3558 //count the number of the stored messages in the fifo |
3785 | 3559 |
3786 //count the number of the stored messages in the fifo | 3560 result = sms_cb_count_messages (); |
3787 | 3561 |
3788 result = sms_cb_count_messages (); | 3562 if (result EQ 0x00) |
3789 | 3563 { |
3790 if (result EQ 0x00) | 3564 TRACE_EVENT("sms cb ERROR, there are 0 cb messages"); |
3791 { | 3565 } |
3792 TRACE_EVENT("sms cb ERROR, there are 0 cb messages"); | 3566 |
3793 } | 3567 if((smscb_data.used_pointer EQ 0xFF) || (result EQ 0x00)) |
3794 | 3568 { |
3795 | 3569 TRACE_EVENT("There is no cb message stored"); |
3796 if((smscb_data.used_pointer EQ 0xFF) || (result EQ 0x00)) | 3570 |
3797 { | 3571 info_screen(0, TxtEmptyList ,TxtNull, NULL); |
3798 TRACE_EVENT("There is no cb message stored"); | 3572 } |
3799 | 3573 else |
3800 info_screen(0, TxtEmptyList ,TxtNull, NULL); | 3574 { |
3801 } | |
3802 else | |
3803 { | |
3804 /***************************Go-lite Optimization changes Start***********************/ | 3575 /***************************Go-lite Optimization changes Start***********************/ |
3805 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | 3576 // Aug 16, 2004 REF: CRR 24323 Deepa M.D |
3806 TRACE_EVENT_P1("Total msg%d ", result); | 3577 TRACE_EVENT_P1("Total msg%d ", result); |
3807 /***************************Go-lite Optimization changes end***********************/ | 3578 /***************************Go-lite Optimization changes end***********************/ |
3808 if (result EQ 0xAA) | 3579 if (result EQ 0xAA) |
3809 { | 3580 { |
3810 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); | 3581 TRACE_EVENT("sms cb ERROR, couldnt find the termination"); |
3811 return 0; // RAVI | 3582 return 0; // RAVI |
3812 } | 3583 } |
3813 | 3584 |
3814 | 3585 //keep this value for the callback function from menu-list |
3815 //keep this value for the callback function from menu-list | 3586 smscb_data.total_number = result; |
3816 smscb_data.total_number = result; | 3587 |
3817 | 3588 //set the reason of reading |
3818 //set the reason of reading | 3589 //read "all_message" , "unread_message", .......... |
3819 //read "all_message" , "unread_message", .......... | 3590 smscb_data.current_status = status; |
3820 smscb_data.current_status = status; | 3591 |
3821 | 3592 //fill up the menu list attributes |
3822 //fill up the menu list attributes | 3593 smscb_data.cb_list_attributes = sms_cb_create_list (smscb_data.total_number); |
3823 smscb_data.cb_list_attributes = sms_cb_create_list (smscb_data.total_number); | 3594 |
3824 | 3595 //show the menu list on the screen now |
3825 | 3596 listDisplayListMenu (win, smscb_data.cb_list_attributes ,(ListCbFunc)sms_cb_list_cb,0); |
3826 //show the menu list on the screen now | 3597 |
3827 listDisplayListMenu (win, smscb_data.cb_list_attributes ,(ListCbFunc)sms_cb_list_cb,0); | 3598 } |
3828 | |
3829 } | |
3830 | 3599 |
3831 return 1; | 3600 return 1; |
3832 } | 3601 } |
3833 | 3602 |
3834 | 3603 |
3844 | 3613 |
3845 *******************************************************************************/ | 3614 *******************************************************************************/ |
3846 static ListMenuData * sms_cb_create_list (UBYTE number) | 3615 static ListMenuData * sms_cb_create_list (UBYTE number) |
3847 { | 3616 { |
3848 UBYTE i = 0, used, next_used, number_multipg =1; // RAVI - Removed - page, pages, variable. , control_bit=0; | 3617 UBYTE i = 0, used, next_used, number_multipg =1; // RAVI - Removed - page, pages, variable. , control_bit=0; |
3849 | |
3850 | 3618 |
3851 ListMenuData *list_menu_data = (ListMenuData *)ALLOC_MEMORY (sizeof(ListMenuData)); | 3619 ListMenuData *list_menu_data = (ListMenuData *)ALLOC_MEMORY (sizeof(ListMenuData)); |
3852 | 3620 |
3853 if (list_menu_data EQ 0) | 3621 if (list_menu_data EQ 0) |
3854 { | 3622 { |
3855 TRACE_EVENT ("failed to create the list for cb"); | 3623 TRACE_EVENT ("failed to create the list for cb"); |
3856 return NULL; | 3624 return NULL; |
3857 } | 3625 } |
3858 | 3626 |
3859 | |
3860 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY (number * sizeof (T_MFW_MNU_ITEM)); | 3627 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY (number * sizeof (T_MFW_MNU_ITEM)); |
3861 | |
3862 | 3628 |
3863 if (list_menu_data->List EQ 0) | 3629 if (list_menu_data->List EQ 0) |
3864 { | 3630 { |
3865 TRACE_EVENT ("failed to create the list for cb"); | 3631 TRACE_EVENT ("failed to create the list for cb"); |
3866 return NULL; | 3632 return NULL; |
3867 } | 3633 } |
3868 | 3634 |
3869 TRACE_EVENT ("sms_cb_create_list ()"); | 3635 TRACE_EVENT ("sms_cb_create_list ()"); |
3870 | 3636 |
3871 | 3637 //take the current position in the fifo |
3872 //take the current position in the fifo | 3638 used = smscb_data.used_pointer; |
3873 used = smscb_data.used_pointer; | |
3874 | |
3875 | 3639 |
3876 /* | 3640 /* |
3877 * Fill Menu List | 3641 * Fill Menu List |
3878 */ | 3642 */ |
3879 | 3643 |
3880 | 3644 //until to reach the end of the fifo |
3881 //until to reach the end of the fifo | 3645 while ( smscb_data.cb_attributes[used].next_link NEQ 0xFF ) |
3882 while ( smscb_data.cb_attributes[used].next_link NEQ 0xFF ) | 3646 { |
3883 { | 3647 if (smscb_data.cb_attributes[used].start_page EQ 0x55) |
3884 | 3648 { |
3885 if (smscb_data.cb_attributes[used].start_page EQ 0x55) | 3649 mnuInitDataItem(&list_menu_data->List[i]); |
3650 | |
3651 next_used = used; | |
3652 | |
3653 // going through the link list | |
3654 next_used = smscb_data.cb_attributes[next_used].next_link; | |
3655 | |
3656 //before we put the item for a multipage, we have to | |
3657 //know how long it is. | |
3658 //This is counting the number of pages belongs to a multipage | |
3659 //Every multipage &singlepage starts with the indication 0x55 | |
3660 while(smscb_data.cb_attributes[next_used].start_page NEQ 0x55) | |
3886 { | 3661 { |
3887 mnuInitDataItem(&list_menu_data->List[i]); | 3662 //sprintf(buf, "number_multipg %d in while", number_multipg); |
3888 | 3663 //TRACE_EVENT(buf); |
3889 next_used = used; | 3664 |
3890 | 3665 number_multipg++; |
3891 // going through the link list | 3666 |
3667 //go out when we reach the end of the link list | |
3668 if (smscb_data.cb_attributes[next_used].next_link EQ 0xFF) | |
3669 break; | |
3670 | |
3671 // going through the link list & take the next cb message | |
3892 next_used = smscb_data.cb_attributes[next_used].next_link; | 3672 next_used = smscb_data.cb_attributes[next_used].next_link; |
3893 | 3673 } |
3894 | 3674 |
3895 | 3675 //fill up the header |
3896 //before we put the item for a multipage, we have to | 3676 //"MID" + "available Page" + "Total page" |
3897 //know how long it is. | 3677 //the user release the uncomplete page about the available page. |
3898 //This is counting the number of pages belongs to a multipage | 3678 /*SPR1920, allocate memory for header string*/ |
3899 //Every multipage &singlepage starts with the indication 0x55 | 3679 if (smscb_data.cb_attributes[used].header == NULL) |
3900 while(smscb_data.cb_attributes[next_used].start_page NEQ 0x55) | 3680 smscb_data.cb_attributes[used].header = (char*)ALLOC_MEMORY(sizeof(char)*25); |
3901 { | |
3902 //sprintf(buf, "number_multipg %d in while", number_multipg); | |
3903 //TRACE_EVENT(buf); | |
3904 | |
3905 number_multipg++; | |
3906 | |
3907 //go out when we reach the end of the link list | |
3908 if (smscb_data.cb_attributes[next_used].next_link EQ 0xFF) | |
3909 break; | |
3910 | |
3911 // going through the link list & take the next cb message | |
3912 next_used = smscb_data.cb_attributes[next_used].next_link; | |
3913 } | |
3914 | |
3915 | |
3916 | |
3917 //fill up the header | |
3918 //"MID" + "available Page" + "Total page" | |
3919 //the user release the uncomplete page about the available page. | |
3920 /*SPR1920, allocate memory for header string*/ | |
3921 if (smscb_data.cb_attributes[used].header == NULL) | |
3922 smscb_data.cb_attributes[used].header = (char*)ALLOC_MEMORY(sizeof(char)*25); | |
3923 sprintf(smscb_data.cb_attributes[used].header,"MID%d,%d/%d", smscb_data.cb_attributes[used].mid, | 3681 sprintf(smscb_data.cb_attributes[used].header,"MID%d,%d/%d", smscb_data.cb_attributes[used].mid, |
3924 number_multipg, smscb_data.cb_attributes[used].pages); | 3682 number_multipg, smscb_data.cb_attributes[used].pages); |
3925 | 3683 |
3926 list_menu_data->List[i].str =(char *) smscb_data.cb_attributes[used].header; | 3684 list_menu_data->List[i].str =(char *) smscb_data.cb_attributes[used].header; |
3927 | 3685 |
3928 //set item to visible | 3686 //set item to visible |
3929 if (smscb_data.current_status EQ ALL_MESSAGE) | 3687 if (smscb_data.current_status EQ ALL_MESSAGE) |
3930 { | 3688 { |
3931 //show all the cb messages | 3689 //show all the cb messages |
3932 list_menu_data->List[i].flagFunc = item_flag_none; | 3690 list_menu_data->List[i].flagFunc = item_flag_none; |
3933 } | |
3934 else if (smscb_data.current_status EQ UNREAD_MESSAGE) | |
3935 { | |
3936 if (smscb_data.cb_attributes[used].status EQ smscb_data.current_status) | |
3937 list_menu_data->List[i].flagFunc = item_flag_none; | |
3938 else | |
3939 list_menu_data->List[i].flagFunc = item_flag_hide; | |
3940 } | |
3941 | |
3942 i++; | |
3943 number_multipg = 1; | |
3944 | |
3945 | |
3946 } | 3691 } |
3947 | 3692 else if (smscb_data.current_status EQ UNREAD_MESSAGE) |
3948 // going through the link list & take the next cb message | 3693 { |
3949 used = smscb_data.cb_attributes[used].next_link; | 3694 if (smscb_data.cb_attributes[used].status EQ smscb_data.current_status) |
3950 | 3695 list_menu_data->List[i].flagFunc = item_flag_none; |
3951 // only to be sure there is a ever ending loop | 3696 else |
3952 if (i > MAX_STORED_PAGES) | 3697 list_menu_data->List[i].flagFunc = item_flag_hide; |
3953 return NULL; | 3698 } |
3954 } | 3699 |
3955 | 3700 i++; |
3956 | |
3957 number_multipg = 1; | 3701 number_multipg = 1; |
3958 | 3702 |
3959 //fill up the last message of the fifo !! | 3703 } |
3960 if (smscb_data.cb_attributes[used].start_page EQ 0x55) | 3704 |
3961 { | 3705 // going through the link list & take the next cb message |
3962 mnuInitDataItem(&list_menu_data->List[i]); | 3706 used = smscb_data.cb_attributes[used].next_link; |
3963 | 3707 |
3964 //fill up the header | 3708 // only to be sure there is a ever ending loop |
3965 //"MID" + "available Page" + "Total page" | 3709 if (i > MAX_STORED_PAGES) |
3966 //the user release the uncomplete page about the available page. | 3710 return NULL; |
3967 /*SPR1920, allocate memory for header string*/ | 3711 } |
3968 if (smscb_data.cb_attributes[used].header == NULL) | 3712 |
3969 smscb_data.cb_attributes[used].header = (char*)ALLOC_MEMORY(sizeof(char)*25); | 3713 number_multipg = 1; |
3970 sprintf(smscb_data.cb_attributes[used].header,"MID%d,%d/%d", smscb_data.cb_attributes[used].mid, | 3714 |
3971 number_multipg, smscb_data.cb_attributes[used].pages); | 3715 //fill up the last message of the fifo !! |
3972 | 3716 if (smscb_data.cb_attributes[used].start_page EQ 0x55) |
3973 | 3717 { |
3974 list_menu_data->List[i].str =(char *) smscb_data.cb_attributes[used].header; | 3718 mnuInitDataItem(&list_menu_data->List[i]); |
3975 | 3719 |
3976 //set item to visible | 3720 //fill up the header |
3977 if (smscb_data.current_status EQ ALL_MESSAGE) | 3721 //"MID" + "available Page" + "Total page" |
3978 { | 3722 //the user release the uncomplete page about the available page. |
3979 //show all the cb messages | 3723 /*SPR1920, allocate memory for header string*/ |
3980 list_menu_data->List[i].flagFunc = item_flag_none; | 3724 if (smscb_data.cb_attributes[used].header == NULL) |
3981 } | 3725 smscb_data.cb_attributes[used].header = (char*)ALLOC_MEMORY(sizeof(char)*25); |
3982 else if (smscb_data.current_status EQ UNREAD_MESSAGE) | 3726 sprintf(smscb_data.cb_attributes[used].header,"MID%d,%d/%d", smscb_data.cb_attributes[used].mid, |
3983 { | 3727 number_multipg, smscb_data.cb_attributes[used].pages); |
3984 if (smscb_data.cb_attributes[used].status EQ smscb_data.current_status) | 3728 |
3985 list_menu_data->List[i].flagFunc = item_flag_none; | 3729 list_menu_data->List[i].str =(char *) smscb_data.cb_attributes[used].header; |
3986 else | 3730 |
3987 list_menu_data->List[i].flagFunc = item_flag_hide; | 3731 //set item to visible |
3988 } | 3732 if (smscb_data.current_status EQ ALL_MESSAGE) |
3989 } | 3733 { |
3990 | 3734 //show all the cb messages |
3991 | 3735 list_menu_data->List[i].flagFunc = item_flag_none; |
3992 | 3736 } |
3993 | 3737 else if (smscb_data.current_status EQ UNREAD_MESSAGE) |
3738 { | |
3739 if (smscb_data.cb_attributes[used].status EQ smscb_data.current_status) | |
3740 list_menu_data->List[i].flagFunc = item_flag_none; | |
3741 else | |
3742 list_menu_data->List[i].flagFunc = item_flag_hide; | |
3743 } | |
3744 } | |
3994 | 3745 |
3995 /* | 3746 /* |
3996 * Fill common parameter for list handling | 3747 * Fill common parameter for list handling |
3997 */ | 3748 */ |
3998 | |
3999 | 3749 |
4000 list_menu_data->ListLength = number; | 3750 list_menu_data->ListLength = number; |
4001 list_menu_data->ListPosition = 1; | 3751 list_menu_data->ListPosition = 1; |
4002 list_menu_data->CursorPosition = 1; | 3752 list_menu_data->CursorPosition = 1; |
4003 list_menu_data->SnapshotSize = number; | 3753 list_menu_data->SnapshotSize = number; |
4026 | 3776 |
4027 *******************************************************************************/ | 3777 *******************************************************************************/ |
4028 | 3778 |
4029 static void sms_cb_list_cb(T_MFW_HND win, ListMenuData * ListData) | 3779 static void sms_cb_list_cb(T_MFW_HND win, ListMenuData * ListData) |
4030 { | 3780 { |
4031 UBYTE number, selected_postion; | 3781 UBYTE number, selected_postion; |
4032 int i;/*SPR 1920*/ | 3782 int i;/*SPR 1920*/ |
4033 | 3783 |
4034 | 3784 TRACE_FUNCTION ("sms_cb_list_cb()"); |
4035 TRACE_FUNCTION ("sms_cb_list_cb()"); | |
4036 | 3785 |
4037 switch (ListData->Reason) | 3786 switch (ListData->Reason) |
4038 { | 3787 { |
4039 case LISTS_REASON_SELECT: /* */ | 3788 case LISTS_REASON_SELECT: /* */ |
4040 | 3789 |
4041 | 3790 selected_postion = sms_cb_give_position_of_msg (smscb_data.used_pointer, ListData->ListPosition); |
4042 // | 3791 |
4043 selected_postion = sms_cb_give_position_of_msg (smscb_data.used_pointer, ListData->ListPosition); | 3792 //display the selected message on the scree |
4044 | 3793 sms_cb_show_cb_message (selected_postion); |
4045 | 3794 |
4046 //display the selected message on the scree | 3795 //destroy the list menu |
4047 sms_cb_show_cb_message (selected_postion); | 3796 listsDestroy(ListData->win); |
4048 | 3797 |
4049 | 3798 //counted the total number of cb msg before created the menu list |
4050 //destroy the list menu | 3799 number = smscb_data.total_number; |
4051 listsDestroy(ListData->win); | 3800 |
4052 | 3801 FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes->List, number * sizeof (T_MFW_MNU_ITEM)); |
4053 //counted the total number of cb msg before created the menu list | 3802 FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes, sizeof (ListMenuData)); |
4054 number = smscb_data.total_number; | 3803 /* SPR 1920 if any memory alloacted for list headers, deallocate it*/ |
4055 | 3804 for(i=0; i<MAX_MIDS;i++) |
4056 | 3805 { |
4057 FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes->List, number * sizeof (T_MFW_MNU_ITEM)); | 3806 if (smscb_data.cb_attributes[i].header != NULL) |
4058 FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes, sizeof (ListMenuData)); | 3807 { |
4059 /* SPR 1920 if any memory alloacted for list headers, deallocate it*/ | 3808 FREE_MEMORY((void*)smscb_data.cb_attributes[i].header,sizeof(char)*25); |
4060 for(i=0; i<MAX_MIDS;i++) | 3809 smscb_data.cb_attributes[i].header = NULL; |
4061 { if (smscb_data.cb_attributes[i].header != NULL) | |
4062 { FREE_MEMORY((void*)smscb_data.cb_attributes[i].header,sizeof(char)*25); | |
4063 smscb_data.cb_attributes[i].header = NULL; | |
4064 } | |
4065 } | 3810 } |
4066 break; | 3811 } |
4067 | 3812 break; |
4068 case LISTS_REASON_BACK: /* back to previous menu */ | 3813 |
4069 | 3814 case LISTS_REASON_BACK: /* back to previous menu */ |
4070 TRACE_EVENT("pressed Back-key"); | 3815 |
4071 | 3816 TRACE_EVENT("pressed Back-key"); |
4072 //destroy the list menu | 3817 |
4073 listsDestroy(ListData->win); | 3818 //destroy the list menu |
4074 | 3819 listsDestroy(ListData->win); |
4075 //counted the total number of cb msg before created the menu list | 3820 |
4076 number = smscb_data.total_number; | 3821 //counted the total number of cb msg before created the menu list |
4077 | 3822 number = smscb_data.total_number; |
4078 FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes->List, number * sizeof (T_MFW_MNU_ITEM)); | 3823 |
4079 FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes, sizeof (ListMenuData)); | 3824 FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes->List, number * sizeof (T_MFW_MNU_ITEM)); |
4080 /* SPR 1920 if any memory alloacted for list headers, deallocate it*/ | 3825 FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes, sizeof (ListMenuData)); |
4081 for(i=0; i<MAX_MIDS;i++) | 3826 /* SPR 1920 if any memory alloacted for list headers, deallocate it*/ |
4082 { if (smscb_data.cb_attributes[i].header != NULL) | 3827 for(i=0; i<MAX_MIDS;i++) |
4083 { FREE_MEMORY((void*)smscb_data.cb_attributes[i].header,sizeof(char)*25); | 3828 { |
4084 smscb_data.cb_attributes[i].header = NULL; | 3829 if (smscb_data.cb_attributes[i].header != NULL) |
4085 } | 3830 { |
3831 FREE_MEMORY((void*)smscb_data.cb_attributes[i].header,sizeof(char)*25); | |
3832 smscb_data.cb_attributes[i].header = NULL; | |
4086 } | 3833 } |
4087 break; | 3834 } |
4088 default: | 3835 break; |
3836 default: | |
4089 return; | 3837 return; |
4090 } | 3838 } |
4091 | |
4092 | |
4093 | |
4094 } | 3839 } |
4095 | 3840 |
4096 | 3841 |
4097 /******************************************************************************* | 3842 /******************************************************************************* |
4098 | 3843 |
4105 $Arguments: | 3850 $Arguments: |
4106 | 3851 |
4107 *******************************************************************************/ | 3852 *******************************************************************************/ |
4108 void sms_cb_show_cb_message(UBYTE link_list_position) | 3853 void sms_cb_show_cb_message(UBYTE link_list_position) |
4109 { | 3854 { |
4110 | |
4111 T_MFW_HND win = mfwParent(mfw_header()); | 3855 T_MFW_HND win = mfwParent(mfw_header()); |
4112 | 3856 |
4113 #ifdef NEW_EDITOR | 3857 #ifdef NEW_EDITOR |
4114 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ | 3858 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ |
4115 #else | 3859 #else |
4116 T_EDITOR_DATA editor_data; | 3860 T_EDITOR_DATA editor_data; |
4117 #endif | 3861 #endif |
4118 | 3862 |
4119 UBYTE number_multipg =1, temp, next_used; | 3863 UBYTE number_multipg =1, temp, next_used; |
4120 | 3864 |
4121 //char buf[60]; | 3865 //char buf[60]; |
4122 | 3866 |
4123 next_used = link_list_position; | 3867 next_used = link_list_position; |
4124 | 3868 |
4125 //check : is it the end of the link list | 3869 //check : is it the end of the link list |
4126 //if yes, not necassary to go through the link list | 3870 //if yes, not necassary to go through the link list |
4127 if (smscb_data.cb_attributes[next_used].next_link NEQ 0xFF) | 3871 if (smscb_data.cb_attributes[next_used].next_link NEQ 0xFF) |
4128 { | 3872 { |
4129 // going through the link list | 3873 // going through the link list |
4130 next_used = smscb_data.cb_attributes[next_used].next_link; | 3874 next_used = smscb_data.cb_attributes[next_used].next_link; |
4131 } | 3875 } |
4132 | 3876 |
4133 //if the multipage contain more than one page, find out | 3877 //if the multipage contain more than one page, find out |
4134 //how many pages ! | 3878 //how many pages ! |
4135 //This is counting the number of pages belongs to a multipage | 3879 //This is counting the number of pages belongs to a multipage |
4136 //Every multipage & singlepge starts with the indication 0x55 | 3880 //Every multipage & singlepge starts with the indication 0x55 |
4137 while(smscb_data.cb_attributes[next_used].start_page NEQ 0x55) | 3881 while(smscb_data.cb_attributes[next_used].start_page NEQ 0x55) |
4138 { | 3882 { |
4139 //sprintf(buf, "number_multipg %d", number_multipg); | 3883 //sprintf(buf, "number_multipg %d", number_multipg); |
4140 //TRACE_EVENT(buf); | |
4141 | |
4142 number_multipg++; | |
4143 | |
4144 if (smscb_data.cb_attributes[next_used].next_link EQ 0xFF) | |
4145 break; | |
4146 | |
4147 // going through the link list & take the next cb message | |
4148 next_used = smscb_data.cb_attributes[next_used].next_link; | |
4149 } | |
4150 | |
4151 //sprintf(buf, "number_multipg %d after..", number_multipg); | |
4152 //TRACE_EVENT(buf); | 3884 //TRACE_EVENT(buf); |
4153 | 3885 |
4154 //keep the value for later | 3886 number_multipg++; |
4155 smscb_data.multipage_number = number_multipg; | 3887 |
4156 | 3888 if (smscb_data.cb_attributes[next_used].next_link EQ 0xFF) |
4157 sms_cb_loadEditDefault(&editor_data); | 3889 break; |
4158 | 3890 |
4159 //buffer for the multipage | 3891 // going through the link list & take the next cb message |
4160 smscb_data.multipage = (UBYTE *) ALLOC_MEMORY (OFFSET(smscb_data.multipage_number) * sizeof (UBYTE)); | 3892 next_used = smscb_data.cb_attributes[next_used].next_link; |
4161 | 3893 } |
4162 next_used = link_list_position; | 3894 |
4163 | 3895 //sprintf(buf, "number_multipg %d after..", number_multipg); |
4164 //fill up the new buffer with the first page | 3896 //TRACE_EVENT(buf); |
3897 | |
3898 //keep the value for later | |
3899 smscb_data.multipage_number = number_multipg; | |
3900 | |
3901 sms_cb_loadEditDefault(&editor_data); | |
3902 | |
3903 //buffer for the multipage | |
3904 smscb_data.multipage = (UBYTE *) ALLOC_MEMORY (OFFSET(smscb_data.multipage_number) * sizeof (UBYTE)); | |
3905 | |
3906 next_used = link_list_position; | |
3907 | |
3908 //fill up the new buffer with the first page | |
3909 /*MC SPR 1920, refer to new message array*/ | |
3910 strcat((char *)smscb_data.multipage, smscb_data.messages[next_used]); | |
3911 /*MC end*/ | |
3912 //check : is it the end of the link list | |
3913 //if yes, not necassary to go through the link list | |
3914 if (smscb_data.cb_attributes[next_used].next_link NEQ 0xFF) | |
3915 { | |
3916 // going through the link list | |
3917 next_used = smscb_data.cb_attributes[next_used].next_link; | |
3918 } | |
3919 | |
3920 temp = smscb_data.multipage_number; | |
3921 | |
3922 //if the multipage contain more than one page, fill up the data | |
3923 //to the new buffer | |
3924 while(temp > 1) | |
3925 { | |
4165 /*MC SPR 1920, refer to new message array*/ | 3926 /*MC SPR 1920, refer to new message array*/ |
4166 strcat((char *)smscb_data.multipage, smscb_data.messages[next_used]); | 3927 strcat((char *)smscb_data.multipage, smscb_data.messages[next_used]); |
4167 /*MC end*/ | 3928 /*MC end*/ |
4168 //check : is it the end of the link list | 3929 |
4169 //if yes, not necassary to go through the link list | 3930 // going through the link list & take the next cb message |
4170 if (smscb_data.cb_attributes[next_used].next_link NEQ 0xFF) | 3931 next_used = smscb_data.cb_attributes[next_used].next_link; |
4171 { | 3932 |
4172 // going through the link list | 3933 temp --; |
4173 next_used = smscb_data.cb_attributes[next_used].next_link; | 3934 } |
4174 } | 3935 |
4175 | 3936 //set the mark |
4176 temp = smscb_data.multipage_number; | 3937 smscb_data.cb_attributes[link_list_position].status = READ_MESSAGE; |
4177 | 3938 |
4178 //if the multipage contain more than one page, fill up the data | 3939 /* SPR#1428 - SH - New Editor changes */ |
4179 //to the new buffer | |
4180 while(temp > 1) | |
4181 { | |
4182 | |
4183 /*MC SPR 1920, refer to new message array*/ | |
4184 strcat((char *)smscb_data.multipage, smscb_data.messages[next_used]); | |
4185 /*MC end*/ | |
4186 | |
4187 // going through the link list & take the next cb message | |
4188 next_used = smscb_data.cb_attributes[next_used].next_link; | |
4189 | |
4190 temp --; | |
4191 } | |
4192 | |
4193 //set the mark | |
4194 smscb_data.cb_attributes[link_list_position].status = READ_MESSAGE; | |
4195 | |
4196 /* SPR#1428 - SH - New Editor changes */ | |
4197 #ifdef NEW_EDITOR | 3940 #ifdef NEW_EDITOR |
4198 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, smscb_data.multipage, OFFSET(smscb_data.multipage_number)); | 3941 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, smscb_data.multipage, OFFSET(smscb_data.multipage_number)); |
4199 AUI_edit_SetEvents(&editor_data, link_list_position, TRUE, FOREVER, (T_AUI_EDIT_CB)sms_cb_editor_cb); | 3942 AUI_edit_SetEvents(&editor_data, link_list_position, TRUE, FOREVER, (T_AUI_EDIT_CB)sms_cb_editor_cb); |
4200 AUI_edit_SetTextStr(&editor_data, TxtDelete, TxtSoftBack, 0, NULL); | 3943 AUI_edit_SetTextStr(&editor_data, TxtDelete, TxtSoftBack, 0, NULL); |
4201 AUI_edit_SetAltTextStr(&editor_data, 0, TxtSoftOptions, FALSE, TxtNull); | 3944 AUI_edit_SetAltTextStr(&editor_data, 0, TxtSoftOptions, FALSE, TxtNull); |
4202 AUI_edit_SetMode(&editor_data, ED_MODE_READONLY, ED_CURSOR_NONE); | 3945 AUI_edit_SetMode(&editor_data, ED_MODE_READONLY, ED_CURSOR_NONE); |
4203 AUI_edit_Start(win, &editor_data); | 3946 AUI_edit_Start(win, &editor_data); |
4204 #else /* NEW_EDITOR */ | 3947 #else /* NEW_EDITOR */ |
4205 editor_data.editor_attr.text =(char *) smscb_data.multipage; | 3948 editor_data.editor_attr.text =(char *) smscb_data.multipage; |
4206 | 3949 |
4207 editor_data.Identifier = link_list_position ; //keep the value (selected cb message) | 3950 editor_data.Identifier = link_list_position ; //keep the value (selected cb message) |
4208 editor_data.editor_attr.size = OFFSET(smscb_data.multipage_number); | 3951 editor_data.editor_attr.size = OFFSET(smscb_data.multipage_number); |
4209 editor_data.min_enter = 0; | 3952 editor_data.min_enter = 0; |
4210 editor_data.LeftSoftKey = TxtDelete; | 3953 editor_data.LeftSoftKey = TxtDelete; |
4211 editor_data.AlternateLeftSoftKey = TxtSoftOptions; | 3954 editor_data.AlternateLeftSoftKey = TxtSoftOptions; |
4212 editor_data.RightSoftKey = TxtSoftBack; | 3955 editor_data.RightSoftKey = TxtSoftBack; |
4213 editor_data.Callback = (T_EDIT_CB)sms_cb_editor_cb; | 3956 editor_data.Callback = (T_EDIT_CB)sms_cb_editor_cb; |
4214 editor_data.mode = READ_ONLY_MODE; | 3957 editor_data.mode = READ_ONLY_MODE; |
4215 | 3958 |
4216 editor_start(win, &editor_data); /* start the editor */ | 3959 editor_start(win, &editor_data); /* start the editor */ |
4217 #endif /* NEW_EDITOR */ | 3960 #endif /* NEW_EDITOR */ |
4218 } | 3961 } |
4219 | 3962 |
4220 /******************************************************************************* | 3963 /******************************************************************************* |
4221 | 3964 |
4222 $Function: sms_cb_loadEditDefault | 3965 $Function: sms_cb_loadEditDefault |
4223 | 3966 |
4224 $Description: Configure T_EDITOR_DATA structure with default editor settings. | 3967 $Description: Configure T_EDITOR_DATA structure with default editor settings. |
4225 | 3968 |
4226 $Returns: none | 3969 $Returns: none |
4227 | 3970 |
4228 $Arguments: editor_data - editor data. | 3971 $Arguments: editor_data - editor data. |
4229 | 3972 |
4230 *******************************************************************************/ | 3973 *******************************************************************************/ |
4231 /* SPR#1428 - SH - New Editor changes */ | 3974 /* SPR#1428 - SH - New Editor changes */ |
4232 #ifdef NEW_EDITOR | 3975 #ifdef NEW_EDITOR |
4233 void sms_cb_loadEditDefault (T_AUI_EDITOR_DATA *editor_data) | 3976 void sms_cb_loadEditDefault (T_AUI_EDITOR_DATA *editor_data) |
4234 { | 3977 { |
4235 TRACE_FUNCTION ("sms_cb_loadEditDefault()"); | 3978 TRACE_FUNCTION ("sms_cb_loadEditDefault()"); |
4236 | 3979 |
4237 AUI_edit_SetDefault(editor_data); | 3980 AUI_edit_SetDefault(editor_data); |
4238 AUI_edit_SetMode(editor_data, ED_MODE_ALPHA, ED_CURSOR_NONE); | 3981 AUI_edit_SetMode(editor_data, ED_MODE_ALPHA, ED_CURSOR_NONE); |
4239 AUI_edit_SetTextStr(editor_data, TxtSoftSelect, TxtSoftBack, 0, NULL); | 3982 AUI_edit_SetTextStr(editor_data, TxtSoftSelect, TxtSoftBack, 0, NULL); |
4240 AUI_edit_SetDisplay(editor_data, 0, COLOUR_EDITOR, EDITOR_FONT); | 3983 AUI_edit_SetDisplay(editor_data, 0, COLOUR_EDITOR, EDITOR_FONT); |
4241 | 3984 |
4242 return; | 3985 return; |
4243 } | 3986 } |
4244 #else /* NEW_EDITOR */ | 3987 #else /* NEW_EDITOR */ |
4245 | 3988 |
4246 void sms_cb_loadEditDefault (T_EDITOR_DATA *editor_data) | 3989 void sms_cb_loadEditDefault (T_EDITOR_DATA *editor_data) |
4247 { | 3990 { |
4248 TRACE_FUNCTION ("sms_cb_loadEditDefault()"); | 3991 TRACE_FUNCTION ("sms_cb_loadEditDefault()"); |
4249 | 3992 |
4250 editor_attr_init(&editor_data->editor_attr, NULL, edtCurNone, 0, 0, 0, COLOUR_EDITOR); | 3993 editor_attr_init(&editor_data->editor_attr, NULL, edtCurNone, 0, 0, 0, COLOUR_EDITOR); |
4251 editor_data_init(editor_data, NULL, TxtSoftSelect, TxtSoftBack, 0, 1, ALPHA_MODE, FOREVER); | 3994 editor_data_init(editor_data, NULL, TxtSoftSelect, TxtSoftBack, 0, 1, ALPHA_MODE, FOREVER); |
4252 editor_data->hide = FALSE; | 3995 editor_data->hide = FALSE; |
4253 editor_data->AlternateLeftSoftKey = TxtNull; | 3996 editor_data->AlternateLeftSoftKey = TxtNull; |
4254 editor_data->Identifier = 0; | 3997 editor_data->Identifier = 0; |
4255 editor_data->TextString = NULL; | 3998 editor_data->TextString = NULL; |
4256 editor_data->destroyEditor = TRUE ; | 3999 editor_data->destroyEditor = TRUE ; |
4257 } | 4000 } |
4258 #endif /* NEW_EDITOR */ | 4001 #endif /* NEW_EDITOR */ |
4259 | 4002 |
4260 | 4003 |
4261 /******************************************************************************* | 4004 /******************************************************************************* |
4262 | 4005 |
4263 $Function: sms_cb_editor_cb | 4006 $Function: sms_cb_editor_cb |
4264 | 4007 |
4265 $Description: callback function of the editor | 4008 $Description: callback function of the editor |
4266 | 4009 |
4267 $Returns: none | 4010 $Returns: none |
4268 | 4011 |
4269 $Arguments: | 4012 $Arguments: |
4270 | 4013 |
4271 *******************************************************************************/ | 4014 *******************************************************************************/ |
4272 static void sms_cb_editor_cb (T_MFW_HND win, USHORT Identifier, SHORT reason) | 4015 static void sms_cb_editor_cb (T_MFW_HND win, USHORT Identifier, SHORT reason) |
4286 FREE_MEMORY ((UBYTE *)smscb_data.multipage, OFFSET(smscb_data.multipage_number) * sizeof (UBYTE)); | 4029 FREE_MEMORY ((UBYTE *)smscb_data.multipage, OFFSET(smscb_data.multipage_number) * sizeof (UBYTE)); |
4287 | 4030 |
4288 switch (reason) | 4031 switch (reason) |
4289 { | 4032 { |
4290 case INFO_KCD_LEFT: | 4033 case INFO_KCD_LEFT: |
4291 | |
4292 | 4034 |
4293 //user selected to delete the message | 4035 //user selected to delete the message |
4294 sms_cb_delete_message (smscb_data.cb_attributes[Identifier].mid); | 4036 sms_cb_delete_message (smscb_data.cb_attributes[Identifier].mid); |
4295 | 4037 |
4296 //update the use_pointer after deleting | 4038 //update the use_pointer after deleting |
4299 if (smscb_data.used_pointer EQ smscb_data.free_pointer) | 4041 if (smscb_data.used_pointer EQ smscb_data.free_pointer) |
4300 { | 4042 { |
4301 //no anymore messages stored | 4043 //no anymore messages stored |
4302 smscb_data.used_pointer = 0xFF; | 4044 smscb_data.used_pointer = 0xFF; |
4303 } | 4045 } |
4304 | |
4305 | 4046 |
4306 if (smscb_data.current_status EQ ALL_MESSAGE) | 4047 if (smscb_data.current_status EQ ALL_MESSAGE) |
4307 { | 4048 { |
4308 //go back to the cb list | 4049 //go back to the cb list |
4309 sms_cb_read_msg (smscb_data.current_status); | 4050 sms_cb_read_msg (smscb_data.current_status); |
4310 } | 4051 } |
4311 else if (smscb_data.current_status EQ UNREAD_MESSAGE) | 4052 else if (smscb_data.current_status EQ UNREAD_MESSAGE) |
4312 { | 4053 { |
4313 // if (sms_cb_count_unread_messages ()) | 4054 // if (sms_cb_count_unread_messages ()) |
4314 // sms_cb_read_msg (smscb_data.current_status); | 4055 // sms_cb_read_msg (smscb_data.current_status); |
4315 | |
4316 } | 4056 } |
4317 | |
4318 | |
4319 | 4057 |
4320 break; | 4058 break; |
4321 | 4059 |
4322 case INFO_KCD_RIGHT: | 4060 case INFO_KCD_RIGHT: |
4323 case INFO_KCD_HUP: | 4061 case INFO_KCD_HUP: |
4324 | |
4325 | 4062 |
4326 //only for tracing | 4063 //only for tracing |
4327 #ifdef DEBUG_SMS_CB | 4064 #ifdef DEBUG_SMS_CB |
4328 /***************************Go-lite Optimization changes Start***********************/ | 4065 /***************************Go-lite Optimization changes Start***********************/ |
4329 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | 4066 // Aug 16, 2004 REF: CRR 24323 Deepa M.D |
4345 /*MC*/ | 4082 /*MC*/ |
4346 TRACE_EVENT_P2("Buffer on %s,i:%d ", smscb_data.messages[test], i); | 4083 TRACE_EVENT_P2("Buffer on %s,i:%d ", smscb_data.messages[test], i); |
4347 /***************************Go-lite Optimization changes end***********************/ | 4084 /***************************Go-lite Optimization changes end***********************/ |
4348 #endif //DEBUG_SMS_CB | 4085 #endif //DEBUG_SMS_CB |
4349 | 4086 |
4350 | |
4351 | |
4352 if (smscb_data.current_status EQ ALL_MESSAGE) | 4087 if (smscb_data.current_status EQ ALL_MESSAGE) |
4353 { | 4088 { |
4354 //go back to the cb list | 4089 //go back to the cb list |
4355 /* Nov 14, 2006 REF: OMAPS00099394 x0039928 | 4090 /* Nov 14, 2006 REF: OMAPS00099394 x0039928 |
4356 Fix: List recreation is commented. | 4091 Fix: List recreation is commented. |
4366 default: | 4101 default: |
4367 TRACE_EVENT("Err: Default"); | 4102 TRACE_EVENT("Err: Default"); |
4368 break; | 4103 break; |
4369 } | 4104 } |
4370 } | 4105 } |
4371 | |
4372 | |
4373 |