FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/mmiSatInfo.c @ 164:0b8ebd4dd2ef
mmiSatInfo.c: bogotab fixes
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 18 Nov 2020 23:24:36 +0000 |
parents | b89fc69b96e1 |
children |
comparison
equal
deleted
inserted
replaced
163:d6bc1298a377 | 164:0b8ebd4dd2ef |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 | 2 |
3 CONDAT (UK) | 3 CONDAT (UK) |
4 | 4 |
5 ******************************************************************************** | 5 ******************************************************************************** |
6 | 6 |
7 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 |
8 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. |
9 | 9 |
10 ******************************************************************************** | 10 ******************************************************************************** |
11 | 11 |
12 $Project name: Basic MMI | 12 $Project name: Basic MMI |
13 $Project code: BMI | 13 $Project code: BMI |
14 $Module: SMS | 14 $Module: SMS |
15 $File: mmiSatInfo.c | 15 $File: mmiSatInfo.c |
16 $Revision: 1.0 | 16 $Revision: 1.0 |
17 | 17 |
18 $Author: Condat(UK) | 18 $Author: Condat(UK) |
19 $Date: 25/10/00 | 19 $Date: 25/10/00 |
20 | 20 |
21 ******************************************************************************** | 21 ******************************************************************************** |
22 | 22 |
23 Description: | 23 Description: |
24 | 24 |
31 July 26, 2005 REF: SPR 29520 x0018858 | 31 July 26, 2005 REF: SPR 29520 x0018858 |
32 Issue: 27.22.4.5 Proactive SIM Command: PLAY TONE fails | 32 Issue: 27.22.4.5 Proactive SIM Command: PLAY TONE fails |
33 Solution: The window which used to come up "Please wait" was not getting destroyed. | 33 Solution: The window which used to come up "Please wait" was not getting destroyed. |
34 Care has been taken to check this. | 34 Care has been taken to check this. |
35 | 35 |
36 25/10/00 Original Condat(UK) BMI version. | 36 25/10/00 Original Condat(UK) BMI version. |
37 21/02/03 removed all calls to function sat_add_unicode_tag_if_needed() | 37 21/02/03 removed all calls to function sat_add_unicode_tag_if_needed() |
38 $End | 38 $End |
39 | 39 |
40 *******************************************************************************/ | 40 *******************************************************************************/ |
41 | 41 |
42 #define ENTITY_MFW | 42 #define ENTITY_MFW |
147 T_MFW_HND parent_win; | 147 T_MFW_HND parent_win; |
148 T_MFW_HND win; | 148 T_MFW_HND win; |
149 T_MFW_HND tim; | 149 T_MFW_HND tim; |
150 T_MFW_HND info; | 150 T_MFW_HND info; |
151 T_SAT_CMD *sat_command; /* pointer to sat_command in parent */ | 151 T_SAT_CMD *sat_command; /* pointer to sat_command in parent */ |
152 T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */ | 152 T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */ |
153 char *TextString; | 153 char *TextString; |
154 UBYTE sound_id; /* sound to play */ | 154 UBYTE sound_id; /* sound to play */ |
155 UBYTE device_id; /* device to play sound on */ | 155 UBYTE device_id; /* device to play sound on */ |
156 BYTE volume; /* volume to play */ | 156 BYTE volume; /* volume to play */ |
157 } T_sat_play_tone; | 157 } T_sat_play_tone; |
158 | 158 |
159 typedef enum { | 159 typedef enum { |
160 NOT_SUPPORTED, | 160 NOT_SUPPORTED, |
161 SINGLE_TONE, | 161 SINGLE_TONE, |
171 /******************************************************************************* | 171 /******************************************************************************* |
172 | 172 |
173 $Function: sat_play_tone_create | 173 $Function: sat_play_tone_create |
174 | 174 |
175 $Description: Creation of an instance for the SAT PLAY TONE dialog. Window must | 175 $Description: Creation of an instance for the SAT PLAY TONE dialog. Window must |
176 be available after reception of SAT command, only one instance. | 176 be available after reception of SAT command, only one instance. |
177 | 177 |
178 $Returns: window handle | 178 $Returns: window handle |
179 | 179 |
180 $Arguments: own_window - window handler | 180 $Arguments: own_window - window handler |
181 | 181 |
182 *******************************************************************************/ | 182 *******************************************************************************/ |
183 | 183 |
214 $Function: sat_play_tone_destroy | 214 $Function: sat_play_tone_destroy |
215 | 215 |
216 $Description: Destroy the sat play tone dialog. | 216 $Description: Destroy the sat play tone dialog. |
217 | 217 |
218 | 218 |
219 $Returns: none | 219 $Returns: none |
220 | 220 |
221 $Arguments: own_window - window handler | 221 $Arguments: own_window - window handler |
222 | 222 |
223 *******************************************************************************/ | 223 *******************************************************************************/ |
224 static void sat_play_tone_destroy (T_MFW_HND own_window) | 224 static void sat_play_tone_destroy (T_MFW_HND own_window) |
225 { | 225 { |
226 T_MFW_WIN * win_data = ((T_MFW_HDR *)own_window)->data; | 226 T_MFW_WIN * win_data = ((T_MFW_HDR *)own_window)->data; |
227 T_sat_play_tone * data = (T_sat_play_tone *)win_data->user; | 227 T_sat_play_tone * data = (T_sat_play_tone *)win_data->user; |
228 | 228 |
229 if (own_window == NULL) | 229 if (own_window == NULL) |
230 { | 230 { |
231 TRACE_EVENT ("Error : sat_play_tone_destroy called with NULL Pointer"); | 231 TRACE_EVENT ("Error : sat_play_tone_destroy called with NULL Pointer"); |
232 return; | 232 return; |
233 } | 233 } |
234 | 234 |
235 if (data) | 235 if (data) |
236 { | 236 { |
237 /* | 237 /* |
238 * Delete WIN Handler | 238 * Delete WIN Handler |
250 | 250 |
251 $Function: sat_play_tone_exec | 251 $Function: sat_play_tone_exec |
252 | 252 |
253 $Description: Dialog function for sat_play_tone_exec window. | 253 $Description: Dialog function for sat_play_tone_exec window. |
254 | 254 |
255 $Returns: none | 255 $Returns: none |
256 | 256 |
257 $Arguments: win - window handler | 257 $Arguments: win - window handler |
258 event -window event | 258 event -window event |
259 value - unique id | 259 value - unique id |
260 sat_command - Sat Command. | 260 sat_command - Sat Command. |
261 | 261 |
262 *******************************************************************************/ | 262 *******************************************************************************/ |
263 static void sat_play_tone_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command) | 263 static void sat_play_tone_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command) |
264 { | 264 { |
265 | |
266 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | 265 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; |
267 T_sat_play_tone * data = (T_sat_play_tone *)win_data->user; | 266 T_sat_play_tone * data = (T_sat_play_tone *)win_data->user; |
268 | 267 |
269 T_SAT_TXT * txt; | 268 T_SAT_TXT * txt; |
270 ULONG time = 0; /* x0039928 - Lint warning fix */ | 269 ULONG time = 0; /* x0039928 - Lint warning fix */ |
282 data->sat_command = sat_command; /* save a pointer to the parameter for later use in callbacks */ | 281 data->sat_command = sat_command; /* save a pointer to the parameter for later use in callbacks */ |
283 data->info = NULL; /* NULL means no info running */ | 282 data->info = NULL; /* NULL means no info running */ |
284 data->tim = NULL; /* NULL means no timer running */ | 283 data->tim = NULL; /* NULL means no timer running */ |
285 | 284 |
286 /* | 285 /* |
287 * --> Select the right Sound ID, if not supported: return | 286 * --> Select the right Sound ID, if not supported: return |
288 */ | 287 */ |
289 | 288 |
290 res = sat_set_selected_sound(sat_command->c.tone, data); | 289 res = sat_set_selected_sound(sat_command->c.tone, data); |
291 | 290 |
292 switch (res) | 291 switch (res) |
293 { | 292 { |
303 /* ignore duration for single tones */ | 302 /* ignore duration for single tones */ |
304 TRACE_EVENT("SINGLE_TONE"); | 303 TRACE_EVENT("SINGLE_TONE"); |
305 audio_PlaySoundID(data->device_id, data->sound_id , data->volume, AUDIO_PLAY_ONCE); | 304 audio_PlaySoundID(data->device_id, data->sound_id , data->volume, AUDIO_PLAY_ONCE); |
306 break; | 305 break; |
307 case DURATION: | 306 case DURATION: |
308 TRACE_EVENT("DURATION"); | 307 TRACE_EVENT("DURATION"); |
309 time = sat_calculate_time (sat_command->c.tone.durUnit, sat_command->c.tone.durValue); | 308 time = sat_calculate_time (sat_command->c.tone.durUnit, sat_command->c.tone.durValue); |
310 if (time EQ 0) | 309 if (time EQ 0) |
311 { | 310 { |
312 /* use default tone duration */ | 311 /* use default tone duration */ |
313 audio_PlaySoundID(data->device_id, data->sound_id , data->volume, AUDIO_PLAY_ONCE); | 312 audio_PlaySoundID(data->device_id, data->sound_id , data->volume, AUDIO_PLAY_ONCE); |
322 } | 321 } |
323 break; | 322 break; |
324 } | 323 } |
325 | 324 |
326 /* | 325 /* |
327 * --> display alpha identifier (if any) | 326 * --> display alpha identifier (if any) |
328 */ | 327 */ |
329 txt = &sat_command->c.tone.alpha; | 328 txt = &sat_command->c.tone.alpha; |
330 | 329 |
331 /*SPR#2340 - DS - Handle cases where no alpha id and/or duration is present */ | 330 /*SPR#2340 - DS - Handle cases where no alpha id and/or duration is present */ |
332 | 331 |
333 if (txt->len > 0) /* alpha id supplied in command */ | 332 if (txt->len > 0) /* alpha id supplied in command */ |
350 //July 26, 2005 REF: SPR 29520 x0018858 | 349 //July 26, 2005 REF: SPR 29520 x0018858 |
351 //wrapping enabled for the display. | 350 //wrapping enabled for the display. |
352 display_info.WrapStrings=WRAP_STRING_2; | 351 display_info.WrapStrings=WRAP_STRING_2; |
353 | 352 |
354 /* | 353 /* |
355 * Call Info Screen | 354 * Call Info Screen |
356 */ | 355 */ |
357 data->info = info_dialog (win, &display_info); | 356 data->info = info_dialog (win, &display_info); |
358 /* destroy when dialog times out */ | 357 /* destroy when dialog times out */ |
359 display_info.TextString = data->TextString; | 358 display_info.TextString = data->TextString; |
360 } | 359 } |
361 else if (txt->text EQ 0 && res NEQ SINGLE_TONE) | 360 else if (txt->text EQ 0 && res NEQ SINGLE_TONE) |
406 | 405 |
407 $Function: sat_play_tone_tim_cb | 406 $Function: sat_play_tone_tim_cb |
408 | 407 |
409 $Description: Callback function for the play tone timer. | 408 $Description: Callback function for the play tone timer. |
410 | 409 |
411 $Returns: Execution status | 410 $Returns: Execution status |
412 | 411 |
413 $Arguments: event -window event | 412 $Arguments: event -window event |
414 tc - timer info | 413 tc - timer info |
415 | 414 |
416 *******************************************************************************/ | 415 *******************************************************************************/ |
417 | 416 |
418 static int sat_play_tone_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc) | 417 static int sat_play_tone_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc) |
419 { | 418 { |
435 data->sat_command = NULL; /* signal response issued to info */ | 434 data->sat_command = NULL; /* signal response issued to info */ |
436 | 435 |
437 /* the last one has to destroy the window */ | 436 /* the last one has to destroy the window */ |
438 data->tim = NULL; /* signal end of timer to info */ | 437 data->tim = NULL; /* signal end of timer to info */ |
439 | 438 |
440 /* API/DSM - 04/09/03 - SPR2491 - Add a call to stop the play of the continuous AUDIO sound*/ | 439 /* API/DSM - 04/09/03 - SPR2491 - Add a call to stop the play of the continuous AUDIO sound*/ |
441 audio_StopSoundbyID(data->device_id, data->sound_id); | 440 audio_StopSoundbyID(data->device_id, data->sound_id); |
442 /* API/DSM - 04/09/03 - SPR2491 - END */ | 441 /* API/DSM - 04/09/03 - SPR2491 - END */ |
443 | 442 |
444 | 443 |
445 /* SPR#2340 - DS - If timer has expired, destroy info_dialog if necessary */ | 444 /* SPR#2340 - DS - If timer has expired, destroy info_dialog if necessary */ |
446 if (data->info NEQ NULL) | 445 if (data->info NEQ NULL) |
447 { | 446 { |
451 //The wndow displaying "Please wait was not getting destroyed. | 450 //The wndow displaying "Please wait was not getting destroyed. |
452 //Destroyed the window and initialized to NULL. | 451 //Destroyed the window and initialized to NULL. |
453 //Begin 29520 | 452 //Begin 29520 |
454 //sat_play_tone_destroy(data->info); | 453 //sat_play_tone_destroy(data->info); |
455 dialog_info_destroy(data->info); | 454 dialog_info_destroy(data->info); |
456 data->info = NULL; | 455 data->info = NULL; |
457 //End 29520 | 456 //End 29520 |
458 } | 457 } |
459 | 458 |
460 if (data->info EQ NULL) | 459 if (data->info EQ NULL) |
461 { | 460 { |
470 | 469 |
471 $Function: sat_calculate_time | 470 $Function: sat_calculate_time |
472 | 471 |
473 $Description: Calculate timeout value | 472 $Description: Calculate timeout value |
474 | 473 |
475 $Returns: time out in ms | 474 $Returns: time out in ms |
476 | 475 |
477 $Arguments: unit - number of units | 476 $Arguments: unit - number of units |
478 value - unit value. | 477 value - unit value. |
479 | 478 |
480 *******************************************************************************/ | 479 *******************************************************************************/ |
481 static ULONG sat_calculate_time (UBYTE unit, UBYTE value) | 480 static ULONG sat_calculate_time (UBYTE unit, UBYTE value) |
482 { | 481 { |
483 ULONG result = (ULONG)value; | 482 ULONG result = (ULONG)value; |
504 | 503 |
505 $Function: sat_set_selected_sound | 504 $Function: sat_set_selected_sound |
506 | 505 |
507 $Description: Choose the Sound IDs, return appropriate duration and support info | 506 $Description: Choose the Sound IDs, return appropriate duration and support info |
508 | 507 |
509 $Returns: time out | 508 $Returns: time out |
510 | 509 |
511 $Arguments: tone_tag - tone name | 510 $Arguments: tone_tag - tone name |
512 data - tone info | 511 data - tone info |
513 | 512 |
514 *******************************************************************************/ | 513 *******************************************************************************/ |
515 | |
516 | 514 |
517 static e_TONE_DURATION sat_set_selected_sound (SatTone tone_tag, T_sat_play_tone * data) | 515 static e_TONE_DURATION sat_set_selected_sound (SatTone tone_tag, T_sat_play_tone * data) |
518 | |
519 { | 516 { |
520 e_TONE_DURATION ret; | 517 e_TONE_DURATION ret; |
521 | 518 |
522 TRACE_FUNCTION("sat_set_selected_sound()"); | 519 TRACE_FUNCTION("sat_set_selected_sound()"); |
523 | 520 |
525 | 522 |
526 /* SPR#2340 - DS - Corrected sound Ids. Use defns rather than magic no.s */ | 523 /* SPR#2340 - DS - Corrected sound Ids. Use defns rather than magic no.s */ |
527 | 524 |
528 switch(tone_tag.tone) | 525 switch(tone_tag.tone) |
529 { | 526 { |
530 case SAT_TONE_CALL_SUB_BUSY: | 527 case SAT_TONE_CALL_SUB_BUSY: |
531 data->sound_id = TONES_BUSY /*17*/; | 528 data->sound_id = TONES_BUSY /*17*/; |
532 break; | 529 break; |
533 case SAT_TONE_CONGESTION: | 530 case SAT_TONE_CONGESTION: |
534 data->sound_id = TONES_CONGEST /*18*/; | 531 data->sound_id = TONES_CONGEST /*18*/; |
535 break; | 532 break; |
536 case SAT_TONE_RADIO_PATH_ACK: | 533 case SAT_TONE_RADIO_PATH_ACK: |
537 case SAT_TONE_GENERAL_BEEP: | 534 case SAT_TONE_GENERAL_BEEP: |
538 data->sound_id = TONES_ACK /*20*/; | 535 data->sound_id = TONES_ACK /*20*/; |
539 break; | 536 break; |
540 case SAT_TONE_RADIO_PATH_NOT: | 537 case SAT_TONE_RADIO_PATH_NOT: |
541 data->sound_id = TONES_DROPPED /*19 - also call dropped*/; | 538 data->sound_id = TONES_DROPPED /*19 - also call dropped*/; |
542 break; | 539 break; |
543 case SAT_TONE_DIAL: | 540 case SAT_TONE_DIAL: |
544 case SAT_TONE_CALL_WAITING: | 541 case SAT_TONE_CALL_WAITING: |
545 data->sound_id = TONES_CW /*21*/; | 542 data->sound_id = TONES_CW /*21*/; |
546 break; | 543 break; |
547 case SAT_TONE_POSITIV_ACK: | 544 case SAT_TONE_POSITIV_ACK: |
548 case SAT_TONE_RINGING_TONE: | 545 case SAT_TONE_RINGING_TONE: |
549 data->sound_id = TONES_RINGING_TONE /*0x27*/; | 546 data->sound_id = TONES_RINGING_TONE /*0x27*/; |
550 break; | 547 break; |
551 case SAT_TONE_ERROR: | 548 case SAT_TONE_ERROR: |
552 case SAT_TONE_NEGATIV_ACK: | 549 case SAT_TONE_NEGATIV_ACK: |
553 data->sound_id = TONES_ERROR /*16*/; | 550 data->sound_id = TONES_ERROR /*16*/; |
554 break; | 551 break; |
555 default: | 552 default: |
556 /* Unknown tone value - default is 'general beep' */ | 553 /* Unknown tone value - default is 'general beep' */ |
557 data->sound_id = TONES_KEYBEEP /*0x26*/; | 554 data->sound_id = TONES_KEYBEEP /*0x26*/; |
558 break; | 555 break; |
559 } | 556 } |
560 | 557 |
561 ret = DURATION; | 558 ret = DURATION; |
562 | 559 |
563 TRACE_EVENT_P2("tone %d, sound_id %x", tone_tag.tone, data->sound_id); | 560 TRACE_EVENT_P2("tone %d, sound_id %x", tone_tag.tone, data->sound_id); |
569 | 566 |
570 $Function: sat_info_cb | 567 $Function: sat_info_cb |
571 | 568 |
572 $Description: Callback function information dialog. | 569 $Description: Callback function information dialog. |
573 | 570 |
574 $Returns: none | 571 $Returns: none |
575 | 572 |
576 $Arguments: win - window | 573 $Arguments: win - window |
577 identifier - unique id | 574 identifier - unique id |
578 reason - event | 575 reason - event |
579 | 576 |
580 *******************************************************************************/ | 577 *******************************************************************************/ |
581 | 578 |
582 static void sat_info_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason) | 579 static void sat_info_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason) |
583 { | 580 { |
584 /* PLAY TONE */ | 581 /* PLAY TONE */ |
585 T_MFW_WIN * play_win_data = ((T_MFW_HDR *)win)->data; | 582 T_MFW_WIN * play_win_data = ((T_MFW_HDR *)win)->data; |
586 T_sat_play_tone * play_data = (T_sat_play_tone *)play_win_data->user; | 583 T_sat_play_tone * play_data = (T_sat_play_tone *)play_win_data->user; |
587 T_SAT_RES sat_res; | 584 T_SAT_RES sat_res; |
588 | 585 |
589 if (win EQ NULL) | 586 if (win EQ NULL) |
590 return; | 587 return; |
591 | 588 |
592 TRACE_FUNCTION("sat_info_cb()"); | 589 TRACE_FUNCTION("sat_info_cb()"); |
593 | 590 |
594 TRACE_EVENT_P2("identifier %d, reason %d", identifier, reason); | 591 TRACE_EVENT_P2("identifier %d, reason %d", identifier, reason); |
595 | 592 |
596 /* | 593 /* |
597 * Who has initiated the information screen | 594 * Who has initiated the information screen |
598 */ | 595 */ |
599 switch (identifier) | 596 switch (identifier) |
600 { | 597 { |
601 case SAT_PLAY_TONE: | 598 case SAT_PLAY_TONE: |
602 if ((play_win_data EQ NULL) || (play_data EQ NULL)) | 599 if ((play_win_data EQ NULL) || (play_data EQ NULL)) |
603 return; /* we have been interrupted by sat_play_tone_tim_cb() */ | 600 return; /* we have been interrupted by sat_play_tone_tim_cb() */ |
604 | 601 |
605 switch (reason) | 602 switch (reason) |
606 { | 603 { |
607 case INFO_TIMEOUT: | 604 case INFO_TIMEOUT: |
608 if (play_data->tim NEQ NULL) | 605 if (play_data->tim NEQ NULL) |
609 { | 606 { |
610 /* NOP on short info timeout && infinite: | 607 /* NOP on short info timeout && infinite: |
611 * tone will be stopped and SUCCESS will be signalled by sat_play_tone_tim_cb() | 608 * tone will be stopped and SUCCESS will be signalled by sat_play_tone_tim_cb() |
612 */ | 609 */ |
613 play_data->info = NULL; /* signal the end of info to timer */ | 610 play_data->info = NULL; /* signal the end of info to timer */ |
614 } | 611 } |
615 else | 612 else |
616 { | 613 { |
617 /* no timer (single tone) or timer timed out: we are the last */ | 614 /* no timer (single tone) or timer timed out: we are the last */ |
618 if (play_data->sat_command NEQ NULL) | 615 if (play_data->sat_command NEQ NULL) |
619 { | 616 { |
634 { | 631 { |
635 /* timer has not yet elapsed, stop it */ | 632 /* timer has not yet elapsed, stop it */ |
636 tim_stop (play_data->tim); | 633 tim_stop (play_data->tim); |
637 } | 634 } |
638 | 635 |
639 /* API/DSM - 04/09/03 - SPR2491 - Add a call to stop the play of the continuous AUDIO sound*/ | 636 /* API/DSM - 04/09/03 - SPR2491 - Add a call to stop the play of the continuous AUDIO sound*/ |
640 audio_StopSoundbyID(play_data->device_id, play_data->sound_id); | 637 audio_StopSoundbyID(play_data->device_id, play_data->sound_id); |
641 /* API/DSM - 04/09/03 - SPR2491 - END */ | 638 /* API/DSM - 04/09/03 - SPR2491 - END */ |
642 | 639 |
643 if (play_data->sat_command NEQ NULL) | 640 if (play_data->sat_command NEQ NULL) |
644 { | 641 { |
645 /* response not yet issued */ | 642 /* response not yet issued */ |
646 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_ABORT; | 643 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_ABORT; |