FreeCalypso > hg > tcs211-c139
comparison g23m/condat/ms/src/bmi/MmiVoiceMemo.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /******************************************************************************* | |
2 | |
3 CONDAT (UK) | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Condat (UK) Ltd and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: Basic MMI | |
13 $Project code: BMI (6349) | |
14 $Module: VOICEMEMO | |
15 $File: MmiVoiceMemo.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 09/04/01 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: | |
24 | |
25 This provides the start code for the MMI | |
26 | |
27 ******************************************************************************** | |
28 $History: MmiVoiceMemo.c | |
29 | |
30 09/04/01 Original Condat(UK) BMI version. | |
31 | |
32 $End | |
33 | |
34 *******************************************************************************/ | |
35 | |
36 | |
37 | |
38 | |
39 /******************************************************************************* | |
40 | |
41 Include files | |
42 | |
43 *******************************************************************************/ | |
44 #define ENTITY_MFW | |
45 | |
46 /* includes */ | |
47 #include <string.h> | |
48 #include <stdio.h> | |
49 #include <stdlib.h> | |
50 | |
51 #include "typedefs.h" | |
52 #include "vsi.h" | |
53 #include "pei.h" | |
54 #include "custom.h" | |
55 #include "gsm.h" | |
56 | |
57 #include "mfw_sys.h" | |
58 | |
59 #include "prim.h" | |
60 | |
61 #include "cus_aci.h" | |
62 | |
63 #include "mfw_mfw.h" | |
64 #include "mfw_win.h" | |
65 #include "mfw_kbd.h" | |
66 /* SPR#1428 - SH - New Editor changes */ | |
67 #ifndef NEW_EDITOR | |
68 #include "mfw_edt.h" | |
69 #endif | |
70 #include "mfw_lng.h" | |
71 #include "mfw_tim.h" | |
72 #include "mfw_icn.h" | |
73 #include "mfw_mnu.h" | |
74 #include "mfw_phb.h" | |
75 #include "mfw_cm.h" | |
76 #include "mfw_sim.h" | |
77 #include "mfw_nm.h" | |
78 #include "mfw_sat.h" | |
79 #include "mfw_phb.h" | |
80 #include "ksd.h" | |
81 #include "psa.h" | |
82 #include "mfw_sms.h" | |
83 #include "mfw_cphs.h" | |
84 #include "mfw_sat.h" | |
85 | |
86 #include "dspl.h" | |
87 | |
88 | |
89 #include "MmiMmi.h" | |
90 #include "MmiDummy.h" | |
91 #include "MmiDialogs.h" | |
92 #include "MmiLists.h" | |
93 #include "MmiIdle.h" | |
94 #include "MmiSoftKeys.h" | |
95 #include "Mmiicons.h" | |
96 #include "MmiMenu.h" | |
97 #include "MmiMain.h" | |
98 #include "MmiStart.h" | |
99 #include "MmiPins.h" | |
100 #include "MmiSettings.h" | |
101 | |
102 #include "gdi.h" | |
103 #include "audio.h" | |
104 #include "MmiSounds.h" | |
105 #include "MmiResources.h" | |
106 #include "mmiColours.h" | |
107 | |
108 //#include "vmd.h" | |
109 #include "MmiVoiceMemo.h" | |
110 #include "mfw_ffs.h" | |
111 | |
112 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
113 #ifndef NEPTUNE_BOARD | |
114 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
115 #include "Audio/audio_api.h" | |
116 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
117 #endif /* NEPTUNE_BOARD*/ | |
118 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
119 | |
120 #include "mfw_aud.h" | |
121 | |
122 /******************************************************************************* | |
123 | |
124 internal data | |
125 | |
126 *******************************************************************************/ | |
127 | |
128 /* | |
129 * Internal events | |
130 */ | |
131 #define VM_INIT 500 | |
132 #define VM_DESTROY 501 | |
133 #define VM_PLAY 502 | |
134 #define VM_RECORD 503 | |
135 #define VM_DELETE_BUFFER 504 | |
136 | |
137 #define VOICE_MEMO_MAX_DURATION 10 // 10 Secs | |
138 | |
139 | |
140 typedef struct | |
141 { | |
142 T_MMI_CONTROL mmi_control; | |
143 T_MFW_HND parent_win; | |
144 T_MFW_HND info_win; | |
145 T_MFW_HND info_tim; | |
146 T_MFW_HND info_kbd; | |
147 USHORT Identifier; | |
148 USHORT time; | |
149 char elapsed_time[7]; | |
150 int play_sk2; | |
151 } T_voice_memo; | |
152 | |
153 | |
154 | |
155 | |
156 /******************************************************************************* | |
157 | |
158 Local prototypes | |
159 | |
160 *******************************************************************************/ | |
161 | |
162 | |
163 T_MFW_HND voice_memo_start (T_MFW_HND parent_win, SHORT ID); | |
164 static T_MFW_HND voice_memo_create (T_MFW_HND parent_win); | |
165 static void voice_memo_destroy (T_MFW_HND own_window); | |
166 static void voice_memo (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
167 static int voice_memo_win_cb (T_MFW_EVENT event, T_MFW_WIN * win); | |
168 static T_MFW_CB voice_memo_tim_cb (T_MFW_EVENT event, T_MFW_TIM * tc); | |
169 static int voice_memo_kbd_cb (T_MFW_EVENT event, T_MFW_KBD * keyboard); | |
170 static void voice_memo_dialog_create(T_MFW_HND win, int str1, int str2); | |
171 void voice_memo_dialog_cb (T_MFW_HND win, UBYTE identifier, UBYTE reason); | |
172 | |
173 /* | |
174 ** Rivera Callback functions | |
175 */ | |
176 static void voice_memo_riv_record_cb(void *parameter); | |
177 static void voice_memo_riv_play_cb(void *parameter); | |
178 | |
179 | |
180 | |
181 /******************************************************************************* | |
182 | |
183 $Function: voice_memo_init | |
184 | |
185 $Description: | |
186 | |
187 $Returns: | |
188 | |
189 $Arguments: | |
190 | |
191 *******************************************************************************/ | |
192 GLOBAL void voice_memo_init (void) | |
193 { | |
194 TRACE_FUNCTION ("voice_memo_init()"); | |
195 } | |
196 | |
197 /******************************************************************************* | |
198 | |
199 $Function: voice_memo_exit | |
200 | |
201 $Description: | |
202 | |
203 | |
204 $Returns: | |
205 | |
206 $Arguments: | |
207 | |
208 *******************************************************************************/ | |
209 GLOBAL void voice_memo_exit (void) | |
210 { | |
211 TRACE_FUNCTION ("voice_memo_exit()"); | |
212 | |
213 } | |
214 | |
215 | |
216 | |
217 | |
218 /******************************************************************************* | |
219 | |
220 $Function: voice_memo_play | |
221 | |
222 $Description: | |
223 | |
224 $Returns: | |
225 | |
226 $Arguments: | |
227 | |
228 *******************************************************************************/ | |
229 GLOBAL int voice_memo_play (MfwMnu* m, MfwMnuItem* i) | |
230 { | |
231 T_MFW_HND win = mfw_parent(mfw_header()); | |
232 | |
233 TRACE_FUNCTION ("voice_memo_play()"); | |
234 | |
235 //create a new voice memo dialog | |
236 voice_memo_start (win, VM_PLAY); | |
237 return 1; // ADDED BY RAVI - 29-11-2005 | |
238 } | |
239 | |
240 | |
241 | |
242 /******************************************************************************* | |
243 | |
244 $Function: voice_memo_record | |
245 | |
246 $Description: | |
247 | |
248 | |
249 $Returns: | |
250 | |
251 $Arguments: | |
252 | |
253 *******************************************************************************/ | |
254 GLOBAL int voice_memo_record (MfwMnu* m, MfwMnuItem* i) | |
255 { | |
256 | |
257 T_MFW_HND win = mfw_parent(mfw_header()); | |
258 | |
259 | |
260 TRACE_FUNCTION ("voice_memo_record()"); | |
261 | |
262 //create a new voice memo dialog | |
263 voice_memo_start (win, VM_RECORD); | |
264 return 1; // RAVI - 29-11-2005 | |
265 } | |
266 | |
267 | |
268 /******************************************************************************* | |
269 | |
270 $Function: voice_memo_start | |
271 | |
272 $Description: create a new voicememo dialog | |
273 | |
274 $Returns: Dialogue info win | |
275 | |
276 $Arguments: parent win, display info | |
277 | |
278 *******************************************************************************/ | |
279 T_MFW_HND voice_memo_start (T_MFW_HND parent_win, SHORT ID) | |
280 { | |
281 T_MFW_HND win; | |
282 | |
283 win = voice_memo_create (parent_win); | |
284 | |
285 if (win NEQ NULL) | |
286 { | |
287 SEND_EVENT (win, VM_INIT, ID, 0); | |
288 } | |
289 return win; | |
290 } | |
291 | |
292 | |
293 | |
294 /******************************************************************************* | |
295 | |
296 $Function: vocie_memo_create | |
297 | |
298 $Description: Creation of window | |
299 | |
300 $Returns: Dialogue info win | |
301 | |
302 $Arguments: parent win | |
303 | |
304 *******************************************************************************/ | |
305 static T_MFW_HND voice_memo_create (T_MFW_HND parent_win) | |
306 { | |
307 T_MFW_WIN * win_data; | |
308 T_voice_memo * data = (T_voice_memo *)ALLOC_MEMORY (sizeof (T_voice_memo)); | |
309 | |
310 TRACE_FUNCTION ("vocie_memo_create()"); | |
311 | |
312 data->info_win = win_create (parent_win, 0, E_WIN_VISIBLE, (T_MFW_CB)voice_memo_win_cb); | |
313 | |
314 if (data->info_win EQ 0) | |
315 return 0; | |
316 | |
317 /* | |
318 * Create window handler | |
319 */ | |
320 data->mmi_control.dialog = (T_DIALOG_FUNC)voice_memo; | |
321 data->mmi_control.data = data; | |
322 data->parent_win = parent_win; | |
323 win_data = ((T_MFW_HDR *)data->info_win)->data; | |
324 win_data->user = (void *)data; | |
325 | |
326 /* | |
327 ** Initialise values to safe defualts | |
328 */ | |
329 data->play_sk2 = TxtSoftBack; | |
330 | |
331 /* | |
332 * return window handle | |
333 */ | |
334 return data->info_win; | |
335 } | |
336 | |
337 | |
338 /******************************************************************************* | |
339 | |
340 $Function: voice_memo_destroy | |
341 | |
342 $Description: Destruction of an dialog | |
343 | |
344 $Returns: void | |
345 | |
346 $Arguments: win | |
347 | |
348 *******************************************************************************/ | |
349 void voice_memo_destroy (T_MFW_HND own_window) | |
350 { | |
351 T_MFW_WIN * win = ((T_MFW_HDR *)own_window)->data; | |
352 T_voice_memo * data = (T_voice_memo *)win->user; | |
353 | |
354 TRACE_FUNCTION ("voice_memo_destroy()"); | |
355 | |
356 if (own_window == NULL) | |
357 { | |
358 TRACE_EVENT ("Error : Called with NULL Pointer"); | |
359 return; | |
360 } | |
361 | |
362 if (data) | |
363 { | |
364 /* | |
365 * Exit TIMER & KEYBOARD Handle | |
366 */ | |
367 kbd_delete (data->info_kbd); | |
368 tim_delete (data->info_tim); | |
369 | |
370 /* | |
371 * Delete WIN Handler | |
372 */ | |
373 win_delete (data->info_win); | |
374 /* | |
375 * Free Memory | |
376 */ | |
377 FREE_MEMORY ((void *)data, sizeof (T_voice_memo)); | |
378 } | |
379 } | |
380 | |
381 | |
382 | |
383 /******************************************************************************* | |
384 | |
385 $Function: voice_memo | |
386 | |
387 $Description: Dialog function for voice memo dialog | |
388 | |
389 $Returns: void | |
390 | |
391 $Arguments: win, window handle event, value, parameter | |
392 | |
393 *******************************************************************************/ | |
394 void voice_memo (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
395 { | |
396 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
397 T_voice_memo * data = (T_voice_memo *)win_data->user; | |
398 | |
399 // T_DISPLAY_DATA display_info; // RAVI | |
400 | |
401 SHORT mfw_aud_retVal; | |
402 | |
403 data->Identifier = value; | |
404 | |
405 TRACE_FUNCTION ("voice_memo()"); | |
406 | |
407 switch (event) | |
408 { | |
409 case VM_INIT: | |
410 TRACE_EVENT ("VM_INIT()"); | |
411 /* | |
412 * Initialize dialog | |
413 */ | |
414 | |
415 /* | |
416 * Create timer and keyboard handler | |
417 */ | |
418 data->info_tim = tim_create (win, 1000, (T_MFW_CB)voice_memo_tim_cb); | |
419 data->info_kbd = kbd_create (win, KEY_ALL, (T_MFW_CB)voice_memo_kbd_cb); | |
420 | |
421 | |
422 if (value EQ VM_PLAY) | |
423 { | |
424 TRACE_EVENT ("VM_PLAY()"); | |
425 | |
426 mfw_aud_retVal = mfw_aud_vm_start_playback(voice_memo_riv_play_cb); | |
427 | |
428 if (mfw_aud_retVal == MFW_AUD_VM_OK) | |
429 { | |
430 //start the second timer | |
431 data->time = 0; | |
432 tim_start (data->info_tim); | |
433 | |
434 //Set the Right Softkey Id | |
435 data->play_sk2 = TxtStop; | |
436 } | |
437 else | |
438 { | |
439 if (mfw_aud_retVal == MFW_AUD_VM_MEM_EMPTY) | |
440 { | |
441 voice_memo_dialog_create(win, TxtRecording, TxtEmpty); | |
442 } | |
443 else | |
444 { | |
445 //Display a dialog and exit | |
446 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_start_playback failed with return value : %d", mfw_aud_retVal); | |
447 | |
448 voice_memo_dialog_create( win, TxtPlayback, TxtFailed); | |
449 } | |
450 } | |
451 } | |
452 else if (value EQ VM_RECORD) | |
453 { | |
454 TRACE_FUNCTION ("VM_RECORD()"); | |
455 | |
456 mfw_aud_retVal = mfw_aud_vm_start_record(VOICE_MEMO_MAX_DURATION, voice_memo_riv_record_cb); | |
457 | |
458 // If the Riviera call failed | |
459 if (mfw_aud_retVal == MFW_AUD_VM_OK) | |
460 { | |
461 //start the second timer | |
462 data->time = 0; | |
463 tim_start (data->info_tim); | |
464 } | |
465 else | |
466 { | |
467 if (mfw_aud_retVal == MFW_AUD_VM_MEM_FULL) | |
468 { | |
469 TRACE_EVENT ("memory full "); | |
470 /* RAVI - 20-1-2006 */ | |
471 /* Silent Implementation */ | |
472 #ifdef NEPTUNE_BOARD | |
473 audio_PlaySoundID(0, TONES_KEYBEEP, getCurrentVoulmeSettings(), | |
474 AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
475 #else | |
476 /* play Keybeep */ | |
477 audio_PlaySoundID(0, TONES_KEYBEEP, 200, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
478 #endif | |
479 /* END RAVI */ | |
480 | |
481 voice_memo_dialog_create( win, TxtRecording, TxtFull ); | |
482 } | |
483 else | |
484 { | |
485 //Display a dialog and exit | |
486 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_start_record failed with return value : %d", mfw_aud_retVal); | |
487 | |
488 voice_memo_dialog_create( win, TxtRecording, TxtFailed ); | |
489 } | |
490 } | |
491 } | |
492 win_show (win); | |
493 break; | |
494 | |
495 | |
496 //if the user selected to clear the Voicememo buffer | |
497 case VM_DELETE_BUFFER: | |
498 voice_memo_dialog_create( win, TxtDeleted, TxtNull ); | |
499 | |
500 /* | |
501 ** Delete the voice memo file | |
502 */ | |
503 mfw_aud_vm_delete_file(); | |
504 break; | |
505 | |
506 case VM_DESTROY: | |
507 voice_memo_destroy(win); | |
508 break; | |
509 } | |
510 } | |
511 | |
512 /******************************************************************************* | |
513 | |
514 $Function: voice_memo_win_cb | |
515 | |
516 $Description: Callback function for information dialog | |
517 | |
518 $Returns: void | |
519 | |
520 $Arguments: window handle event, win | |
521 *******************************************************************************/ | |
522 static int voice_memo_win_cb (T_MFW_EVENT event, T_MFW_WIN * win) | |
523 { | |
524 T_voice_memo * data = (T_voice_memo *)win->user; | |
525 | |
526 TRACE_FUNCTION ("voice_memo_win_cb()"); | |
527 | |
528 if (data EQ 0) | |
529 return 1; | |
530 | |
531 switch (event) | |
532 { | |
533 case E_WIN_VISIBLE: | |
534 if (win->flags & E_WIN_VISIBLE) | |
535 { | |
536 /* | |
537 * Clear Screen | |
538 */ | |
539 dspl_ClearAll(); | |
540 | |
541 switch (data->Identifier) | |
542 { | |
543 case VM_PLAY: | |
544 /* | |
545 * Print the information screen | |
546 */ | |
547 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtPlayback); | |
548 | |
549 /* | |
550 * Print the elapsed time | |
551 */ | |
552 displayAlignedText(LEFT, Mmi_layout_line(2), 0, data->elapsed_time); | |
553 | |
554 /* | |
555 * Print softkeys | |
556 */ | |
557 displaySoftKeys(TxtDelete, data->play_sk2); | |
558 break; | |
559 | |
560 case VM_RECORD: | |
561 /* | |
562 * Print the information screen | |
563 */ | |
564 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtRecording); | |
565 | |
566 /* | |
567 * Print the elapsed time | |
568 */ | |
569 displayAlignedText(LEFT, Mmi_layout_line(2), 0, data->elapsed_time); | |
570 | |
571 /* | |
572 * Print softkeys | |
573 */ | |
574 displaySoftKeys(TxtStop, '\0'); | |
575 break; | |
576 } | |
577 | |
578 } | |
579 break; | |
580 | |
581 default: | |
582 return 0; | |
583 } | |
584 return 1; | |
585 } | |
586 | |
587 | |
588 /******************************************************************************* | |
589 | |
590 $Function: voice_memo_tim_cb | |
591 | |
592 $Description: Callback function for the voice_memo timer. | |
593 | |
594 | |
595 $Returns: MFW event handler | |
596 | |
597 $Arguments: window handle event, timer control block | |
598 | |
599 *******************************************************************************/ | |
600 static T_MFW_CB voice_memo_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc) | |
601 { | |
602 T_MFW_HND win = mfw_parent (mfw_header()); | |
603 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
604 T_voice_memo * data = (T_voice_memo *)win_data->user; | |
605 | |
606 SHORT mfw_aud_retVal; | |
607 | |
608 // char buf[40]; // RAVI | |
609 | |
610 TRACE_FUNCTION ("voice_memo_tim_cb()"); | |
611 | |
612 switch (data->Identifier) | |
613 { | |
614 case VM_PLAY: | |
615 //the max. playback time is 10 second | |
616 if (data->time < mfw_aud_vm_get_duration()) | |
617 { | |
618 TRACE_EVENT ("continue the second timer"); | |
619 | |
620 data->time ++; | |
621 // it shows here the elapsed time | |
622 sprintf(data->elapsed_time,"%02d sec", data->time); | |
623 | |
624 TRACE_EVENT (data->elapsed_time); | |
625 | |
626 //continue the second timer | |
627 tim_start (data->info_tim); | |
628 } | |
629 else | |
630 { | |
631 data->play_sk2 = TxtSoftBack; | |
632 #ifndef _SIMULATION_ | |
633 /* | |
634 ** Stop playing the Voice Memo. | |
635 */ | |
636 mfw_aud_retVal = mfw_aud_vm_stop_playback(voice_memo_riv_play_cb); | |
637 | |
638 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
639 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_stop_playback failed with return value : %d", mfw_aud_retVal); | |
640 #else | |
641 TRACE_EVENT("call mfw_aud_vm_stop_playback()"); | |
642 #endif | |
643 } | |
644 break; | |
645 | |
646 | |
647 case VM_RECORD: | |
648 | |
649 data->time++; | |
650 | |
651 if (data->time < VOICE_MEMO_MAX_DURATION) | |
652 { | |
653 TRACE_EVENT ("continue the second timer"); | |
654 | |
655 // it shows here the remainig time | |
656 sprintf(data->elapsed_time,"%02d sec", (VOICE_MEMO_MAX_DURATION - data->time)); | |
657 | |
658 TRACE_EVENT (data->elapsed_time); | |
659 | |
660 //continue the second timer | |
661 tim_start (data->info_tim); | |
662 } | |
663 else | |
664 { | |
665 mfw_aud_vm_set_duration(VOICE_MEMO_MAX_DURATION); | |
666 | |
667 #ifndef _SIMULATION_ | |
668 /* | |
669 ** Stop recording the Voice Memo. | |
670 */ | |
671 mfw_aud_retVal = mfw_aud_vm_stop_record(voice_memo_riv_record_cb); | |
672 | |
673 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
674 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_stop_record failed with return value : %d", mfw_aud_retVal); | |
675 /* RAVI - 20-1-2006 */ | |
676 #ifdef NEPTUNE_BOARD | |
677 audio_PlaySoundID(0, TONES_KEYBEEP, getCurrentVoulmeSettings(), | |
678 AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
679 #else | |
680 /*the voice memo is now full, show "memory full" */ | |
681 audio_PlaySoundID(0, TONES_KEYBEEP, 200, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
682 #endif | |
683 /* END RAVI */ | |
684 | |
685 voice_memo_dialog_create( win, TxtRecording, TxtFull ); | |
686 #else | |
687 TRACE_EVENT("call mfw_aud_vm_stop_record()"); | |
688 #endif | |
689 } | |
690 break; | |
691 } | |
692 | |
693 //Update the screen | |
694 winShow(win); | |
695 | |
696 return 0; | |
697 } | |
698 | |
699 | |
700 /******************************************************************************* | |
701 | |
702 $Function: voice_memo_kbd_cb | |
703 | |
704 $Description: Keyboard event handler | |
705 | |
706 $Returns: status int | |
707 | |
708 $Arguments: window handle event, keyboard control block | |
709 | |
710 *******************************************************************************/ | |
711 | |
712 static int voice_memo_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard) | |
713 { | |
714 T_MFW_HND win = mfw_parent (mfw_header()); | |
715 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
716 T_voice_memo * data = (T_voice_memo *)win_data->user; | |
717 | |
718 USHORT Identifier = data->Identifier; | |
719 SHORT mfw_aud_retVal; | |
720 | |
721 | |
722 TRACE_FUNCTION("voice_memo_kbd_cb"); | |
723 | |
724 switch (keyboard->code) | |
725 { | |
726 case KCD_HUP: | |
727 case KCD_LEFT: | |
728 if (Identifier EQ VM_PLAY) | |
729 { | |
730 #ifndef _SIMULATION_ | |
731 /* | |
732 ** Stop playing the Voice Memo and Delete it. | |
733 */ | |
734 mfw_aud_retVal = mfw_aud_vm_stop_playback(voice_memo_riv_play_cb); | |
735 | |
736 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
737 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_stop_playback failed with return value : %d", mfw_aud_retVal); | |
738 #else | |
739 TRACE_EVENT("call mfw_aud_vm_stop_playback()"); | |
740 #endif | |
741 //delete the voicememo buffer | |
742 mfw_aud_vm_set_duration(0); | |
743 | |
744 //user selected the delete-key | |
745 SEND_EVENT (win, VM_DELETE_BUFFER, 0, 0); | |
746 } | |
747 else if (Identifier EQ VM_RECORD) | |
748 { | |
749 mfw_aud_vm_set_duration(data->time); | |
750 | |
751 #ifndef _SIMULATION_ | |
752 /* | |
753 ** Stop recording the Voice Memo. | |
754 */ | |
755 mfw_aud_retVal = mfw_aud_vm_stop_record(voice_memo_riv_record_cb); | |
756 | |
757 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
758 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_stop_record failed with return value : %d", mfw_aud_retVal); | |
759 | |
760 //go back to the previous dialog | |
761 SEND_EVENT (win, VM_DESTROY, 0, 0); | |
762 #else | |
763 TRACE_EVENT("call mfw_aud_vm_stop_record()"); | |
764 #endif | |
765 } | |
766 break; | |
767 | |
768 case KCD_RIGHT: | |
769 if (Identifier EQ VM_PLAY) | |
770 { | |
771 | |
772 #ifndef _SIMULATION_ | |
773 /* | |
774 ** Stop playing the Voice Memo. | |
775 */ | |
776 mfw_aud_retVal = mfw_aud_vm_stop_playback(voice_memo_riv_play_cb); | |
777 | |
778 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
779 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_stop_playback failed with return value : %d", mfw_aud_retVal); | |
780 #else | |
781 TRACE_EVENT("call mfw_aud_vm_stop_playback()"); | |
782 #endif | |
783 | |
784 //go back to the previous dialog | |
785 SEND_EVENT (win, VM_DESTROY, 0, 0); | |
786 } | |
787 else if (Identifier EQ VM_RECORD) | |
788 { | |
789 //nothing | |
790 } | |
791 break; | |
792 | |
793 default: | |
794 break; | |
795 } | |
796 return MFW_EVENT_CONSUMED; | |
797 } | |
798 | |
799 | |
800 /******************************************************************************* | |
801 | |
802 $Function: voice_memo_dialog_cb | |
803 | |
804 $Description: | |
805 | |
806 $Returns: | |
807 | |
808 $Arguments: | |
809 | |
810 *******************************************************************************/ | |
811 void voice_memo_dialog_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason) | |
812 { | |
813 TRACE_FUNCTION ("voice_memo_dialog_cb()"); | |
814 | |
815 switch (reason) | |
816 { | |
817 case INFO_KCD_LEFT: | |
818 /* no break; */ | |
819 case INFO_TIMEOUT: | |
820 /* no break; */ | |
821 case INFO_KCD_HUP: | |
822 /* no break; */ | |
823 case INFO_KCD_RIGHT: | |
824 /* no break; */ | |
825 case INFO_KCD_CLEAR: | |
826 | |
827 //go back to the previous dialog | |
828 SEND_EVENT (win, VM_DESTROY,0, 0); | |
829 | |
830 break; | |
831 } | |
832 } | |
833 | |
834 | |
835 /******************************************************************************* | |
836 | |
837 $Function: voice_memo_dialog_create | |
838 | |
839 $Description: | |
840 | |
841 $Returns: | |
842 | |
843 $Arguments: | |
844 | |
845 *******************************************************************************/ | |
846 static void voice_memo_dialog_create(T_MFW_HND win, int str1, int str2) | |
847 { | |
848 T_DISPLAY_DATA display_info; | |
849 | |
850 TRACE_FUNCTION ("voice_memo_dialog_create()"); | |
851 | |
852 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, str1, str2, COLOUR_STATUS); | |
853 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)voice_memo_dialog_cb, THREE_SECS, KEY_CLEAR | KEY_RIGHT | KEY_LEFT ); | |
854 /* | |
855 * Call Info Screen | |
856 */ | |
857 info_dialog (win, &display_info); | |
858 } | |
859 | |
860 static void voice_memo_riv_record_cb(void *parameter) | |
861 { | |
862 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
863 #ifndef NEPTUNE_BOARD | |
864 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
865 | |
866 T_AUDIO_VM_RECORD_STATUS *record_status; | |
867 | |
868 record_status = (T_AUDIO_VM_RECORD_STATUS *)parameter; | |
869 | |
870 if (record_status->status != AUDIO_OK) | |
871 { | |
872 TRACE_EVENT_P1("ERROR : voice_memo_riv_play_cb received AUDIO_ERROR, recorded duration is %d", | |
873 record_status->recorded_duration); | |
874 } | |
875 else | |
876 { | |
877 TRACE_EVENT_P1("INFO : voice_memo_riv_play_cb received AUDIO_OK, recorded duration is %d", | |
878 record_status->recorded_duration); | |
879 | |
880 mfw_aud_vm_set_duration((UINT8)record_status->recorded_duration); | |
881 } | |
882 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
883 #endif /* NEPTUNE_BOARD */ | |
884 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
885 | |
886 } | |
887 | |
888 static void voice_memo_riv_play_cb(void *parameter) | |
889 { | |
890 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
891 #ifndef NEPTUNE_BOARD | |
892 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
893 | |
894 T_AUDIO_VM_PLAY_STATUS *play_status; | |
895 | |
896 play_status = (T_AUDIO_VM_PLAY_STATUS *)parameter; | |
897 | |
898 if (play_status->status != AUDIO_OK) | |
899 { | |
900 TRACE_EVENT("ERROR : voice_memo_riv_play_cb received AUDIO_ERROR"); | |
901 } | |
902 else | |
903 { | |
904 TRACE_EVENT("INFO : voice_memo_riv_play_cb received AUDIO_OK"); | |
905 } | |
906 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
907 #endif /* NEPTUNE_BOARD*/ | |
908 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
909 | |
910 } | |
911 | |
912 |