FreeCalypso > hg > fc-magnetite
comparison src/cs/services/Audio/audio_vm_play.c @ 0:945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
binary blobs and LCD demo files have been excluded,
all line endings are LF only
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 25 Sep 2016 22:50:11 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:945cf7f506b2 |
---|---|
1 /****************************************************************************/ | |
2 /* */ | |
3 /* File Name: audio_vm_play.c */ | |
4 /* */ | |
5 /* Purpose: This file contains all the functions used to manage the */ | |
6 /* Voice Memorization play. */ | |
7 /* */ | |
8 /* Version 0.1 */ | |
9 /* */ | |
10 /* Date Modification */ | |
11 /* ------------------------------------ */ | |
12 /* 24 July 2001 Create */ | |
13 /* */ | |
14 /* Author */ | |
15 /* Stephanie Gerthoux */ | |
16 /* */ | |
17 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/ | |
18 /****************************************************************************/ | |
19 | |
20 #include "rv/rv_defined_swe.h" | |
21 #ifdef RVM_AUDIO_MAIN_SWE | |
22 #ifndef _WINDOWS | |
23 #include "config/swconfig.cfg" | |
24 #include "config/sys.cfg" | |
25 #include "config/chipset.cfg" | |
26 #endif | |
27 | |
28 /* include the usefull L1 header */ | |
29 #include "l1_confg.h" | |
30 | |
31 #if (VOICE_MEMO) | |
32 #include "rv/rv_general.h" | |
33 #include "rvm/rvm_gen.h" | |
34 #include "audio/audio_features_i.h" | |
35 #include "audio/audio_ffs_i.h" | |
36 #include "audio/audio_api.h" | |
37 #include "audio/audio_structs_i.h" | |
38 #include "audio/audio_var_i.h" | |
39 #include "audio/audio_messages_i.h" | |
40 #include "rvf/rvf_target.h" | |
41 #include "audio/audio_const_i.h" | |
42 #include "audio/audio_error_hdlr_i.h" | |
43 | |
44 /* include the usefull L1 header */ | |
45 #define BOOL_FLAG | |
46 #define CHAR_FLAG | |
47 #include "l1_types.h" | |
48 #include "l1audio_cust.h" | |
49 #include "l1audio_msgty.h" | |
50 #include "l1audio_signa.h" | |
51 | |
52 /********************************************************************************/ | |
53 /* */ | |
54 /* Function Name: audio_vm_play_send_status */ | |
55 /* */ | |
56 /* Purpose: This function sends the voice memorization play status */ | |
57 /* to the entity. */ | |
58 /* */ | |
59 /* Input Parameters: */ | |
60 /* status, */ | |
61 /* return path */ | |
62 /* */ | |
63 /* Output Parameters: */ | |
64 /* None. */ | |
65 /* */ | |
66 /* Note: */ | |
67 /* None. */ | |
68 /* */ | |
69 /* Revision History: */ | |
70 /* None. */ | |
71 /* */ | |
72 /********************************************************************************/ | |
73 void audio_vm_play_send_status (T_AUDIO_RET status, T_RV_RETURN return_path) | |
74 { | |
75 void *p_send_message; | |
76 T_RVF_MB_STATUS mb_status = RVF_RED; | |
77 | |
78 while (mb_status == RVF_RED) | |
79 { | |
80 /* allocate the message buffer */ | |
81 mb_status = rvf_get_buf (p_audio_gbl_var->mb_external, | |
82 sizeof (T_AUDIO_VM_PLAY_STATUS), | |
83 (T_RVF_BUFFER **) (&p_send_message)); | |
84 | |
85 /* If insufficient resources, then report a memory error and abort. */ | |
86 /* and wait until more ressource is given */ | |
87 if (mb_status == RVF_RED) | |
88 { | |
89 audio_voice_memo_error_trace(AUDIO_ENTITY_NO_MEMORY); | |
90 rvf_delay(RVF_MS_TO_TICKS(1000)); | |
91 } | |
92 } | |
93 | |
94 /*fill the header of the message */ | |
95 ((T_AUDIO_VM_PLAY_STATUS *)(p_send_message))->os_hdr.msg_id = AUDIO_VM_PLAY_STATUS_MSG; | |
96 | |
97 /* fill the status parameters */ | |
98 ((T_AUDIO_VM_PLAY_STATUS *)(p_send_message))->status = status; | |
99 | |
100 if (return_path.callback_func == NULL) | |
101 { | |
102 /* send the message to the entity */ | |
103 rvf_send_msg (return_path.addr_id, | |
104 p_send_message); | |
105 } | |
106 else | |
107 { | |
108 /* call the callback function */ | |
109 (*return_path.callback_func)((void *)(p_send_message)); | |
110 rvf_free_buf((T_RVF_BUFFER *)p_send_message); | |
111 } | |
112 } | |
113 | |
114 | |
115 /********************************************************************************/ | |
116 /* */ | |
117 /* Function Name: audio_vm_play_convert_parameter */ | |
118 /* */ | |
119 /* Purpose: Convert the voice memorization play parameters from the */ | |
120 /* entity to the l1 parameters */ | |
121 /* */ | |
122 /* Input Parameters: */ | |
123 /* session_id of the voice memo play */ | |
124 /* id of the voice memo play */ | |
125 /* */ | |
126 /* Output Parameters: */ | |
127 /* layer 1 voice memo play message */ | |
128 /* */ | |
129 /* Note: */ | |
130 /* None. */ | |
131 /* */ | |
132 /* Revision History: */ | |
133 /* None. */ | |
134 /* */ | |
135 /********************************************************************************/ | |
136 void audio_vm_play_convert_parameter( UINT8 channel_id, | |
137 T_MMI_VM_PLAY_REQ *l1_parameter) | |
138 { | |
139 /* session id : specifies the customer data identification corresponding to */ | |
140 /* this voice memorization */ | |
141 l1_parameter->session_id = channel_id; | |
142 } | |
143 | |
144 /********************************************************************************/ | |
145 /* */ | |
146 /* Function Name: audio_vm_play_manager */ | |
147 /* */ | |
148 /* Purpose: This function is called to manage a voice memorization play */ | |
149 /* manager */ | |
150 /* */ | |
151 /* Input Parameters: */ | |
152 /* Message to the audio entity */ | |
153 /* */ | |
154 /* Output Parameters: */ | |
155 /* None. */ | |
156 /* */ | |
157 /* Note: */ | |
158 /* None. */ | |
159 /* */ | |
160 /* Revision History: */ | |
161 /* None. */ | |
162 /* */ | |
163 /********************************************************************************/ | |
164 void audio_vm_play_manager (T_RV_HDR *p_message) | |
165 { | |
166 /* Declare local variables. */ | |
167 void *p_send_message; | |
168 T_RVF_MB_STATUS mb_status; | |
169 | |
170 /**************** audio_vm_play_manager function begins ***********************/ | |
171 | |
172 switch(p_audio_gbl_var->vm_play.state) | |
173 { | |
174 case AUDIO_VM_PLAY_IDLE: | |
175 { | |
176 switch(p_message->msg_id) | |
177 { | |
178 case AUDIO_VM_PLAY_START_REQ: | |
179 { | |
180 /* save the task id of the entity */ | |
181 p_audio_gbl_var->vm_play.task_id = p_message->src_addr_id; | |
182 | |
183 /* save the return path */ | |
184 p_audio_gbl_var->vm_play.return_path.callback_func = | |
185 ((T_AUDIO_VM_PLAY_START*)(p_message))->return_path.callback_func; | |
186 p_audio_gbl_var->vm_play.return_path.addr_id = | |
187 ((T_AUDIO_VM_PLAY_START*)(p_message))->return_path.addr_id; | |
188 | |
189 /* Send the Start message to the FFS */ | |
190 /* allocate the message buffer */ | |
191 mb_status = rvf_get_buf (p_audio_gbl_var->mb_internal, | |
192 sizeof (T_AUDIO_FFS_FLASH_2_RAM_START), | |
193 (T_RVF_BUFFER **) (&p_send_message)); | |
194 | |
195 /* If insufficient resources, then report a memory error and abort. */ | |
196 if (mb_status == RVF_RED) | |
197 { | |
198 audio_voice_memo_error_trace(AUDIO_ENTITY_NO_MEMORY); | |
199 } | |
200 | |
201 /* fill the header of the message */ | |
202 ((T_AUDIO_FFS_FLASH_2_RAM_START *)(p_send_message))->os_hdr.msg_id = AUDIO_FFS_FLASH_2_RAM_START_REQ; | |
203 | |
204 /* fill the parameters */ | |
205 ((T_AUDIO_FFS_FLASH_2_RAM_START *)(p_send_message))->audio_ffs_fd = | |
206 ((T_AUDIO_VM_PLAY_START*)(p_message))->audio_ffs_fd; | |
207 ((T_AUDIO_FFS_FLASH_2_RAM_START *)(p_send_message))->initial_size = AUDIO_VM_PLAY_SIZE; | |
208 ((T_AUDIO_FFS_FLASH_2_RAM_START *)(p_send_message))->session_id = AUDIO_FFS_SESSION_VM_PLAY; | |
209 | |
210 /* no loop with a voice memo */ | |
211 ((T_AUDIO_FFS_FLASH_2_RAM_START *)(p_send_message))->loop = FALSE; | |
212 | |
213 /* send the message to the entity */ | |
214 rvf_send_msg (p_audio_gbl_var->audio_ffs_addrId, | |
215 p_send_message); | |
216 | |
217 /* change to the state AUDIO_VM_PLAY_WAIT_INIT_FFS */ | |
218 p_audio_gbl_var->vm_play.state = AUDIO_VM_PLAY_WAIT_INIT_FFS; | |
219 break; | |
220 } | |
221 case AUDIO_VM_PLAY_STOP_REQ: | |
222 { | |
223 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_STOP *)(p_message))->return_path); | |
224 audio_voice_memo_error_trace(AUDIO_ERROR_STOP_EVENT); | |
225 break; | |
226 } /* case AUDIO_VM_PLAY_STOP_REQ */ | |
227 } | |
228 break; | |
229 } /* case AUDIO_VM_PLAY_IDLE */ | |
230 | |
231 case AUDIO_VM_PLAY_WAIT_INIT_FFS: | |
232 { | |
233 switch(p_message->msg_id) | |
234 { | |
235 case AUDIO_FFS_INIT_DONE: | |
236 { | |
237 /* send the start voice memo play message to the L1 */ | |
238 /* allocate the buffer for the message to the L1 */ | |
239 p_send_message = audio_allocate_l1_message(sizeof(T_MMI_VM_PLAY_REQ)); | |
240 if ( p_send_message != NULL) | |
241 { | |
242 /* Convert the entity parameters to the audio L1 parameters */ | |
243 audio_vm_play_convert_parameter(((T_AUDIO_FFS_INIT *)(p_message))->channel_id, | |
244 ((T_MMI_VM_PLAY_REQ *)(p_send_message))); | |
245 | |
246 /* send the start command to the audio L1 */ | |
247 audio_send_l1_message(MMI_VM_PLAY_START_REQ, p_send_message); | |
248 } | |
249 | |
250 /* change to the state AUDIO_VM_PLAY_WAIT_START_CONFIRMATION */ | |
251 p_audio_gbl_var->vm_play.state = AUDIO_VM_PLAY_WAIT_START_CON; | |
252 break; | |
253 } | |
254 | |
255 case AUDIO_VM_PLAY_STOP_REQ: | |
256 { | |
257 /*.Before stopping this task, control that */ | |
258 /* stop task id caller = Voice Memorization task id */ | |
259 if ( p_audio_gbl_var->vm_play.task_id == p_message->src_addr_id) | |
260 { | |
261 /* change to the state AUDIO_VM_PLAY_WAIT_INIT_DONE */ | |
262 p_audio_gbl_var->vm_play.state = AUDIO_VM_PLAY_WAIT_INIT_DONE; | |
263 } | |
264 else | |
265 { | |
266 /* A stop request from an other task is sent during a start connection */ | |
267 /* event error - send an error message */ | |
268 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_STOP *)(p_message))->return_path); | |
269 audio_voice_memo_error_trace(AUDIO_ERROR_STOP_EVENT); | |
270 } | |
271 break; | |
272 } /* case AUDIO_VM_PLAY_STOP_REQ */ | |
273 case AUDIO_VM_PLAY_START_REQ: | |
274 { | |
275 /* event error - send an error message*/ | |
276 /* Close the FFS file previously open by the audio start API*/ | |
277 #ifndef _WINDOWS | |
278 if ( ffs_close(((T_AUDIO_VM_PLAY_START *)(p_message))->audio_ffs_fd) != EFFS_OK ) | |
279 { | |
280 audio_voice_memo_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
281 } | |
282 #endif | |
283 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_START *)(p_message))->return_path); | |
284 audio_voice_memo_error_trace(AUDIO_ERROR_START_EVENT); | |
285 break; | |
286 } | |
287 | |
288 } /* switch */ | |
289 break; | |
290 } /* case AUDIO_VM_PLAY_E1_WAIT_INIT_FFS */ | |
291 | |
292 case AUDIO_VM_PLAY_WAIT_INIT_DONE: | |
293 { | |
294 switch(p_message->msg_id) | |
295 { | |
296 case AUDIO_FFS_INIT_DONE: | |
297 { | |
298 /* Send FFS stop command */ | |
299 /* allocate the message buffer */ | |
300 mb_status = rvf_get_buf (p_audio_gbl_var->mb_internal, | |
301 sizeof (T_AUDIO_FFS_STOP_REQ), | |
302 (T_RVF_BUFFER **) (&p_send_message)); | |
303 | |
304 /* If insufficient resources, then report a memory error and abort. */ | |
305 if (mb_status == RVF_RED) | |
306 { | |
307 audio_voice_memo_error_trace(AUDIO_ENTITY_NO_MEMORY); | |
308 } | |
309 | |
310 /* fill the header of the message */ | |
311 ((T_AUDIO_FFS_STOP_REQ *)(p_send_message))->os_hdr.msg_id = AUDIO_FFS_STOP_REQ; | |
312 | |
313 /* fill the parameter */ | |
314 ((T_AUDIO_FFS_STOP_REQ *)(p_send_message))->session_id = AUDIO_FFS_SESSION_VM_PLAY; | |
315 | |
316 /* send the message to the entity */ | |
317 rvf_send_msg (p_audio_gbl_var->audio_ffs_addrId, | |
318 p_send_message); | |
319 | |
320 /* change to the state AUDIO_VM_PLAY_WAIT_STOP_FFS */ | |
321 p_audio_gbl_var->vm_play.state = AUDIO_VM_PLAY_WAIT_STOP_FFS; | |
322 break; | |
323 } | |
324 case AUDIO_VM_PLAY_START_REQ: | |
325 { | |
326 /* event error - send an error message*/ | |
327 /* Close the FFS file previously open by the audio start API*/ | |
328 #ifndef _WINDOWS | |
329 if ( ffs_close(((T_AUDIO_VM_PLAY_START *)(p_message))->audio_ffs_fd) != EFFS_OK ) | |
330 { | |
331 audio_voice_memo_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
332 } | |
333 #endif | |
334 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_START *)(p_message))->return_path); | |
335 audio_voice_memo_error_trace(AUDIO_ERROR_START_EVENT); | |
336 break; | |
337 } | |
338 case AUDIO_VM_PLAY_STOP_REQ: | |
339 { | |
340 /* event error - send an error message*/ | |
341 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_STOP *)(p_message))->return_path); | |
342 audio_voice_memo_error_trace(AUDIO_ERROR_STOP_EVENT); | |
343 break; | |
344 } | |
345 } | |
346 break; | |
347 } /* case AUDIO_VM_PLAY_WAIT_INIT_DONE*/ | |
348 | |
349 case AUDIO_VM_PLAY_WAIT_START_CON: | |
350 { | |
351 switch(p_message->msg_id) | |
352 { | |
353 case MMI_VM_PLAY_START_CON: | |
354 { | |
355 /* change to the state AUDIO_VM_PLAY_WAIT_STOP_COMMAND */ | |
356 p_audio_gbl_var->vm_play.state = AUDIO_VM_PLAY_WAIT_STOP_COMMAND; | |
357 break; | |
358 } | |
359 case AUDIO_VM_PLAY_STOP_REQ: | |
360 { /*.Before stopping this task, control that */ | |
361 /* stop task id caller = voice memo task id */ | |
362 if ( p_audio_gbl_var->vm_play.task_id == p_message->src_addr_id) | |
363 { | |
364 /* change to the state AUDIO_VM_PLAY_WAIT_STOP_CONFIRMATION */ | |
365 p_audio_gbl_var->vm_play.state = AUDIO_VM_PLAY_WAIT_START_CON_TO_STOP; | |
366 } | |
367 else | |
368 { | |
369 /* A stop request from an other task is sent during a start connection */ | |
370 /* event error - send an error message */ | |
371 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_STOP *)(p_message))->return_path); | |
372 audio_voice_memo_error_trace(AUDIO_ERROR_STOP_EVENT); | |
373 } | |
374 break; | |
375 } | |
376 case AUDIO_VM_PLAY_START_REQ: | |
377 { | |
378 /* event error - send an error message*/ | |
379 /* Close the FFS file previously open by the audio start API*/ | |
380 #ifndef _WINDOWS | |
381 if ( ffs_close(((T_AUDIO_VM_PLAY_START *)(p_message))->audio_ffs_fd) != EFFS_OK ) | |
382 { | |
383 audio_voice_memo_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
384 } | |
385 #endif | |
386 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_START *)(p_message))->return_path); | |
387 audio_voice_memo_error_trace(AUDIO_ERROR_START_EVENT); | |
388 break; | |
389 } | |
390 } | |
391 break; | |
392 } /* case AUDIO_VM_PLAY_WAIT_START_CON */ | |
393 | |
394 case AUDIO_VM_PLAY_WAIT_START_CON_TO_STOP: | |
395 { | |
396 switch(p_message->msg_id) | |
397 { | |
398 case MMI_VM_PLAY_START_CON: | |
399 { | |
400 /* send the stop command to the audio L1 */ | |
401 /* allocate the buffer for the message to the L1 */ | |
402 p_send_message = audio_allocate_l1_message(0); | |
403 if ( p_send_message != NULL) | |
404 { | |
405 /* send the stop command to the audio L1 */ | |
406 audio_send_l1_message(MMI_VM_PLAY_STOP_REQ, p_send_message); | |
407 } | |
408 | |
409 /* change to the state AUDIO_VM_PLAY_WAIT_STOP_CON */ | |
410 p_audio_gbl_var->vm_play.state = AUDIO_VM_PLAY_WAIT_STOP_CON; | |
411 break; | |
412 } | |
413 case AUDIO_VM_PLAY_START_REQ: | |
414 { | |
415 /* event error - send an error message*/ | |
416 /* Close the FFS file previously open by the audio start API*/ | |
417 #ifndef _WINDOWS | |
418 if ( ffs_close(((T_AUDIO_VM_PLAY_START *)(p_message))->audio_ffs_fd) != EFFS_OK ) | |
419 { | |
420 audio_voice_memo_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
421 } | |
422 #endif | |
423 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_START *)(p_message))->return_path); | |
424 audio_voice_memo_error_trace(AUDIO_ERROR_START_EVENT); | |
425 break; | |
426 } | |
427 case AUDIO_VM_PLAY_STOP_REQ: | |
428 { | |
429 /* event error - send an error message*/ | |
430 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_STOP *)(p_message))->return_path); | |
431 audio_voice_memo_error_trace(AUDIO_ERROR_STOP_EVENT); | |
432 break; | |
433 } | |
434 | |
435 } | |
436 break; | |
437 } /* case AUDIO_VM_PLAY_WAIT_START_CON_TO_STOP */ | |
438 | |
439 case AUDIO_VM_PLAY_WAIT_STOP_COMMAND: | |
440 { | |
441 switch(p_message->msg_id) | |
442 { | |
443 case MMI_VM_PLAY_STOP_CON: | |
444 { | |
445 /* Send FFS stop command */ | |
446 /* allocate the message buffer */ | |
447 mb_status = rvf_get_buf (p_audio_gbl_var->mb_internal, | |
448 sizeof (T_AUDIO_FFS_STOP_REQ), | |
449 (T_RVF_BUFFER **) (&p_send_message)); | |
450 | |
451 /* If insufficient resources, then report a memory error and abort. */ | |
452 if (mb_status == RVF_RED) | |
453 { | |
454 audio_voice_memo_error_trace(AUDIO_ENTITY_NO_MEMORY); | |
455 } | |
456 | |
457 /* fill the header of the message */ | |
458 ((T_AUDIO_FFS_STOP_REQ *)(p_send_message))->os_hdr.msg_id = AUDIO_FFS_STOP_REQ; | |
459 | |
460 /* fill the parameter */ | |
461 ((T_AUDIO_FFS_STOP_REQ *)(p_send_message))->session_id = AUDIO_FFS_SESSION_VM_PLAY; | |
462 | |
463 /* send the message to the entity */ | |
464 rvf_send_msg (p_audio_gbl_var->audio_ffs_addrId, | |
465 p_send_message); | |
466 | |
467 /* change to the state AUDIO_VM_PLAY_WAIT_STOP_FFS */ | |
468 p_audio_gbl_var->vm_play.state = AUDIO_VM_PLAY_WAIT_STOP_FFS; | |
469 break; | |
470 } | |
471 | |
472 case AUDIO_VM_PLAY_STOP_REQ: | |
473 { /*.Before stopping this task, control that stop task id caller = Voice task id */ | |
474 if ( p_audio_gbl_var->vm_play.task_id == p_message->src_addr_id) | |
475 { | |
476 /* send the stop command to the audio L1 */ | |
477 /* allocate the buffer for the message to the L1 */ | |
478 p_send_message = audio_allocate_l1_message(0); | |
479 if (p_send_message != NULL) | |
480 { | |
481 /* send the stop command to the audio L1 */ | |
482 audio_send_l1_message(MMI_VM_PLAY_STOP_REQ, p_send_message); | |
483 } | |
484 | |
485 /* change to the state AUDIO_VM_PLAY_WAIT_STOP_CONFIRMATION */ | |
486 p_audio_gbl_var->vm_play.state = AUDIO_VM_PLAY_WAIT_STOP_CON; | |
487 } | |
488 else | |
489 { | |
490 /* A stop request from an other task is sent during a start connection */ | |
491 /* event error - send an error message */ | |
492 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_STOP *)(p_message))->return_path); | |
493 audio_voice_memo_error_trace(AUDIO_ERROR_STOP_EVENT); | |
494 } | |
495 break; | |
496 } | |
497 case AUDIO_VM_PLAY_START_REQ: | |
498 { | |
499 /* A start request from an other task is sent during a start connection */ | |
500 /* event error - send an error message */ | |
501 /* Close the FFS file previously open by the audio start API*/ | |
502 #ifndef _WINDOWS | |
503 if ( ffs_close(((T_AUDIO_VM_PLAY_START *)(p_message))->audio_ffs_fd) != EFFS_OK ) | |
504 { | |
505 audio_voice_memo_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
506 } | |
507 #endif | |
508 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_START *)(p_message))->return_path); | |
509 audio_voice_memo_error_trace(AUDIO_ERROR_START_EVENT); | |
510 } | |
511 } | |
512 break; | |
513 } /* case AUDIO_VM_PLAY_WAIT_STOP_COMMAND */ | |
514 | |
515 case AUDIO_VM_PLAY_WAIT_STOP_CON: | |
516 { | |
517 switch(p_message->msg_id) | |
518 { | |
519 case MMI_VM_PLAY_STOP_CON: | |
520 { | |
521 /* Send FFS stop command */ | |
522 /* allocate the message buffer */ | |
523 mb_status = rvf_get_buf (p_audio_gbl_var->mb_internal, | |
524 sizeof (T_AUDIO_FFS_STOP_REQ), | |
525 (T_RVF_BUFFER **) (&p_send_message)); | |
526 | |
527 /* If insufficient resources, then report a memory error and abort. */ | |
528 if (mb_status == RVF_RED) | |
529 { | |
530 audio_voice_memo_error_trace(AUDIO_ENTITY_NO_MEMORY); | |
531 } | |
532 | |
533 /* fill the header of the message */ | |
534 ((T_AUDIO_FFS_STOP_REQ *)(p_send_message))->os_hdr.msg_id = AUDIO_FFS_STOP_REQ; | |
535 | |
536 /* fill the parameter */ | |
537 ((T_AUDIO_FFS_STOP_REQ *)(p_send_message))->session_id = AUDIO_FFS_SESSION_VM_PLAY; | |
538 | |
539 /* send the message to the entity */ | |
540 rvf_send_msg (p_audio_gbl_var->audio_ffs_addrId, | |
541 p_send_message); | |
542 | |
543 /* change to the state AUDIO_VM_PLAY_WAIT_STOP_FFS */ | |
544 p_audio_gbl_var->vm_play.state = AUDIO_VM_PLAY_WAIT_STOP_FFS; | |
545 break; | |
546 } | |
547 case AUDIO_VM_PLAY_STOP_REQ: | |
548 { | |
549 /* event error - send an error message*/ | |
550 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_STOP *)(p_message))->return_path); | |
551 audio_voice_memo_error_trace(AUDIO_ERROR_STOP_EVENT); | |
552 break; | |
553 } | |
554 case AUDIO_VM_PLAY_START_REQ: | |
555 { | |
556 /* event error - send an error message*/ | |
557 /* Close the FFS file previously open by the audio start API*/ | |
558 #ifndef _WINDOWS | |
559 if ( ffs_close(((T_AUDIO_VM_PLAY_START *)(p_message))->audio_ffs_fd) != EFFS_OK ) | |
560 { | |
561 audio_voice_memo_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
562 } | |
563 #endif | |
564 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_START *)(p_message))->return_path); | |
565 audio_voice_memo_error_trace(AUDIO_ERROR_START_EVENT); | |
566 break; | |
567 } | |
568 | |
569 } | |
570 break; | |
571 } /* case AUDIO_VM_PLAY_WAIT_STOP_CON */ | |
572 | |
573 case AUDIO_VM_PLAY_WAIT_STOP_FFS: | |
574 { | |
575 switch(p_message->msg_id) | |
576 { | |
577 case AUDIO_FFS_STOP_CON: | |
578 { | |
579 audio_vm_play_send_status (AUDIO_OK, p_audio_gbl_var->vm_play.return_path); | |
580 | |
581 /* change to the state AUDIO_VM_PLAY_IDLE */ | |
582 p_audio_gbl_var->vm_play.state = AUDIO_VM_PLAY_IDLE; | |
583 | |
584 break; | |
585 } | |
586 case AUDIO_VM_PLAY_STOP_REQ: | |
587 { | |
588 /* event error - send an error message*/ | |
589 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_STOP *)(p_message))->return_path); | |
590 audio_voice_memo_error_trace(AUDIO_ERROR_STOP_EVENT); | |
591 break; | |
592 } | |
593 case AUDIO_VM_PLAY_START_REQ: | |
594 { | |
595 /* event error - send an error message*/ | |
596 /* Close the FFS file previously open by the audio start API*/ | |
597 #ifndef _WINDOWS | |
598 if ( ffs_close(((T_AUDIO_VM_PLAY_START *)(p_message))->audio_ffs_fd) != EFFS_OK ) | |
599 { | |
600 audio_voice_memo_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
601 } | |
602 #endif | |
603 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_START *)(p_message))->return_path); | |
604 audio_voice_memo_error_trace(AUDIO_ERROR_START_EVENT); | |
605 break; | |
606 } | |
607 } | |
608 break; | |
609 } /* case AUDIO_VM_PLAY_WAIT_STOP_CON */ | |
610 } /* switch(p_audio_gbl_var->vm_play.state) */ | |
611 } /*********************** End of audio_vm_play_manager function **********************/ | |
612 | |
613 #endif /* VM_PLAY */ | |
614 #endif /* RVM_AUDIO_MAIN_SWE */ |