comparison g23m/condat/ms/src/bmi/mmimmsom.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1
2 /*******************************************************************************
3
4 TI (Shanghai)
5
6 ********************************************************************************
7
8 This software product is the property of TI (Shanghai) Ltd and may not be
9 disclosed to any third party without the express permission of the owner.
10
11 ********************************************************************************
12
13 $Project name: TISHMMS Project
14 $Project code: BMI (6349)
15 $Module: MMS
16 $File: MmiMMSom.h
17 $Revision: 1.0
18
19 $Author: Yan Bin(bin-yan@ti.com)
20 $Date: 28/08/03
21
22 ********************************************************************************
23
24 Description:
25
26 This module provides definitions of the types and
27 constants which are shared across the MMS
28 application modules.
29
30 ********************************************************************************
31 $History: MmiMMSom.c
32
33 xreddymn Aug-20-2005 MMI-SPR-32709
34 Added support for previewing objects before inserting into MMS
35
36 xrashmic 08 Feb, 2005 MMI-SPR-27853
37 Added more parameters to the information_dialog function
38
39 xreddymn Jan-31-2005 MMI-SPR-28483: Support for MIDI objects
40
41 xrashmic 28 Jan, 2004 MMI-SPR-28166
42 Added support for saving Plugin Images
43
44 xrashmic 7 Dec, 2004 MMI-SPR-23965
45 Description: Not able to extract the objects in EMS message
46 Solution: Extract and store the objects in the Object Manager
47
48 xrashmic 29 Nov, 2004 MMI-SPR-26161
49 Description: The downloaded object through wap was not visible to the MMI
50 Solution: The downloaded wap object is available in the object manager
51 and can be used by the MMS
52
53 Bug Id 1 & 9 : 12 Aug, 2004 - xpradipg
54 Description:"No Media" displayed instead of Options screen
55 Solution: Added the BMI information window instead of writing directly onto the display
56
57 Bug Id 25 : 13 Aug, 2004 - xrashmic
58 Description: Changed the Insert note to Insert, Preview is not yet implemented,
59 therefore commented for time being
60
61 28/08/03 Original TI(Shanghai) BMI version.
62
63 $End
64
65 *******************************************************************************/
66 #define MMI_MMSOM_C
67
68 #define ENTITY_MFW
69
70 /* includes */
71 #include <string.h>
72 #include <stdio.h>
73 #include <stdlib.h>
74
75 #if defined (NEW_FRAME)
76
77 #include "typedefs.h"
78 #include "vsi.h"
79 #include "pei.h"
80 #include "custom.h"
81 #include "gsm.h"
82
83 #else
84
85 #include "STDDEFS.H"
86 #include "custom.h"
87 #include "gsm.h"
88 #include "vsi.h"
89
90 #endif
91 #include "prim.h"
92
93
94 #include "mfw_mfw.h"
95 #include "mfw_win.h"
96 #include "mfw_kbd.h"
97 #include "mfw_edt.h"
98 #include "mfw_tim.h"
99 #include "mfw_phb.h"
100 #include "ksd.h"
101 #include "psa.h"
102 #include "mfw_sms.h"
103 #include "mfw_smsi.h"
104 #include "mfw_icn.h"
105 #include "mfw_mnu.h"
106 #include "mfw_lng.h"
107 #include "mfw_sat.h"
108 #include "mfw_kbd.h"
109 #include "mfw_nm.h"
110
111 #include "psa_util.h"
112
113 #include "dspl.h"
114 // #include "unicode_types.h"
115
116 #include "MmiMain.h"
117 #include "MmiDummy.h"
118 //#include "MmiLists.h"
119 #include "MmiMmi.h"
120 #include "mmiCall.h"//GW 29/11/01 for 'callNumber'
121
122 #include "MmiDialogs.h"
123 #include "MmiLists.h"
124 #include "MmiMenu.h"
125 #include "MmiSoftKeys.h"
126 //#include "MmiEditor.h"
127 #include "MmiBookShared.h" // MZ
128 #include "mmimmsmenu.h"
129 #include "mmimmsom.h"
130 #include "mmiwindow.h"
131 #include "mfw_ffs.h"
132
133 #include "cus_aci.h"
134
135 #include "prim.h"
136 #ifndef PCM_2_FFS
137 #include "pcm.h"
138 #endif
139
140
141 #include "aci_cmh.h" //GW 29/11/01 added for types in aci_fd.h
142 #include "aci_fd.h" //GW 29/11/01 added for types in 'cmh.h'
143 #include "cmh.h" //GW 29/11/01 added for types in 'cmh_phb.h'
144 #include "cmh_phb.h" //GW 29/11/01 added for cmhPHB_getAdrStr
145
146 #include "mmiColours.h"
147
148
149
150 // ronaldc 8-5
151
152 #include "mg4def.h"
153 #include "evtdefs.h"
154 #include "mg4stu.h"
155 #include "Mg4Dal.h"
156 #include "mg4devif.h"
157 #include "dalevt.h"
158 #include "evif.h"
159 #include "mg4str.h"
160 #include "mmif.h"
161 #include "mg4mem.h"
162
163
164 MfwWin* getWinData( MfwHnd win);
165
166 /*********************************************************************
167
168 DYNAMIC MENU WINDOW. DECLARATION
169
170 **********************************************************************/
171
172
173
174 static MfwMnuAttr MmsOm_menuAttrib =
175 {
176 &melody_menuArea,
177 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
178 -1, /* use default font */
179 NULL, /* with these items */
180 0, /* number of items */
181 COLOUR_LIST_XX, TxtNull, MNUATTRSPARE
182 };
183
184 extern ESTATUS DisplayImageByObjId(MDword id, MBool bFullScreen);
185
186 static int MMSom_OPTexeInsert(MfwMnu* m, MfwMnuItem* i);
187 static int MMSom_OPTexePreview(MfwMnu* m, MfwMnuItem* i);
188 static int MMSom_OPTexeDelete(MfwMnu* m, MfwMnuItem* i);
189 USHORT MMSom_OPTexePreview_Available( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi );
190
191 static MfwMnuItem MMSom_OPTItems [] =
192 {
193 {0,0,0,(char *)TxtMMSInsert,0,(MenuFunc)MMSom_OPTexeInsert,item_flag_none},
194 {0,0,0,(char *)TxtDelete,0,(MenuFunc)MMSom_OPTexeDelete,item_flag_none},
195 {0,0,0,(char *)TxtMMSPreview,0,(MenuFunc)MMSom_OPTexePreview,MMSom_OPTexePreview_Available},
196 };
197
198 static MfwMnuAttr MMSom_OPTAttrib =
199 {
200 &SmsRead_R_OPTArea,
201 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
202 -1, /* use default font */
203 MMSom_OPTItems, /* with these items */
204 sizeof(MMSom_OPTItems)/sizeof(MfwMnuItem), /* number of items */
205 COLOUR_LIST_SMS, TxtNull, MNUATTRSPARE
206
207 };
208 static ListMenuData *menu_list_data=NULL;
209
210 #if 1
211
212 static int currentObjectNumber = 0;
213
214 /***********************************************************************************************************************
215
216
217 ***********************************************************************************************************************/
218
219 #pragma DATA_SECTION (g_ObjectBuffer, ".MMSFSBUF0");
220
221 UCS2 g_ObjectFilename[] = {'j','p','g','0',0};
222 UCS2 g_AMRFilename[] = {'a','m','r','0',0};
223
224 unsigned char g_ObjectBuffer[30 * 1024];//liuyu do not need in mass production
225 //xrashmic 7 Dec, 2004 MMI-SPR-23965
226 extern EV_S_EXTRACTABLE_IN_MESSAGE apExtractableInMessage;
227 extern PP_S_OBJECT_DATA *appObj;
228 extern int attachmentInEMS;
229 UCS2 filename[14];
230 ESTATUS M4_StoreExtractedObject(char *objbuffer, int size, M4_E_OBJECT_TYPE obj_Type);
231 //xrashmic 08 Feb, 2005 MMI-SPR-27853
232 extern T_MFW_HND information_dialog(USHORT TxtId1, USHORT TxtId2,char* Txt1, char* Txt2, USHORT SoftKeyTxtId1, USHORT SoftKeyTxtId2, int timer, T_MFW_EVENT keyEvents, T_VOID_FUNC callback);
233
234 /*! \brief Notify the menu system that the action has failed
235 */
236 void M4_ActionError(ESTATUS aEStatus)
237 {
238 if(aEStatus==EObjectAlreadyExists)
239 {
240 TRACE_EVENT("EObjectAlreadyExists!!!");
241 }else
242 TRACE_EVENT_P1("MMS action error: %d",(int )aEStatus);
243 }
244
245 /*! \brief Notify the menu system that the action has been completed successfully.
246 *
247 */
248 void M4_ActionComplete()
249 {
250 TRACE_EVENT("MMS action complete");
251 }
252
253 void M4_ObjectAttribFreeFunc (void *aObjectAtrrib)
254 {
255 M4_S_OBJECT_ATTRIB *objectAttrib = aObjectAtrrib;
256 TRACE_FUNCTION("M4_ObjectAttribFreeFunc");
257
258 FREE_MEMORY((void*)objectAttrib, sizeof(*objectAttrib));
259 }
260
261 void M4_ObjectItemFreeFunc ( void *aObjectItem)
262 {
263 M4_S_OBJECT_ITEM *objectItem = aObjectItem;
264 TRACE_FUNCTION("M4_ObjectItemFreeFunc");
265
266 FREE_MEMORY((void*)objectItem, sizeof(*objectItem));
267 }
268 ESTATUS M4_StorePicEventHandler(EVENT_ID aeId, EVENT_TYPE aeType,
269 MESSAGE_PARAM ampParam, EVT_HANDLE EvtHandle)
270 {
271 TRACE_FUNCTION("M4_StorePicObjectEventHandlerFunc");
272 switch (aeId)
273 {
274 case EMG4_FileOpDone :
275 currentObjectNumber++;
276 TRACE_EVENT("mms:case EMG4_FileOpDone begin");
277 M4_StoreNextPicObject(EvtHandle);
278 break;
279 default:
280 TRACE_EVENT("mms:default EMG4_FileOpDone begin");
281 FREE_MEMORY((void*)EvtHandle, sizeof(*EvtHandle));
282 }
283
284 return ENoError;
285 }
286
287 ESTATUS M4_StoreSndEventHandler(EVENT_ID aeId, EVENT_TYPE aeType,
288 MESSAGE_PARAM ampParam, EVT_HANDLE EvtHandle)
289 {
290 TRACE_FUNCTION("M4_StoreSndObjectEventHandlerFunc");
291 switch (aeId)
292 {
293 case EMG4_FileOpDone :
294 currentObjectNumber++;
295 TRACE_EVENT("mms:case EMG4_FileOpDone begin");
296 M4_StoreNextSndObject(EvtHandle);
297 break;
298 default:
299 TRACE_EVENT("mms:default EMG4_FileOpDone begin");
300 FREE_MEMORY((void*)EvtHandle, sizeof(*EvtHandle));
301 }
302
303 return ENoError;
304 }
305
306 void M4_StoreNextSndObject(EVT_HANDLE aEvtHandler)
307 {
308 TRACE_FUNCTION("M4_StoreNextSndObject");
309 if (currentObjectNumber < MAX_MMS_MEDIA)
310 {
311 ESTATUS estatus;
312 M4_S_OBJECT_ITEM *objectItem = NULL;
313 M4_S_OBJECT_ATTRIB *objectAttrib = NULL;
314
315 objectItem = (M4_S_OBJECT_ITEM*) ALLOC_MEMORY( sizeof(M4_S_OBJECT_ITEM));
316 objectAttrib = (M4_S_OBJECT_ATTRIB*) ALLOC_MEMORY( sizeof(M4_S_OBJECT_ATTRIB));
317
318 {
319 struct stat_s stat;
320 char filename[]="/amr0";
321 signed char Ffs_ret;
322
323 filename[4]='0'+currentObjectNumber;
324 g_AMRFilename[3]='0'+currentObjectNumber;
325
326 Ffs_ret = ffs_stat(filename, &stat);
327
328 if (Ffs_ret != 0)//empty file id found
329 {
330 //xmzhou_trace_string("M4_StoreNextSndObject file not found");
331 return;
332 }
333
334 TRACE_EVENT_P1("read jpg size: %d", stat.size);
335 ffs_fread(filename, (void *) g_ObjectBuffer,stat.size);
336
337 objectItem->objectSize = stat.size;
338 objectItem->pData = (MByte *)g_ObjectBuffer;
339 objectItem->memHdr.freeFunc = M4_ObjectItemFreeFunc;
340
341 objectAttrib->drmInfo = EDrmNotSet;
342 objectAttrib->memHdr.freeFunc = M4_ObjectAttribFreeFunc;
343 objectAttrib->objectFile.fileNameLen= 10;
344 objectAttrib->objectFile.pFileName = (UCS2 *)g_AMRFilename;
345 objectAttrib->objectId = 100 + currentObjectNumber;
346 objectAttrib->objectSize = stat.size;
347 objectAttrib->type = EMtMimeAmr;
348 }
349
350
351 TRACE_EVENT("MMS: OM_StoreObjectAsync begin");
352 estatus = OM_StoreObjectAsync(aEvtHandler,objectItem,objectAttrib);
353 TRACE_EVENT_P1("MMS: OM_StoreObjectAsync end:%d",estatus);
354 if (estatus != ENoError)
355 {
356 M4_ActionError(estatus);
357 FREE_MEMORY((void*)aEvtHandler, sizeof(*aEvtHandler));
358 }
359 }
360 else
361 {
362 FREE_MEMORY((void*)aEvtHandler, sizeof(*aEvtHandler));
363 M4_ActionComplete();
364 }
365
366 }
367
368 void M4_StoreNextPicObject(EVT_HANDLE aEvtHandler)
369 {
370 TRACE_FUNCTION("M4_StoreNextPicObject");
371 if (currentObjectNumber < MAX_MMS_MEDIA)
372 {
373 ESTATUS estatus;
374 M4_S_OBJECT_ITEM *objectItem = NULL;
375 M4_S_OBJECT_ATTRIB *objectAttrib = NULL;
376
377 objectItem = (M4_S_OBJECT_ITEM*) ALLOC_MEMORY( sizeof(M4_S_OBJECT_ITEM));
378 objectAttrib = (M4_S_OBJECT_ATTRIB*) ALLOC_MEMORY( sizeof(M4_S_OBJECT_ATTRIB));
379
380 {
381 struct stat_s stat;
382 char filename[]="/jpg0";
383 signed char Ffs_ret;
384
385 filename[4]='0'+currentObjectNumber;
386 g_ObjectFilename[3]='0'+currentObjectNumber;
387
388 Ffs_ret = ffs_stat(filename, &stat);
389
390 if (Ffs_ret != 0)//empty file id found
391 {
392 //xmzhou_trace_string("M4_StoreNextPicObject file not found");
393 return;
394 }
395
396 TRACE_EVENT_P1("read jpg size: %d", stat.size);
397 ffs_fread(filename, (void *) g_ObjectBuffer,stat.size);
398
399 objectItem->objectSize = stat.size;
400 objectItem->pData = (MByte *)g_ObjectBuffer;
401 objectItem->memHdr.freeFunc = M4_ObjectItemFreeFunc;
402
403 objectAttrib->drmInfo = EDrmNotSet;
404 objectAttrib->memHdr.freeFunc = M4_ObjectAttribFreeFunc;
405 objectAttrib->objectFile.fileNameLen= 10;
406 objectAttrib->objectFile.pFileName = (UCS2 *)g_ObjectFilename;
407 objectAttrib->objectId = 100+currentObjectNumber;
408 objectAttrib->objectSize = stat.size;
409 objectAttrib->type = EMtMimeJpeg;;
410 }
411
412
413 TRACE_EVENT("MMS: OM_StoreObjectAsync begin");
414 estatus = OM_StoreObjectAsync(aEvtHandler,objectItem,objectAttrib);
415 TRACE_EVENT_P1("MMS: OM_StoreObjectAsync end:%d",estatus);
416 if (estatus != ENoError)
417 {
418 M4_ActionError(estatus);
419 FREE_MEMORY((void*)aEvtHandler, sizeof(*aEvtHandler));
420 }
421 }
422 else
423 {
424 FREE_MEMORY((void*)aEvtHandler, sizeof(*aEvtHandler));
425 M4_ActionComplete();
426 }
427
428 }
429
430
431 // insert objects into OM.
432 void M4_InsertPicObjectIntoOM()
433 {
434
435 EVT_HANDLE evtHandler=NULL;
436 TRACE_FUNCTION("M4_InsertPicObjectIntoOM");
437
438 evtHandler = (EVT_HANDLE)ALLOC_MEMORY(sizeof(EVT_STRUCT));
439
440 memset(evtHandler,0x00,sizeof(EVT_STRUCT));
441 evtHandler->handler = M4_StorePicEventHandler;
442
443 currentObjectNumber = 0;
444
445 M4_StoreNextPicObject(evtHandler);
446 }
447 void M4_InsertSndObjectIntoOM()
448 {
449 EVT_HANDLE evtHandler=NULL;
450 TRACE_FUNCTION("M4_InsertSndObjectIntoOM");
451
452 evtHandler = (EVT_HANDLE)ALLOC_MEMORY(sizeof(EVT_STRUCT));
453
454 memset(evtHandler,0x00,sizeof(EVT_STRUCT));
455 evtHandler->handler = M4_StoreSndEventHandler;
456
457 currentObjectNumber = 0;
458
459 M4_StoreNextSndObject(evtHandler);
460 }
461
462 // insert Object into current message
463
464 void M4_InsertObjectIntoMessage(M4_OBJECT_ID aObjectID)
465 {
466 ESTATUS eResult=0;
467 TRACE_FUNCTION("M4_InsertObjectIntoMessage");
468 eResult=DAL_PostMessage(EMG4_InsertObject,EMG4_Type_NotUsed,aObjectID,0);
469 TRACE_EVENT_P2("MMS: M4_InsertObjectIntoMessage:%d, obj:%d", eResult,aObjectID);
470 }
471
472 /*
473 delete obejct from OM.
474 */
475 ESTATUS M4_DeleteObjectEventHandlerFunc(EVENT_ID aeId, EVENT_TYPE aeType, MESSAGE_PARAM ampParam, EVT_HANDLE evtHandle)
476 {
477 TRACE_FUNCTION("M4_DeleteObjectEventHandlerFunc");
478 switch (aeId)
479 {
480 case EMG4_FileOpDone :
481 M4_ActionComplete();
482 break;
483 }
484 FREE_MEMORY((void*)evtHandle, sizeof(*evtHandle));
485 return ENoError;
486 }
487
488
489 void M4_DeleteObjectFromOM(M4_OBJECT_ID aObjectID)
490 {
491 EVT_HANDLE evtHandler;
492 ESTATUS eResult=0;
493
494 /* Create the event handler */
495 evtHandler = (EVT_HANDLE)ALLOC_MEMORY(sizeof(EVT_STRUCT));
496 if (evtHandler == NULL)
497 {
498 M4_ActionError(EOutOfMemory);
499 return;
500 }
501
502 memset(evtHandler,0x00,sizeof(EVT_STRUCT)); /* Reset the structure */
503 evtHandler->handler = M4_DeleteObjectEventHandlerFunc;
504
505 eResult=OM_DeleteObjectAsync(evtHandler,aObjectID);
506 TRACE_EVENT_P1("MMS: OM_DeleteObjectAsync:%d", eResult);
507 }
508
509
510 /*
511 List obejct from OM.
512 */
513
514 static M4_S_OBJECT_LIST* g_pObjectList = NULL;
515 static UBYTE g_current_select=0; /*indicate the current object*/
516
517 void M4_ListObjects(UINT32 ObjType)
518 {
519 MDword conditions = 0;
520 ESTATUS eResult=0;
521 TRACE_FUNCTION("M4_ListObjects");
522
523 if (ObjType == MMS_INSERT_SOUND)
524 {
525 conditions = OM_MT_SOUND_NO_DRM;
526 }
527 else if (ObjType == MMS_INSERT_PICTURE)
528 {
529 conditions = OM_MT_IMAGE_NO_DRM;
530 }
531 else if (ObjType == EMS_INSERT_SOUND)
532 {
533 conditions = OM_MT_EMS_PREDEF_SOUND;
534 }
535 else if (ObjType == EMS_INSERT_PICTURE)
536 {
537 conditions = OM_MT_EMS_PREDEF_ANIM;
538 }
539 //xrashmic 7 Dec, 2004 MMI-SPR-23965
540 // Separate lists for the user defined Image and Picture objects
541 else if (ObjType == EMS_INSERT_PICTURE_USR)
542 {
543 conditions = OM_MT_EMS_IMAGE;
544 }
545 else if (ObjType == EMS_INSERT_SOUND_USR)
546 {
547 conditions = OM_MT_EMS_SOUND;
548 }
549
550 else
551 {
552 //xmzhou_trace_string("M4_ListObjects() error ObjType");
553 return;
554 }
555
556 //conditions = OM_MT_SOUND_NO_DRM;
557 eResult=OM_ListObjectsByParam(conditions,&g_pObjectList);
558 if(eResult==EObjectNotFound)
559 {
560 TRACE_EVENT("MMS: OM_ListObjectsByParam:not found");
561 }else
562 { TRACE_EVENT_P1("MMS: OM_ListObjectsByParam:%d", eResult);
563 }
564 M4_ActionComplete(); /* Post back to the menu system to say that we have finished the action */
565 }
566 void M4_FreeListObjectsMemory()
567 {
568 TRACE_FUNCTION("M4_FreeListObjectsMemory");
569 if (g_pObjectList)
570 {
571 g_pObjectList->memHdr.freeFunc(g_pObjectList);
572 g_pObjectList = NULL;
573 }
574 }
575
576 //int ConvertUcs2To8BitString(pUcs2String, uLength, p8BitString)
577
578 #endif
579
580 #define MMS_OM_LIST_BEGIN
581
582
583 /*******************************************************************************
584
585 $Function: MMSomList_cb
586
587 $Description: Callback function for the melody list.
588
589 $Returns: none
590
591 $Arguments: Parent - parent window.
592 ListData - Menu item list
593 *******************************************************************************/
594
595 void MMSomList_cb(T_MFW_HND * Parent, ListMenuData * ListData)
596 {
597
598 if ((ListData->Reason EQ LISTS_REASON_BACK) || (ListData->Reason EQ LISTS_REASON_CLEAR)
599 || (ListData->Reason EQ LISTS_REASON_HANGUP)) // sbh - added hangup key
600 {
601 listsDestroy(ListData->win);
602 MMI_DestoryWindow(Parent);
603 }
604 else if(ListData->Reason EQ LISTS_REASON_SELECT)
605 {
606 g_current_select=ListData->CursorPosition;
607 MMSom_OPT_start(ListData->win,0);
608 }else if(ListData->Reason EQ LISTS_REASON_SCROLL)
609 {
610 TRACE_FUNCTION ("MMSom_OPTexePreview()");
611 DisplayImageByObjId(g_pObjectList->pList[ListData->CursorPosition].objectId,EFalse);
612
613 }
614 }
615
616
617 // Bug Id 1 & 9 : 12 Aug, 2004 - xpradipg
618 /*******************************************************************************
619
620 $Function: No_Media_info_cb
621
622 $Description: Callback function for the information dialogue when media list is empty
623
624 $Returns: none
625
626 $Arguments:
627 *******************************************************************************/
628 static void No_Media_info_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
629 {
630 switch(reason)
631 {
632 case INFO_KCD_HUP:
633 case INFO_KCD_RIGHT:
634 case INFO_KCD_CLEAR:
635 case INFO_TIMEOUT:
636 TRACE_EVENT_P1("the value of win in No_media_info_cb is %x",*((int*)win));
637 MMI_DestoryWindow(win);
638 break;
639 default:
640 break;
641 }
642 }
643
644 /*******************************************************************************
645
646 $Function: MMSom_exec_cb
647
648 $Description: Exec callback function of the MMS Create window
649
650 $Returns: none
651
652 $Arguments: win - window handler
653 event - mfw event
654 parameter - optional data.
655
656 *******************************************************************************/
657 char g_ObjectTitle[MAX_MMS_MEDIA][32];
658
659 void MMSom_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
660 /* callback handler for events sent to to trigger execution */
661 {
662 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
663 int i;
664 T_DISPLAY_DATA display_info;
665
666 TRACE_FUNCTION ("MMSom_exec_cb()");
667
668 switch (event)
669 {
670 case MWM_CREATE:
671 /* initialization of administrative data */
672 TRACE_EVENT("MWM_CREATE");
673
674 //yanbin: call magic4 function to create object list
675 M4_ListObjects((UINT32)parameter);
676
677 if(g_pObjectList==NULL)
678 {
679 TRACE_EVENT("!!!no media object");
680 TRACE_EVENT ("Insert objects into OM");
681
682 if ((UINT32)parameter == MMS_INSERT_SOUND)
683 {
684 M4_InsertSndObjectIntoOM();
685 }
686 else if ((UINT32)parameter == MMS_INSERT_PICTURE)
687 {
688 M4_InsertPicObjectIntoOM();
689 }
690 else
691 {
692 //xmzhou_trace_string("MMSom_exec_cb error obj type");
693 }
694
695 // xreddymn Aug-09-2004, Why is winShow being called in a Window Callback ?
696 //winShow(win);
697 break;
698 }
699
700 TRACE_EVENT_P1("M4_ListObjects total:%d",g_pObjectList->numItems);
701
702 menu_list_data =(ListMenuData *) ALLOC_MEMORY(sizeof(ListMenuData));
703 if (menu_list_data == NULL)
704 {
705 // xmzhou_trace_string("menu_list_data == NULL error");
706 return;
707 }
708 menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( g_pObjectList->numItems * sizeof(T_MFW_MNU_ITEM) );
709
710 if (menu_list_data->List == NULL)
711 {
712 // xmzhou_trace_string("menu_list_data->List == NULL error");
713 return;
714 }
715
716 for (i = 0; i < g_pObjectList->numItems ; i++)
717 {
718 char tempbuf[64];
719 mnuInitDataItem(&menu_list_data->List[i]);
720 menu_list_data->List[i].flagFunc = item_flag_none;
721 ConvertUcs2To8BitString(g_pObjectList->pList[i].objectFile.pFileName,
722 g_pObjectList->pList[i].objectFile.fileNameLen, (MByte*) tempbuf);
723 sprintf(g_ObjectTitle[i],"%d:%s-(%d B)",i,tempbuf, g_pObjectList->pList[i].objectSize);
724 // data->menu_list_data->List[i].str = "pic1";
725 menu_list_data->List[i].str = g_ObjectTitle[i];
726 }
727
728 menu_list_data->ListLength =g_pObjectList->numItems;
729 menu_list_data->ListPosition = 1;
730 menu_list_data->CursorPosition = 1;
731 menu_list_data->SnapshotSize = g_pObjectList->numItems;
732 menu_list_data->Font = 0;
733 menu_list_data->LeftSoftKey = TxtSoftSelect;
734 menu_list_data->RightSoftKey = TxtSoftBack;
735 menu_list_data->KeyEvents = KEY_ALL;
736 menu_list_data->Reason = 0;
737 menu_list_data->Strings = TRUE;
738 menu_list_data->Attr = &MmsOm_menuAttrib;
739 menu_list_data->autoDestroy = FALSE;
740 listDisplayListMenu(win,menu_list_data,(ListCbFunc)MMSomList_cb,0);
741
742 /* put the (new) dialog window on top of the window stack */
743 // xreddymn Aug-09-2004, Why is winShow being called in a Window Callback ?
744 //winShow(win);
745 break;
746
747 case MWM_ONDRAW:
748 TRACE_EVENT("MWM_ONDRAW");
749 //xpradipg 12 Aug, 2004 : Bug Id 1 & 9
750 //"No Media" displayed instead of Options screen
751 //check for any object present in the object buffer before displaying the error screen.
752 //since MWM_ONDRAW is called for every draw. Add the BMI information dialog screen.
753 if(g_pObjectList ==NULL)
754 {
755
756 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtSoftBack, "No Media", TxtNull, COLOUR_STATUS);
757 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)No_Media_info_cb, FOREVER, KEY_HUP| KEY_RIGHT);
758 info_dialog (win, &display_info);
759 }
760 break;
761 case MWM_DESTORY:
762 if(menu_list_data)
763 {
764 if(menu_list_data->List)
765 {
766 FREE_MEMORY((void*)(menu_list_data->List),g_pObjectList->numItems* sizeof(T_MFW_MNU_ITEM ));
767 }
768 FREE_MEMORY((void*)(menu_list_data),sizeof(ListMenuData));
769 }
770 M4_FreeListObjectsMemory();
771 break;
772 default:
773 break;
774 }
775 }
776
777
778 /**/
779 T_MFW_HND l_omwin=NULL;
780 /*******************************************************************************
781
782 $Function: MMSom_start
783
784 $Description: Start the creation of the main window for Create MMS
785
786 $Returns: mfw window handler
787
788 $Arguments: parent_window - Parent window handler
789 menuAttr - Menu attributes.
790
791 *******************************************************************************/
792 T_MFW_HND MMSom_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
793 {
794
795 TRACE_FUNCTION ("MMSom_start()");
796 l_omwin= MMI_CreateWindow(parent_window, (T_DIALOG_FUNC)MMSom_exec_cb,(void*)menuAttr, 0, 0, 0);
797 return l_omwin;
798 }
799
800
801 #define MMS_OM_OPTION_BEGIN
802
803 /*******************************************************************************
804
805 $Function: MMSom_OPT_exec_cb
806
807 $Description: Exec callback function for the Option window
808
809 $Returns: none
810
811 $Arguments: win - current window
812 event - event id
813 value - unique id
814 parameter - optional data.
815
816 *******************************************************************************/
817
818 void MMSom_OPT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
819 /* callback handler for events sent to to trigger execution */
820 {
821 TRACE_FUNCTION ("MMSom_OPT_exec_cb()");
822 switch (event)
823 {
824 case MWM_CREATE:
825
826 TRACE_EVENT("Event:MWM_CREATE");
827 /* initialization of administrative data */
828 // data->parent_data = parent_data;
829 winShow(win);
830 break;
831 case MWM_ONDRAW:
832 dspl_ClearAll();
833 displaySoftKeys(TxtSoftOK,TxtSoftBack);
834 break;
835 case MWM_DESTORY:
836 break;
837 default:
838 return;
839 }
840 }
841
842
843 /*******************************************************************************
844
845 $Function: MMSom_OPT_start
846
847 $Description: Start the creation of the main window for Create MMS
848
849 $Returns: mfw window handler
850
851 $Arguments: parent_window - Parent window handler
852 menuAttr - Menu attributes.
853
854 *******************************************************************************/
855 T_MFW_HND MMSom_OPT_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
856 {
857
858 TRACE_FUNCTION ("SmsRead_R_start()");
859 return MMI_CreateWindow(parent_window, (T_DIALOG_FUNC)MMSom_OPT_exec_cb, (void*)menuAttr,0,&MMSom_OPTAttrib, 0);
860 }
861
862
863
864 static int MMSom_OPTexeInsert(MfwMnu* m, MfwMnuItem* i)
865 {
866 T_MFW_HND win = mfwParent(mfw_header());
867
868 TRACE_EVENT_P1("MMSom_OPTexeInsert():%d",g_current_select);
869 //data->current_select
870 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
871 M4_InsertObjectIntoMessage(g_pObjectList->pList[g_current_select].objectId);
872 MMI_DestoryWindow(win);
873 }
874
875 //xreddymn Aug-19-2005 MMI-SPR-32709: Preview of Objects
876
877 extern MDword DeviceMelodyId;
878 extern BOOL g_M4_display_active;
879
880 BOOL g_M4_object_preview = FALSE;
881
882 /*******************************************************************************
883
884 $Function: MMSom_OPTexePreview_Available
885
886 $Description: Decides whether to display "Preview" or not for the selected
887 object
888
889 $Returns: 0 = Do not display the "Preview" option
890 1 = Display the "preview" option
891
892 $Arguments: m = MfwMnuTag, passed by MFW
893 ma = MfwMnuAttrTag, passed by MFW
894 mi = MfwMnuItemTag, passed by MFW
895
896 *******************************************************************************/
897
898 USHORT MMSom_OPTexePreview_Available( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
899 {
900 switch(g_pObjectList->pList[g_current_select].type)
901 {
902 case EMtEmsPredefMelody:
903 case EMtEmsMelody:
904 case EMtMimeAmr:
905 case EMtMimeMidi:
906 // case EMtMimeSMidi:
907 // case EAudioWav:
908 // case EMtSMAF:
909 return 0;
910 case EMtMimeBmp:
911 case EMtMimePng:
912 case EMtMimeGif:
913 case EMtMimeJpeg:
914 case EMtMimeWbmp:
915 return 0;
916 default:
917 return 1;
918 }
919 }
920
921 /*******************************************************************************
922
923 $Function: MMSom_OPTexePreview_kbd_cb
924
925 $Description: Key handler for object preview
926
927 $Returns: MFW_EVENT_CONSUMED
928
929 $Arguments: e = Event
930 k = structure containing key code
931
932 *******************************************************************************/
933
934 static int MMSom_OPTexePreview_kbd_cb (MfwEvt e, MfwKbd *k)
935 {
936 T_MFW_HND win = mfwParent(mfw_header());
937
938 if (e & KEY_LONG)
939 {
940 switch (k->code)
941 {
942 case KCD_HUP:
943 case KCD_RIGHT:
944 MMI_DestoryWindow(win);
945 break;
946 default:
947 return MFW_EVENT_CONSUMED;
948 }
949 }
950 else
951 {
952 switch (k->code)
953 {
954 case KCD_HUP:
955 case KCD_RIGHT:
956 MMI_DestoryWindow(win);
957 break;
958 default:
959 return MFW_EVENT_CONSUMED;
960 }
961 }
962 return MFW_EVENT_CONSUMED;
963 }
964
965 /*******************************************************************************
966
967 $Function: MMSom_OPTexePreview_cb
968
969 $Description: Window handler for object preview
970
971 $Returns: None
972
973 $Arguments: win = Handle to the window
974 event = Window event
975
976 *******************************************************************************/
977
978 void MMSom_OPTexePreview_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
979 /* callback handler for events sent to to trigger execution */
980 {
981 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
982 int i;
983 T_DISPLAY_DATA display_info;
984 MRect apClientRect;
985
986 switch (event)
987 {
988 case MWM_CREATE:
989 break;
990
991 case MWM_ONDRAW:
992 dspl_Enable(0);
993 g_M4_object_preview = TRUE;
994 g_M4_display_active = TRUE;
995 DeviceGetClientRect(&apClientRect);
996 dspl_SetBgdColour(COL_White);
997 dspl_Clear(apClientRect.topLeft.uX, apClientRect.topLeft.uY, apClientRect.bottomRight.uX, apClientRect.bottomRight.uY);
998 DisplayImageByObjId(g_pObjectList->pList[g_current_select].objectId,EFalse);
999 displaySoftKeys(TxtNull,TxtSoftBack);
1000 g_M4_display_active = FALSE;
1001 g_M4_object_preview = FALSE;
1002 dspl_Enable(1);
1003 break;
1004
1005 case MWM_DESTORY:
1006 break;
1007
1008 default:
1009 break;
1010 }
1011 }
1012
1013 /*******************************************************************************
1014
1015 $Function: MMSom_OPTexePreview_Start
1016
1017 $Description: Opens the object preview window
1018
1019 $Returns: Handle to the object preview window
1020
1021 $Arguments: parent_window = Handle to the parent window
1022 menuAttr = Menu Attributes (Optional)
1023
1024 *******************************************************************************/
1025
1026 T_MFW_HND MMSom_OPTexePreview_Start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
1027 {
1028 T_MFW_HND win;
1029 win= MMI_CreateWindow(parent_window, (T_DIALOG_FUNC)MMSom_OPTexePreview_cb,(void*)menuAttr, (MfwCb)MMSom_OPTexePreview_kbd_cb, 0, 0);
1030 return win;
1031 }
1032
1033 /*******************************************************************************
1034
1035 $Function: MMSom_preview_dialog_cb
1036
1037 $Description: Handles dialog events for preview window for sound objects
1038
1039 $Returns: None
1040
1041 $Arguments: win = Handle to the window
1042 identifier = (Not used in this function)
1043 reason = Dialog event
1044
1045 *******************************************************************************/
1046
1047 static void MMSom_preview_dialog_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
1048 {
1049 switch(reason)
1050 {
1051 case INFO_KCD_HUP:
1052 case INFO_KCD_RIGHT:
1053 case INFO_KCD_CLEAR:
1054 case INFO_TIMEOUT:
1055 MMI_DestoryWindow(win);
1056 DeviceCancelMelody(DeviceMelodyId);
1057 break;
1058 default:
1059 break;
1060 }
1061 }
1062
1063 /*******************************************************************************
1064
1065 $Function: MMSom_OPTexePreview
1066
1067 $Description: Called when "preview" is selected in the menu
1068
1069 $Returns: None
1070
1071 $Arguments: win = Handle to the window
1072 identifier = (Not used in this function)
1073 reason = Dialog event
1074
1075 *******************************************************************************/
1076
1077 static int MMSom_OPTexePreview(MfwMnu* m, MfwMnuItem* i)
1078 {
1079 M4_S_OBJECT_ITEM *appObjectItem;
1080 T_MFW_HND win = mfwParent(mfw_header());
1081
1082 TRACE_FUNCTION ("MMSom_OPTexePreview()");
1083
1084 switch(g_pObjectList->pList[g_current_select].type)
1085 {
1086 case EMtEmsPredefMelody:
1087 case EMtEmsMelody:
1088 case EMtMimeAmr:
1089 case EMtMimeMidi:
1090 // case EMtMimeSMidi:
1091 // case EAudioWav:
1092 // case EMtSMAF:
1093 {
1094 T_DISPLAY_DATA display_info;
1095 OM_RetrieveObject(&appObjectItem, g_pObjectList->pList[g_current_select].objectId);
1096 DevicePlayMelody(g_pObjectList->pList[g_current_select].type, appObjectItem->pData, appObjectItem->objectSize, NULL);
1097 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtSoftBack, "Playing ...", TxtNull, COLOUR_STATUS);
1098 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)MMSom_preview_dialog_cb, FOREVER, KEY_HUP | KEY_RIGHT);
1099 info_dialog (win, &display_info);
1100 }
1101 break;
1102
1103 case EMtMimeBmp:
1104 case EMtMimePng:
1105 case EMtMimeGif:
1106 case EMtMimeJpeg:
1107 case EMtMimeWbmp:
1108 MMSom_OPTexePreview_Start(win, NULL);
1109 break;
1110
1111 default:
1112 break;
1113 }
1114 }
1115
1116 //xreddymn Aug-19-2005 MMI-SPR-32709: Preview of Objects, changes end
1117
1118 static void MMSom_Delete_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
1119 {
1120
1121 T_MFW_HND l_parent=NULL;
1122 TRACE_FUNCTION("MMSom_Delete_cb");
1123
1124 switch (reason)
1125 {
1126 case INFO_KCD_LEFT:
1127 //yanbin: Call magic4 function to delete current object
1128 M4_DeleteObjectFromOM(g_pObjectList->pList[g_current_select].objectId);
1129 l_parent=MMI_ParentWindow(win);
1130 MMI_DestoryWindow(win);
1131 TRACE_EVENT_P2("l_omwin:%x,l_parent:%x ", l_omwin, l_parent);
1132 // MMI_DestoryWindow(l_omwin);
1133 break;
1134 case INFO_KCD_HUP:
1135 case INFO_KCD_RIGHT:
1136 case INFO_KCD_CLEAR:
1137 //return back
1138 MMI_DestoryWindow(win);
1139 break;
1140 default:
1141 break;
1142 }
1143 }
1144 static int MMSom_OPTexeDelete(MfwMnu* m, MfwMnuItem* i)
1145 {
1146 T_MFW_HND win = mfwParent(mfw_header());
1147 T_DISPLAY_DATA display_info;
1148 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtSoftBack, TxtPressOk, TxtDelete, COLOUR_STATUS);
1149 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)MMSom_Delete_cb, FOREVER, KEY_LEFT|KEY_RIGHT|KEY_CLEAR|KEY_HUP);
1150 info_dialog (win, &display_info);
1151 }
1152
1153 #undef MMI_MMSOM_C
1154
1155 /*******************************************************************************
1156
1157 $Function: M4_StoreExtarctedObjectEventHandler
1158
1159 $Description: Event handler for M4_StoreDownloadedObject
1160 xrashmic 7 Dec, 2004 MMI-SPR-21621
1161 $Returns: ESTATUS
1162
1163 $Arguments:
1164 *******************************************************************************/
1165
1166 ESTATUS M4_StoreDownloadObjEventHandler(EVENT_ID aeId, EVENT_TYPE aeType,
1167 MESSAGE_PARAM ampParam, EVT_HANDLE EvtHandle)
1168 {
1169 switch (aeId)
1170 {
1171 case EMG4_FileOpDone :
1172 break;
1173 default:
1174 FREE_MEMORY((void*)EvtHandle, sizeof(*EvtHandle));
1175 }
1176
1177 return ENoError;
1178 }
1179
1180 /*******************************************************************************
1181
1182 $Function: M4_StorePluginObjEventHandler
1183
1184 $Description: Event handler for M4_StorePluginObject
1185 xrashmic 28 Jan, 2005 MMI-SPR-28166
1186 $Returns: ESTATUS
1187
1188 $Arguments:
1189 *******************************************************************************/
1190
1191 ESTATUS M4_StorePluginObjEventHandler(EVENT_ID aeId, EVENT_TYPE aeType,
1192 MESSAGE_PARAM ampParam, EVT_HANDLE EvtHandle)
1193 {
1194 switch (aeId)
1195 {
1196 case EMG4_FileOpDone :
1197 //xrashmic 28 Jan, 2005 MMI-SPR-28166
1198 information_dialog(TxtSaved, TxtNull, NULL, NULL, TxtNull, TxtSoftBack, THREE_SECS, KEY_RIGHT|KEY_HUP, NULL);
1199 break;
1200 default:
1201 FREE_MEMORY((void*)EvtHandle, sizeof(*EvtHandle));
1202 }
1203
1204 return ENoError;
1205 }
1206
1207 /*******************************************************************************
1208
1209 $Function: M4_StoreExtarctedObjectEventHandler
1210
1211 $Description: Event handler for M4_StoreExtarctedObject
1212 xrashmic 7 Dec, 2004 MMI-SPR-23965
1213 $Returns: ESTATUS
1214
1215 $Arguments:
1216 *******************************************************************************/
1217
1218 ESTATUS M4_StoreExtractedObjectEventHandler(EVENT_ID aeId, EVENT_TYPE aeType,
1219 MESSAGE_PARAM ampParam, EVT_HANDLE EvtHandle)
1220 {
1221 ESTATUS status;
1222 switch (aeId)
1223 {
1224 case EMG4_FileOpDone :
1225 attachmentInEMS++;
1226 if(appObj)
1227 appObj->oms.freeFunc(appObj);
1228 if(attachmentInEMS<apExtractableInMessage.NumOfAttachments)
1229 {
1230 EV_ReadExtractableItem(&apExtractableInMessage.pAttachmentsInMessage[attachmentInEMS],&appObj);
1231 status = M4_StoreExtractedObject((char *)appObj->objData.pByteData, appObj->lObjectDataSize, appObj->contentType);
1232 }
1233 else
1234 {
1235 apExtractableInMessage.omh.freeFunc(&apExtractableInMessage);
1236 //xrashmic 08 Feb, 2005 MMI-SPR-27853
1237 //Added more parameters to the information_dialog function
1238 information_dialog(TxtAllObjects, TxtExtracted, NULL,NULL, TxtNull, TxtSoftBack, FOREVER, KEY_RIGHT|KEY_HUP, NULL);
1239 }
1240 break;
1241 case EOutOfMemory:
1242 //xrashmic 08 Feb, 2005 MMI-SPR-27853
1243 //Added more parameters to the information_dialog function
1244 information_dialog(TxtError, TxtExtracting, NULL,NULL, TxtNull, TxtSoftBack, FOREVER, KEY_RIGHT|KEY_HUP, NULL);
1245 break;
1246 default:
1247 FREE_MEMORY((void*)EvtHandle, sizeof(*EvtHandle));
1248 }
1249
1250 return ENoError;
1251 }
1252
1253 /*******************************************************************************
1254
1255 $Function: M4_StoreIntoObjectManager
1256
1257 $Description: Stores objects into Object manager.
1258 xrashmic 7 Dec, 2004 MMI-SPR-23965, MMI-SPR-26161
1259 $Returns: ESTATUS
1260
1261 $Arguments: objbuffer - The object data
1262 size - The object size
1263 evtHandler - contains the call back function for the events
1264 obj_Type - The type of the object
1265 objectId - Object Id
1266 *******************************************************************************/
1267
1268 ESTATUS M4_StoreIntoObjectManager(char *objbuffer, int size,EVT_HANDLE evtHandler, M4_E_OBJECT_TYPE obj_Type,M4_OBJECT_ID objectId)
1269 {
1270 ESTATUS estatus;
1271 M4_S_OBJECT_ITEM *objectItem = NULL;
1272 M4_S_OBJECT_ATTRIB *objectAttrib = NULL;
1273 TRACE_FUNCTION("M4_StoreIntoObjectManager");
1274
1275 objectItem = (M4_S_OBJECT_ITEM*) ALLOC_MEMORY( sizeof(M4_S_OBJECT_ITEM));
1276 objectAttrib = (M4_S_OBJECT_ATTRIB*) ALLOC_MEMORY( sizeof(M4_S_OBJECT_ATTRIB));
1277
1278 objectItem->objectSize = size;
1279 objectItem->pData = (MByte *)objbuffer;
1280 objectItem->memHdr.freeFunc = M4_ObjectItemFreeFunc;
1281
1282 objectAttrib->drmInfo = EDrmNotSet;
1283 objectAttrib->memHdr.freeFunc = M4_ObjectAttribFreeFunc;
1284 objectAttrib->objectFile.fileNameLen= sizeof(filename);
1285 objectAttrib->objectFile.pFileName = filename;
1286 objectAttrib->objectId = objectId;
1287 objectAttrib->objectSize = size;
1288 objectAttrib->type = obj_Type;
1289 estatus = OM_StoreObjectAsync(evtHandler,objectItem,objectAttrib);
1290 if (estatus != ENoError)
1291 {
1292 TRACE_EVENT("ERROR inserting into obejct manager");
1293 switch(estatus)
1294 {
1295 case ENotActive:
1296 TRACE_EVENT("ERROR ENotActive");
1297 break;
1298 case EBadArgument:
1299 TRACE_EVENT("ERROR EBadArgument ");
1300 break;
1301 case EObjectAlreadyExists:
1302 TRACE_EVENT("ERROR EObjectAlreadyExists");
1303 break;
1304 case EOutOfMemory:
1305 TRACE_EVENT("ERROR EOutOfMemory");
1306 break;
1307 default:
1308 TRACE_EVENT("ERROR");
1309 }
1310 }
1311 return estatus;
1312 }
1313 /*******************************************************************************
1314
1315 $Function: M4_StoreExtarctedObject
1316
1317 $Description: Insert the extracted object into Object manager.
1318 xrashmic 7 Dec, 2004 MMI-SPR-23965
1319 $Returns: ESTATUS
1320
1321 $Arguments: objbuffer - The object data
1322 size - The object size
1323 obj_Type - The type of the object
1324 *******************************************************************************/
1325
1326 ESTATUS M4_StoreExtractedObject(char *objbuffer, int size, M4_E_OBJECT_TYPE obj_Type)
1327 {
1328 ESTATUS estatus;
1329 EVT_HANDLE evtHandler=NULL;
1330 char tempFile[14];
1331 int strLength=0;
1332 M4_OBJECT_ID objectId;
1333 TRACE_FUNCTION("M4_StoreExtractedObject");
1334 memset(evtHandler,0x00,sizeof(EVT_STRUCT));
1335
1336 evtHandler = (EVT_HANDLE)ALLOC_MEMORY(sizeof(EVT_STRUCT));
1337 evtHandler->handler = M4_StoreExtractedObjectEventHandler;
1338
1339
1340 if(obj_Type== EMtEmsMelody || obj_Type==EMtEmsNoteFormat)
1341 {
1342 FFS_flashData.audio_usr_obj++;
1343 strLength=sprintf(tempFile,"Audio%d",FFS_flashData.audio_usr_obj);
1344 objectId=500+ FFS_flashData.audio_usr_obj;
1345 }
1346 else
1347 {
1348 FFS_flashData.image_usr_obj++;
1349 strLength=sprintf(tempFile,"Image%d",FFS_flashData.image_usr_obj);
1350 objectId=500+ FFS_flashData.image_usr_obj;
1351 }
1352 Convert8BitStringToUcs2((const MByte *)&tempFile,strLength,filename);
1353 estatus = M4_StoreIntoObjectManager(objbuffer,size,evtHandler,obj_Type,objectId);
1354 // To update the number of extracted objects.
1355 flash_write();
1356 return estatus;
1357 }
1358
1359
1360 /*******************************************************************************
1361
1362 $Function: M4_StoreDownloadedObject
1363
1364 $Description: Insert the downloaded object into Object manager.
1365 xrashmic 29 Nov, 2004 MMI-SPR-26161
1366 $Returns: ESTATUS
1367
1368 $Arguments: objbuffer - The object data
1369 size - The object size
1370 obj_Type - The type of the object
1371 *******************************************************************************/
1372 ESTATUS M4_StoreDownloadedObject(char *objbuffer, int size, M4_E_OBJECT_TYPE obj_Type )
1373 {
1374 ESTATUS estatus;
1375 EVT_HANDLE evtHandler=NULL;
1376 char tempFile[14];
1377 int strLength=0;
1378 M4_OBJECT_ID objectId;
1379
1380 TRACE_FUNCTION("M4_StoreDownloadedObject");
1381 memset(evtHandler,0x00,sizeof(EVT_STRUCT));
1382 evtHandler = (EVT_HANDLE)ALLOC_MEMORY(sizeof(EVT_STRUCT));
1383 evtHandler->handler = M4_StoreDownloadObjEventHandler;
1384 // xreddymn Jan-31-2005 MMI-SPR-28483: Included MIDI MIME type
1385 if((obj_Type==EMtMimeAmr)||(obj_Type==EMtMimeMidi))
1386 {
1387 FFS_flashData.audio_usr_obj++;
1388 strLength=sprintf(tempFile,"Audio%d",FFS_flashData.audio_usr_obj);
1389 objectId=500+ FFS_flashData.audio_usr_obj;
1390 }
1391 else
1392 {
1393 FFS_flashData.image_usr_obj++;
1394 strLength=sprintf(tempFile,"Image%d",FFS_flashData.image_usr_obj);
1395 objectId=500+ FFS_flashData.image_usr_obj;
1396 }
1397 Convert8BitStringToUcs2((const MByte *)&tempFile,strLength,filename);
1398 estatus = M4_StoreIntoObjectManager(objbuffer,size,evtHandler,obj_Type,objectId);
1399 // To update the number of downloaded objects.
1400 flash_write();
1401 return estatus;
1402
1403 }
1404
1405 /*******************************************************************************
1406
1407 $Function: M4_StorePluginObject
1408
1409 $Description: Insert the Pluign object into Object manager.
1410 xrashmic 28 Jan, 2004 MMI-SPR-28166
1411 $Returns: ESTATUS
1412
1413 $Arguments: objbuffer - The object data
1414 size - The object size
1415 obj_Type - The type of the object
1416 *******************************************************************************/
1417 ESTATUS M4_StorePluginObject(char *objbuffer, int size, M4_E_OBJECT_TYPE obj_Type )
1418 {
1419 ESTATUS estatus;
1420 EVT_HANDLE evtHandler=NULL;
1421 char tempFile[14];
1422 int strLength=0;
1423 M4_OBJECT_ID objectId;
1424
1425 TRACE_FUNCTION("M4_StoreDownloadedObject");
1426 memset(evtHandler,0x00,sizeof(EVT_STRUCT));
1427 evtHandler = (EVT_HANDLE)ALLOC_MEMORY(sizeof(EVT_STRUCT));
1428 evtHandler->handler = M4_StorePluginObjEventHandler;
1429 // xreddymn Jan-31-2005 MMI-SPR-28483: Included MIDI MIME type
1430 if((obj_Type==EMtMimeAmr)||(obj_Type==EMtMimeMidi))
1431 {
1432 FFS_flashData.audio_usr_obj++;
1433 strLength=sprintf(tempFile,"Audio%d",FFS_flashData.audio_usr_obj);
1434 objectId=500+ FFS_flashData.audio_usr_obj;
1435 }
1436 else
1437 {
1438 FFS_flashData.image_usr_obj++;
1439 strLength=sprintf(tempFile,"Image%d",FFS_flashData.image_usr_obj);
1440 objectId=500+ FFS_flashData.image_usr_obj;
1441 }
1442 Convert8BitStringToUcs2((const MByte *)&tempFile,strLength,filename);
1443 estatus = M4_StoreIntoObjectManager(objbuffer,size,evtHandler,obj_Type,objectId);
1444 // To update the number of downloaded objects.
1445 flash_write();
1446 return estatus;
1447
1448 }
1449
1450
1451 #undef MMI_MMSOM_C
1452