FreeCalypso > hg > fc-tourmaline
comparison src/ui/mfw/mfw_fm.c @ 3:67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:33:10 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:3a14ee9a9843 | 3:67bfe9f274f6 |
---|---|
1 #ifdef FF_MMI_FILEMANAGER | |
2 /* ========================================================= | |
3 * Texas Instruments OMAP(TM) Platform Software | |
4 * (c) Copyright Texas Instruments, Incorporated. All Rights Reserved. | |
5 * | |
6 * Use of this software is controlled by the terms and conditions found | |
7 * in the license agreement under which this software has been supplied. | |
8 * ========================================================== */ | |
9 | |
10 /*========================================================== | |
11 * @file mfw_fmc | |
12 * | |
13 * This provides the functionality of File Manager Applications. | |
14 * It supports file/Directory related operations on NOR, NAND and MMC | |
15 * | |
16 * @path \bmi\condat\ms\src\mfw | |
17 * | |
18 * @rev 00.01 | |
19 */ | |
20 /* ========================================================== */ | |
21 /*=========================================================== | |
22 *! | |
23 *! Revision History | |
24 *! =================================== | |
25 | |
26 Nov 12 2007 DRT :OMAPS00144861 x0056422 | |
27 Description: MM: There are some issues with resume and stop | |
28 callback in BT MMI code. | |
29 | |
30 | |
31 Aug 27, 2007 REF:DRT OMAPS00137370 x0045876 | |
32 Description: MM: MIDI/IMY file is not played correctly after listening a | |
33 MP3 in the Browse Midi list. | |
34 Solution: Param Voice_Limit is changed when MP3 or AAC file is played. So before | |
35 playing MP3 or AAC file, Voice_Limit should be saved. | |
36 | |
37 Jul 04, 2007 DRT:OMAPS00135749 x0062174(Nimitha) | |
38 Description: Once the audio file has finished automatically play button has to be pressed twice, | |
39 in order to be played again. | |
40 Solution : The global variable aud_state_status is set to AUD_FM_NONE once the file playing stopped. | |
41 | |
42 April 27, 2007 DRT:OMAPS00128836 x0073106 | |
43 Description: Unexpected behavior when copying images with the same names from a memory to another. | |
44 Solution:In mfw_fm_copy_start () added a if condition if(rfs_stat() && image file). | |
45 | |
46 Apr 10, 2007 DRT: OMAPS00125309 x0039928 | |
47 Description: MM - Mono option does not work => MMI changes required | |
48 Solution: Selected Output channel from the settings menu is set for all the players. | |
49 | |
50 Apr 06, 2007 DRT: OMAPS00124877 x0039928 | |
51 Description: MM: Voice limit Options doesn't work | |
52 Solution: voice limit value is taken from the global variable set by menu options. | |
53 | |
54 Mar 28, 2007 ER: OMAPS00106188 x0039928 | |
55 Description: Align Midi application menu choices and audio Player menu choices | |
56 | |
57 Mar 15, 2007 DRT: OMAPS00120201 x0039928 | |
58 Description: JPEG dir not created in FFS in N5.23 pre release | |
59 Solution: The directories are created after format for NOR-MS, NAND and T-FLASH | |
60 | |
61 *! 10-Apr-2006 mf: Modified x0020906. Change required per SRxxxx | |
62 *! to provide File Manager Functionality. | |
63 *! | |
64 *! | |
65 *! 17-Jan-2006 mf: Revisions appear in reverse chronological order; | |
66 *! that is, newest first. The date format is dd-Mon-yyyy. | |
67 * =========================================================== */ | |
68 | |
69 /****************************************************************************** | |
70 Include Files | |
71 *******************************************************************************/ | |
72 #define ENTITY_MFW | |
73 | |
74 #include <string.h> | |
75 #include <stdio.h> | |
76 #include <stdlib.h> | |
77 | |
78 #define FF_MMI_RFS_ENABLED | |
79 | |
80 #if defined (NEW_FRAME) | |
81 | |
82 #include "typedefs.h" | |
83 #include "vsi.h" | |
84 #include "pei.h" | |
85 #include "custom.h" | |
86 #include "gsm.h" | |
87 | |
88 #else | |
89 | |
90 #include "STDDEFS.H" | |
91 #include "custom.h" | |
92 #include "gsm.h" | |
93 #include "vsi.h" | |
94 | |
95 #endif | |
96 | |
97 | |
98 #include "mfw_mfw.h" | |
99 #include "mfw_phb.h" | |
100 #include "mfw_phbi.h" | |
101 #include "mfw_cm.h" | |
102 #include "mfw_cmi.h" | |
103 | |
104 #include "mfw_nm.h" | |
105 #include "mfw_sim.h" | |
106 #include "mfw_sima.h" | |
107 #include "mfw_nmi.h" | |
108 #include "mfw_simi.h" | |
109 #include "mfw_sms.h" | |
110 #include "mfw_smsi.h" | |
111 #include "mfw_win.h" | |
112 | |
113 #include "ksd.h" | |
114 #include "psa.h" | |
115 | |
116 #if defined (FAX_AND_DATA) | |
117 #include "aci_fd.h" | |
118 #endif | |
119 | |
120 //#ifdef FF_MMI_RFS_ENABLED | |
121 #include "rfs/rfs_api.h" | |
122 //#else | |
123 #include "ffs/ffs_api.h" | |
124 //#endif | |
125 | |
126 #include "message.h" | |
127 #include "prim.h" | |
128 #include "aci_cmh.h" | |
129 | |
130 #include "cmh.h" | |
131 #include "phb.h" | |
132 #include "cmh_phb.h" | |
133 | |
134 #include "mfw_ss.h" | |
135 #include "mfw_ssi.h" | |
136 #include "mfw_win.h" | |
137 | |
138 #include "gdi.h" | |
139 #include "prim.h" | |
140 #ifndef PCM_2_FFS | |
141 #include "pcm.h" | |
142 #endif | |
143 | |
144 #ifdef FF_MMI_MIDI_FORMAT | |
145 #include "bae/bae_options.h" | |
146 #endif | |
147 | |
148 #include "mfw_fm.h" | |
149 /**********************NOTE*************************** | |
150 FFS header To be replaced with FS Abstraction Header | |
151 ******************************************************/ | |
152 | |
153 #ifdef FF_MMI_A2DP_AVRCP | |
154 #include "mfw_bt_api.h" | |
155 #include "mfw_bt_private.h" | |
156 #endif | |
157 | |
158 | |
159 #ifdef INT_PHONEBOOK | |
160 #include "ATBPbGI.h" | |
161 #endif | |
162 /******************************************************************************* | |
163 | |
164 Defines | |
165 | |
166 *******************************************************************************/ | |
167 EXTERN MfwHdr * current_mfw_elem; | |
168 static MSL_HANDLE msl_handle; | |
169 static T_RV_RETURN_PATH fm_aud_return_path; | |
170 T_MFW_AUD_PARA para_aud; | |
171 extern UBYTE mfw_player_playback_loop_flag; | |
172 extern T_AS_PLAYER_PARAMS player_para; | |
173 extern INT16 player_channel; | |
174 extern int aud_state_status; | |
175 | |
176 | |
177 /* OMAPS00151698, x0056422 */ | |
178 #ifdef FF_MMI_A2DP_AVRCP | |
179 extern BMI_BT_STRUCTTYPE tGlobalBmiBtStruct; | |
180 #endif | |
181 //Daisy tang added for Real Resume feature 20071107 | |
182 //start | |
183 BOOL isPlayer_Real_Pause = FALSE; | |
184 UINT32 last_file_size_played = 0; | |
185 char last_inputFileName[FM_MAX_DIR_PATH_LENGTH]; | |
186 T_WCHAR last_inputFileName_uc[FM_MAX_DIR_PATH_LENGTH]; | |
187 T_AS_PLAYER_TYPE last_file_type; | |
188 BOOL last_play_bar; | |
189 UINT32 last_para_aud_pt; | |
190 //end | |
191 | |
192 | |
193 /******************************************************************************* | |
194 | |
195 Local prototypes | |
196 | |
197 *******************************************************************************/ | |
198 | |
199 void Msl_mslil_Callback(void* handle, U32 ucp_type, U32 tCMd, U32 tStatus); | |
200 void mfw_fm_audPlay_cb(void *parameter); | |
201 void mfw_fm_signal(T_MFW_EVENT event, void *para); | |
202 BOOL mfw_fm_sign_exec (T_MFW_HDR * cur_elem, T_MFW_EVENT event, T_MFW_FM_PARA * para); | |
203 /* June 28, 2007 DRT: OMAPS00135749 x0062174 */ | |
204 EXTERN void mmi_set_aud_state_status( T_FM_AUD_STATE status); | |
205 | |
206 | |
207 /******************************************************************************* | |
208 $Function: mfw_fm_create | |
209 | |
210 $Description: This function initialises an Mfw fm entity and adds it to the Window Stack | |
211 | |
212 $Returns: T_MFW_HND : A handle for the entity | |
213 | |
214 $Arguments: hWin : Parent Window Handle | |
215 event : Event Mask of the events to be handled | |
216 cbfunc : Callback function to handle the events | |
217 *******************************************************************************/ | |
218 T_MFW_HND mfw_fm_create(T_MFW_HND hWin, T_MFW_EVENT event, T_MFW_CB cbfunc) | |
219 { | |
220 T_MFW_HDR *hdr; | |
221 T_MFW_FM *fm_para; | |
222 | |
223 TRACE_FUNCTION("mfw_FM_create()"); | |
224 | |
225 hdr = (T_MFW_HDR *) mfwAlloc(sizeof (T_MFW_HDR)); | |
226 fm_para = (T_MFW_FM *) mfwAlloc(sizeof (T_MFW_FM)); | |
227 | |
228 if (!hdr OR !fm_para) | |
229 return FALSE; | |
230 | |
231 /* | |
232 * initialisation of the handler | |
233 */ | |
234 fm_para->emask = event; | |
235 fm_para->handler = cbfunc; | |
236 | |
237 hdr->data = fm_para; | |
238 hdr->type = MfwTypfm; | |
239 | |
240 /* | |
241 * installation of the handler | |
242 */ | |
243 return mfwInsert((T_MFW_HDR *)hWin, hdr); | |
244 } | |
245 | |
246 /******************************************************************************* | |
247 | |
248 $Function: mfw_fm_delete | |
249 | |
250 $Description: This function clears down an Mfw entity and removes it from the | |
251 Window Stack | |
252 | |
253 $Returns: T_MFW_RES : The result of the function | |
254 | |
255 $Arguments: T_MFW_HND : The Handle of the entity to be removed | |
256 | |
257 *******************************************************************************/ | |
258 T_MFW_RES mfw_fm_delete(T_MFW_HND hnd) | |
259 { | |
260 TRACE_FUNCTION("mfw_FM_delete()"); | |
261 | |
262 if (!hnd OR !((T_MFW_HDR *)hnd)->data) | |
263 return MFW_RES_ILL_HND; | |
264 | |
265 if (!mfwRemove((T_MFW_HDR *)hnd)) | |
266 return MFW_RES_ILL_HND; | |
267 | |
268 mfwFree((U8 *)(((T_MFW_HDR *) hnd)->data),sizeof(T_MFW_FM)); | |
269 mfwFree((U8 *)hnd,sizeof(T_MFW_HDR)); | |
270 | |
271 return MFW_RES_OK; | |
272 } | |
273 | |
274 /******************************************************************************* | |
275 | |
276 $Function: mfw_fm_sign_exec | |
277 | |
278 $Description: This function sends the Mfw FM events from the Mfw to the BMI. | |
279 | |
280 $Returns: None | |
281 | |
282 $Arguments: None | |
283 | |
284 *******************************************************************************/ | |
285 BOOL mfw_fm_sign_exec (T_MFW_HDR * cur_elem, T_MFW_EVENT event, T_MFW_FM_PARA * para) | |
286 { | |
287 TRACE_FUNCTION("mfw_fm_sign_exec()"); | |
288 | |
289 | |
290 while (cur_elem) | |
291 { | |
292 /* | |
293 * event handler is available | |
294 */ | |
295 if (cur_elem->type EQ MfwTypfm) | |
296 { | |
297 T_MFW_FM * fm_data; | |
298 TRACE_EVENT("MfwTyFm"); | |
299 /* | |
300 * handler is FM management handler | |
301 */ | |
302 fm_data = (T_MFW_FM *)cur_elem->data; | |
303 if (fm_data->emask & event) | |
304 { | |
305 /* | |
306 * event is expected by the call back function | |
307 */ | |
308 fm_data->event = event; | |
309 switch (event) | |
310 { | |
311 /* | |
312 ** Generic Events | |
313 */ | |
314 case E_FM_THMB_INIT: | |
315 case E_FM_THMB_DEINIT: | |
316 case E_FM_THMB_GEN: | |
317 case E_FM_IMG_INIT: | |
318 case E_FM_IMG_DRAW: | |
319 case E_FM_IMG_DEINIT: | |
320 case E_FM_AUDIO_STOP: | |
321 if(para!=NULL) | |
322 memcpy (&fm_data->para, para, sizeof (T_MFW_FM_PARA)); | |
323 break; | |
324 } | |
325 /* | |
326 * if call back defined, call it | |
327 */ | |
328 if (fm_data->handler) | |
329 { | |
330 // store current mfw elem | |
331 current_mfw_elem = cur_elem; | |
332 if ((*(fm_data->handler)) (fm_data->event, (void *)&fm_data->para)) | |
333 return TRUE; | |
334 } | |
335 } | |
336 } | |
337 cur_elem = cur_elem->next; | |
338 } | |
339 return FALSE; | |
340 } | |
341 | |
342 /******************************************************************************* | |
343 | |
344 $Function: mfw_FM_signal | |
345 | |
346 $Description: This function sends the Mfw events from the Mfw to the BMI. | |
347 | |
348 $Returns: None | |
349 | |
350 $Arguments: T_MFW_EVENT : The event to be sent to the BMI | |
351 void * : Pointer to the Event data | |
352 | |
353 *******************************************************************************/ | |
354 void mfw_fm_signal(T_MFW_EVENT event, void *para) | |
355 { | |
356 UBYTE temp; | |
357 temp = dspl_Enable(0); | |
358 | |
359 TRACE_FUNCTION("mfw_FM_signal()"); | |
360 | |
361 if (mfwSignallingMethod EQ 0) | |
362 { | |
363 /* | |
364 * focus is on a window | |
365 */ | |
366 if (mfwFocus) | |
367 { | |
368 /* | |
369 * send event to sim management | |
370 * handler if available | |
371 */ | |
372 if (mfw_fm_sign_exec (mfwFocus, event, para)) | |
373 { | |
374 dspl_Enable(temp); | |
375 return; | |
376 } | |
377 } | |
378 /* | |
379 * actual focussed window is not available | |
380 * or has no network management registration | |
381 * handler, then search all nodes from the root. | |
382 */ | |
383 if (mfwRoot) | |
384 mfw_fm_sign_exec (mfwRoot, event, para); | |
385 } | |
386 else | |
387 { | |
388 MfwHdr * h = 0; | |
389 /* | |
390 * Focus set, then start here | |
391 */ | |
392 if (mfwFocus) | |
393 h = mfwFocus; | |
394 /* | |
395 * Focus not set, then start root | |
396 */ | |
397 if (!h) | |
398 h = mfwRoot; | |
399 /* | |
400 * No elements available, return | |
401 */ | |
402 while (h) | |
403 { | |
404 /* | |
405 * Signal consumed, then return | |
406 */ | |
407 if (mfw_fm_sign_exec (h, event, para)) | |
408 { | |
409 dspl_Enable(temp); | |
410 return; | |
411 } | |
412 /* | |
413 * All windows tried inclusive root | |
414 */ | |
415 if (h == mfwRoot) | |
416 { | |
417 dspl_Enable(temp); | |
418 return; | |
419 } | |
420 /* | |
421 * get parent window | |
422 */ | |
423 h = mfwParent(mfwParent(h)); | |
424 | |
425 if (h) | |
426 h = ((MfwWin * )(h->data))->elems; | |
427 } | |
428 | |
429 mfw_fm_sign_exec (mfwRoot, event, para); | |
430 | |
431 } | |
432 dspl_Enable(temp); | |
433 return; | |
434 } | |
435 | |
436 /******************************************************************************* | |
437 $Function: mfw_fm_readDir | |
438 | |
439 $Description: Reads the objects from the given directory | |
440 | |
441 $Returns: FM_DIR_DOESNOTEXISTS/FM_READDIR_ERROR/FM_NO_ERROR | |
442 | |
443 $Arguments: dir_path : Current Directory Path | |
444 dir_name : Current Directory Name | |
445 num_objs : num of obejcts | |
446 obj_list : object list | |
447 source : Current Drive | |
448 *******************************************************************************/ | |
449 T_MFW_FM_STATUS mfw_fm_readDir(char *dir_path, char *dir_name, UBYTE *num_objs, T_FM_OBJ **obj_list, T_FM_DEVICE_TYPE source, T_FM_APP_TYPE app) | |
450 { | |
451 char curDir[FM_MAX_DIR_PATH_LENGTH]; | |
452 /* x0083025 - OMAPS00156759 - Jan 29, 2008 */ | |
453 #if defined(FF_MMI_UNICODE_SUPPORT)||defined (FF_MMI_RFS_ENABLED) | |
454 T_WCHAR objName_uc[FM_MAX_OBJ_NAME_LENGTH]; | |
455 T_WCHAR curObj_uc[FM_MAX_DIR_PATH_LENGTH]; | |
456 #else | |
457 char objName_u8[FM_MAX_OBJ_NAME_LENGTH]; | |
458 #endif | |
459 | |
460 #ifdef FF_MMI_RFS_ENABLED | |
461 char ext1[FM_MAX_EXT_LENGTH]; | |
462 T_RFS_DIR f_dir; | |
463 UINT16 curDir_uc[FM_MAX_DIR_PATH_LENGTH]; | |
464 T_RFS_RET result; | |
465 T_RFS_STAT f_stat; | |
466 #else | |
467 T_FFS_DIR f_dir; | |
468 #endif | |
469 int iCount=0; | |
470 | |
471 TRACE_FUNCTION("mfw_fm_readDir"); | |
472 | |
473 *num_objs = 0; | |
474 memset(curDir, 0, FM_MAX_DIR_PATH_LENGTH); | |
475 #ifdef FF_MMI_RFS_ENABLED | |
476 switch (source) | |
477 { | |
478 case FM_NOR_FLASH: | |
479 sprintf(curDir,"%s%s%s","/FFS",dir_path,dir_name); | |
480 TRACE_EVENT_P1("Current Dir %s",curDir); | |
481 break; | |
482 case FM_NORMS_FLASH: | |
483 sprintf(curDir,"%s%s%s","/NOR",dir_path,dir_name); | |
484 TRACE_EVENT_P1("Current Dir %s",curDir); | |
485 break; | |
486 case FM_NAND_FLASH: | |
487 sprintf(curDir,"%s%s%s","/NAND",dir_path,dir_name); | |
488 TRACE_EVENT_P1("Current Dir %s",curDir); | |
489 break; | |
490 case FM_T_FLASH: | |
491 sprintf(curDir,"%s%s%s","/MMC",dir_path,dir_name); | |
492 TRACE_EVENT_P1("Current Dir %s",curDir); | |
493 break; | |
494 default: | |
495 TRACE_EVENT("Default: Invalid value"); | |
496 break; | |
497 } | |
498 | |
499 convert_u8_to_unicode((const char *)curDir, curDir_uc); | |
500 if (rfs_opendir (curDir_uc, &f_dir) < 0) | |
501 { | |
502 TRACE_EVENT_P1("Opening dir %s Failed",curDir); | |
503 return FM_DIR_DOESNOTEXISTS; | |
504 } | |
505 | |
506 for (iCount = 0; rfs_readdir (&f_dir, objName_uc, FM_MAX_OBJ_NAME_LENGTH) > 0x0; ) | |
507 { | |
508 if (objName_uc[0] == '\0') | |
509 { | |
510 return FM_READDIR_ERROR; | |
511 } | |
512 if( objName_uc[0] != '.' ) | |
513 { | |
514 /* x0083025 - OMAPS00156759 - Jan 29, 2008 */ | |
515 wstrcpy(curObj_uc, curDir_uc); | |
516 { // append '/' char to the end of string | |
517 T_WCHAR *tmp = curObj_uc; | |
518 while (*tmp) ++tmp; | |
519 *tmp++ = '/'; | |
520 *tmp = 0; | |
521 } | |
522 wstrcat(curObj_uc, objName_uc); | |
523 | |
524 result= rfs_stat(curObj_uc, &f_stat); | |
525 | |
526 if(result == RFS_EOK) | |
527 { | |
528 if(f_stat.file_dir.mode & RFS_IXUSR) | |
529 { | |
530 obj_list[iCount] = (T_FM_OBJ*)mfwAlloc(sizeof(T_FM_OBJ)); | |
531 | |
532 /* x0083025 - OMAPS00156759 - Jan 29, 2008 */ | |
533 #ifdef FF_MMI_UNICODE_SUPPORT | |
534 wstrcpy(obj_list[iCount]->name_uc, objName_uc); | |
535 TRACE_EVENT_P1("%s", obj_list[iCount]->name_uc); | |
536 #endif | |
537 convert_unicode_to_u8(objName_uc, obj_list[iCount]->name); | |
538 TRACE_EVENT_P1("%s", obj_list[iCount]->name); | |
539 (*num_objs)++; | |
540 iCount++; | |
541 if((*num_objs) >= FM_MAX_OBJ ) | |
542 { | |
543 TRACE_EVENT("MAX COUNT Reached"); | |
544 if(source == FM_NOR_FLASH) | |
545 rfs_closedir(&f_dir); | |
546 return FM_NO_ERROR; | |
547 } | |
548 } | |
549 else | |
550 { | |
551 /* x0083025 - OMAPS00156759 - Jan 29, 2008 */ | |
552 convert_unicode_to_u8(wstrchr(objName_uc,'.')+1, ext1); | |
553 | |
554 if(ext1) | |
555 { | |
556 switch(app) | |
557 { | |
558 case FM_IMAGE: | |
559 if(strcmp(ext1, "jpg") == 0) | |
560 { | |
561 obj_list[iCount] = (T_FM_OBJ*)mfwAlloc(sizeof(T_FM_OBJ)); | |
562 | |
563 /* x0083025 - OMAPS00156759 - Jan 29, 2008 */ | |
564 convert_unicode_to_u8(objName_uc, obj_list[iCount]->name); | |
565 | |
566 TRACE_EVENT_P1("%s", obj_list[iCount]->name); | |
567 (*num_objs)++; | |
568 iCount++; | |
569 if((*num_objs) >= FM_MAX_OBJ ) | |
570 { | |
571 TRACE_EVENT("MAX COUNT Reached"); | |
572 if(source == FM_NOR_FLASH) | |
573 rfs_closedir(&f_dir); | |
574 return FM_NO_ERROR; | |
575 } | |
576 } | |
577 break; | |
578 case FM_AUDIO: | |
579 if( | |
580 | |
581 #ifdef FF_MP3_RINGER | |
582 (strcmp(ext1, "mp3") == 0) | |
583 #else | |
584 (0) | |
585 #endif | |
586 #ifdef FF_AAC_RINGER | |
587 || (strcmp(ext1, "aac") == 0) | |
588 #else | |
589 || (0) | |
590 #endif | |
591 | |
592 #ifdef FF_MMI_MIDI_FORMAT | |
593 | |
594 #ifdef PAL_ENABLE_XMF | |
595 || (strcmp(ext1, "xmf") == 0) | |
596 #else | |
597 || (0) | |
598 #endif | |
599 #ifdef PAL_ENABLE_IMELODY | |
600 || (strcmp(ext1, "imy") == 0) | |
601 #else | |
602 || (0) | |
603 #endif | |
604 #ifdef PAL_ENABLE_SMAF_MA3 | |
605 || (strcmp(ext1, "mmf") == 0) | |
606 #else | |
607 || (0) | |
608 #endif | |
609 #ifdef PAL_ENABLE_XMF | |
610 || (strcmp(ext1, "mxmf") == 0) | |
611 #else | |
612 || (0) | |
613 #endif | |
614 #ifdef PAL_ENABLE_SMS | |
615 || (strcmp(ext1, "sms") == 0) | |
616 #else | |
617 || (0) | |
618 #endif | |
619 #ifdef PAL_ENABLE_DIGITAL_AUDIO | |
620 || (strcmp(ext1, "wav") == 0) | |
621 #else | |
622 || (0) | |
623 #endif | |
624 #ifdef PAL_ENABLE_MIDI_NORMALIZER | |
625 || (strcmp(ext1, "mid") == 0) | |
626 #else | |
627 || (0) | |
628 #endif | |
629 | |
630 #endif | |
631 ) | |
632 | |
633 { | |
634 obj_list[iCount] = (T_FM_OBJ*)mfwAlloc(sizeof(T_FM_OBJ)); | |
635 /* x0083025 - OMAPS00156759 - Jan 29, 2008 */ | |
636 #ifdef FF_MMI_UNICODE_SUPPORT | |
637 wstrcpy(obj_list[iCount]->name_uc, objName_uc); | |
638 TRACE_EVENT_P1("%s", obj_list[iCount]->name_uc); | |
639 #else | |
640 convert_unicode_to_u8(objName_uc, obj_list[iCount]->name); | |
641 TRACE_EVENT_P1("%s", obj_list[iCount]->name); | |
642 #endif | |
643 (*num_objs)++; | |
644 iCount++; | |
645 if((*num_objs) >= FM_MAX_OBJ ) | |
646 { | |
647 TRACE_EVENT("MAX COUNT Reached"); | |
648 if(source == FM_NOR_FLASH) | |
649 rfs_closedir(&f_dir); | |
650 return FM_NO_ERROR; | |
651 } | |
652 } | |
653 break; | |
654 } | |
655 } | |
656 } | |
657 } | |
658 } | |
659 } | |
660 TRACE_EVENT_P2("Dir %s contains %d Objects",curDir,iCount); | |
661 if(source == FM_NOR_FLASH) | |
662 rfs_closedir(&f_dir); | |
663 #else | |
664 sprintf(curDir,"%s%s",dir_path,dir_name); | |
665 TRACE_EVENT_P1("Current Dir %s",curDir); | |
666 | |
667 /**********************NOTE*************************** | |
668 FFS API To be replaced with FS Abstraction API | |
669 ******************************************************/ | |
670 if (ffs_opendir (curDir, &f_dir) < 0) | |
671 { | |
672 TRACE_EVENT_P1("Opening dir %s Failed",curDir); | |
673 return FM_DIR_DOESNOTEXISTS; | |
674 } | |
675 /**********************NOTE*************************** | |
676 FFS API To be replaced with FS Abstraction API | |
677 ******************************************************/ | |
678 for (iCount = 0; ffs_readdir (&f_dir, objName_u8, FM_MAX_OBJ_NAME_LENGTH) > 0x0; iCount++) | |
679 { | |
680 if (objName_u8[0] == '\0') | |
681 { | |
682 return FM_READDIR_ERROR; | |
683 } | |
684 if( objName_u8[0] != '.' ) | |
685 { | |
686 obj_list[iCount] = (T_FM_OBJ*)mfwAlloc(sizeof(T_FM_OBJ)); | |
687 strcpy(obj_list[iCount]->name, objName_u8); | |
688 TRACE_EVENT_P1("%s", obj_list[iCount]->name); | |
689 (*num_objs)++; | |
690 if((*num_objs) >= FM_MAX_OBJ ) | |
691 { | |
692 TRACE_EVENT("MAX COUNT Reached"); | |
693 break; | |
694 } | |
695 } | |
696 } | |
697 TRACE_EVENT_P2("Dir %s contains %d Objects",curDir,iCount); | |
698 #endif | |
699 | |
700 | |
701 return FM_NO_ERROR; | |
702 } | |
703 | |
704 /******************************************************************************* | |
705 $Function: mfw_fm_rename | |
706 | |
707 $Description: Renames the selcted object with the new name | |
708 | |
709 $Returns: FM_RENAME_ERROR/FM_NO_ERROR | |
710 | |
711 $Arguments: old_filename : Old filename | |
712 new_filename : New filename | |
713 source : Current Drive | |
714 *******************************************************************************/ | |
715 #ifdef FF_MMI_UNICODE_SUPPORT | |
716 T_MFW_FM_STATUS mfw_fm_rename(T_WCHAR* old_filename, T_WCHAR* new_filename, T_FM_DEVICE_TYPE source) | |
717 #else | |
718 T_MFW_FM_STATUS mfw_fm_rename(char* old_filename, char * new_filename, T_FM_DEVICE_TYPE source) | |
719 #endif | |
720 { | |
721 | |
722 #ifdef FF_MMI_RFS_ENABLED | |
723 T_RFS_RET rfsResult; | |
724 char old_filename_mt[FM_MAX_DIR_PATH_LENGTH]; | |
725 char new_filename_mt[FM_MAX_DIR_PATH_LENGTH]; | |
726 UINT16 new_filename_uc[FM_MAX_DIR_PATH_LENGTH]; | |
727 UINT16 old_filename_uc[FM_MAX_DIR_PATH_LENGTH]; | |
728 #else | |
729 | |
730 #if defined(FF_MMI_UNICODE_SUPPORT) && !defined(FF_MMI_RFS_ENABLED) | |
731 char old_filename_u8[FM_MAX_DIR_PATH_LENGTH]; | |
732 char new_filename_u8[FM_MAX_DIR_PATH_LENGTH]; | |
733 #endif | |
734 | |
735 T_FFS_RET ffsResult; | |
736 #endif | |
737 | |
738 TRACE_FUNCTION("mfw_fm_rename"); | |
739 | |
740 #ifdef FF_MMI_RFS_ENABLED | |
741 switch (source) | |
742 { | |
743 case FM_NOR_FLASH: | |
744 strcpy(old_filename_mt, "/FFS"); | |
745 strcpy(new_filename_mt, "/FFS"); | |
746 break; | |
747 case FM_NORMS_FLASH: | |
748 strcpy(old_filename_mt, "/NOR"); | |
749 strcpy(new_filename_mt, "/NOR"); | |
750 break; | |
751 case FM_NAND_FLASH: | |
752 strcpy(old_filename_mt, "/NAND"); | |
753 strcpy(new_filename_mt, "/NAND"); | |
754 break; | |
755 case FM_T_FLASH: | |
756 strcpy(old_filename_mt, "/MMC"); | |
757 strcpy(new_filename_mt, "/MMC"); | |
758 break; | |
759 } | |
760 | |
761 #ifdef FF_MMI_UNICODE_SUPPORT | |
762 convert_u8_to_unicode(old_filename_mt,old_filename_uc); | |
763 convert_u8_to_unicode(new_filename_mt, new_filename_uc); | |
764 wstrcat(old_filename_uc, old_filename); | |
765 wstrcat(new_filename_uc, new_filename); | |
766 #else | |
767 strcat(old_filename_mt, old_filename); | |
768 strcat(new_filename_mt, new_filename); | |
769 convert_u8_to_unicode(old_filename_mt,old_filename_uc); | |
770 convert_u8_to_unicode(new_filename_mt, new_filename_uc); | |
771 #endif | |
772 | |
773 rfsResult = rfs_rename(old_filename_uc, new_filename_uc); | |
774 if(rfsResult != RFS_EOK) | |
775 { | |
776 return FM_RENAME_ERROR; | |
777 } | |
778 #else | |
779 | |
780 #ifdef FF_MMI_UNICODE_SUPPORT | |
781 convert_unicode_to_u8(old_filename, old_filename_u8); | |
782 convert_unicode_to_u8(new_filename, new_filename_u8; | |
783 | |
784 ffsResult = ffs_rename(old_filename_u8,new_filename_u8); | |
785 #else | |
786 ffsResult = ffs_rename(old_filename,new_filename); | |
787 #endif | |
788 if(ffsResult != EFFS_OK) | |
789 { | |
790 return FM_RENAME_ERROR; | |
791 } | |
792 #endif | |
793 return FM_NO_ERROR; | |
794 } | |
795 | |
796 /******************************************************************************* | |
797 $Function: mfw_fm_rename_image | |
798 | |
799 $Description: Renames the selected image and its thumbnail with the new name | |
800 | |
801 $Returns: FM_RENAME_ERROR/FM_NO_ERROR | |
802 | |
803 $Arguments: path : Current directory path | |
804 dirname : Current Directory name | |
805 old_filename : Old filename | |
806 new_filename : New filename | |
807 source : Current Drive | |
808 *******************************************************************************/ | |
809 T_MFW_FM_STATUS mfw_fm_rename_image(char * path, char * dirname, char* old_filename, char * new_filename, T_FM_DEVICE_TYPE source) | |
810 { | |
811 T_MFW_FM_STATUS ffsResult; | |
812 char t_oldfilename[FM_MAX_DIR_PATH_LENGTH]; | |
813 char t_newfilename[FM_MAX_DIR_PATH_LENGTH]; | |
814 | |
815 #ifdef FF_MMI_UNICODE_SUPPORT | |
816 T_WCHAR oldfilename_uc[FM_MAX_DIR_PATH_LENGTH]; | |
817 T_WCHAR newfilename_uc[FM_MAX_DIR_PATH_LENGTH]; | |
818 #endif | |
819 | |
820 TRACE_FUNCTION("mfw_fm_rename_image"); | |
821 | |
822 #ifdef FF_MMI_RFS_ENABLED | |
823 | |
824 sprintf(t_oldfilename,"%s%s/%s.jpg",path,dirname,old_filename); | |
825 sprintf(t_newfilename,"%s%s/%s.jpg",path,dirname,new_filename); | |
826 /* February 8, 2008 DRT:OMAPS00156759 (x0083025) For Unicode Support--> Start*/ | |
827 | |
828 #ifdef FF_MMI_UNICODE_SUPPORT | |
829 convert_u8_to_unicode(t_oldfilename, oldfilename_uc); | |
830 convert_u8_to_unicode(t_newfilename, newfilename_uc); | |
831 ffsResult = mfw_fm_rename(oldfilename_uc,newfilename_uc,source); | |
832 #else | |
833 ffsResult = mfw_fm_rename(t_oldfilename,t_newfilename,source); | |
834 #endif | |
835 if(ffsResult != FM_NO_ERROR) | |
836 { | |
837 return FM_RENAME_ERROR; | |
838 } | |
839 switch(source) | |
840 { | |
841 case FM_NOR_FLASH: | |
842 sprintf(t_oldfilename,"%s%s/%s.tmb",NORDIR,THUMB,old_filename); | |
843 sprintf(t_newfilename,"%s%s/%s.tmb",NORDIR,THUMB,new_filename); | |
844 break; | |
845 case FM_NORMS_FLASH: | |
846 sprintf(t_oldfilename,"%s%s/%s.tmb",NORMSDIR,THUMB,old_filename); | |
847 sprintf(t_newfilename,"%s%s/%s.tmb",NORMSDIR,THUMB,new_filename); | |
848 break; | |
849 case FM_NAND_FLASH: | |
850 sprintf(t_oldfilename,"%s%s/%s.tmb",NANDDIR,THUMB,old_filename); | |
851 sprintf(t_newfilename,"%s%s/%s.tmb",NANDDIR,THUMB,new_filename); | |
852 break; | |
853 case FM_T_FLASH: | |
854 sprintf(t_oldfilename,"%s%s/%s.tmb",TFLASHDIR,THUMB,old_filename); | |
855 sprintf(t_newfilename,"%s%s/%s.tmb",TFLASHDIR,THUMB,new_filename); | |
856 break; | |
857 } | |
858 | |
859 #ifdef FF_MMI_UNICODE_SUPPORT | |
860 convert_u8_to_unicode(t_oldfilename, oldfilename_uc); | |
861 convert_u8_to_unicode(t_newfilename, newfilename_uc); | |
862 ffsResult = mfw_fm_rename(oldfilename_uc,newfilename_uc,source); | |
863 #else | |
864 ffsResult = mfw_fm_rename(t_oldfilename,t_newfilename,source); | |
865 #endif | |
866 if(ffsResult != FM_NO_ERROR) | |
867 { | |
868 return FM_RENAME_ERROR; | |
869 } | |
870 #else | |
871 sprintf(t_oldfilename,"%s%s/%s.jpg",path,dirname,old_filename); | |
872 sprintf(t_newfilename,"%s%s/%s.jpg",path,dirname,new_filename); | |
873 | |
874 ffsResult = mfw_fm_rename(t_oldfilename,t_newfilename,source); | |
875 if(ffsResult != FM_NO_ERROR) | |
876 { | |
877 return FM_RENAME_ERROR; | |
878 } | |
879 sprintf(t_oldfilename,"%s%s/%s.tmb",NORDIR,THUMB,old_filename); | |
880 sprintf(t_newfilename,"%s%s/%s.tmb",NORDIR,THUMB,new_filename); | |
881 | |
882 ffsResult = mfw_fm_rename(t_oldfilename,t_newfilename,source); | |
883 | |
884 if(ffsResult != FM_NO_ERROR) | |
885 { | |
886 return FM_RENAME_ERROR; | |
887 } | |
888 #endif | |
889 return FM_NO_ERROR; | |
890 } | |
891 | |
892 /******************************************************************************* | |
893 $Function: mfw_fm_createRootDir | |
894 | |
895 $Description: Creates the root jpeg, tones directory | |
896 | |
897 $Returns: FM_NO_ERROR | |
898 | |
899 $Arguments: source : Current Drive | |
900 *******************************************************************************/ | |
901 T_MFW_FM_STATUS mfw_fm_createRootDir(T_FM_DEVICE_TYPE source) | |
902 { | |
903 #ifdef FF_MMI_RFS_ENABLED | |
904 T_RFS_RET ffsResult; | |
905 T_RFS_DIR f_dir; | |
906 UINT16 dir_path_uc[FM_MAX_DIR_PATH_LENGTH]; | |
907 #else | |
908 T_FFS_RET ffsResult; | |
909 T_FFS_DIR f_dir; | |
910 #endif | |
911 char dir_path[FM_MAX_DIR_PATH_LENGTH]; | |
912 | |
913 TRACE_FUNCTION("mfw_fm_createRootDir"); | |
914 | |
915 #ifdef FF_MMI_RFS_ENABLED | |
916 TRACE_EVENT_P1("Source %d",source); | |
917 switch (source) | |
918 { | |
919 case FM_NOR_FLASH: | |
920 sprintf(dir_path,"%s%s%s","/FFS",NORDIR,NORDIR_IMG); | |
921 convert_u8_to_unicode(dir_path, dir_path_uc); | |
922 /**********************NOTE*************************** | |
923 FFS API To be replaced with FS Abstraction API | |
924 ******************************************************/ | |
925 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
926 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
927 if(ffsResult > 0) | |
928 rfs_closedir(&f_dir); | |
929 else if(RFS_ENOENT == ffsResult) | |
930 { | |
931 /**********************NOTE*************************** | |
932 FFS API To be replaced with FS Abstraction API | |
933 ******************************************************/ | |
934 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
935 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
936 } | |
937 sprintf(dir_path,"%s%s%s","/FFS",NORDIR,THUMB); | |
938 convert_u8_to_unicode(dir_path, dir_path_uc); | |
939 /**********************NOTE*************************** | |
940 FFS API To be replaced with FS Abstraction API | |
941 ******************************************************/ | |
942 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
943 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
944 if(ffsResult > 0) | |
945 rfs_closedir(&f_dir); | |
946 else if(RFS_ENOENT == ffsResult) | |
947 { | |
948 /**********************NOTE*************************** | |
949 FFS API To be replaced with FS Abstraction API | |
950 ******************************************************/ | |
951 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
952 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
953 } | |
954 sprintf(dir_path,"%s%s%s","/FFS",NORDIR,NORDIR_AUD); | |
955 convert_u8_to_unicode(dir_path, dir_path_uc); | |
956 /**********************NOTE*************************** | |
957 FFS API To be replaced with FS Abstraction API | |
958 ******************************************************/ | |
959 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
960 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
961 if(ffsResult > 0) | |
962 rfs_closedir(&f_dir); | |
963 else if(RFS_ENOENT == ffsResult) | |
964 { | |
965 /**********************NOTE*************************** | |
966 FFS API To be replaced with FS Abstraction API | |
967 ******************************************************/ | |
968 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
969 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
970 } | |
971 break; | |
972 case FM_NORMS_FLASH: | |
973 sprintf(dir_path,"%s%s%s","/NOR",NORMSDIR,NORMSDIR_IMG); | |
974 convert_u8_to_unicode(dir_path, dir_path_uc); | |
975 /**********************NOTE*************************** | |
976 FFS API To be replaced with FS Abstraction API | |
977 ******************************************************/ | |
978 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
979 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
980 // if(ffsResult > 0) | |
981 // rfs_closedir(&f_dir); | |
982 // else | |
983 if(RFS_ENOENT == ffsResult) | |
984 { | |
985 /**********************NOTE*************************** | |
986 FFS API To be replaced with FS Abstraction API | |
987 ******************************************************/ | |
988 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
989 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
990 } | |
991 sprintf(dir_path,"%s%s%s","/NOR",NORMSDIR,THUMB); | |
992 convert_u8_to_unicode(dir_path, dir_path_uc); | |
993 /**********************NOTE*************************** | |
994 FFS API To be replaced with FS Abstraction API | |
995 ******************************************************/ | |
996 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
997 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
998 // if(ffsResult > 0) | |
999 // rfs_closedir(&f_dir); | |
1000 // else | |
1001 if(RFS_ENOENT == ffsResult) | |
1002 { | |
1003 /**********************NOTE*************************** | |
1004 FFS API To be replaced with FS Abstraction API | |
1005 ******************************************************/ | |
1006 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
1007 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1008 } | |
1009 sprintf(dir_path,"%s%s%s","/NOR",NORMSDIR,NORMSDIR_AUD); | |
1010 convert_u8_to_unicode(dir_path, dir_path_uc); | |
1011 /**********************NOTE*************************** | |
1012 FFS API To be replaced with FS Abstraction API | |
1013 ******************************************************/ | |
1014 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
1015 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1016 // if(ffsResult > 0) | |
1017 // rfs_closedir(&f_dir); | |
1018 // else | |
1019 if(RFS_ENOENT == ffsResult) | |
1020 { | |
1021 /**********************NOTE*************************** | |
1022 FFS API To be replaced with FS Abstraction API | |
1023 ******************************************************/ | |
1024 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
1025 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1026 } | |
1027 break; | |
1028 case FM_NAND_FLASH: | |
1029 /**********************NOTE*************************** | |
1030 FS Abstraction API to be added | |
1031 ******************************************************/ | |
1032 sprintf(dir_path,"%s%s%s","/NAND",NANDDIR,NANDDIR_IMG); | |
1033 convert_u8_to_unicode(dir_path, dir_path_uc); | |
1034 /**********************NOTE*************************** | |
1035 FFS API To be replaced with FS Abstraction API | |
1036 ******************************************************/ | |
1037 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
1038 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1039 // if(ffsResult > 0) | |
1040 // rfs_closedir(&f_dir); | |
1041 // else | |
1042 if(RFS_ENOENT == ffsResult) | |
1043 { | |
1044 /**********************NOTE*************************** | |
1045 FFS API To be replaced with FS Abstraction API | |
1046 ******************************************************/ | |
1047 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
1048 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1049 } | |
1050 sprintf(dir_path,"%s%s%s","/NAND",NANDDIR,THUMB); | |
1051 convert_u8_to_unicode(dir_path, dir_path_uc); | |
1052 /**********************NOTE*************************** | |
1053 FFS API To be replaced with FS Abstraction API | |
1054 ******************************************************/ | |
1055 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
1056 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1057 // if(ffsResult > 0) | |
1058 // rfs_closedir(&f_dir); | |
1059 // else | |
1060 if(RFS_ENOENT == ffsResult) | |
1061 { | |
1062 /**********************NOTE*************************** | |
1063 FFS API To be replaced with FS Abstraction API | |
1064 ******************************************************/ | |
1065 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
1066 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1067 } | |
1068 sprintf(dir_path,"%s%s%s","/NAND",NANDDIR,NANDDIR_AUD); | |
1069 convert_u8_to_unicode(dir_path, dir_path_uc); | |
1070 /**********************NOTE*************************** | |
1071 FFS API To be replaced with FS Abstraction API | |
1072 ******************************************************/ | |
1073 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
1074 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1075 // if(ffsResult > 0) | |
1076 // rfs_closedir(&f_dir); | |
1077 // else | |
1078 if(RFS_ENOENT == ffsResult) | |
1079 { | |
1080 /**********************NOTE*************************** | |
1081 FFS API To be replaced with FS Abstraction API | |
1082 ******************************************************/ | |
1083 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
1084 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1085 } | |
1086 break; | |
1087 case FM_T_FLASH: | |
1088 /**********************NOTE*************************** | |
1089 FS Abstraction API to be added | |
1090 ******************************************************/ | |
1091 sprintf(dir_path,"%s%s%s","/MMC",TFLASHDIR,TFLASHDIR_IMG); | |
1092 convert_u8_to_unicode(dir_path, dir_path_uc); | |
1093 /**********************NOTE*************************** | |
1094 FFS API To be replaced with FS Abstraction API | |
1095 ******************************************************/ | |
1096 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
1097 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1098 // if(ffsResult > 0) | |
1099 // rfs_closedir(&f_dir); | |
1100 // else | |
1101 if(RFS_ENOENT == ffsResult) | |
1102 { | |
1103 /**********************NOTE*************************** | |
1104 FFS API To be replaced with FS Abstraction API | |
1105 ******************************************************/ | |
1106 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
1107 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1108 } | |
1109 sprintf(dir_path,"%s%s%s","/MMC",TFLASHDIR,THUMB); | |
1110 convert_u8_to_unicode(dir_path, dir_path_uc); | |
1111 /**********************NOTE*************************** | |
1112 FFS API To be replaced with FS Abstraction API | |
1113 ******************************************************/ | |
1114 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
1115 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1116 // if(ffsResult > 0) | |
1117 // rfs_closedir(&f_dir); | |
1118 // else | |
1119 if(RFS_ENOENT == ffsResult) | |
1120 { | |
1121 /**********************NOTE*************************** | |
1122 FFS API To be replaced with FS Abstraction API | |
1123 ******************************************************/ | |
1124 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
1125 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1126 } | |
1127 sprintf(dir_path,"%s%s%s","/MMC",TFLASHDIR,TFLASHDIR_AUD); | |
1128 convert_u8_to_unicode(dir_path, dir_path_uc); | |
1129 /**********************NOTE*************************** | |
1130 FFS API To be replaced with FS Abstraction API | |
1131 ******************************************************/ | |
1132 ffsResult = rfs_opendir(dir_path_uc,&f_dir); | |
1133 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1134 // if(ffsResult > 0) | |
1135 // rfs_closedir(&f_dir); | |
1136 // else | |
1137 if(RFS_ENOENT == ffsResult) | |
1138 { | |
1139 /**********************NOTE*************************** | |
1140 FFS API To be replaced with FS Abstraction API | |
1141 ******************************************************/ | |
1142 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU); | |
1143 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path); | |
1144 } | |
1145 break; | |
1146 } | |
1147 #else | |
1148 sprintf(dir_path,"%s%s",NORDIR,NORDIR_IMG); | |
1149 /**********************NOTE*************************** | |
1150 FFS API To be replaced with FS Abstraction API | |
1151 ******************************************************/ | |
1152 ffsResult = ffs_opendir(dir_path,&f_dir); | |
1153 if(EFFS_NOTFOUND == ffsResult) | |
1154 { | |
1155 /**********************NOTE*************************** | |
1156 FFS API To be replaced with FS Abstraction API | |
1157 ******************************************************/ | |
1158 ffsResult = ffs_mkdir(dir_path); | |
1159 } | |
1160 sprintf(dir_path,"%s%s",NORDIR,THUMB); | |
1161 /**********************NOTE*************************** | |
1162 FFS API To be replaced with FS Abstraction API | |
1163 ******************************************************/ | |
1164 ffsResult = ffs_opendir(dir_path,&f_dir); | |
1165 if(EFFS_NOTFOUND == ffsResult) | |
1166 { | |
1167 /**********************NOTE*************************** | |
1168 FFS API To be replaced with FS Abstraction API | |
1169 ******************************************************/ | |
1170 ffsResult = ffs_mkdir(dir_path); | |
1171 } | |
1172 sprintf(dir_path,"%s%s",NORDIR,NORDIR_AUD); | |
1173 /**********************NOTE*************************** | |
1174 FFS API To be replaced with FS Abstraction API | |
1175 ******************************************************/ | |
1176 ffsResult = ffs_opendir(dir_path,&f_dir); | |
1177 if(EFFS_NOTFOUND == ffsResult) | |
1178 { | |
1179 /**********************NOTE*************************** | |
1180 FFS API To be replaced with FS Abstraction API | |
1181 ******************************************************/ | |
1182 ffsResult = ffs_mkdir(dir_path); | |
1183 } | |
1184 #endif | |
1185 return FM_NO_ERROR; | |
1186 } | |
1187 | |
1188 /******************************************************************************* | |
1189 $Function: mfw_fm_newdir | |
1190 | |
1191 $Description: creates a new direcotry with the given name | |
1192 | |
1193 $Returns: FM_DIR_EXISTS/FM_NO_ERROR | |
1194 | |
1195 $Arguments: dirname : new directory name | |
1196 source : Current Drive | |
1197 *******************************************************************************/ | |
1198 T_MFW_FM_STATUS mfw_fm_newdir(char *dirname, T_FM_DEVICE_TYPE source) | |
1199 { | |
1200 #ifdef FF_MMI_RFS_ENABLED | |
1201 T_RFS_RET ffsResult; | |
1202 T_RFS_DIR f_dir; | |
1203 char pathname[FM_MAX_DIR_PATH_LENGTH]; | |
1204 UINT16 pathname_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1205 #else | |
1206 T_FFS_RET ffsResult; | |
1207 T_FFS_DIR f_dir; | |
1208 #endif | |
1209 | |
1210 TRACE_FUNCTION("mfw_fm_newdir"); | |
1211 | |
1212 #ifdef FF_MMI_RFS_ENABLED | |
1213 switch (source) | |
1214 { | |
1215 case FM_NOR_FLASH: | |
1216 strcpy(pathname,"/FFS"); | |
1217 break; | |
1218 case FM_NORMS_FLASH: | |
1219 strcpy(pathname,"/NOR"); | |
1220 break; | |
1221 case FM_NAND_FLASH: | |
1222 strcpy(pathname,"/NAND"); | |
1223 break; | |
1224 case FM_T_FLASH: | |
1225 strcpy(pathname,"/MMC"); | |
1226 break; | |
1227 } | |
1228 strcat(pathname,dirname); | |
1229 convert_u8_to_unicode(pathname,pathname_uc); | |
1230 | |
1231 ffsResult = rfs_opendir(pathname_uc,&f_dir); | |
1232 if(RFS_ENOENT == ffsResult) | |
1233 { | |
1234 ffsResult = rfs_mkdir(pathname_uc,RFS_IRWXU); | |
1235 } | |
1236 else | |
1237 { | |
1238 return FM_DIR_EXISTS; | |
1239 } | |
1240 #else | |
1241 | |
1242 ffsResult = ffs_opendir(dirname,&f_dir); | |
1243 if(EFFS_NOTFOUND == ffsResult) | |
1244 { | |
1245 ffsResult = ffs_mkdir(dirname); | |
1246 } | |
1247 else | |
1248 { | |
1249 return FM_DIR_EXISTS; | |
1250 } | |
1251 #endif | |
1252 return FM_NO_ERROR; | |
1253 } | |
1254 | |
1255 /******************************************************************************* | |
1256 $Function: mfw_fm_readProperties | |
1257 | |
1258 $Description: Reads the properties of all the objects in the given directory | |
1259 | |
1260 $Returns: None | |
1261 | |
1262 $Arguments: dir_path : Current Directory Path | |
1263 dir_name : Current Directory Name | |
1264 num_objs : num of obejcts | |
1265 obj_list : object list | |
1266 obj_properties: Object properties | |
1267 source : Current Drive | |
1268 *******************************************************************************/ | |
1269 void mfw_fm_readProperties(char *dir_path, char *dir_name, UBYTE num_objs, T_FM_OBJ **obj_list, T_FM_OBJ_PROPERTIES **obj_properties,T_FM_DEVICE_TYPE source, T_FM_APP_TYPE app) | |
1270 { | |
1271 /* January 16, 2008 DRT:OMAPS00156759 (x0082844) Shubhro -> For Unicode Support--> Start*/ | |
1272 #if defined(FF_MMI_UNICODE_SUPPORT)||defined (FF_MMI_RFS_ENABLED) | |
1273 T_WCHAR curObj_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1274 #else | |
1275 char curObj_u8[FM_MAX_DIR_PATH_LENGTH]; | |
1276 #endif | |
1277 /* January 16, 2008 DRT:OMAPS00156759 (x0082844) Shubhro --> End*/ | |
1278 | |
1279 char curPath[FM_MAX_DIR_PATH_LENGTH]; | |
1280 int iCount=0; | |
1281 | |
1282 #ifdef FF_MMI_RFS_ENABLED | |
1283 T_RFS_RET result; | |
1284 T_RFS_STAT f_stat; | |
1285 T_RTC_DATE_TIME time_and_date; | |
1286 #else | |
1287 T_FFS_RET result; | |
1288 T_FFS_STAT f_stat; | |
1289 #endif | |
1290 | |
1291 TRACE_FUNCTION("mfw_fm_readProperties"); | |
1292 | |
1293 #ifdef FF_MMI_RFS_ENABLED | |
1294 switch (source) | |
1295 { | |
1296 case FM_NOR_FLASH: | |
1297 sprintf(curPath,"%s%s%s/","/FFS",dir_path,dir_name); | |
1298 break; | |
1299 case FM_NORMS_FLASH: | |
1300 sprintf(curPath,"%s%s%s/","/NOR",dir_path,dir_name); | |
1301 break; | |
1302 case FM_NAND_FLASH: | |
1303 sprintf(curPath,"%s%s%s/","/NAND",dir_path,dir_name); | |
1304 break; | |
1305 case FM_T_FLASH: | |
1306 sprintf(curPath,"%s%s%s/","/MMC",dir_path,dir_name); | |
1307 break; | |
1308 } | |
1309 | |
1310 | |
1311 for (iCount = 0;iCount<num_objs; iCount++) | |
1312 { | |
1313 | |
1314 /* February 8, 2008 DRT:OMAPS00156759 (x0083025) For Unicode Support--> Start*/ | |
1315 convert_u8_to_unicode(curPath, curObj_uc); | |
1316 | |
1317 #ifdef FF_MMI_UNICODE_SUPPORT | |
1318 // If it's an image it's stored as char | |
1319 if (app == FM_AUDIO) | |
1320 { | |
1321 wstrcat(curObj_uc, obj_list[iCount]->name_uc); | |
1322 } | |
1323 else | |
1324 #endif | |
1325 { | |
1326 T_WCHAR filename_uc[FM_MAX_OBJ_NAME_LENGTH]; | |
1327 convert_u8_to_unicode(obj_list[iCount]->name, filename_uc); | |
1328 wstrcat(curObj_uc, filename_uc); | |
1329 } | |
1330 result= rfs_stat(curObj_uc, &f_stat); | |
1331 if(result == RFS_EOK) | |
1332 { | |
1333 if(f_stat.file_dir.mode & RFS_IXUSR) | |
1334 obj_list[iCount]->type=OBJECT_TYPE_FOLDER; | |
1335 else | |
1336 obj_list[iCount]->type=OBJECT_TYPE_FILE; | |
1337 } | |
1338 TRACE_EVENT_P2("Object %s type %d",curObj_uc, obj_list[iCount]->type); | |
1339 | |
1340 obj_properties[iCount] = (T_FM_OBJ_PROPERTIES *)mfwAlloc(sizeof(T_FM_OBJ_PROPERTIES)); | |
1341 obj_properties[iCount]->size = f_stat.file_dir.size; | |
1342 result = rfs_getdatetime(curObj_uc,NULL /* creation date and time */,&time_and_date /* last modified date and time */); | |
1343 sprintf(obj_properties[iCount]->date,"%d-%d-%d", time_and_date.day, time_and_date.month, 2000 + time_and_date.year); | |
1344 sprintf(obj_properties[iCount]->time,"%d.%d.%d", time_and_date.hour, time_and_date.minute, time_and_date.second); | |
1345 } | |
1346 | |
1347 #else | |
1348 sprintf(curPath,"%s%s/",dir_path,dir_name); | |
1349 for (iCount = 0;iCount<num_objs; iCount++) | |
1350 { | |
1351 sprintf(curObj_u8,"%s%s",curPath,obj_list[iCount]->name); | |
1352 /**********************NOTE*************************** | |
1353 FFS API To be replaced with FS Abstraction API | |
1354 ******************************************************/ | |
1355 result= ffs_stat( curObj_u8, (void *)&f_stat ); | |
1356 if(result == EFFS_OK) | |
1357 { | |
1358 switch(f_stat.type) | |
1359 { | |
1360 case OT_FILE: | |
1361 obj_list[iCount]->type=OBJECT_TYPE_FILE; | |
1362 break; | |
1363 case OT_DIR: | |
1364 obj_list[iCount]->type=OBJECT_TYPE_FOLDER; | |
1365 break; | |
1366 default: | |
1367 obj_list[iCount]->type=OBJECT_TYPE_NONE; | |
1368 break; | |
1369 } | |
1370 } | |
1371 TRACE_EVENT_P2("name %s, Object type %d", obj_list[iCount]->name,obj_list[iCount]->type); | |
1372 obj_properties[iCount] = (T_FM_OBJ_PROPERTIES*)mfwAlloc(sizeof(T_FM_OBJ_PROPERTIES)); | |
1373 obj_properties[iCount]->size=f_stat.size; | |
1374 } | |
1375 #endif | |
1376 } | |
1377 | |
1378 /******************************************************************************* | |
1379 $Function: mfw_fm_readFIleFolders | |
1380 | |
1381 $Description: Classifies all the objects as either File or Directory | |
1382 | |
1383 $Returns: None | |
1384 | |
1385 $Arguments: fm_curr_dir : Current directory | |
1386 source : Current Drive | |
1387 *******************************************************************************/ | |
1388 void mfw_fm_readFileFolders(char *dir_path, char *dir_name, UBYTE num_objs, T_FM_OBJ **obj_list, T_FM_DEVICE_TYPE source) | |
1389 { | |
1390 char curObj[FM_MAX_DIR_PATH_LENGTH]; | |
1391 char curPath[FM_MAX_DIR_PATH_LENGTH]; | |
1392 int iCount=0; | |
1393 #ifdef FF_MMI_RFS_ENABLED | |
1394 T_RFS_RET result; | |
1395 T_RFS_STAT f_stat; | |
1396 UINT16 curObj_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1397 #else | |
1398 T_FFS_RET result; | |
1399 T_FFS_STAT f_stat; | |
1400 #endif | |
1401 | |
1402 TRACE_FUNCTION("mfw_fm_readFileFolders"); | |
1403 | |
1404 #ifdef FF_MMI_RFS_ENABLED | |
1405 switch (source) | |
1406 { | |
1407 case FM_NOR_FLASH: | |
1408 sprintf(curPath,"%s%s%s/","/FFS",dir_path,dir_name); | |
1409 break; | |
1410 case FM_NORMS_FLASH: | |
1411 sprintf(curPath,"%s%s%s/","/NOR",dir_path,dir_name); | |
1412 break; | |
1413 case FM_NAND_FLASH: | |
1414 sprintf(curPath,"%s%s%s/","/NAND",dir_path,dir_name); | |
1415 break; | |
1416 case FM_T_FLASH: | |
1417 sprintf(curPath,"%s%s%s/","/MMC",dir_path,dir_name); | |
1418 break; | |
1419 } | |
1420 for (iCount = 0;iCount<num_objs; iCount++) | |
1421 { | |
1422 sprintf(curObj,"%s%s",curPath,obj_list[iCount]->name); | |
1423 convert_u8_to_unicode(curObj, curObj_uc); | |
1424 result= rfs_stat(curObj_uc, &f_stat); | |
1425 if(result == RFS_EOK) | |
1426 { | |
1427 if(f_stat.file_dir.mode & RFS_IXUSR) | |
1428 obj_list[iCount]->type=OBJECT_TYPE_FOLDER; | |
1429 else | |
1430 obj_list[iCount]->type=OBJECT_TYPE_FILE; | |
1431 } | |
1432 TRACE_EVENT_P2("Object %s type %d",curObj, obj_list[iCount]->type); | |
1433 } | |
1434 #else | |
1435 sprintf(curPath,"%s%s/",dir_path,dir_name); | |
1436 | |
1437 for (iCount = 0;iCount<num_objs; iCount++) | |
1438 { | |
1439 sprintf(curObj,"%s%s",curPath,obj_list[iCount]->name); | |
1440 | |
1441 result= ffs_stat( curObj, (void *)&f_stat ); | |
1442 if(result == EFFS_OK) | |
1443 { | |
1444 switch(f_stat.type) | |
1445 { | |
1446 case OT_FILE: | |
1447 obj_list[iCount]->type=OBJECT_TYPE_FILE; | |
1448 break; | |
1449 case OT_DIR: | |
1450 obj_list[iCount]->type=OBJECT_TYPE_FOLDER; | |
1451 break; | |
1452 default: | |
1453 obj_list[iCount]->type=OBJECT_TYPE_NONE; | |
1454 break; | |
1455 } | |
1456 } | |
1457 TRACE_EVENT_P2("Object %s type %d",curObj, obj_list[iCount]->type); | |
1458 } | |
1459 #endif | |
1460 } | |
1461 /******************************************************************************* | |
1462 $Function: mfw_fm_getMemStat | |
1463 | |
1464 $Description: Extracts the memory usage details of a given drive | |
1465 | |
1466 $Returns: None | |
1467 | |
1468 $Arguments: nfree : free bytes | |
1469 nused : used bytes | |
1470 source : Current Drive | |
1471 *******************************************************************************/ | |
1472 void mfw_fm_getMemStat(int *nfree, int *nused,T_FM_DEVICE_TYPE source) | |
1473 { | |
1474 | |
1475 T_RFS_STAT f_stat; | |
1476 char curObj[FM_MAX_DIR_PATH_LENGTH]; | |
1477 UINT16 curObj_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1478 TRACE_FUNCTION("mfw_fm_getMemStat"); | |
1479 | |
1480 memset(curObj, 0, FM_MAX_DIR_PATH_LENGTH); | |
1481 switch (source) | |
1482 { | |
1483 case FM_NOR_FLASH: | |
1484 strcpy(curObj,"/FFS"); | |
1485 break; | |
1486 case FM_NORMS_FLASH: | |
1487 strcpy(curObj,"/NOR"); | |
1488 break; | |
1489 case FM_NAND_FLASH: | |
1490 strcpy(curObj,"/NAND"); | |
1491 break; | |
1492 case FM_T_FLASH: | |
1493 strcpy(curObj,"/MMC"); | |
1494 break; | |
1495 } | |
1496 convert_u8_to_unicode(curObj, curObj_uc); | |
1497 rfs_stat(curObj_uc, &f_stat); /* warning fix */ | |
1498 *nfree = f_stat.mount_point.free_space; | |
1499 *nused = f_stat.mount_point.used_size; | |
1500 | |
1501 } | |
1502 | |
1503 /******************************************************************************* | |
1504 $Function: mfw_fm_format | |
1505 | |
1506 $Description: Formats the given drive | |
1507 | |
1508 $Returns: FM_NO_ERROR/FM_FORMAT_ERROR | |
1509 | |
1510 $Arguments: source : Current Drive | |
1511 *******************************************************************************/ | |
1512 T_MFW_FM_STATUS mfw_fm_format(T_FM_DEVICE_TYPE source) | |
1513 { | |
1514 T_RFS_RET result; | |
1515 UINT16 mount_point_uc[6]; | |
1516 TRACE_FUNCTION("mfw_fm_format"); | |
1517 memset(mount_point_uc, 0x00,6); | |
1518 switch (source) | |
1519 { | |
1520 case FM_NORMS_FLASH: | |
1521 convert_u8_to_unicode("/NOR", mount_point_uc); | |
1522 break; | |
1523 case FM_NAND_FLASH: | |
1524 convert_u8_to_unicode("/NAND", mount_point_uc); | |
1525 break; | |
1526 case FM_T_FLASH: | |
1527 convert_u8_to_unicode("/MMC", mount_point_uc); | |
1528 break; | |
1529 } | |
1530 | |
1531 result = rfs_preformat(mount_point_uc, 0xDEAD); | |
1532 if(result < RFS_EOK) | |
1533 return FM_FORMAT_ERROR; | |
1534 else | |
1535 { | |
1536 result = rfs_format(mount_point_uc, NULL, 0x2BAD); | |
1537 if (result < RFS_EOK) | |
1538 return FM_FORMAT_ERROR; | |
1539 else | |
1540 { | |
1541 /* Mar 15, 2007 DRT: OMAPS00120201 x0039928 */ | |
1542 /* Fix: Creating the default directories for the selected device after format */ | |
1543 mfw_fm_createRootDir(source); | |
1544 return FM_NO_ERROR; | |
1545 } | |
1546 } | |
1547 } | |
1548 | |
1549 /******************************************************************************* | |
1550 $Function: mfw_fm_remove | |
1551 | |
1552 $Description: Deletes the selected object | |
1553 | |
1554 $Returns: FM_DELETE_DIRNOTEMPTY/FM_DELETE_ERROR/FM_NO_ERROR | |
1555 | |
1556 $Arguments: source : Current Drive | |
1557 *******************************************************************************/ | |
1558 #ifdef FF_MMI_UNICODE_SUPPORT | |
1559 T_MFW_FM_STATUS mfw_fm_remove(T_WCHAR* objname_u16,T_FM_DEVICE_TYPE source) | |
1560 #else | |
1561 T_MFW_FM_STATUS mfw_fm_remove(char* objname,T_FM_DEVICE_TYPE source) | |
1562 #endif | |
1563 { | |
1564 #ifdef FF_MMI_RFS_ENABLED | |
1565 T_RFS_RET rfsResult; | |
1566 char objname_mt[FM_MAX_DIR_PATH_LENGTH]; | |
1567 T_WCHAR objname_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1568 #else | |
1569 T_FFS_RET ffsResult; | |
1570 #endif | |
1571 | |
1572 | |
1573 TRACE_FUNCTION("mfw_fm_remove"); | |
1574 | |
1575 #ifdef FF_MMI_RFS_ENABLED | |
1576 switch (source) | |
1577 { | |
1578 case FM_NOR_FLASH: | |
1579 strcpy(objname_mt,"/FFS"); | |
1580 break; | |
1581 case FM_NORMS_FLASH: | |
1582 strcpy(objname_mt,"/NOR"); | |
1583 break; | |
1584 case FM_NAND_FLASH: | |
1585 strcpy(objname_mt,"/NAND"); | |
1586 break; | |
1587 case FM_T_FLASH: | |
1588 strcpy(objname_mt,"/MMC"); | |
1589 break; | |
1590 } | |
1591 #ifdef FF_MMI_UNICODE_SUPPORT | |
1592 convert_u8_to_unicode(objname_mt, objname_uc); | |
1593 wstrcat(objname_uc, objname_u16); | |
1594 #else | |
1595 strcat(objname_mt,objname); | |
1596 convert_u8_to_unicode(objname_mt, objname_uc); | |
1597 #endif | |
1598 TRACE_EVENT_P1("objname %s",objname_uc); | |
1599 rfsResult = rfs_remove(objname_uc); | |
1600 if(rfsResult != RFS_EOK) | |
1601 { | |
1602 return FM_DELETE_ERROR; | |
1603 } | |
1604 #else | |
1605 { | |
1606 #ifdef FF_MMI_UNICODE_SUPPORT | |
1607 char objname[FM_MAX_DIR_PATH_LENGTH]; | |
1608 convert_unicode_to_u8(objname_u16, objname); | |
1609 #endif | |
1610 TRACE_EVENT_P1("objname %s",objname); | |
1611 ffsResult = ffs_remove(objname); | |
1612 } | |
1613 if(ffsResult != EFFS_OK) | |
1614 { | |
1615 if(ffsResult == EFFS_DIRNOTEMPTY) | |
1616 return FM_DELETE_DIRNOTEMPTY; | |
1617 else | |
1618 return FM_DELETE_ERROR; | |
1619 } | |
1620 | |
1621 #endif | |
1622 return FM_NO_ERROR; | |
1623 } | |
1624 | |
1625 /******************************************************************************* | |
1626 $Function: mfw_fm_remove_image | |
1627 | |
1628 $Description: Deletes the selcted image and its thumbnail | |
1629 | |
1630 $Returns: FM_DELETE_ERROR/FM_NO_ERROR | |
1631 | |
1632 $Arguments: path : Current directory path | |
1633 dirname : Current Directory name | |
1634 old_filename : Old filename | |
1635 new_filename : New filename | |
1636 source : Current Drive | |
1637 *******************************************************************************/ | |
1638 T_MFW_FM_STATUS mfw_fm_remove_image(char * path, char * dirname, char* objname,T_FM_DEVICE_TYPE source) | |
1639 { | |
1640 char obj[FM_MAX_DIR_PATH_LENGTH]; | |
1641 T_MFW_FM_STATUS ffsResult; | |
1642 | |
1643 TRACE_FUNCTION("mfw_fm_delete_image"); | |
1644 | |
1645 sprintf(obj,"%s%s/%s.jpg",path,dirname,objname); | |
1646 TRACE_EVENT_P1("obj %s",obj); | |
1647 #ifdef FF_MMI_UNICODE_SUPPORT | |
1648 { | |
1649 T_WCHAR obj_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1650 convert_u8_to_unicode(obj, obj_uc); | |
1651 ffsResult = mfw_fm_remove(obj_uc,source); | |
1652 } | |
1653 #else | |
1654 ffsResult = mfw_fm_remove(obj,source); | |
1655 #endif | |
1656 if(ffsResult != FM_NO_ERROR) | |
1657 { | |
1658 return FM_DELETE_ERROR; | |
1659 } | |
1660 switch(source) | |
1661 { | |
1662 case FM_NOR_FLASH: | |
1663 sprintf(obj,"%s%s/%s.tmb",NORDIR,THUMB,objname); | |
1664 break; | |
1665 case FM_NORMS_FLASH: | |
1666 sprintf(obj,"%s%s/%s.tmb",NORMSDIR,THUMB,objname); | |
1667 break; | |
1668 case FM_NAND_FLASH: | |
1669 sprintf(obj,"%s%s/%s.tmb",NANDDIR,THUMB,objname); | |
1670 break; | |
1671 case FM_T_FLASH: | |
1672 sprintf(obj,"%s%s/%s.tmb",TFLASHDIR,THUMB,objname); | |
1673 break; | |
1674 } | |
1675 #ifdef FF_MMI_UNICODE_SUPPORT | |
1676 { | |
1677 T_WCHAR obj_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1678 convert_u8_to_unicode(obj, obj_uc); | |
1679 ffsResult = mfw_fm_remove(obj_uc,source); | |
1680 } | |
1681 #else | |
1682 ffsResult = mfw_fm_remove(obj,source); | |
1683 #endif | |
1684 if(ffsResult != FM_NO_ERROR) | |
1685 { | |
1686 return FM_DELETE_ERROR; | |
1687 } | |
1688 return FM_NO_ERROR; | |
1689 } | |
1690 | |
1691 /******************************************************************************* | |
1692 $Function: mfw_fm_copy_start | |
1693 | |
1694 $Description: starts copying the give file | |
1695 | |
1696 $Returns: FM_COPY_ERROR/FM_COPY_DONE/FM_COPY_PROGRESS | |
1697 | |
1698 $Arguments: data : Copy/Move operation related structure | |
1699 *******************************************************************************/ | |
1700 T_FM_COPY_STATE mfw_fm_copy_start(T_MFW_FM_COPYMOVE_STRUCT *data) | |
1701 { | |
1702 char *ext2; | |
1703 T_RFS_STAT f_stat; | |
1704 T_RFS_SIZE iResult = 0; | |
1705 UINT16 source_file_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1706 UINT16 destination_file_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1707 char source_file[FM_MAX_DIR_PATH_LENGTH]; | |
1708 char destination_file[FM_MAX_DIR_PATH_LENGTH]; | |
1709 | |
1710 TRACE_FUNCTION("mfw_fm_copy_start"); | |
1711 | |
1712 switch (data->source_type) | |
1713 { | |
1714 case FM_NOR_FLASH: | |
1715 strcpy(source_file,"/FFS"); | |
1716 break; | |
1717 case FM_NORMS_FLASH: | |
1718 strcpy(source_file,"/NOR"); | |
1719 break; | |
1720 case FM_NAND_FLASH: | |
1721 strcpy(source_file,"/NAND"); | |
1722 break; | |
1723 case FM_T_FLASH: | |
1724 strcpy(source_file,"/MMC"); | |
1725 break; | |
1726 } | |
1727 | |
1728 switch (data->destination_type) | |
1729 { | |
1730 case FM_NOR_FLASH: | |
1731 strcpy(destination_file,"/FFS"); | |
1732 break; | |
1733 case FM_NORMS_FLASH: | |
1734 strcpy(destination_file,"/NOR"); | |
1735 break; | |
1736 case FM_NAND_FLASH: | |
1737 strcpy(destination_file,"/NAND"); | |
1738 break; | |
1739 case FM_T_FLASH: | |
1740 strcpy(destination_file,"/MMC"); | |
1741 break; | |
1742 } | |
1743 #ifdef FF_MMI_UNICODE_SUPPORT | |
1744 convert_u8_to_unicode(source_file, source_file_uc); | |
1745 convert_u8_to_unicode(destination_file, destination_file_uc); | |
1746 wstrcat(source_file_uc, data->sourceFile); | |
1747 wstrcat(destination_file_uc, data->destinationFile); | |
1748 #else | |
1749 strcat(source_file, data->sourceFile); | |
1750 strcat(destination_file, data->destinationFile); | |
1751 | |
1752 convert_u8_to_unicode(source_file, source_file_uc); | |
1753 convert_u8_to_unicode(destination_file, destination_file_uc); | |
1754 #endif | |
1755 | |
1756 ext2=(char *)mmi_fm_get_ext(source_file);//April 27, 2007 DRT:OMAPS00128836 x0073106 | |
1757 | |
1758 if( ( (rfs_stat(destination_file_uc, &f_stat)) != RFS_ENOENT)//April 27, 2007 DRT:OMAPS00128836 x0073106 | |
1759 && (strcmp((const char*)ext2, "jpg") ==0 )) | |
1760 { | |
1761 return FM_COPY_NONE; | |
1762 } | |
1763 | |
1764 data->sourceFileID = (T_RFS_FD)rfs_open( source_file_uc, RFS_O_RDONLY, NULL); | |
1765 data->destFileID= (T_RFS_FD)rfs_open( destination_file_uc, RFS_O_WRONLY|RFS_O_CREAT, RFS_IRUSR|RFS_IWUSR); | |
1766 data->bytesRead = 0; | |
1767 | |
1768 if(data->sourceFileSize > FM_COPY_BUFFER_SIZE ) | |
1769 { | |
1770 data->buf_size = FM_COPY_BUFFER_SIZE; | |
1771 data->bytesRead = data->buf_size; | |
1772 } | |
1773 else | |
1774 { | |
1775 data->buf_size = data->sourceFileSize; | |
1776 data->bytesRead = data->buf_size; | |
1777 } | |
1778 | |
1779 iResult = (T_RFS_SIZE)rfs_read(data->sourceFileID, data->buf, data->buf_size ); | |
1780 TRACE_EVENT_P1("iResult %d",iResult); | |
1781 if(iResult < 0) | |
1782 { | |
1783 //Error Reading | |
1784 rfs_close( data->sourceFileID); | |
1785 rfs_close(data->destFileID ); | |
1786 return FM_COPY_ERROR; | |
1787 } | |
1788 iResult = (T_RFS_SIZE)rfs_write( data->destFileID, data->buf, data->buf_size); | |
1789 TRACE_EVENT_P1("iResult %d",iResult); | |
1790 if(iResult < 0) | |
1791 { | |
1792 //Error writing | |
1793 rfs_close( data->sourceFileID); | |
1794 rfs_close(data->destFileID ); | |
1795 return FM_COPY_ERROR; | |
1796 } | |
1797 if(data->bytesRead < data->sourceFileSize) | |
1798 { | |
1799 return FM_COPY_PROGRESS; | |
1800 } | |
1801 else | |
1802 { | |
1803 rfs_close( data->sourceFileID); | |
1804 rfs_close(data->destFileID ); | |
1805 return FM_COPY_DONE; | |
1806 } | |
1807 | |
1808 // return FM_COPY_ERROR; | |
1809 } | |
1810 | |
1811 /******************************************************************************* | |
1812 $Function: mfw_fm_copy_continue | |
1813 | |
1814 $Description: resumes copying the give file | |
1815 | |
1816 $Returns: FM_COPY_ERROR/FM_COPY_DONE/FM_COPY_PROGRESS | |
1817 | |
1818 $Arguments: data : Copy/Move operation related structure | |
1819 *******************************************************************************/ | |
1820 T_FM_COPY_STATE mfw_fm_copy_continue(T_MFW_FM_COPYMOVE_STRUCT *data) | |
1821 { | |
1822 T_RFS_SIZE iResult = 0; | |
1823 | |
1824 /* | |
1825 UINT16 source_file_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1826 UINT16 destination_file_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1827 char source_file[FM_MAX_DIR_PATH_LENGTH]; | |
1828 char destination_file[FM_MAX_DIR_PATH_LENGTH]; | |
1829 | |
1830 TRACE_FUNCTION("mfw_fm_copy_continue"); | |
1831 | |
1832 | |
1833 switch (data->source_type) | |
1834 { | |
1835 case FM_NOR_FLASH: | |
1836 strcpy(source_file,"/FFS"); | |
1837 break; | |
1838 case FM_NORMS_FLASH: | |
1839 strcpy(source_file,"/NOR"); | |
1840 break; | |
1841 case FM_NAND_FLASH: | |
1842 strcpy(source_file,"/NAND"); | |
1843 break; | |
1844 case FM_T_FLASH: | |
1845 strcpy(source_file,"/MMC"); | |
1846 break; | |
1847 } | |
1848 | |
1849 switch (data->destination_type) | |
1850 { | |
1851 case FM_NOR_FLASH: | |
1852 strcpy(destination_file,"/FFS"); | |
1853 break; | |
1854 case FM_NORMS_FLASH: | |
1855 strcpy(destination_file,"/NOR"); | |
1856 break; | |
1857 case FM_NAND_FLASH: | |
1858 strcpy(destination_file,"/NAND"); | |
1859 break; | |
1860 case FM_T_FLASH: | |
1861 strcpy(destination_file,"/MMC"); | |
1862 break; | |
1863 } | |
1864 | |
1865 strcat(source_file, data->sourceFile); | |
1866 strcat(destination_file, data->destinationFile); | |
1867 | |
1868 convert_u8_to_unicode(source_file, source_file_uc); | |
1869 convert_u8_to_unicode(destination_file, destination_file_uc); | |
1870 | |
1871 */ | |
1872 if( (data->bytesRead+ FM_COPY_BUFFER_SIZE) < data->sourceFileSize) | |
1873 { | |
1874 //More blocks to be read | |
1875 data->buf_size = FM_COPY_BUFFER_SIZE; | |
1876 data->bytesRead = data->bytesRead + data->buf_size; | |
1877 } | |
1878 else | |
1879 { | |
1880 //Last chunk to be read | |
1881 data->buf_size = data->sourceFileSize - data->bytesRead; | |
1882 data->bytesRead = data->bytesRead + FM_COPY_BUFFER_SIZE; | |
1883 } | |
1884 | |
1885 iResult = (T_RFS_SIZE)rfs_read(data->sourceFileID, data->buf, data->buf_size ); | |
1886 TRACE_EVENT_P1("iResult %d",iResult); | |
1887 if(iResult < 0) | |
1888 { | |
1889 //Error Reading | |
1890 rfs_close( data->sourceFileID); | |
1891 rfs_close(data->destFileID ); | |
1892 return FM_COPY_ERROR; | |
1893 } | |
1894 iResult = (T_RFS_SIZE)rfs_write( data->destFileID, data->buf, data->buf_size); | |
1895 TRACE_EVENT_P1("iResult %d",iResult); | |
1896 if(iResult < 0) | |
1897 { | |
1898 //Error Writing | |
1899 rfs_close( data->sourceFileID); | |
1900 rfs_close(data->destFileID ); | |
1901 return FM_COPY_ERROR; | |
1902 } | |
1903 | |
1904 if(data->bytesRead < data->sourceFileSize) | |
1905 { | |
1906 return FM_COPY_PROGRESS; | |
1907 } | |
1908 else | |
1909 { | |
1910 rfs_close(data->sourceFileID); | |
1911 rfs_close(data->destFileID ); | |
1912 return FM_COPY_DONE; | |
1913 } | |
1914 // return FM_COPY_ERROR; | |
1915 } | |
1916 | |
1917 //Image List | |
1918 /******************************************************************************* | |
1919 $Function: mfw_fm_checkThumbnail | |
1920 | |
1921 $Description: Checks for thumbnail | |
1922 | |
1923 $Returns: FM_FILE_DOESNOTEXISTS/FM_NO_ERROR | |
1924 | |
1925 $Arguments: obj : Current image | |
1926 source : Current Drive | |
1927 *******************************************************************************/ | |
1928 T_MFW_FM_STATUS mfw_fm_checkThumbnail( char * obj,T_FM_DEVICE_TYPE source) | |
1929 { | |
1930 | |
1931 char filename[FM_MAX_DIR_PATH_LENGTH]; | |
1932 #ifdef FF_MMI_RFS_ENABLED | |
1933 T_RFS_FD fd = 0; | |
1934 UINT16 filename_uc[FM_MAX_DIR_PATH_LENGTH]; | |
1935 #else | |
1936 T_FFS_FD fd = 0; | |
1937 #endif | |
1938 TRACE_FUNCTION("mfw_fm_check_thumbnail"); | |
1939 | |
1940 TRACE_EVENT_P1("File %s",obj); | |
1941 | |
1942 #ifdef FF_MMI_RFS_ENABLED | |
1943 memset(filename, 0, FM_MAX_DIR_PATH_LENGTH); | |
1944 switch(source) | |
1945 { | |
1946 case FM_NOR_FLASH: | |
1947 sprintf(filename,"%s%s%s/%s.tmb","/FFS",NORDIR,THUMB,obj); | |
1948 break; | |
1949 case FM_NORMS_FLASH: | |
1950 sprintf(filename,"%s%s%s/%s.tmb","/NOR",NORMSDIR,THUMB,obj); | |
1951 break; | |
1952 case FM_NAND_FLASH: | |
1953 sprintf(filename,"%s%s%s/%s.tmb","/NAND",NANDDIR,THUMB,obj); | |
1954 break; | |
1955 case FM_T_FLASH: | |
1956 sprintf(filename,"%s%s%s/%s.tmb","/MMC",TFLASHDIR,THUMB,obj); | |
1957 break; | |
1958 } | |
1959 convert_u8_to_unicode(filename, filename_uc); | |
1960 if ((fd = rfs_open (filename_uc, RFS_O_RDONLY, NULL)) == RFS_ENOENT) | |
1961 { | |
1962 TRACE_EVENT("Create the thmbnail."); | |
1963 return FM_FILE_DOESNOTEXISTS; | |
1964 } | |
1965 else | |
1966 { | |
1967 TRACE_EVENT_P1("Error %d",fd); | |
1968 rfs_close(fd); | |
1969 return FM_FILE_EXISTS; | |
1970 } | |
1971 #else | |
1972 sprintf(filename,"%s%s/%s.tmb",NORDIR,THUMB,obj); | |
1973 /**********************NOTE*************************** | |
1974 FFS API To be replaced with FS Abstraction API | |
1975 ******************************************************/ | |
1976 if ((fd = ffs_open (filename, FFS_O_RDONLY)) <= EFFS_NOTFOUND) | |
1977 { | |
1978 TRACE_EVENT("Create the thmbnail."); | |
1979 return FM_FILE_DOESNOTEXISTS; | |
1980 } | |
1981 else | |
1982 { | |
1983 TRACE_EVENT_P1("Error %d",fd); | |
1984 /**********************NOTE*************************** | |
1985 FFS API To be replaced with FS Abstraction API | |
1986 ******************************************************/ | |
1987 ffs_close(fd); | |
1988 return FM_FILE_EXISTS; | |
1989 } | |
1990 #endif | |
1991 // return FM_FILE_DOESNOTEXISTS; | |
1992 } | |
1993 /******************************************************************************* | |
1994 $Function: mfw_fm_imgViewer_create | |
1995 | |
1996 $Description: This function will create the handle of imageviewer UCP | |
1997 | |
1998 $Returns: Result of the UCP creation | |
1999 | |
2000 $Arguments: None | |
2001 *******************************************************************************/ | |
2002 T_FM_IMG_STATE mfw_fm_imgViewer_create(void) | |
2003 { | |
2004 MSL_IMGVIEW_STATUS mslResult = MSL_IMGVIEW_STATUS_OK; | |
2005 | |
2006 TRACE_FUNCTION ("mfw_fm_imgViewer_create()"); | |
2007 | |
2008 mslResult = MSL_ImgView_Create(&msl_handle); | |
2009 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2010 return FM_UCP_NO_ERROR; | |
2011 else | |
2012 return FM_UCP_ERROR; | |
2013 } | |
2014 | |
2015 /******************************************************************************* | |
2016 $Function: mfw_fm_imgViewer_init | |
2017 | |
2018 $Description: This function will initialise the imageviewer UCP | |
2019 | |
2020 $Returns: Result of the UCP initialization | |
2021 | |
2022 $Arguments: None | |
2023 *******************************************************************************/ | |
2024 T_FM_IMG_STATE mfw_fm_imgViewer_init(void) | |
2025 { | |
2026 MSL_IMGVIEW_STATUS mslResult = MSL_IMGVIEW_STATUS_OK; | |
2027 | |
2028 TRACE_FUNCTION ("mfw_fm_imgViewer_init()"); | |
2029 | |
2030 mslResult = MSL_ImgView_Init(msl_handle); | |
2031 | |
2032 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2033 return FM_UCP_NO_ERROR; | |
2034 else | |
2035 return FM_UCP_ERROR; | |
2036 } | |
2037 | |
2038 /******************************************************************************* | |
2039 $Function: mfw_fm_imgViewer_destroy | |
2040 | |
2041 $Description: This function destroy the imageviewer UCP | |
2042 | |
2043 $Returns: Result of the UCP destroy | |
2044 | |
2045 $Arguments: None | |
2046 *******************************************************************************/ | |
2047 T_FM_IMG_STATE mfw_fm_imgViewer_destroy(void) | |
2048 { | |
2049 MSL_IMGVIEW_STATUS mslResult = MSL_IMGVIEW_STATUS_OK; | |
2050 | |
2051 TRACE_FUNCTION ("mfw_fm_imgViewer_destroy()"); | |
2052 mslResult = MSL_ImgView_Destroy(msl_handle); | |
2053 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2054 return FM_UCP_NO_ERROR; | |
2055 else | |
2056 return FM_UCP_ERROR; | |
2057 } | |
2058 | |
2059 /******************************************************************************* | |
2060 $Function: mfw_fm_imgViewer_deinit | |
2061 | |
2062 $Description: This function will deinit the imageviewer UCP | |
2063 | |
2064 $Returns: Result of the UCP de-initialization | |
2065 | |
2066 $Arguments: None | |
2067 *******************************************************************************/ | |
2068 T_FM_IMG_STATE mfw_fm_imgViewer_deinit(void) | |
2069 { | |
2070 MSL_IMGVIEW_STATUS mslResult = MSL_IMGVIEW_STATUS_OK; | |
2071 | |
2072 TRACE_FUNCTION ("mfw_fm_imgViewer_deinit()"); | |
2073 | |
2074 mslResult = MSL_ImgView_Deinit(msl_handle); | |
2075 | |
2076 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2077 return FM_UCP_NO_ERROR; | |
2078 else | |
2079 return FM_UCP_ERROR; | |
2080 } | |
2081 | |
2082 | |
2083 /******************************************************************************* | |
2084 $Function: mfw_fm_imgViewer_pause | |
2085 | |
2086 $Description: This function will pause the imageviewer UCP. | |
2087 | |
2088 $Returns: Result of the UCP pause | |
2089 | |
2090 $Arguments: None | |
2091 *******************************************************************************/ | |
2092 T_FM_IMG_STATE mfw_fm_imgViewer_pause(void) | |
2093 { | |
2094 MSL_IMGVIEW_STATUS mslResult = MSL_IMGVIEW_STATUS_OK; | |
2095 | |
2096 TRACE_FUNCTION ("mfw_fm_imgViewer_pause()"); | |
2097 mslResult = MSL_ImgView_Pause((MSL_HANDLE)msl_handle); | |
2098 | |
2099 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2100 return FM_UCP_NO_ERROR; | |
2101 else | |
2102 return FM_UCP_ERROR; | |
2103 } | |
2104 | |
2105 | |
2106 /******************************************************************************* | |
2107 $Function: mfw_fm_imgViewer_view | |
2108 | |
2109 $Description: This function will start the rendering of the image on LCD. | |
2110 | |
2111 $Returns: Result of the drawing the image | |
2112 | |
2113 $Arguments: None | |
2114 *******************************************************************************/ | |
2115 T_FM_IMG_STATE mfw_fm_imgViewer_view(void) | |
2116 { | |
2117 MSL_IMGVIEW_STATUS mslResult = MSL_IMGVIEW_STATUS_OK; | |
2118 | |
2119 TRACE_FUNCTION ("mfw_fm_imgViewer_view()"); | |
2120 mslResult = MSL_ImgView_View((MSL_HANDLE)msl_handle); | |
2121 | |
2122 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2123 return FM_UCP_NO_ERROR; | |
2124 else | |
2125 return FM_UCP_ERROR;} | |
2126 /******************************************************************************* | |
2127 $Function: mfw_fm_imgViewer_setImageProperty | |
2128 | |
2129 $Description: This function will set the parameters for the imageviewer UCP | |
2130 | |
2131 $Returns: Result of the UCP updation of configurations | |
2132 | |
2133 $Arguments: filepath : Image path | |
2134 filename : Image name | |
2135 width : Image width | |
2136 height : Image height | |
2137 xoffset : Image x offset | |
2138 yoffset : Image y offset | |
2139 source : Current drive | |
2140 *******************************************************************************/ | |
2141 T_FM_IMG_STATE mfw_fm_imgViewer_setImageProperty( char * filepath, char *filename, int width, int height,int xoffset, int yoffset, T_FM_DEVICE_TYPE source) | |
2142 { | |
2143 | |
2144 MSL_IMGVIEW_STATUS mslResult; | |
2145 //The fullpath will be included. | |
2146 char tmb_name_p[FM_MAX_OBJ_NAME_LENGTH]; | |
2147 MSL_DISPLAY_CONFIGTYPE mfw_fm_dspl_config; | |
2148 MSL_FILE_CONFIGTYPE mfw_fm_file_config ; | |
2149 int rotation_degree = 0; | |
2150 int zoom_factor = 0; | |
2151 | |
2152 TRACE_FUNCTION ("mfw_fm_imgViewer_setImageProperty()"); | |
2153 | |
2154 mfw_fm_dspl_config.tImgFormat = MSL_COLOR_RGB565; | |
2155 mfw_fm_dspl_config.unDisplayImgHeight = height; | |
2156 mfw_fm_dspl_config.unDisplayImgWidth = width; | |
2157 mfw_fm_dspl_config.unDisplayXOffset = xoffset; | |
2158 mfw_fm_dspl_config.unDisplayYOffset = yoffset; | |
2159 mslResult = MSL_ImgView_SetConfig(msl_handle,MSL_DISPLAY_CONFIGINDEX,&mfw_fm_dspl_config); | |
2160 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2161 mslResult = MSL_ImgView_SetConfig (msl_handle,MSL_ROTATE_CONFIGINDEX,&rotation_degree); | |
2162 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2163 mslResult = MSL_ImgView_SetConfig(msl_handle,MSL_ZOOM_CONFIGINDEX,&zoom_factor); | |
2164 mfw_fm_file_config.sFileName = (char *) mfwAlloc(FM_MAX_OBJ_NAME_LENGTH); | |
2165 | |
2166 #ifdef FF_MMI_RFS_ENABLED | |
2167 switch (source) | |
2168 { | |
2169 case FM_NOR_FLASH: | |
2170 sprintf(tmb_name_p,"%s%s%s/%s.tmb","/FFS",NORDIR,THUMB, filename); | |
2171 // mfw_fm_file_config.tFileType = MSL_FILETYPE_FFS; | |
2172 break; | |
2173 case FM_NORMS_FLASH: | |
2174 sprintf(tmb_name_p,"%s%s%s/%s.tmb","/NOR",NORMSDIR,THUMB, filename); | |
2175 // mfw_fm_file_config.tFileType = MSL_FILETYPE_FFS; | |
2176 break; | |
2177 case FM_NAND_FLASH: | |
2178 sprintf(tmb_name_p,"%s%s%s/%s.tmb","/NAND",NANDDIR,THUMB, filename); | |
2179 /**********************NOTE*************************** | |
2180 Drive type to be updated | |
2181 ******************************************************/ | |
2182 // mfw_fm_file_config.tFileType = MSL_FILETYPE_RFS; | |
2183 break; | |
2184 case FM_T_FLASH: | |
2185 sprintf(tmb_name_p,"%s%s%s/%s.tmb","/MMC",TFLASHDIR,THUMB, filename); | |
2186 /**********************NOTE*************************** | |
2187 Drive type to be updated | |
2188 ******************************************************/ | |
2189 //mfw_fm_file_config.tFileType = MSL_FILETYPE_TFLASH; | |
2190 break; | |
2191 default: | |
2192 sprintf(tmb_name_p,"/%s/%s.tmb",THUMB, filename); | |
2193 } | |
2194 strcat(mfw_fm_file_config.sFileName,tmb_name_p); | |
2195 #else | |
2196 strcpy(mfw_fm_file_config.sFileName,tmb_name_p); | |
2197 #endif | |
2198 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2199 mslResult = MSL_ImgView_SetConfig(msl_handle,MSL_DECFILE_CONFIGINDEX,&mfw_fm_file_config); | |
2200 mfwFree((U8 *)mfw_fm_file_config.sFileName,FM_MAX_OBJ_NAME_LENGTH); | |
2201 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2202 return FM_UCP_NO_ERROR; | |
2203 else | |
2204 return FM_UCP_ERROR; | |
2205 | |
2206 } | |
2207 | |
2208 /******************************************************************************* | |
2209 $Function: mfw_fm_imgViewer_setConfigs | |
2210 | |
2211 $Description: This function will set the parameters for the imageviewer UCP | |
2212 | |
2213 $Returns: Result of the UCP updation of configurations | |
2214 | |
2215 $Arguments: filepath : Image path | |
2216 filename : Image name | |
2217 width : Image width | |
2218 height : Image height | |
2219 xoffset : Image x offset | |
2220 yoffset : Image y offset | |
2221 zFactor : Zoom factor | |
2222 rotation_degree : Rotate factor | |
2223 source : Current drive | |
2224 *******************************************************************************/ | |
2225 T_FM_IMG_STATE mfw_fm_imgViewer_setConfigs(char *filename,int width, int height,int xoffset, int yoffset,U32 zFactor,int rotation_degree,T_FM_DEVICE_TYPE source) | |
2226 { | |
2227 MSL_IMGVIEW_STATUS mslResult; | |
2228 MSL_DISPLAY_CONFIGTYPE mfw_fm_dspl_config; | |
2229 MSL_FILE_CONFIGTYPE mfw_fm_file_config ; | |
2230 int zoom_factor = zFactor; | |
2231 int rAngle = rotation_degree; | |
2232 | |
2233 TRACE_FUNCTION ("mfw_fm_imgViewer_setRotationConfigs()"); | |
2234 | |
2235 mfw_fm_dspl_config.unDisplayImgHeight = height; | |
2236 mfw_fm_dspl_config.unDisplayImgWidth = width; | |
2237 mfw_fm_dspl_config.unDisplayXOffset = xoffset; | |
2238 mfw_fm_dspl_config.unDisplayYOffset = yoffset; | |
2239 mslResult = MSL_ImgView_SetConfig(msl_handle,MSL_DISPLAY_CONFIGINDEX,&mfw_fm_dspl_config); | |
2240 | |
2241 mfw_fm_file_config.sFileName = (char *) mfwAlloc(FM_MAX_OBJ_NAME_LENGTH); | |
2242 | |
2243 #ifdef FF_MMI_RFS_ENABLED | |
2244 switch (source) | |
2245 { | |
2246 case FM_NOR_FLASH: | |
2247 strcpy(mfw_fm_file_config.sFileName,"/FFS"); | |
2248 // mfw_fm_file_config.tFileType = MSL_FILETYPE_FFS; | |
2249 break; | |
2250 case FM_NORMS_FLASH: | |
2251 strcpy(mfw_fm_file_config.sFileName,"/NOR"); | |
2252 // mfw_fm_file_config.tFileType = MSL_FILETYPE_FFS; | |
2253 break; | |
2254 case FM_NAND_FLASH: | |
2255 strcpy(mfw_fm_file_config.sFileName,"/NAND"); | |
2256 /**********************NOTE*************************** | |
2257 Drive type to be updated | |
2258 ******************************************************/ | |
2259 // mfw_fm_file_config.tFileType = MSL_FILETYPE_RFS; | |
2260 break; | |
2261 case FM_T_FLASH: | |
2262 strcpy(mfw_fm_file_config.sFileName,"/MMC"); | |
2263 /**********************NOTE*************************** | |
2264 Drive type to be updated | |
2265 ******************************************************/ | |
2266 //mfw_fm_file_config.tFileType = MSL_FILETYPE_TFLASH; | |
2267 break; | |
2268 } | |
2269 strcat(mfw_fm_file_config.sFileName,filename); | |
2270 #else | |
2271 strcpy(mfw_fm_file_config.sFileName,filename); | |
2272 #endif | |
2273 | |
2274 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2275 mslResult = MSL_ImgView_SetConfig(msl_handle,MSL_DECFILE_CONFIGINDEX,&mfw_fm_file_config); | |
2276 | |
2277 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2278 mslResult = MSL_ImgView_SetConfig(msl_handle,MSL_ZOOM_CONFIGINDEX,&zoom_factor); | |
2279 | |
2280 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2281 mslResult = MSL_ImgView_SetConfig (msl_handle,MSL_ROTATE_CONFIGINDEX,&rAngle); | |
2282 | |
2283 mfwFree((U8 *)mfw_fm_file_config.sFileName,FM_MAX_OBJ_NAME_LENGTH); | |
2284 | |
2285 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2286 return FM_UCP_NO_ERROR; | |
2287 else | |
2288 return FM_UCP_ERROR; | |
2289 } | |
2290 | |
2291 /******************************************************************************* | |
2292 $Function: mfw_imgView_setcallback | |
2293 | |
2294 $Description: This function will set the callback for viewer UCP | |
2295 | |
2296 $Returns: Result of the updating the callback function | |
2297 | |
2298 $Arguments: None | |
2299 *******************************************************************************/ | |
2300 T_FM_IMG_STATE mfw_fm_imgViewer_setcallback(void) | |
2301 { | |
2302 MSL_IMGVIEW_STATUS mslResult; | |
2303 | |
2304 TRACE_FUNCTION("mfw_fm_imgViewer_setcallback"); | |
2305 | |
2306 mslResult = MSL_ImgView_SetConfig(msl_handle,MSL_CALLBACKSET_CONFIGINDEX,(MSL_CALLBACK)Msl_mslil_Callback); | |
2307 if(mslResult == MSL_IMGVIEW_STATUS_OK) | |
2308 return FM_UCP_NO_ERROR; | |
2309 else | |
2310 return FM_UCP_ERROR; | |
2311 } | |
2312 | |
2313 /******************************************************************************* | |
2314 $Function: mfw_fm_imgThmb_create | |
2315 | |
2316 $Description: This function will create the handle of thumbnail UCP | |
2317 | |
2318 $Returns: Result of the UCP create | |
2319 | |
2320 $Arguments: None | |
2321 *******************************************************************************/ | |
2322 T_FM_IMG_STATE mfw_fm_imgThmb_create(void) | |
2323 { | |
2324 MSL_IMGTHMB_STATUS mslResult = MSL_IMGTHMB_STATUS_OK; | |
2325 | |
2326 TRACE_FUNCTION ("mfw_fm_imgThmb_create()"); | |
2327 | |
2328 mslResult = MSL_ImgThmb_Create(&msl_handle); | |
2329 | |
2330 if(mslResult == MSL_IMGTHMB_STATUS_OK) | |
2331 return FM_UCP_NO_ERROR; | |
2332 else | |
2333 return FM_UCP_ERROR; | |
2334 } | |
2335 | |
2336 /******************************************************************************* | |
2337 $Function: mfw_fm_imgThmb_init | |
2338 | |
2339 $Description: This function will initialise of thumbnail UCP | |
2340 | |
2341 $Returns: Result of the UCP initialization | |
2342 | |
2343 $Arguments: None | |
2344 *******************************************************************************/ | |
2345 T_FM_IMG_STATE mfw_fm_imgThmb_init(void) | |
2346 { | |
2347 MSL_IMGTHMB_STATUS mslResult = MSL_IMGTHMB_STATUS_OK; | |
2348 | |
2349 TRACE_FUNCTION ("mfw_fm_imgThmb_init()"); | |
2350 | |
2351 mslResult = MSL_ImgThmb_Init(msl_handle); | |
2352 | |
2353 if(mslResult == MSL_IMGTHMB_STATUS_OK) | |
2354 return FM_UCP_NO_ERROR; | |
2355 else | |
2356 return FM_UCP_ERROR; | |
2357 } | |
2358 | |
2359 /******************************************************************************* | |
2360 $Function: mfw_fm_imgThmb_destroy | |
2361 | |
2362 $Description: This function will destroy the thumbnail UCP. | |
2363 | |
2364 $Returns: Result of the UCP destroy | |
2365 | |
2366 $Arguments: None | |
2367 *******************************************************************************/ | |
2368 T_FM_IMG_STATE mfw_fm_imgThmb_destroy(void) | |
2369 { | |
2370 MSL_IMGTHMB_STATUS mslResult; | |
2371 | |
2372 TRACE_FUNCTION ("mfw_fm_imgThmb_destroy()"); | |
2373 | |
2374 mslResult = MSL_ImgThmb_Destroy(msl_handle); | |
2375 if (mslResult != MSL_IMGTHMB_STATUS_OK) | |
2376 { | |
2377 MSL_ImgThmb_Destroy(msl_handle); | |
2378 msl_handle=0; | |
2379 return FM_UCP_ERROR; | |
2380 } | |
2381 if(mslResult == MSL_IMGTHMB_STATUS_OK) | |
2382 return FM_UCP_NO_ERROR; | |
2383 else | |
2384 return FM_UCP_ERROR; | |
2385 } | |
2386 | |
2387 /******************************************************************************* | |
2388 $Function: mfw_fm_imgThmb_deinit | |
2389 | |
2390 $Description: This function will deinit the thumbnail UCP. | |
2391 | |
2392 $Returns: Result of the UCP de-initialization | |
2393 | |
2394 $Arguments: None | |
2395 *******************************************************************************/ | |
2396 T_FM_IMG_STATE mfw_fm_imgThmb_deinit(void) | |
2397 { | |
2398 MSL_IMGTHMB_STATUS mslResult; | |
2399 | |
2400 TRACE_FUNCTION ("mfw_fm_imgThmb_deinit()"); | |
2401 | |
2402 mslResult = MSL_ImgThmb_Deinit(msl_handle); | |
2403 | |
2404 if(mslResult == MSL_IMGTHMB_STATUS_OK) | |
2405 return FM_UCP_NO_ERROR; | |
2406 else | |
2407 return FM_UCP_ERROR; | |
2408 } | |
2409 | |
2410 /******************************************************************************* | |
2411 | |
2412 $Function: mfw_fm_imgThmb_pause | |
2413 | |
2414 $Description: This function will pasue the thumbnail UCP. | |
2415 | |
2416 $Returns: Result of the UCP pause | |
2417 | |
2418 $Arguments: None | |
2419 | |
2420 *******************************************************************************/ | |
2421 T_FM_IMG_STATE mfw_fm_imgThmb_pause(void) | |
2422 { | |
2423 MSL_IMGTHMB_STATUS mslResult; | |
2424 | |
2425 TRACE_FUNCTION ("mfw_fm_imgThmb_pause()"); | |
2426 mslResult = MSL_ImgThmb_Pause((MSL_HANDLE)msl_handle); | |
2427 | |
2428 if(mslResult == MSL_IMGTHMB_STATUS_OK) | |
2429 return FM_UCP_NO_ERROR; | |
2430 else | |
2431 return FM_UCP_ERROR; | |
2432 } | |
2433 | |
2434 /******************************************************************************* | |
2435 $Function: mfw_fm_imgThmb_generate | |
2436 | |
2437 $Description: This function will generate the thumbnail file in filesystem. | |
2438 | |
2439 $Returns: Result of the thumbanil generation | |
2440 | |
2441 $Arguments: None | |
2442 *******************************************************************************/ | |
2443 T_FM_IMG_STATE mfw_fm_imgThmb_generate(void) | |
2444 { | |
2445 MSL_IMGTHMB_STATUS mslResult; | |
2446 | |
2447 TRACE_FUNCTION ("mfw_fm_imgThmb_generate()"); | |
2448 | |
2449 mslResult = MSL_ImgThmb_Generate((MSL_HANDLE)msl_handle); | |
2450 if(mslResult == MSL_IMGTHMB_STATUS_OK) | |
2451 return FM_UCP_NO_ERROR; | |
2452 else | |
2453 return FM_UCP_ERROR; | |
2454 } | |
2455 | |
2456 | |
2457 /******************************************************************************* | |
2458 $Function: mfw_fm_imgThmb_setparams | |
2459 | |
2460 $Description: This function will set the parameters for thumbnail UCP | |
2461 | |
2462 $Returns: Result of the UCP updation of configurations | |
2463 | |
2464 $Arguments: inFilepath : Image path | |
2465 inFilename : Image name | |
2466 width : Image width | |
2467 height : Image height | |
2468 source : Current drive | |
2469 *******************************************************************************/ | |
2470 T_FM_IMG_STATE mfw_fm_imgThmb_setparams(char * inFilepath, char* inFilename, int width,int height, T_FM_DEVICE_TYPE source) | |
2471 { | |
2472 MSL_IMGTHMB_STATUS mslResult = MSL_IMGTHMB_STATUS_OK; | |
2473 char tmb_name_p[FM_MAX_DIR_PATH_LENGTH]; | |
2474 | |
2475 MSL_RESCALE_CONFIGTYPE mfw_fm_rescaleconfig ; | |
2476 MSL_FILE_CONFIGTYPE mfw_fm_file_config ; | |
2477 | |
2478 TRACE_FUNCTION ("mfw_fm_imgThmb_setparams()"); | |
2479 | |
2480 mfw_fm_rescaleconfig.unRescaledImgHeight = height; | |
2481 mfw_fm_rescaleconfig.unRescaledImgWidth =width ; | |
2482 mslResult = MSL_ImgThmb_SetConfigs(msl_handle,MSL_RESCALE_CONFIGINDEX,&mfw_fm_rescaleconfig); | |
2483 mfw_fm_file_config.sFileName = (char *) mfwAlloc(FM_MAX_DIR_PATH_LENGTH); | |
2484 switch (source) | |
2485 { | |
2486 case FM_NOR_FLASH: | |
2487 sprintf(mfw_fm_file_config.sFileName,"%s%s%s.jpg","/FFS",inFilepath,inFilename); | |
2488 sprintf(tmb_name_p,"%s%s%s/%s.tmb","/FFS",NORDIR,THUMB, inFilename); | |
2489 // mfw_fm_file_config.tFileType = MSL_FILETYPE_FFS; | |
2490 break; | |
2491 case FM_NORMS_FLASH: | |
2492 sprintf(mfw_fm_file_config.sFileName,"%s%s%s.jpg","/NOR",inFilepath,inFilename); | |
2493 sprintf(tmb_name_p,"%s%s%s/%s.tmb","/NOR",NORMSDIR,THUMB, inFilename); | |
2494 // mfw_fm_file_config.tFileType = MSL_FILETYPE_FFS; | |
2495 break; | |
2496 case FM_NAND_FLASH: | |
2497 /**********************NOTE*************************** | |
2498 Drive type to be updated | |
2499 ******************************************************/ | |
2500 sprintf(mfw_fm_file_config.sFileName,"%s%s%s.jpg","/NAND",inFilepath,inFilename); | |
2501 sprintf(tmb_name_p,"%s%s%s/%s.tmb","/NAND",NANDDIR,THUMB, inFilename); | |
2502 mfw_fm_file_config.tFileType = MSL_FILETYPE_RFS; | |
2503 break; | |
2504 case FM_T_FLASH: | |
2505 /**********************NOTE*************************** | |
2506 Drive type to be updated | |
2507 ******************************************************/ | |
2508 sprintf(mfw_fm_file_config.sFileName,"%s%s%s.jpg","/MMC",inFilepath,inFilename); | |
2509 sprintf(tmb_name_p,"%s%s%s/%s.tmb","/MMC",TFLASHDIR,THUMB, inFilename); | |
2510 //mfw_fm_file_config.tFileType = MSL_FILETYPE_TFLASH; | |
2511 break; | |
2512 } | |
2513 if(mslResult == MSL_IMGTHMB_STATUS_OK) | |
2514 { | |
2515 mslResult = MSL_ImgThmb_SetConfigs(msl_handle,MSL_DECFILE_CONFIGINDEX,&mfw_fm_file_config); | |
2516 } | |
2517 sprintf(mfw_fm_file_config.sFileName,"%s",tmb_name_p); | |
2518 if(mslResult == MSL_IMGTHMB_STATUS_OK) | |
2519 { | |
2520 mslResult = MSL_ImgThmb_SetConfigs(msl_handle,MSL_ENCFILE_CONFIGINDEX,&mfw_fm_file_config); | |
2521 } | |
2522 mfwFree((U8 *)mfw_fm_file_config.sFileName,FM_MAX_DIR_PATH_LENGTH); | |
2523 if(mslResult == MSL_IMGTHMB_STATUS_OK) | |
2524 return FM_UCP_NO_ERROR; | |
2525 else | |
2526 return FM_UCP_ERROR; | |
2527 } | |
2528 | |
2529 /******************************************************************************* | |
2530 $Function: mfw_fm_imgThmb_setcallback | |
2531 | |
2532 $Description: This function will set the callback for thumbnail UCP | |
2533 | |
2534 $Returns: Result of the UCP updation of configurations | |
2535 | |
2536 $Arguments: None | |
2537 *******************************************************************************/ | |
2538 T_FM_IMG_STATE mfw_fm_imgThmb_setcallback() | |
2539 { | |
2540 MSL_IMGTHMB_STATUS mslResult = MSL_IMGTHMB_STATUS_OK; | |
2541 | |
2542 TRACE_FUNCTION("mfw_fm_imgThmb_setcallback"); | |
2543 | |
2544 mslResult = MSL_ImgThmb_SetConfigs(msl_handle,MSL_CALLBACKSET_CONFIGINDEX,(MSL_CALLBACK)Msl_mslil_Callback); | |
2545 if(mslResult == MSL_IMGTHMB_STATUS_OK) | |
2546 return FM_UCP_NO_ERROR; | |
2547 else | |
2548 return FM_UCP_ERROR; | |
2549 } | |
2550 | |
2551 /******************************************************************************* | |
2552 $Function: mfw_fm_thmb_mslcb | |
2553 | |
2554 $Description: This function is the callback for the thumbnail UCP | |
2555 | |
2556 $Returns: None | |
2557 | |
2558 $Arguments: tCMd : Current command being executed by the MSL | |
2559 tStatus : Status of the current command | |
2560 *******************************************************************************/ | |
2561 void mfw_fm_thmb_mslcb( U32 tCMd,U32 tStatus) | |
2562 { | |
2563 T_MFW_FM_PARA para; | |
2564 | |
2565 TRACE_FUNCTION("mfw_fm_thmb_mslcb()"); | |
2566 switch(tCMd) | |
2567 { | |
2568 case MSL_CMD_INIT: | |
2569 TRACE_EVENT_P1("MSL_CMD_INIT %d",tStatus); | |
2570 if(tStatus ==MSL_IMGTHMB_STATUS_OK) | |
2571 { | |
2572 para.img_state=FM_UCP_NO_ERROR; | |
2573 } | |
2574 else | |
2575 { | |
2576 para.img_state=FM_UCP_ERROR; | |
2577 } | |
2578 mfw_fm_signal(E_FM_THMB_INIT, ¶); | |
2579 break; | |
2580 case MSL_CMD_GENERATE: | |
2581 TRACE_EVENT_P1("MSL_CMD_GENERATE %d",tStatus); | |
2582 switch(tStatus) | |
2583 { | |
2584 case MSL_IMGTHMB_STATUS_OK: | |
2585 para.img_state = FM_UCP_NO_ERROR; | |
2586 break; | |
2587 case MSL_IMGTHMB_ERROR_BAD_STREAM: | |
2588 para.img_state = FM_UCP_ERROR_BAD_STREAM; | |
2589 break; | |
2590 case MSL_IMGTHMB_ERROR_UNKNOWN: | |
2591 para.img_state = FM_UCP_ERROR_UNKNOWN; | |
2592 break; | |
2593 case MSL_IMGTHMB_ERROR_IOWRITE: | |
2594 para.img_state = FM_UCP_ERROR_NO_MEM; | |
2595 break; | |
2596 case MSL_IMGTHMB_ERROR_INVALID_ARGUMENT: | |
2597 para.img_state = FM_UCP_ERROR_INVALID_ARGUMENT; | |
2598 break; | |
2599 default : | |
2600 para.img_state = FM_UCP_ERROR; | |
2601 } | |
2602 mfw_fm_signal(E_FM_THMB_GEN, ¶); | |
2603 break; | |
2604 case MSL_CMD_DEINIT: | |
2605 TRACE_EVENT_P1("MSL_CMD_DEINIT %d",tStatus); | |
2606 if(tStatus ==MSL_IMGTHMB_STATUS_OK) | |
2607 { | |
2608 para.img_state=FM_UCP_NO_ERROR; | |
2609 } | |
2610 else | |
2611 { | |
2612 para.img_state=FM_UCP_ERROR; | |
2613 } | |
2614 mfw_fm_signal(E_FM_THMB_DEINIT, ¶); | |
2615 break; | |
2616 } | |
2617 } | |
2618 | |
2619 /******************************************************************************* | |
2620 $Function: mfw_fm_view_mslcb | |
2621 | |
2622 $Description: This function is the callback for the Viewer UCP | |
2623 | |
2624 $Returns: None | |
2625 | |
2626 $Arguments: tCMd : Current command being executed by the MSL | |
2627 tStatus : Status of the current command | |
2628 *******************************************************************************/ | |
2629 void mfw_fm_view_mslcb( U32 tCMd,U32 tStatus) | |
2630 { | |
2631 T_MFW_FM_PARA para; | |
2632 | |
2633 TRACE_FUNCTION("mfw_fm_view_mslcb()"); | |
2634 | |
2635 switch(tCMd) | |
2636 { | |
2637 case MSL_CMD_INIT: | |
2638 TRACE_EVENT_P1("MSL_CMD_INIT %d",tStatus); | |
2639 if(tStatus ==MSL_IMGVIEW_STATUS_OK) | |
2640 { | |
2641 para.img_state=FM_UCP_NO_ERROR; | |
2642 } | |
2643 else | |
2644 { | |
2645 para.img_state=FM_UCP_ERROR; | |
2646 } | |
2647 mfw_fm_signal(E_FM_IMG_INIT, ¶); | |
2648 break; | |
2649 case MSL_CMD_VIEW: | |
2650 TRACE_EVENT_P1("MSL_CMD_VIEW %d",tStatus); | |
2651 switch(tStatus ) | |
2652 { | |
2653 case MSL_IMGVIEW_STATUS_OK: | |
2654 para.img_state = FM_UCP_NO_ERROR; | |
2655 break; | |
2656 case MSL_IMGVIEW_ERROR_BAD_STREAM: | |
2657 para.img_state = FM_UCP_ERROR_BAD_STREAM; | |
2658 break; | |
2659 case MSL_IMGVIEW_ERROR_UNKNOWN: | |
2660 para.img_state = FM_UCP_ERROR_UNKNOWN; | |
2661 break; | |
2662 case MSL_IMGVIEW_ERROR_IOREAD: | |
2663 para.img_state = FM_UCP_ERROR_READ_FAILED; | |
2664 break; | |
2665 case MSL_IMGVIEW_ERROR_INVALID_ARGUMENT: | |
2666 para.img_state = FM_UCP_ERROR_INVALID_ARGUMENT; | |
2667 break; | |
2668 default : | |
2669 para.img_state = FM_UCP_ERROR; | |
2670 } | |
2671 mfw_fm_signal(E_FM_IMG_DRAW,¶); | |
2672 break; | |
2673 case MSL_CMD_DEINIT: | |
2674 TRACE_EVENT_P1("MSL_CMD_DEINIT %d",tStatus); | |
2675 if(tStatus ==MSL_IMGVIEW_STATUS_OK) | |
2676 { | |
2677 para.img_state=FM_UCP_NO_ERROR; | |
2678 } | |
2679 else | |
2680 { | |
2681 para.img_state=FM_UCP_ERROR; | |
2682 } | |
2683 mfw_fm_signal(E_FM_IMG_DEINIT, ¶); | |
2684 break; | |
2685 | |
2686 } | |
2687 } | |
2688 | |
2689 | |
2690 //Audio List | |
2691 | |
2692 /******************************************************************************* | |
2693 $Function: mfw_fm_audPlay_cb | |
2694 | |
2695 $Description: Callback fundtion for auio play/stop | |
2696 | |
2697 $Returns: None | |
2698 | |
2699 $Arguments: parameter : The structure conveying the stop indication data | |
2700 *******************************************************************************/ | |
2701 void mfw_fm_audPlay_cb(void *parameter) | |
2702 { | |
2703 T_MFW_FM_PARA para; | |
2704 T_AS_STOP_IND *stop_ind = (T_AS_STOP_IND *)parameter; | |
2705 | |
2706 /* OMAPS00151698, x0056422 */ | |
2707 T_AS_START_IND *start_ind = ( T_AS_START_IND *)parameter; | |
2708 | |
2709 /* OMAPS00151698, x0056422 */ | |
2710 | |
2711 T_AS_PROBAR_IND_MP3 *mp3_pb = (T_AS_PROBAR_IND_MP3 *)parameter; | |
2712 | |
2713 TRACE_FUNCTION("mfw_fm_audPlay_cb"); | |
2714 | |
2715 | |
2716 | |
2717 if(mmi_get_aud_state_status() == FM_AUD_NONE) | |
2718 { | |
2719 | |
2720 TRACE_EVENT_P1("AS_START_IND status %d ",start_ind->status); | |
2721 mmi_set_aud_state_status(FM_AUD_PLAY); | |
2722 | |
2723 /* OMAPS00151698, x0056422 */ | |
2724 #ifdef FF_MMI_A2DP_AVRCP | |
2725 | |
2726 //if BT connected and aud is initialized, and the command wasnt from BT, then send callback | |
2727 tGlobalBmiBtStruct.tAudioState = FM_AUD_PLAY; | |
2728 if((tGlobalBmiBtStruct.bConnected != BMI_BT_NOTCONNECTED) | |
2729 && (start_ind->status == AS_OK)) | |
2730 { | |
2731 | |
2732 | |
2733 if( NULL != tGlobalBmiBtStruct.BmiEventCallback) | |
2734 tGlobalBmiBtStruct.BmiEventCallback(BMI_EVENT_USER_PLAY); | |
2735 tGlobalBmiBtStruct.tCmdSrc == BMI_BT_COMMAND_NONE; | |
2736 } | |
2737 #endif // FF_MMI_A2DP_AVRCP | |
2738 } | |
2739 | |
2740 switch(stop_ind->header.msg_id ) | |
2741 { | |
2742 /* OMAPS00151698, x0056422 */ | |
2743 case AS_PAUSE_IND: | |
2744 TRACE_EVENT_P1("AS_PAUSE_IND status %d",stop_ind->status); | |
2745 mmi_set_aud_state_status( FM_AUD_PAUSE); | |
2746 /* OMAPS00151698, x0056422 */ | |
2747 #ifdef FF_MMI_A2DP_AVRCP | |
2748 tGlobalBmiBtStruct.tAudioState = FM_AUD_PAUSE; | |
2749 if(tGlobalBmiBtStruct.bConnected != BMI_BT_NOTCONNECTED) | |
2750 { | |
2751 if(NULL != tGlobalBmiBtStruct.BmiEventCallback) | |
2752 tGlobalBmiBtStruct.BmiEventCallback(BMI_EVENT_USER_PAUSE); | |
2753 tGlobalBmiBtStruct.tCmdSrc = BMI_BT_COMMAND_NONE; | |
2754 } | |
2755 #endif//FF_MMI_A2DP_AVRCP | |
2756 break; | |
2757 /* OMAPS00151698, x0056422 */ | |
2758 | |
2759 case AS_STOP_IND: | |
2760 TRACE_EVENT_P2("AS_STOP_IND status %d end %d",stop_ind->status, stop_ind->end_of_media); | |
2761 mfw_unset_stereo_path(mfw_get_current_audioDevice()); | |
2762 //Daisy tang added for Real Resume feature 20071107 | |
2763 if(isPlayer_Real_Pause) | |
2764 { | |
2765 last_file_size_played = stop_ind->file_size; | |
2766 last_para_aud_pt = para_aud.aud_pt; | |
2767 } | |
2768 | |
2769 switch((int)(stop_ind->status)) | |
2770 { | |
2771 case AS_NOT_SUPPORTED: | |
2772 para.aud_state = FM_AUD_ERROR_NOTSUPPORTED; | |
2773 break; | |
2774 case AS_MEMORY_ERR: | |
2775 para.aud_state = FM_AUD_ERROR_MEM; | |
2776 break; | |
2777 case AS_INTERNAL_ERR: | |
2778 para.aud_state = FM_AUD_ERROR_INTERNAL; | |
2779 break; | |
2780 case AS_INVALID_PARAM: | |
2781 para.aud_state = FM_AUD_ERROR_INVALIDPARAM; | |
2782 break; | |
2783 case AS_NOT_READY: | |
2784 para.aud_state = FM_AUD_ERROR_NOTREADY; | |
2785 break; | |
2786 case AS_MESSAGING_ERR: | |
2787 para.aud_state = FM_AUD_ERROR_MSGING; | |
2788 break; | |
2789 case AS_FFS_ERR: | |
2790 para.aud_state = FM_AUD_ERROR_FFS; | |
2791 break; | |
2792 case AS_PLAYER_ERR: | |
2793 para.aud_state = FM_AUD_ERROR_PLAYER; | |
2794 break; | |
2795 case AS_DENIED: | |
2796 para.aud_state = FM_AUD_ERROR_DENIED; | |
2797 break; | |
2798 case AS_AUDIO_ERR: | |
2799 para.aud_state = FM_AUD_ERROR_AUDIO; | |
2800 break; | |
2801 case AS_NOT_ALLOWED: | |
2802 para.aud_state = FM_AUD_ERROR_NOTALLOWED; | |
2803 break; | |
2804 default: | |
2805 para.aud_state = FM_AUD_NONE; | |
2806 } | |
2807 /* June 28, 2007 DRT: OMAPS00135749 x0062174 */ | |
2808 mmi_set_aud_state_status( FM_AUD_NONE); | |
2809 | |
2810 /* OMAPS00151698, x0056422 */ | |
2811 #ifdef FF_MMI_A2DP_AVRCP | |
2812 tGlobalBmiBtStruct.tAudioState = FM_AUD_NONE; | |
2813 /* x0056422, updated changes from this ID */ | |
2814 /*OMAPS001448610 : This callback code is removed since L1 sends the callback to BT for | |
2815 stop playback irrespective of whether the stop is due to end of media or is user prompted. */ | |
2816 tGlobalBmiBtStruct.tCmdSrc = BMI_BT_COMMAND_NONE; | |
2817 | |
2818 #endif//FF_MMI_A2DP_AVRCP | |
2819 /* OMAPS00151698, x0056422 */ | |
2820 mfw_fm_signal(E_FM_AUDIO_STOP, ¶); | |
2821 break; | |
2822 | |
2823 case AS_PROBAR_IND: | |
2824 TRACE_EVENT_P2("pt %d tt %d",mp3_pb->u32TotalTimePlayed, mp3_pb->u32totalTimeEst); | |
2825 para_aud.aud_pt = mp3_pb->u32TotalTimePlayed + last_para_aud_pt; //Daisy tang added for Real Resume feature 20071107 | |
2826 para_aud.aud_tt = mp3_pb->u32totalTimeEst; | |
2827 mfw_fm_signal(E_FM_AUDIO_PROG, NULL); | |
2828 break; | |
2829 } | |
2830 return; | |
2831 | |
2832 } | |
2833 | |
2834 /******************************************************************************* | |
2835 $Function: mfw_fm_aud_get_type | |
2836 | |
2837 $Description: Deduces the type of audio file | |
2838 | |
2839 $Returns: audio file type | |
2840 | |
2841 $Arguments: file_name : audio file | |
2842 *******************************************************************************/ | |
2843 T_FM_OBJ_TYPE mfw_fm_aud_get_type(char * file_name) | |
2844 { | |
2845 T_AS_PLAYER_TYPE player_type; | |
2846 UINT16 filename_uc[47]; | |
2847 TRACE_FUNCTION("mfw_fm_aud_get_type"); | |
2848 | |
2849 convert_u8_to_unicode(file_name, filename_uc); | |
2850 as_deduce_player_type(filename_uc,&player_type); | |
2851 switch(player_type) | |
2852 { | |
2853 case AS_PLAYER_TYPE_MIDI: | |
2854 TRACE_EVENT("AS_PLAYER_TYPE_MIDI"); | |
2855 return OBJECT_TYPE_AUDIO_MIDI; | |
2856 case AS_PLAYER_TYPE_MP3: | |
2857 TRACE_EVENT("AS_PLAYER_TYPE_MP3"); | |
2858 return OBJECT_TYPE_AUDIO_MP3; | |
2859 case AS_PLAYER_TYPE_AAC: | |
2860 TRACE_EVENT("AS_PLAYER_TYPE_AAC"); | |
2861 return OBJECT_TYPE_AUDIO_AAC; | |
2862 default: | |
2863 TRACE_EVENT("Default"); | |
2864 return OBJECT_TYPE_FILE; | |
2865 } | |
2866 } | |
2867 | |
2868 /******************************************************************************* | |
2869 $Function: mfw_fm_audPlay | |
2870 | |
2871 $Description: Plays the selected audio file | |
2872 | |
2873 $Returns: None | |
2874 | |
2875 $Arguments: file_name : audio file | |
2876 file_type : audio file type | |
2877 *******************************************************************************/ | |
2878 #ifdef FF_MMI_UNICODE_SUPPORT | |
2879 T_FM_AUD_STATE mfw_fm_audPlay(T_WCHAR * filename_uc, T_FM_OBJ_TYPE file_type, BOOL play_bar) | |
2880 { | |
2881 | |
2882 #else | |
2883 T_FM_AUD_STATE mfw_fm_audPlay(char * file_name, T_FM_OBJ_TYPE file_type, BOOL play_bar) | |
2884 { | |
2885 UINT16 filename_uc[FM_MAX_DIR_PATH_LENGTH]; | |
2886 | |
2887 convert_u8_to_unicode(file_name, filename_uc); | |
2888 #endif | |
2889 T_AS_RET status; | |
2890 T_AS_PLAYER_TYPE player_type; | |
2891 int i=0; | |
2892 | |
2893 TRACE_FUNCTION("mfw_fm_audPlay"); | |
2894 | |
2895 //Daisy tang added for Real Resume feature 20071107 | |
2896 //start | |
2897 #ifdef FF_MMI_UNICODE_SUPPORT | |
2898 for(i==0;i<FM_MAX_DIR_PATH_LENGTH;i++) | |
2899 { | |
2900 last_inputFileName_uc[i]=filename_uc[i]; | |
2901 } | |
2902 | |
2903 #else | |
2904 strcpy(last_inputFileName, file_name); | |
2905 #endif | |
2906 last_file_type = file_type; | |
2907 last_play_bar = play_bar; | |
2908 last_file_size_played = 0; | |
2909 last_para_aud_pt = 0; | |
2910 //end | |
2911 switch(file_type) | |
2912 { | |
2913 case OBJECT_TYPE_AUDIO_MIDI: | |
2914 TRACE_EVENT("AS_PLAYER_TYPE_MIDI"); | |
2915 | |
2916 /* Aug 27, 2007 DRT: OMAPS00137370 x0045876 */ | |
2917 /* Voice Limit parameter should be saved to a temp var before playing | |
2918 MP3 or AAC file */ | |
2919 player_para.midi.voice_limit = mfw_player_midi_get_voice_limit(); | |
2920 /* Apr 10, 2007 DRT: OMAPS00125309 x0039928 */ | |
2921 /* MONO is 1 and STEREO is 2 for midi player*/ | |
2922 player_para.midi.output_channels = player_channel; | |
2923 player_type = AS_PLAYER_TYPE_MIDI; | |
2924 break; | |
2925 case OBJECT_TYPE_AUDIO_MP3: | |
2926 TRACE_EVENT("AS_PLAYER_TYPE_MP3"); | |
2927 | |
2928 /* Aug 27, 2007 DRT: OMAPS00137370 x0045876 */ | |
2929 /* Voice Limit parameter should be saved to a temp var before playing | |
2930 MP3 or AAC file */ | |
2931 mfw_player_set_voice_limit (player_para.midi.voice_limit); | |
2932 /* Apr 10, 2007 DRT: OMAPS00125309 x0039928 */ | |
2933 /* MONO is 0 and STEREO is 1 for mp3 player*/ | |
2934 player_para.mp3.mono_stereo = player_channel - 1; | |
2935 player_para.mp3.size_file_start = 0; | |
2936 player_type = AS_PLAYER_TYPE_MP3; | |
2937 break; | |
2938 case OBJECT_TYPE_AUDIO_AAC: | |
2939 TRACE_EVENT("AS_PLAYER_TYPE_AAC"); | |
2940 | |
2941 /* Aug 27, 2007 DRT: OMAPS00137370 x0045876 */ | |
2942 /* Voice Limit parameter should be saved to a temp var before playing | |
2943 MP3 or AAC file */ | |
2944 mfw_player_set_voice_limit (player_para.midi.voice_limit); | |
2945 /* Apr 10, 2007 DRT: OMAPS00125309 x0039928 */ | |
2946 /* MONO is 0 and STEREO is 1 for aac player*/ | |
2947 player_para.aac.mono_stereo = player_channel - 1 ; | |
2948 player_para.aac.size_file_start= 0; | |
2949 player_type = AS_PLAYER_TYPE_AAC; | |
2950 break; | |
2951 default: | |
2952 /* Aug 27, 2007 DRT: OMAPS00137370 x0045876 */ | |
2953 /* Voice Limit parameter should be saved to a temp var before playing | |
2954 MP3 or AAC file */ | |
2955 player_para.midi.voice_limit = mfw_player_midi_get_voice_limit(); | |
2956 /* Apr 10, 2007 DRT: OMAPS00125309 x0039928 */ | |
2957 /* MONO is 1 and STEREO is 2 for midi player*/ | |
2958 player_para.midi.output_channels = player_channel; | |
2959 player_type = AS_PLAYER_TYPE_MIDI; | |
2960 break; | |
2961 } | |
2962 as_player_set_params(player_type,&player_para); | |
2963 | |
2964 mfw_set_stereo_path(mfw_get_current_audioDevice()); | |
2965 fm_aud_return_path.addr_id = 0; | |
2966 fm_aud_return_path.callback_func = mfw_fm_audPlay_cb; | |
2967 | |
2968 status=as_play_file(player_type,filename_uc,AS_VOLUME_HIGH,mfw_player_playback_loop_flag,play_bar,&fm_aud_return_path); | |
2969 if(status == AS_OK) | |
2970 return FM_AUD_NO_ERROR; | |
2971 else | |
2972 return FM_AUD_ERROR; | |
2973 } | |
2974 | |
2975 /******************************************************************************* | |
2976 $Function: mfw_fm_audStop | |
2977 | |
2978 $Description: Stops playing the selected audio file | |
2979 | |
2980 $Returns: None | |
2981 | |
2982 $Arguments: file_name : audio file | |
2983 file_type : audio file type | |
2984 *******************************************************************************/ | |
2985 T_FM_AUD_STATE mfw_fm_audStop(void) | |
2986 { | |
2987 T_AS_RET status; | |
2988 TRACE_EVENT("mfw_fm_audStop"); | |
2989 fm_aud_return_path.addr_id = 0; | |
2990 fm_aud_return_path.callback_func = mfw_fm_audPlay_cb; | |
2991 status=as_stop(&fm_aud_return_path); | |
2992 if(status == AS_OK) | |
2993 return FM_AUD_NO_ERROR; | |
2994 else | |
2995 return FM_AUD_ERROR; | |
2996 } | |
2997 | |
2998 T_FM_AUD_STATE mfw_fm_audPause(void) | |
2999 { | |
3000 T_AS_RET status; | |
3001 TRACE_EVENT("mfw_fm_audPause"); | |
3002 fm_aud_return_path.addr_id = 0; | |
3003 fm_aud_return_path.callback_func = mfw_fm_audPlay_cb; | |
3004 status=as_pause(&fm_aud_return_path); | |
3005 if(status == AS_OK) | |
3006 return FM_AUD_NO_ERROR; | |
3007 else | |
3008 return FM_AUD_ERROR; | |
3009 } | |
3010 | |
3011 T_FM_AUD_STATE mfw_fm_audResume(void) | |
3012 { | |
3013 T_AS_RET status; | |
3014 TRACE_EVENT("mfw_fm_audResume"); | |
3015 fm_aud_return_path.addr_id = 0; | |
3016 fm_aud_return_path.callback_func = mfw_fm_audPlay_cb; | |
3017 mmi_set_aud_state_status( FM_AUD_PLAY); | |
3018 | |
3019 | |
3020 /* OMAPS00151698, x0056422 */ | |
3021 #ifdef FF_MMI_A2DP_AVRCP | |
3022 tGlobalBmiBtStruct.tAudioState = FM_AUD_PLAY; | |
3023 if(tGlobalBmiBtStruct.bConnected != BMI_BT_NOTCONNECTED) | |
3024 { | |
3025 /*OMAPS001448610 : This check for Headset/handset command is to be removed since the handling is now exactly the same. */ | |
3026 if(NULL != tGlobalBmiBtStruct.BmiEventCallback) | |
3027 tGlobalBmiBtStruct.BmiEventCallback(BMI_EVENT_USER_RESUME); | |
3028 tGlobalBmiBtStruct.tCmdSrc = BMI_BT_COMMAND_NONE; | |
3029 | |
3030 } | |
3031 #endif//FF_MMI_A2DP_AVRCP | |
3032 | |
3033 /* OMAPS00151698, x0056422 */ | |
3034 status=as_resume(&fm_aud_return_path); | |
3035 if(status == AS_OK) | |
3036 return FM_AUD_NO_ERROR; | |
3037 else | |
3038 return FM_AUD_ERROR; | |
3039 } | |
3040 //Daisy tang added for Real Resume feature 20071107 | |
3041 //start | |
3042 T_FM_AUD_STATE mfw_fm_audRealPause(void) | |
3043 { | |
3044 T_AS_RET status; | |
3045 TRACE_EVENT("mfw_fm_audRealPause"); | |
3046 isPlayer_Real_Pause = TRUE; | |
3047 | |
3048 fm_aud_return_path.addr_id = 0; | |
3049 fm_aud_return_path.callback_func = mfw_fm_audPlay_cb; | |
3050 status=as_stop(&fm_aud_return_path); | |
3051 if(status == AS_OK) | |
3052 return FM_AUD_NO_ERROR; | |
3053 else | |
3054 return FM_AUD_ERROR; | |
3055 } | |
3056 | |
3057 T_FM_AUD_STATE mfw_fm_audRealResume(void) | |
3058 { | |
3059 T_AS_RET status; | |
3060 T_AS_PLAYER_TYPE player_type; | |
3061 UINT16 filename_uc[FM_MAX_DIR_PATH_LENGTH]; | |
3062 int i=0; | |
3063 | |
3064 | |
3065 TRACE_FUNCTION("mfw_fm_audRealResume"); | |
3066 | |
3067 if(!isPlayer_Real_Pause) | |
3068 return FM_AUD_ERROR; | |
3069 if((last_file_type NEQ OBJECT_TYPE_AUDIO_MP3) AND (last_file_type NEQ OBJECT_TYPE_AUDIO_AAC)) | |
3070 return FM_AUD_ERROR; | |
3071 | |
3072 isPlayer_Real_Pause = FALSE; | |
3073 | |
3074 switch(last_file_type) | |
3075 { | |
3076 case OBJECT_TYPE_AUDIO_MP3: | |
3077 TRACE_EVENT("AS_PLAYER_TYPE_MP3"); | |
3078 | |
3079 /* Aug 27, 2007 DRT: OMAPS00137370 x0045876 */ | |
3080 /* Voice Limit parameter should be saved to a temp var before playing | |
3081 MP3 or AAC file */ | |
3082 mfw_player_set_voice_limit (player_para.midi.voice_limit); | |
3083 /* Apr 10, 2007 DRT: OMAPS00125309 x0039928 */ | |
3084 /* MONO is 0 and STEREO is 1 for mp3 player*/ | |
3085 player_para.mp3.mono_stereo = player_channel - 1; | |
3086 player_para.mp3.size_file_start = last_file_size_played;//Daisy tang added for MP3 feature 20071107 | |
3087 player_type = AS_PLAYER_TYPE_MP3; | |
3088 break; | |
3089 case OBJECT_TYPE_AUDIO_AAC: | |
3090 TRACE_EVENT("AS_PLAYER_TYPE_AAC"); | |
3091 | |
3092 /* Aug 27, 2007 DRT: OMAPS00137370 x0045876 */ | |
3093 /* Voice Limit parameter should be saved to a temp var before playing | |
3094 MP3 or AAC file */ | |
3095 mfw_player_set_voice_limit (player_para.midi.voice_limit); | |
3096 /* Apr 10, 2007 DRT: OMAPS00125309 x0039928 */ | |
3097 /* MONO is 0 and STEREO is 1 for aac player*/ | |
3098 player_para.aac.mono_stereo = player_channel - 1 ; | |
3099 player_para.aac.size_file_start= last_file_size_played;//Daisy tang added for MP3 feature 20071107 | |
3100 | |
3101 player_type = AS_PLAYER_TYPE_AAC; | |
3102 break; | |
3103 } | |
3104 as_player_set_params(player_type,&player_para); | |
3105 | |
3106 mfw_set_stereo_path(mfw_get_current_audioDevice()); | |
3107 fm_aud_return_path.addr_id = 0; | |
3108 fm_aud_return_path.callback_func = mfw_fm_audPlay_cb; | |
3109 #ifdef FF_MMI_UNICODE_SUPPORT | |
3110 for(i==0;i<FM_MAX_DIR_PATH_LENGTH;i++) | |
3111 { | |
3112 filename_uc[i]=last_inputFileName_uc[i]; | |
3113 } | |
3114 #else | |
3115 convert_u8_to_unicode(last_inputFileName, filename_uc); | |
3116 #endif | |
3117 status=as_play_file(player_type,filename_uc,AS_VOLUME_HIGH,mfw_player_playback_loop_flag,last_play_bar,&fm_aud_return_path); | |
3118 if(status == AS_OK) | |
3119 return FM_AUD_NO_ERROR; | |
3120 else | |
3121 return FM_AUD_ERROR; | |
3122 } | |
3123 //end | |
3124 | |
3125 | |
3126 #endif | |
3127 | |
3128 |