comparison src/ui/mfw/mfw_fm.h @ 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 /* =========================================================
2 * Texas Instruments OMAP(TM) Platform Software
3 * (c) Copyright Texas Instruments, Incorporated. All Rights Reserved.
4 *
5 * Use of this software is controlled by the terms and conditions found
6 * in the license agreement under which this software has been supplied.
7 * ========================================================== */
8
9 /*==========================================================
10 * @file mfw_FileManager.h
11 *
12 * This provides the functionality of File Manager Applications.
13 * It supports file/folder related operations on FFS and MMC
14 *
15 * @path \bmi\condat\ms\src\mfw
16 *
17 * @rev 00.01
18 */
19 /* ========================================================== */
20 /*===========================================================
21 *!
22 *! Revision History
23 *! ===================================
24 Apr 06, 2007 DRT: OMAPS00124874 x0039928
25 Description: MM: Renaming process of an Imy file is incorrect
26 Solution: Seperate enum values for different audio files is added.
27
28 Mar 28, 2007 ER: OMAPS00106188 x0039928
29 Description: Align Midi application menu choices and audio Player menu choices
30
31 *! 10-Apr-2006 mf: Modified x0020906. Change required per SRxxxx
32 *! to provide File Manager Functionality.
33 *!
34 *!
35 *! 17-Jan-2006 mf: Revisions appear in reverse chronological order;
36 *! that is, newest first. The date format is dd-Mon-yyyy.
37 * =========================================================== */
38
39
40 #ifndef DEF_MFW_FILEMANAGER
41 #define DEF_MFW_FILEMANAGER
42 //Includes for Image Services
43 #include "msl/inc/msl_imgthmb.h"
44 #include "msl/inc/msl_imgview.h"
45 //Includes for Audio Services
46 #include "as/as_api.h"
47 #include "as/as_message.h"
48
49
50 /*******************************************************************************
51
52 Interface constants
53
54 *******************************************************************************/
55 #define FM_MAX_EXT_LENGTH 5
56 #define FM_MAX_OBJ_NAME_LENGTH 200// 45
57 #ifdef FF_MMI_UNICODE_SUPPORT
58 /* x0083025 OMAPS00156759
59 * Changed from 250 to 100 because to much memory is being taken when unicode
60 * is enabled (2 bytes per char) and system would eventually crash */
61 #define FM_MAX_DIR_PATH_LENGTH 100
62 #else
63 #define FM_MAX_DIR_PATH_LENGTH 250
64 #endif
65 #define FM_MAX_OBJ_DATE_LENGTH 15
66 #define FM_MAX_OBJ_TIME_LENGTH 15
67
68 #define FM_COPY_BUFFER_SIZE 1000
69
70 #define FM_MAX_OBJ 20
71 #define E_FM_THMB_INIT (T_MFW_EVENT)0x00000001
72 #define E_FM_THMB_DEINIT (T_MFW_EVENT)0x00000010
73 #define E_FM_THMB_GEN (T_MFW_EVENT)0x00000100
74 #define E_FM_IMG_INIT (T_MFW_EVENT)0x00001000
75 #define E_FM_IMG_DEINIT (T_MFW_EVENT)0x00010000
76 #define E_FM_IMG_DRAW (T_MFW_EVENT)0x00100000
77 #define E_FM_AUDIO_STOP (T_MFW_EVENT)0x01000000
78 #define E_FM_AUDIO_PROG (T_MFW_EVENT)0x10000000
79 #define E_FM_ALL_SERVICES (T_MFW_EVENT)0xFFFFFFFF
80 //Image
81
82 typedef enum
83 {
84 FM_UCP_ERROR_FATAL = -8,
85 FM_UCP_ERROR_NONFATAL,
86 FM_UCP_ERROR_UNKNOWN,
87 FM_UCP_ERROR_INVALID_ARGUMENT,
88 FM_UCP_ERROR_BAD_STREAM,
89 FM_UCP_ERROR_NO_MEM,
90 FM_UCP_ERROR_READ_FAILED,
91 FM_UCP_ERROR,
92 FM_UCP_NONE = 0,
93 FM_UCP_NO_ERROR,
94 FM_UCP_THMB_INIT,
95 FM_UCP_THMB_GEN,
96 FM_UCP_THMB_DEINIT,
97 FM_UCP_THMBIMG_INIT,
98 FM_UCP_THMBIMG_DRAW,
99 FM_UCP_THMBIMG_DEINIT,
100 FM_UCP_QCIFIMG_INIT,
101 FM_UCP_QCIFIMG_DRAW,
102 FM_UCP_QCIFIMG_DEINIT
103 }T_FM_IMG_STATE;
104 typedef struct
105 {
106 T_FM_IMG_STATE state;
107 T_FM_IMG_STATE cmd;
108 int ipMsl;
109 }T_FM_IMG;
110
111 typedef struct
112 {
113 BOOL thumbnail;
114 }T_FM_OBJ_IMAGE;
115 #define MFW_FM_ZOOM_LOW 1024
116 #define MFW_FM_ZOOM_MAX (8 * MFW_FM_ZOOM_LOW)
117 typedef enum
118 {
119 MFW_FM_ROTATE_0 = 0,
120 MFW_FM_ROTATE_90,
121 MFW_FM_ROTATE_180,
122 MFW_FM_ROTATE_270,
123 MFW_FM_ROTATE_MAX
124 }T_FM_IMG_ROTATE;
125 //Audio
126 typedef enum
127 {
128 FM_AUD_ERROR_NOTALLOWED = -12,
129 FM_AUD_ERROR_AUDIO,
130 FM_AUD_ERROR_DENIED,
131 FM_AUD_ERROR_PLAYER,
132 FM_AUD_ERROR_FFS,
133 FM_AUD_ERROR_MSGING,
134 FM_AUD_ERROR_NOTREADY,
135 FM_AUD_ERROR_INVALIDPARAM,
136 FM_AUD_ERROR_INTERNAL,
137 FM_AUD_ERROR_MEM,
138 FM_AUD_ERROR_NOTSUPPORTED,
139 FM_AUD_ERROR = -1 ,
140 FM_AUD_NO_ERROR,
141 FM_AUD_NONE,
142 FM_AUD_PLAY,
143 FM_AUD_FORWARD,
144 FM_AUD_REWIND,
145 FM_AUD_PAUSE,
146 FM_AUD_STOP,
147 }T_FM_AUD_STATE;
148
149 #define FM_AUD_MIDI_CHANNEL_MONO 1
150 #define FM_AUD_MIDI_CHANNEL_STEREO 2
151
152 #define FM_AUD_MP3_CHANNEL_MONO 0
153 #define FM_AUD_MP3_CHANNEL_STEREO 1
154
155 #define FM_AUD_AAC_CHANNEL_MONO 0
156 #define FM_AUD_AAC_CHANNEL_STEREO 1
157 #define FM_MFW_QCIF_WIDTH 176
158 #define FM_MFW_QCIF_HEIGHT 144
159 #define FM_MFW_PREVIEW_WIDTH 48
160 #define FM_MFW_PREVIEW_HEIGHT 48
161
162 typedef struct
163 {
164 T_FM_AUD_STATE state;
165 }T_FM_AUD;
166
167 typedef struct
168 {
169 BOOL hidden;
170 }T_FM_OBJ_AUDIO;
171
172 typedef enum
173 {
174 FM_IMAGE=0,
175 FM_AUDIO
176 }T_FM_APP_TYPE;
177
178 //Misc
179 typedef enum
180 {
181 FM_INVALID=-1,
182 FM_NOR_FLASH,
183 FM_NORMS_FLASH,
184 FM_NAND_FLASH,
185 FM_T_FLASH
186 }T_FM_DEVICE_TYPE;
187 typedef enum
188 {
189 FM_NONE=-1,
190 FM_OPEN,
191 FM_BACK,
192 FM_COPY,
193 FM_MOVE,
194 FM_OPTIONS_FILE,
195 FM_OPTIONS_FOLDER,
196 FM_IMGVIEW,
197 FM_RENAME,
198 FM_DELETE,
199 FM_NEWDIR,
200 FM_REMOVE
201 }T_FM_OPERATION_TYPE;
202
203 typedef enum
204 {
205 OBJECT_TYPE_NONE=-1,
206 OBJECT_TYPE_FILE,
207 OBJECT_TYPE_AUDIO,
208 OBJECT_TYPE_AUDIO_MIDI,
209 OBJECT_TYPE_AUDIO_MP3,
210 OBJECT_TYPE_AUDIO_AAC,
211 OBJECT_TYPE_IMAGE,
212 OBJECT_TYPE_FOLDER,
213 OBJECT_TYPE_IMAGE_FOLDER,
214 OBJECT_TYPE_AUDIO_FOLDER,
215 OBJECT_TYPE_AUDIO_XMF, /* Apr 06, 2007 DRT: OMAPS00124874 x0039928 */
216 OBJECT_TYPE_AUDIO_IMY,
217 OBJECT_TYPE_AUDIO_MMF,
218 OBJECT_TYPE_AUDIO_MXMF,
219 OBJECT_TYPE_AUDIO_SMS,
220 OBJECT_TYPE_AUDIO_WAV
221 }T_FM_OBJ_TYPE;
222
223 typedef enum
224 {
225 FM_COPY_ERROR = -1,
226 FM_COPY_NONE,
227 FM_COPY_START,
228 FM_COPY_PROGRESS,
229 FM_COPY_DONE
230 }T_FM_COPY_STATE;
231 typedef enum
232 {
233 FM_STATE_NONE=0,
234 FM_STATE_ERROR
235 }T_MFW_FM_STATE;
236 typedef enum
237 {
238 FM_NO_ERROR=0,
239 FM_DIR_DOESNOTEXISTS,
240 FM_FILE_EXISTS,
241 FM_FILE_DOESNOTEXISTS,
242 FM_READDIR_ERROR,
243 FM_RENAME_ERROR,
244 FM_DELETE_ERROR,
245 FM_DELETE_DIRNOTEMPTY,
246 FM_DIR_EXISTS,
247 FM_FORMAT_ERROR
248 }T_MFW_FM_STATUS;
249
250
251 typedef struct
252 {
253 UINT32 aud_tt;
254 UINT16 aud_pt;
255 }T_MFW_AUD_PARA;
256
257 typedef union
258 {
259 T_FM_AUD aud;
260 T_FM_IMG img;
261 }T_FM_DIRTYPE_INFO;
262
263 typedef union
264 {
265 T_FM_IMG_STATE img_state;
266 T_FM_AUD_STATE aud_state;
267 } T_MFW_FM_PARA;
268
269 typedef union
270 {
271 T_FM_OBJ_AUDIO audio;
272 T_FM_OBJ_IMAGE image;
273 }T_FM_OBJ_DATA;
274
275 typedef struct
276 {
277 char name[FM_MAX_OBJ_NAME_LENGTH];
278 #ifdef FF_MMI_UNICODE_SUPPORT
279 T_WCHAR name_uc[FM_MAX_OBJ_NAME_LENGTH];
280 #endif
281 T_FM_OBJ_TYPE type;
282 }T_FM_OBJ;
283
284 typedef struct
285 {
286 char name[15];
287 }T_FM_OBJ_ITEM;
288
289 typedef struct
290 {
291 int size;
292 char date[FM_MAX_OBJ_DATE_LENGTH];
293 char time[FM_MAX_OBJ_TIME_LENGTH];
294 }T_FM_OBJ_PROPERTIES;
295
296 typedef struct
297 {
298 T_FM_OBJ *obj_list[FM_MAX_OBJ];
299 T_FM_OBJ_PROPERTIES *obj_properties[FM_MAX_OBJ];
300 T_FM_OBJ_DATA *obj_data[FM_MAX_OBJ];
301 UBYTE num_objs;
302 char dir_name[FM_MAX_OBJ_NAME_LENGTH];
303 char dir_path[FM_MAX_DIR_PATH_LENGTH];
304 T_FM_OBJ_TYPE dir_type;
305 int depth;
306 int startIndex;
307 int currentIndex;
308 T_FM_DIRTYPE_INFO dirinfo;
309 }T_FM_CURDIR;
310 typedef struct
311 {
312 T_FM_OBJ *obj_list[FM_MAX_OBJ];
313 UBYTE num_objs;
314 char dir_name[FM_MAX_OBJ_NAME_LENGTH];
315 char dir_path[FM_MAX_DIR_PATH_LENGTH];
316 T_FM_OBJ_TYPE dir_type;
317 int currentIndex;
318 int depth;
319 }T_FM_DESTDIR;
320 typedef struct
321 {
322 T_MFW_EVENT emask; /* events of interest */
323 T_MFW_EVENT event; /* current event */
324 T_MFW_CB handler;
325 T_MFW_FM_PARA para;
326 } T_MFW_FM;
327 typedef struct
328 {
329
330 T_RFS_FD sourceFileID;
331 // int sourceFileID;
332 #ifdef FF_MMI_UNICODE_SUPPORT
333 T_WCHAR *sourceFile;
334 #else
335 char *sourceFile;
336 #endif
337 T_FM_DEVICE_TYPE source_type;
338 int sourceFileSize;
339
340 T_RFS_FD destFileID;
341 // int destFileID;
342 #ifdef FF_MMI_UNICODE_SUPPORT
343 T_WCHAR *destinationFile;
344 #else
345 char *destinationFile;
346 #endif
347 T_FM_DEVICE_TYPE destination_type;
348 char *buf;
349 T_RFS_SIZE buf_size;
350 int bytesRead;
351 T_FM_COPY_STATE state;
352 }T_MFW_FM_COPYMOVE_STRUCT;
353
354 #define THUMB "thumbnail"
355
356 #define NORDIR "/mmi/"
357 #define NORDIR_IMG "jpeg"
358 #define NORDIR_AUD "tones"
359
360 #define NORMSDIR "/"
361 #define NORMSDIR_IMG "jpeg"
362 #define NORMSDIR_AUD "tones"
363
364 #define NANDDIR "/"
365 #define NANDDIR_IMG "jpeg"
366 #define NANDDIR_AUD "tones"
367
368 #define TFLASHDIR "/"
369 #define TFLASHDIR_IMG "jpeg"
370 #define TFLASHDIR_AUD "tones"
371
372
373
374 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);
375 void mfw_fm_readFileFolders(char *dir_path, char *dir_name, UBYTE num_objs, T_FM_OBJ **obj_list, T_FM_DEVICE_TYPE source);
376 T_MFW_FM_STATUS mfw_fm_create_rootdir(T_FM_DEVICE_TYPE source);
377 T_MFW_HND mfw_fm_create(T_MFW_HND hWin, T_MFW_EVENT event, T_MFW_CB cbfunc);
378 T_MFW_RES mfw_fm_delete(T_MFW_HND hnd);
379 T_MFW_FM_STATUS mfw_fm_format(T_FM_DEVICE_TYPE source) ;
380 #ifdef FF_MMI_UNICODE_SUPPORT
381 T_MFW_FM_STATUS mfw_fm_rename(T_WCHAR* old_filename, T_WCHAR* new_filename, T_FM_DEVICE_TYPE source);
382 T_MFW_FM_STATUS mfw_fm_remove(T_WCHAR* objname,T_FM_DEVICE_TYPE source);
383 #else
384 T_MFW_FM_STATUS mfw_fm_rename(char* old_filename, char * new_filename, T_FM_DEVICE_TYPE source);
385 T_MFW_FM_STATUS mfw_fm_remove(char* objname,T_FM_DEVICE_TYPE source);
386 #endif
387
388 T_MFW_FM_STATUS mfw_fm_rename_image(char * path, char * dirname, char* old_filename, char * new_filename,T_FM_DEVICE_TYPE source);
389 T_MFW_FM_STATUS mfw_fm_remove_image(char * path, char * dirname, char* objname,T_FM_DEVICE_TYPE source) ;
390 T_MFW_FM_STATUS mfw_fm_newdir(char *dirname, T_FM_DEVICE_TYPE source);
391 T_MFW_FM_STATUS mfw_fm_createRootDir(T_FM_DEVICE_TYPE source);
392 T_FM_COPY_STATE mfw_fm_copy_start(T_MFW_FM_COPYMOVE_STRUCT *data) ;
393 T_FM_COPY_STATE mfw_fm_copy_continue(T_MFW_FM_COPYMOVE_STRUCT *data) ;
394 void mfw_fm_getMemStat(int *nfree, int *nused,T_FM_DEVICE_TYPE source);
395
396
397 //Image
398 T_FM_IMG_STATE mfw_fm_imgThmb_create(void);
399 T_FM_IMG_STATE mfw_fm_imgThmb_init(void);
400 T_FM_IMG_STATE mfw_fm_imgThmb_destroy(void);
401 T_FM_IMG_STATE mfw_fm_imgThmb_deinit(void);
402 T_FM_IMG_STATE mfw_fm_imgThmb_pause(void);
403 T_FM_IMG_STATE mfw_fm_imgThmb_generate(void);
404 T_FM_IMG_STATE mfw_fm_imgThmb_setparams(char * inFilepath, char* inFilename, int width,int height,T_FM_DEVICE_TYPE source);
405 T_FM_IMG_STATE mfw_fm_imgThmb_setcallback(void);
406 T_FM_IMG_STATE mfw_fm_imgViewer_create(void);
407 T_FM_IMG_STATE mfw_fm_imgViewer_init(void);
408 T_FM_IMG_STATE mfw_fm_imgViewer_destroy(void);
409 T_FM_IMG_STATE mfw_fm_imgViewer_deinit(void);
410 T_FM_IMG_STATE mfw_fm_imgViewer_pause(void);
411 T_FM_IMG_STATE mfw_fm_imgViewer_view(void);
412 T_FM_IMG_STATE mfw_fm_imgViewer_setparams(char * inFilepath, char* inFilename, int width,int height);
413 T_FM_IMG_STATE mfw_fm_imgViewer_setcallback(void);
414 void mfw_fm_thmb_mslcb( U32 tCMd,U32 tStatus);
415 void mfw_fm_view_mslcb( U32 tCMd,U32 tStatus);
416 T_MFW_FM_STATUS mfw_fm_checkThumbnail( char * obj,T_FM_DEVICE_TYPE source);
417 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);
418 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);
419 void mfw_fm_thmb_mslcb( U32 tCMd,U32 tStatus);
420 void mfw_fm_view_mslcb( U32 tCMd,U32 tStatus);
421
422
423
424 //Audio
425 T_FM_AUD_STATE mfw_fm_audStop(void);
426 #ifdef FF_MMI_UNICODE_SUPPORT
427 T_FM_AUD_STATE mfw_fm_audPlay(T_WCHAR * file_name, T_FM_OBJ_TYPE file_type, BOOL play_bar);
428 #else
429 T_FM_AUD_STATE mfw_fm_audPlay(char * file_name, T_FM_OBJ_TYPE file_type, BOOL play_bar);
430 #endif
431 T_FM_OBJ_TYPE mfw_fm_aud_get_type(char * file_name);
432 T_FM_AUD_STATE mfw_fm_audPause(void);
433 T_FM_AUD_STATE mfw_fm_audResume(void);
434 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);
435 /* OMAPS00151698, x0056522 */
436 void mfw_fm_audPlay_cb(void *parameter);
437
438 /*********************************/
439
440 #if 0
441 typedef UINT16 T_RFS_MODE;
442
443 #define RFS_IXUSR 0x0100 // Execute permission for the user
444 #define RFS_IWUSR 0x0200 // Write permission for the user
445 #define RFS_IRUSR 0x0400 // Read permission for the user
446 #define RFS_IRWXU 0x0700 // Read Write permission mask (default) for the user
447
448 #define RFS_IXGRP 0x0010 // Execute permission for group
449 #define RFS_IWGRP 0x0020 // Write permission for group
450 #define RFS_IRGRP 0x0040 // Read permission for group
451 #define RFS_IRWXG 0x0070 // Read Write permission mask (default) for group
452
453 #define RFS_IXOTH 0x0001 // Execute permission for others
454 #define RFS_IWOTH 0x0002 // Write permission for others
455 #define RFS_IROTH 0x0004 // Read permission for others
456 #define RFS_IRWXO 0x0007 // Read Write permission mask (default) for others
457
458 typedef INT32 T_RFS_RET;
459
460 #define RFS_EOK 0
461
462 #define RFS_ENODEVICE -1
463 #define RFS_EAGAIN -2
464 #define RFS_ENOSPACE -3
465 #define RFS_EFSFULL -4
466 #define RFS_EBADNAME -5
467 #define RFS_ENOENT -6
468 #define RFS_EEXISTS -7
469 #define RFS_EACCES -8
470 #define RFS_ENAMETOOLONG -9
471 #define RFS_EINVALID -10
472 #define RFS_ENOTEMPTY -11
473 #define RFS_EFBIG -12
474 #define RFS_ENOTAFILE -13
475 #define RFS_ENUMFD -14
476 #define RFS_EBADFD -15
477 #define RFS_EBADDIR -16
478 #define RFS_EBADOP -17
479 #define RFS_ELOCKED -18
480 #define RFS_EMOUNT -19
481 #define RFS_EDEVICE -20
482 #define RFS_EBUSY -21
483 #define RFS_ENOTADIR -22
484 #define RFS_EMAGIC -23
485 #define RFS_EMEMORY -24
486 #define RFS_EMSGSEND -25
487 #define RFS_ENOTALLOWED -26
488 #define RFS_ENOTSUPPORTED -27
489 #define RFS_EEMPTY -28
490 #define RFS_EINTERNALERROR -29
491 #define RFS_CORRUPT_LFN -30
492 #define RFS_E_FILETOOBIG -31
493
494
495 typedef union {
496 T_RFS_FS_STAT file_system;
497 T_RFS_MP_STAT mount_point;
498 T_RFS_FILE_DIR_STAT file_dir;
499 } T_RFS_STAT;
500
501 /* Defines the DIR type. This represents a directory stream, which is an ordered
502 * sequence of all the di-rectory entries (files) in a particular directory.
503 */
504 typedef struct {
505 UINT32 opendir_ino; // inode of directory that was opened
506 UINT32 lastread_ino; // last inode of the read direcoty entry
507 UINT8 mpt_idx; // mount point where the directory is located
508 UINT8 fscore_nmb; // file system type
509 } T_RFS_DIR;
510
511 typedef enum
512 {
513 FFS_ATTRIB_READWRITE = FFS_ATTRIB_READWRITE_MASK,
514 FFS_ATTRIB_READONLY = FFS_ATTRIB_READONLY_MASK,
515 FFS_ATTRIB_HIDDEN = FFS_ATTRIB_HIDDEN_MASK,
516 FFS_ATTRIB_SYSTEM = FFS_ATTRIB_SYSTEM_MASK,
517 FFS_ATTRIB_SUBDIR = FFS_ATTRIB_SUBDIR_MASK,
518 FFS_ATTRIB_ARCHIVE = FFS_ATTRIB_ARCHIVE_MASK,
519 FFS_ATTRIB_INVALID
520 }T_FFS_ATTRIB_TYPE;
521
522 /**********************************/
523 #endif
524
525 #endif
526