comparison src/ui3/mfw/mfw_camapp.c @ 420:e8ddbb0837ed

src/ui3: initial import of TCS3/LoCosto BMI & MFW code
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 Jan 2018 03:09:00 +0000
parents
children
comparison
equal deleted inserted replaced
419:59143cd42ec7 420:e8ddbb0837ed
1 /*
2 +--------------------------------------------------------------------+
3 | PROJECT: MMI-Framework (8417) $Workfile:: mfw_camapp.c $|
4 | $Author:: NDH $Revision:: 1 $|
5 | CREATED: 21.05.04 $Modtime:: 21.05.04 14:58 $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9 MODULE : MFW_CAMAPP
10
11 PURPOSE : This module contains Camera Interface functions.
12
13 HISTORY:
14
15 Oct 23 2007. DRT:OMAPS00149238. x0083025 (adrian)
16 Description: The quality is same for the 3 modes (economy, Standard, High)
17 Solution: Data type sent to MM from BMI is different. Changed data type to match.
18
19 May 24 2007 DR:OMAPS00133032 x0061088(Prachi)
20 Description:Snapshot with border frame picture captured with tiny square
21 frame on the left top corner.
22
23
24 April 03 2007 ER:OMAPS00116772 x0061088(Prachi)
25 Description:Support of 1.3 Mpixel camera on Locosto Plus
26
27 Mar 09 2007 DRT :OMAPS00118881 x0061088(Prachi)
28 Description :Camera Application Not Attached doesn't describe the real situation
29 Solution : mfw_msl_cam_create() is now checking for error "MSL_IMGCAP_ERROR_NOMEMORY"
30 returning from msl_cam_create().If msl_cam_create() returns the error
31 "MSL_IMGCAP_ERROR_NOMEMORY" then the MMI shows a error message "Not Enough Memory" and
32 exits from the camera application.
33
34
35 xrashmic 11 Aug 2006, OMAPS00089912
36 Based on framebuffer selection, the color format for snapshot would be RGB565 or YUYV
37 Viewfinder frame buffer width and height set to QCIF width and QCIF height respectively
38
39 xrashmic 02 Aug 2006, OMAPS00087612
40 Hanlding of MSL errors for the snapshot save failed scenario
41
42 May 17 2006, xdeepadh - LOCOSTO-DRT-OMAPS00077374
43 Description:Saving Images in NAND flash during viewfinder->snapshot.
44 Solution: Based on the compile time flag FF_MMI_RFS_ENABLED, the
45 appropriate file system APIS will be called.
46
47 May 02 2006, xdeepadh - LOCOSTO-DRT-OMAPS00076437
48 Description: MT call not handled in camera Application
49 Solution: The asynch event handling in Camera Application has been handled.
50
51 Jan 10 2006, xdeepadh - LOCOSTO-ENH-
52 Description: Application to test camera
53 Solution: Implemented the camera application with following functionalities
54 preview, snapshot ,configure and image saving.
55
56 */
57
58
59
60
61 #ifdef FF_MMI_CAMERA_APP
62
63
64
65 /*
66 ** Include Files
67 */
68
69 #define ENTITY_MFW
70 /* includes */
71 #include <string.h>
72
73
74 #include "typedefs.h"
75 #include "vsi.h"
76 #include "pei.h"
77 #include "custom.h"
78 #include "gsm.h"
79
80 #include "message.h" // included for aci_cmh.h ....
81 #include "prim.h" //included for aci_cmh.h ....
82 #include "aci_cmh.h" // included for mfw_sat.h, included for MmiDummy.h, included for MmiMenu.h
83
84 #include "mfw_mfw.h"
85 #include "mfw_win.h"
86 #include "mfw_camapp.h"
87 #include "mks/mks_api.h"
88 // May 17 2006, xdeepadh - LOCOSTO-DRT-OMAPS00077374
89 #ifdef FF_MMI_RFS_ENABLED
90 #include "rfs/rfs_api.h"
91 #else
92 #include "ffs/ffs_api.h"
93 #endif //FF_MMI_RFS_ENABLED
94
95 #include "mfw_ffs.h"
96
97 #if (BOARD == 71)
98 #define ISAMPLE
99 #endif
100
101
102 #include "dspl.h"
103 #include "msl/inc/msl_imgcap.h"
104
105 /*Variable declarations*/
106 EXTERN MfwHdr * current_mfw_elem;
107 MSL_HANDLE imgCapHandle;
108 void Msl_mslil_Callback(void* handle, U32 ucp_type, U32 tCMd, U32 tStatus);
109
110 //Feb 19 2006, x0061088(Prachi) LOCOSTO-DRT-OMAPS00112518
111 #ifdef FF_MMI_RELIANCE_FFS
112 T_FFS_DIR close_dir;
113 #endif
114
115 /*******************************************************************************
116
117 Local prototypes
118
119 *******************************************************************************/
120
121 BOOL mfw_cam_sign_exec (T_MFW_HDR * cur_elem, T_MFW_EVENT event, T_MFW_CAM_PARA * para);
122 void mfw_cam_signal(T_MFW_EVENT event, void *para);
123
124 /*******************************************************************************
125
126 $Function: mfw_cam_create
127
128 $Description: This function initialises an Mfw Camera entity and adds it to the Window Stack
129
130 $Returns: T_MFW_HND : A handle for the entity
131
132 $Arguments: T_MFW_HND : Parent Window Handle
133 T_MFW_EVENT : Event Mask of the events to be handled
134 T_MFW_CB : Callback function to handle the events
135
136 *******************************************************************************/
137 T_MFW_HND mfw_cam_create(T_MFW_HND hWin, T_MFW_EVENT event, T_MFW_CB cbfunc)
138 {
139 T_MFW_HDR *hdr;
140 T_MFW_CAM *cam_para;
141
142 TRACE_FUNCTION("mfw_cam_create()");
143
144 hdr = (T_MFW_HDR *) mfwAlloc(sizeof (T_MFW_HDR));
145 cam_para = (T_MFW_CAM *) mfwAlloc(sizeof (T_MFW_CAM));
146
147 if (!hdr OR !cam_para)
148 return FALSE;
149
150 /*
151 * initialisation of the handler
152 */
153 cam_para->emask = event;
154 cam_para->handler = cbfunc;
155
156 hdr->data = cam_para;
157 hdr->type = MfwTypCt;
158
159 /*
160 * installation of the handler
161 */
162 return mfwInsert((T_MFW_HDR *)hWin, hdr);
163 }
164
165 /*******************************************************************************
166
167 $Function: mfw_cam_delete
168
169 $Description: This function clears down an Mfw Camera entity and removes it from the
170 Window Stack
171
172 $Returns: T_MFW_RES : The result of the function
173
174 $Arguments: T_MFW_HND : The Handle of the entity to be removed
175
176 *******************************************************************************/
177 T_MFW_RES mfw_cam_delete(T_MFW_HND hnd)
178 {
179 TRACE_FUNCTION("mfw_cam_delete()");
180
181 if (!hnd OR !((T_MFW_HDR *)hnd)->data)
182 return MFW_RES_ILL_HND;
183
184 if (!mfwRemove((T_MFW_HDR *)hnd))
185 return MFW_RES_ILL_HND;
186
187 mfwFree((U8 *)(((T_MFW_HDR *) hnd)->data),sizeof(T_MFW_CAM));
188 mfwFree((U8 *)hnd,sizeof(T_MFW_HDR));
189
190 return MFW_RES_OK;
191 }
192
193 /*******************************************************************************
194
195 $Function: mfw_cam_sign_exec
196
197 $Description: This function sends the Mfw Camera test events from the Mfw to the BMI.
198
199 $Returns: None
200
201 $Arguments: None
202
203 *******************************************************************************/
204 BOOL mfw_cam_sign_exec (T_MFW_HDR * cur_elem, T_MFW_EVENT event, T_MFW_CAM_PARA * para)
205 {
206 TRACE_FUNCTION("mfw_cam_sign_exec()");
207 TRACE_EVENT_P2("Event %d, mfw_state %d",event,para->state);
208
209 while (cur_elem)
210 {
211 /*
212 * event handler is available
213 */
214 if (cur_elem->type EQ MfwTypCt)
215 {
216 T_MFW_CAM * cam_data;
217 /*
218 * handler is CM management handler
219 */
220 cam_data = (T_MFW_CAM *)cur_elem->data;
221 if (cam_data->emask & event)
222 {
223 /*
224 * event is expected by the call back function
225 */
226 cam_data->event = event;
227 switch (event)
228 {
229 /*
230 ** Generic Events
231 */
232 case E_CAM_INIT:
233 if(para!=NULL)
234 memcpy (&cam_data->para, para, sizeof (T_MFW_CAM_PARA));
235 break;
236 case E_CAM_VIEWFINDER:
237 if(para!=NULL)
238 memcpy (&cam_data->para, para, sizeof (T_MFW_CAM_PARA));
239 break;
240 case E_CAM_SNAPSHOT:
241 if(para!=NULL)
242 memcpy (&cam_data->para, para, sizeof (T_MFW_CAM_PARA));
243 break;
244 /* April 03 2007 ER:OMAPS00116772 x0061088(Prachi) */
245 case E_CAM_PREVIEW:
246 if(para!=NULL)
247 memcpy (&cam_data->para, para, sizeof (T_MFW_CAM_PARA));
248 break;
249 case E_CAM_PAUSE:
250 if(para!=NULL)
251 memcpy (&cam_data->para, para, sizeof (T_MFW_CAM_PARA));
252 break;
253 case E_CAM_DEINIT:
254 if(para!=NULL)
255 memcpy (&cam_data->para, para, sizeof (T_MFW_CAM_PARA));
256 break;
257 }
258
259 /*
260 * if call back defined, call it
261 */
262 if (cam_data->handler)
263 {
264 // store current mfw elem
265 current_mfw_elem = cur_elem;
266
267 if ((*(cam_data->handler)) (cam_data->event, (void *)&cam_data->para))
268 return TRUE;
269 }
270 }
271 }
272 cur_elem = cur_elem->next;
273 }
274 return FALSE;
275 }
276
277 /*******************************************************************************
278
279 $Function: mfw_cam_signal
280
281 $Description: This function sends the Mfw Bluetooth events from the Mfw to the BMI.
282
283 $Returns: None
284
285 $Arguments: T_MFW_EVENT : The event to be sent to the BMI
286 void * : Pointer to the Event data
287
288 *******************************************************************************/
289 void mfw_cam_signal(T_MFW_EVENT event, void *para)
290 {
291 UBYTE temp;
292 temp = dspl_Enable(0);
293
294 TRACE_FUNCTION("mfw_cam_signal()");
295
296 if (mfwSignallingMethod EQ 0)
297 {
298 /*
299 * focus is on a window
300 */
301 if (mfwFocus)
302 {
303 /*
304 * send event to sim management
305 * handler if available
306 */
307 if (mfw_cam_sign_exec (mfwFocus, event, para))
308 {
309 dspl_Enable(temp);
310 return;
311 }
312 }
313
314 /*
315 * actual focussed window is not available
316 * or has no network management registration
317 * handler, then search all nodes from the root.
318 */
319 if (mfwRoot)
320 mfw_cam_sign_exec (mfwRoot, event, para);
321 }
322 else
323 {
324 MfwHdr * h = 0;
325
326 /*
327 * Focus set, then start here
328 */
329 if (mfwFocus)
330 h = mfwFocus;
331
332 /*
333 * Focus not set, then start root
334 */
335 if (!h)
336 h = mfwRoot;
337
338 /*
339 * No elements available, return
340 */
341 while (h)
342 {
343 /*
344 * Signal consumed, then return
345 */
346 if (mfw_cam_sign_exec (h, event, para))
347 {
348 dspl_Enable(temp);
349 return;
350 }
351
352 /*
353 * All windows tried inclusive root
354 */
355 if (h == mfwRoot)
356 {
357 dspl_Enable(temp);
358 return;
359 }
360
361 /*
362 * get parent window
363 */
364 h = mfwParent(mfwParent(h));
365
366 if (h)
367 h = ((MfwWin * )(h->data))->elems;
368 }
369
370 mfw_cam_sign_exec (mfwRoot, event, para);
371
372 }
373
374 dspl_Enable(temp);
375
376 return;
377 }
378
379 /*******************************************************************************
380
381 $Function: mfw_cam_setDefaultConfigurations
382
383 $Description: This function sets the ImgCap ucp structure to default values
384
385 $Returns: None
386
387 $Arguments: None
388
389 *******************************************************************************/
390 T_MFW_CAM_ERROR mfw_cam_setDefaultConfigurations()
391 {
392 MSL_IMGCAP_STATUS status;
393
394
395
396
397 MSL_CAM_CONFIGTYPE mfw_cam_config;
398 MSL_DISPLAY_CONFIGTYPE mfw_cam_dspl_config;
399
400 TRACE_FUNCTION("mfw_msl_cam_setDefaultConfig()");
401
402 status = MSL_ImgCap_SetConfig(imgCapHandle,MSL_CALLBACKSET_CONFIGINDEX,(MSL_CALLBACK)Msl_mslil_Callback);
403
404 mfw_cam_config.tImgFormat = MSL_COLOR_RGB565;
405 mfw_cam_config.tMode = MSL_CAMERAMODE_VF;
406 mfw_cam_config.unImgHeight = QCIF_HEIGHT ; //xrashmic 11 Aug 2006, OMAPS00089912
407 mfw_cam_config.unImgWidth = QCIF_WIDTH;
408
409 if(status == MSL_IMGCAP_STATUS_OK)
410 status = MSL_ImgCap_SetConfig(imgCapHandle,MSL_CAMERA_CONFIGINDEX,&mfw_cam_config);
411
412
413 mfw_cam_dspl_config.tImgFormat = MSL_COLOR_RGB565;
414
415 mfw_cam_dspl_config.unDisplayImgHeight = QCIF_HEIGHT;//xrashmic 11 Aug 2006, OMAPS00089912
416 mfw_cam_dspl_config.unDisplayImgWidth = QCIF_WIDTH;
417 mfw_cam_dspl_config.unDisplayXOffset = 0;
418 mfw_cam_dspl_config.unDisplayYOffset = 0;
419 if(status == MSL_IMGCAP_STATUS_OK)
420 status = MSL_ImgCap_SetConfig(imgCapHandle,MSL_DISPLAY_CONFIGINDEX,&mfw_cam_dspl_config);
421 /* April 03 2007 ER:OMAPS00116772 x0061088(Prachi) */
422
423 status = MSL_ImgCap_SetConfig(imgCapHandle, MSL_SAVESS_CONFIGINDEX,&FFS_flashData.cam_auto_save);
424 if(status != MSL_IMGCAP_STATUS_OK)
425 {
426 TRACE_ERROR("Error in configuring");
427 return MFW_CAM_ERROR;
428 }
429
430 return MFW_CAM_NO_ERROR;
431
432
433 }
434
435
436 /*******************************************************************************
437
438 $Function: mfw_cam_setSnapshotConfigurations
439
440 $Description: This function configures the msl with default values
441
442 $Returns: None
443
444 $Arguments: None
445 xrashmic 11 Aug 2006, OMAPS00089912 : Added a parameter boolean 'frame'
446 *******************************************************************************/
447 T_MFW_CAM_ERROR mfw_cam_setSnapshotConfigurations(BOOL frame)
448 {
449 MSL_IMGCAP_STATUS status;
450
451 char filename[CAM_FILENAME_EDITOR_INPUT_LEN];
452
453 MSL_CAM_CONFIGTYPE mfw_cam_config;
454 MSL_DISPLAY_CONFIGTYPE mfw_cam_dspl_config;
455 MSL_FILE_CONFIGTYPE mfw_cam_file_config ;
456
457 TRACE_FUNCTION("mfw_cam_setSnapshotConfigurations()");
458
459 status = MSL_ImgCap_SetConfig(imgCapHandle,MSL_CALLBACKSET_CONFIGINDEX,(MSL_CALLBACK)Msl_mslil_Callback);
460 //xrashmic 11 Aug 2006, OMAPS00089912
461 //For optimal performance in the camera application Color format for camera capture
462 //in the case of snapshot should be YUYV for no frame and RGB565 only if overlay option is selected
463 if(frame)
464 mfw_cam_config.tImgFormat = MSL_COLOR_RGB565;
465 else
466 mfw_cam_config.tImgFormat = MSL_COLOR_YUYV;
467 mfw_cam_config.tMode = MSL_CAMERAMODE_SS;
468 //added by prachi
469 #if CAM_SENSOR == 1
470 if (FFS_flashData.cam_changed_resolution == TRUE )
471 {
472 switch(FFS_flashData.cam_resolution)
473 {
474 case CAM_RESOLUTION_VGA:
475 mfw_cam_config.unImgHeight = VGA_HEIGHT ;
476 mfw_cam_config.unImgWidth = VGA_WIDTH;
477 break;
478 case CAM_RESOLUTION_QCIF:
479 mfw_cam_config.unImgHeight = QCIF_HEIGHT ;
480 mfw_cam_config.unImgWidth = QCIF_WIDTH;
481 break;
482 case CAM_RESOLUTION_SXGA:
483 mfw_cam_config.unImgHeight = SXGA_HEIGHT ;
484 mfw_cam_config.unImgWidth = SXGA_WIDTH;
485 break;
486 }
487
488 }
489 else
490 {
491 /* May 24 2007 DR:OMAPS00133032 x0061088(Prachi)*/
492 mfw_cam_config.unImgHeight = VGA_HEIGHT ;
493 mfw_cam_config.unImgWidth = VGA_WIDTH;
494 }
495 #else
496 mfw_cam_config.unImgHeight =VGA_HEIGHT;
497 mfw_cam_config.unImgWidth =VGA_WIDTH;
498 #endif
499
500 if(status == MSL_IMGCAP_STATUS_OK)
501 status = MSL_ImgCap_SetConfig(imgCapHandle,MSL_CAMERA_CONFIGINDEX,&mfw_cam_config);
502
503 mfw_cam_dspl_config.tImgFormat = MSL_COLOR_RGB565;
504
505 mfw_cam_dspl_config.unDisplayImgHeight = QCIF_HEIGHT; //xrashmic 11 Aug 2006, OMAPS00089912
506 mfw_cam_dspl_config.unDisplayImgWidth = QCIF_WIDTH;
507 mfw_cam_dspl_config.unDisplayXOffset = 0;
508 mfw_cam_dspl_config.unDisplayYOffset = 0;
509 if(status == MSL_IMGCAP_STATUS_OK)
510 status = MSL_ImgCap_SetConfig(imgCapHandle,MSL_DISPLAY_CONFIGINDEX,&mfw_cam_dspl_config);
511
512 mfw_cam_file_config.sFileName= (char *) mfwAlloc(CAM_FILENAME_EDITOR_INPUT_LEN);
513
514 switch(FFS_flashData.snap_storage)
515 {
516 case SNAP_STG_FFS:
517 sprintf(filename,"%s%s/%s%d","/FFS/mmi",JPEG_CONTENT_DIR,(char *)mmi_get_Filename(),(int)FFS_flashData.camera_file_counter);
518 break;
519 case SNAP_STG_NORMS:
520 sprintf(filename,"%s%s/%s%d","/NOR/",JPEG_CONTENT_DIR,(char *)mmi_get_Filename(),(int)FFS_flashData.camera_file_counter);
521 break;
522 case SNAP_STG_NAND:
523 sprintf(filename,"%s%s/%s%d","/NAND",JPEG_CONTENT_DIR,(char *)mmi_get_Filename(),(int)FFS_flashData.camera_file_counter);
524 break;
525 case SNAP_STG_MMC:
526 sprintf(filename,"%s%s/%s%d","/MMC",JPEG_CONTENT_DIR,(char *)mmi_get_Filename(),(int)FFS_flashData.camera_file_counter);
527 break;
528 }
529
530 TRACE_EVENT_P1("filename ************is %s",filename);
531 strcpy(mfw_cam_file_config.sFileName, filename);
532
533 // May 17 2006, xdeepadh - LOCOSTO-DRT-OMAPS00077374
534 //Set the file type
535 //#ifdef FF_MMI_RFS_ENABLED
536 // mfw_cam_file_config.tFileType = MSL_FILETYPE_RFS;
537 #ifdef FF_MMI_FILEMANAGER
538 mfw_cam_file_config.tFileType = MSL_FILETYPE_RFS;
539 #else
540 mfw_cam_file_config.tFileType = MSL_FILETYPE_FFS;
541 #endif
542 if(status == MSL_IMGCAP_STATUS_OK)
543 status = MSL_ImgCap_SetConfig(imgCapHandle,MSL_ENCFILE_CONFIGINDEX,&mfw_cam_file_config);
544 mfwFree((U8 *)mfw_cam_file_config.sFileName,CAM_FILENAME_EDITOR_INPUT_LEN);
545
546 if(status != MSL_IMGCAP_STATUS_OK)
547 {
548 TRACE_ERROR("Error in configuring");
549 return MFW_CAM_ERROR;
550 }
551
552 return MFW_CAM_NO_ERROR;
553
554
555 }
556
557
558
559 /*******************************************************************************
560
561 $Function: mfw_cam_setQualityConfig
562
563 $Description: This function is used to update the MSL of the new quliaty factor in ImgCap ucp
564
565 $Returns: None
566
567 $Arguments: None
568
569 *******************************************************************************/
570 // Oct 23 2007. DRT:OMAPS00149238. x0083025 (adrian)
571 T_MFW_CAM_ERROR mfw_msl_cam_setQualityConfig(U32 qFactor)
572 {
573 MSL_IMGCAP_STATUS status;
574 TRACE_FUNCTION("mfw_msl_cam_setQualityConfig()");
575
576 status=MSL_ImgCap_SetConfig(imgCapHandle,MSL_ENCQUALITY_CONFIGINDEX,&qFactor);
577 if(status != MSL_IMGCAP_STATUS_OK)
578 {
579 TRACE_ERROR("Error in updating quality config");
580 return MFW_CAM_ERROR;
581 }
582 return MFW_CAM_NO_ERROR;
583 }
584
585
586 /*******************************************************************************
587
588 $Function: mfw_cam_setRotateConfig
589
590 $Description: This function is used to update the MSL of the new rotate in ImgCap ucp
591
592 $Returns: None
593
594 $Arguments: None
595
596 *******************************************************************************/
597 T_MFW_CAM_ERROR mfw_msl_cam_setRotateConfig(int tRotate)
598 {
599 MSL_IMGCAP_STATUS status;
600 TRACE_FUNCTION("mfw_msl_cam_setRotateConfig()");
601
602 status=MSL_ImgCap_SetConfig(imgCapHandle,MSL_ROTATE_CONFIGINDEX,&tRotate);
603 if(status != MSL_IMGCAP_STATUS_OK)
604 {
605 TRACE_ERROR("Error in updating the rotate config");
606 return MFW_CAM_ERROR;
607 }
608 return MFW_CAM_NO_ERROR;
609 }
610
611 /*******************************************************************************
612
613 $Function: mfw_cam_setBrustModeConfig
614
615 $Description: This function is used to update the MSL of the Burst mode in ImgCap ucp
616
617 $Returns: None
618
619 $Arguments: None
620
621 *******************************************************************************/
622 T_MFW_CAM_ERROR mfw_msl_cam_setBurstModeConfig(UBYTE burstCount)
623 {
624 MSL_IMGCAP_STATUS status;
625 TRACE_FUNCTION("mfw_msl_cam_setBurstModeConfig()");
626
627 status=MSL_ImgCap_SetConfig(imgCapHandle, MSL_BURSTCOUNT_CONFIGINDEX,&burstCount);
628 if(status != MSL_IMGCAP_STATUS_OK)
629 {
630 TRACE_ERROR("Error in updating Burstmode config");
631 return MFW_CAM_ERROR;
632 }
633 return MFW_CAM_NO_ERROR;
634 }
635
636 /*******************************************************************************
637
638 $Function: mfw_cam_setfileNameConfig
639
640 $Description: This function is used to update the MSL of the filename of the saved image
641 in ImgCap ucp
642
643 $Returns: None
644
645 $Arguments: None
646
647 *******************************************************************************/
648 T_MFW_CAM_ERROR mfw_msl_cam_setFileNameConfig()
649 {
650 MSL_IMGCAP_STATUS status;
651 MSL_FILE_CONFIGTYPE mfw_cam_file_config ;
652 char filename[CAM_FILENAME_EDITOR_INPUT_LEN];
653
654 TRACE_FUNCTION("mfw_msl_cam_setFileNameConfig()");
655
656 mfw_cam_file_config.sFileName= (char *) mfwAlloc(CAM_FILENAME_EDITOR_INPUT_LEN);
657
658 switch(FFS_flashData.snap_storage)
659 {
660 case SNAP_STG_FFS:
661 sprintf(filename,"%s%s/%s%d","/FFS/mmi",JPEG_CONTENT_DIR,(char *)mmi_get_Filename(),(int)FFS_flashData.camera_file_counter);
662 break;
663 case SNAP_STG_NORMS:
664 sprintf(filename,"%s%s/%s%d","/NOR/mmi",JPEG_CONTENT_DIR,(char *)mmi_get_Filename(),(int)FFS_flashData.camera_file_counter);
665 break;
666 case SNAP_STG_NAND:
667 sprintf(filename,"%s%s/%s%d","/NAND",JPEG_CONTENT_DIR,(char *)mmi_get_Filename(),(int)FFS_flashData.camera_file_counter);
668 break;
669 case SNAP_STG_MMC:
670 sprintf(filename,"%s%s/%s%d","/MMC",JPEG_CONTENT_DIR,(char *)mmi_get_Filename(),(int)FFS_flashData.camera_file_counter);
671 break;
672 }
673
674 TRACE_EVENT_P1("filename ************is %s",filename);
675 strcpy(mfw_cam_file_config.sFileName, filename);
676 // May 17 2006, xdeepadh - LOCOSTO-DRT-OMAPS00077374
677 // Set the file type
678 //#ifdef FF_MMI_RFS_ENABLED
679 #ifdef FF_MMI_FILEMANAGER
680 mfw_cam_file_config.tFileType = MSL_FILETYPE_RFS;
681 #else
682 mfw_cam_file_config.tFileType = MSL_FILETYPE_FFS;
683 #endif
684 /*if(status != MSL_IMGCAP_STATUS_OK)*//*a0393213 warnings removal-variable "status" is used before its value is set*/
685 status = MSL_ImgCap_SetConfig(imgCapHandle,MSL_ENCFILE_CONFIGINDEX,&mfw_cam_file_config);
686 mfwFree((U8 *)mfw_cam_file_config.sFileName,CAM_FILENAME_EDITOR_INPUT_LEN);
687 if(status != MSL_IMGCAP_STATUS_OK)
688 {
689 TRACE_ERROR("Error in updating filename");
690 return MFW_CAM_ERROR;
691 }
692 return MFW_CAM_NO_ERROR;
693 }
694
695
696 /*******************************************************************************
697
698 $Function: mfw_cam_set_overlayConfig
699
700 $Description: This function is used to update the MSL of the Border frames for both
701 Viewfinder and Snapshot
702
703 $Returns: None
704
705 $Arguments: None
706
707 *******************************************************************************/
708 T_MFW_CAM_ERROR mfw_msl_cam_setOverlayConfig(MSL_U8 * overlayBuffer)
709 {
710 MSL_IMGCAP_STATUS status;
711 MSL_IMG_OVERLAYCONFIG mfw_cam_overlayconfig ;
712 TRACE_FUNCTION("mfw_msl_cam_setOverlayConfig()");
713
714 mfw_cam_overlayconfig.nAlpha = 0;
715 mfw_cam_overlayconfig.nImgHeight = QCIF_HEIGHT; //xrashmic 11 Aug 2006, OMAPS00089912
716 mfw_cam_overlayconfig.nImgWidth = QCIF_WIDTH;
717 mfw_cam_overlayconfig.nOverlayXOffset = 0;
718 mfw_cam_overlayconfig.nOverlayYOffset = 0;
719 mfw_cam_overlayconfig.nTransparencyColor = 0x0020 ;
720 mfw_cam_overlayconfig.pOverlayBuff = overlayBuffer;
721 mfw_cam_overlayconfig.tOverlayMode = MSL_OVERLAYMODE_COLORKEY;
722 status = MSL_ImgCap_SetConfig(imgCapHandle,MSL_OVERLAY_CONFIGINDEX,&mfw_cam_overlayconfig);
723
724 if(status != MSL_IMGCAP_STATUS_OK)
725 {
726 TRACE_ERROR("Error in pdating viewfinder config");
727 return MFW_CAM_ERROR;
728 }
729 return MFW_CAM_NO_ERROR;
730 }
731
732 /*******************************************************************************
733
734 $Function: mfw_cam_set_SSOverlayConfig
735
736 $Description: This function is used to update the MSL of the Border frames for both
737 Viewfinder and Snapshot
738
739 $Returns: None
740
741 $Arguments: None
742
743 *******************************************************************************/
744 T_MFW_CAM_ERROR mfw_cam_set_SSOverlayConfig(MSL_U8 * overlayBuffer)
745 {
746 MSL_IMGCAP_STATUS status;
747 MSL_IMG_OVERLAYCONFIG mfw_cam_overlayconfig ;
748 TRACE_FUNCTION("mfw_cam_set_SSOverlayConfig()");
749
750 mfw_cam_overlayconfig.nAlpha = 0;
751 #if CAM_SENSOR == 1
752 if( FFS_flashData.cam_changed_resolution == TRUE )
753 {
754 switch(FFS_flashData.cam_resolution)
755 {
756 case CAM_RESOLUTION_VGA:
757 mfw_cam_overlayconfig.nImgHeight = VGA_HEIGHT;
758 mfw_cam_overlayconfig.nImgWidth = VGA_WIDTH;
759 break;
760 case CAM_RESOLUTION_QCIF:
761 mfw_cam_overlayconfig.nImgHeight = QCIF_HEIGHT;
762 mfw_cam_overlayconfig.nImgWidth = QCIF_WIDTH;
763 break;
764 }
765 }
766 else
767 {
768 mfw_cam_overlayconfig.nImgHeight = VGA_HEIGHT;
769 mfw_cam_overlayconfig.nImgWidth = VGA_WIDTH;
770 }
771 #else
772 mfw_cam_overlayconfig.nImgHeight = VGA_HEIGHT;
773 mfw_cam_overlayconfig.nImgWidth = VGA_WIDTH;
774 #endif
775 mfw_cam_overlayconfig.nOverlayXOffset = 0;
776 mfw_cam_overlayconfig.nOverlayYOffset = 0;
777 mfw_cam_overlayconfig.nTransparencyColor = 0x0020 ;
778 mfw_cam_overlayconfig.pOverlayBuff = overlayBuffer;
779 mfw_cam_overlayconfig.tOverlayMode = MSL_OVERLAYMODE_COLORKEY;
780 status = MSL_ImgCap_SetConfig(imgCapHandle,MSL_OVERLAY_CONFIGINDEX,&mfw_cam_overlayconfig);
781
782 if(status != MSL_IMGCAP_STATUS_OK)
783 {
784 TRACE_ERROR("Error in pdating viewfinder config");
785 return MFW_CAM_ERROR;
786 }
787 return MFW_CAM_NO_ERROR;
788 }
789
790
791 /*******************************************************************************
792
793 $Function: mfw_cam_set_zoomConfig
794
795 $Description: This function is used to update the MSL of the Border frames for both
796 Viewfinder and Snapshot
797
798 $Returns: None
799
800 $Arguments: None
801
802 *******************************************************************************/
803 T_MFW_CAM_ERROR mfw_msl_cam_setZoomConfig(U32 zFactor)
804 {
805 MSL_IMGCAP_STATUS status;
806 U32 zoomFactor = zFactor ;
807 TRACE_FUNCTION("mfw_msl_cam_setZoomConfig()");
808
809 status=MSL_ImgCap_SetConfig(imgCapHandle,MSL_ZOOM_CONFIGINDEX,&zoomFactor);
810 if(status != MSL_IMGCAP_STATUS_OK)
811 {
812 TRACE_ERROR("Error in updating zoom config");
813 return MFW_CAM_ERROR;
814 }
815 return MFW_CAM_NO_ERROR;
816 }
817
818 /*******************************************************************************
819
820 $Function: mfw_msl_cam_cb
821
822 $Description: This is the callback funtion for the imgCap UCP
823
824 $Returns: None
825
826 $Arguments: tCmd - specifies the cmd for which the callback is received
827 tStatus - Status message
828
829 *******************************************************************************/
830 void mfw_msl_cam_cb( U32 tCMd,U32 tStatus)
831 {
832 T_MFW_CAM_PARA para;
833
834 TRACE_FUNCTION("mfw_msl_cam_cb()");
835
836 switch(tCMd)
837 {
838 case MSL_CMD_INIT:
839 if(tStatus==MSL_IMGCAP_STATUS_OK)
840 {
841 TRACE_EVENT("Init Done");
842 para.state=CAM_STATE_INIT_DONE;
843 }
844 else
845 {
846 TRACE_EVENT("Init Error");
847 para.state=CAM_STATE_ERROR;
848 }
849 mfw_cam_signal(E_CAM_INIT,&para);
850 break;
851 case MSL_CMD_VIEWFINDER:
852 if(tStatus==MSL_IMGCAP_STATUS_OK)
853 {
854 TRACE_EVENT("Viewfinder done");
855 para.state=CAM_STATE_VIEWFINDER_DONE;
856 }
857 else
858 {
859 TRACE_EVENT("Viewfinder Error");
860 para.state=CAM_STATE_ERROR;
861 }
862 mfw_cam_signal(E_CAM_VIEWFINDER,&para);
863 break;
864 case MSL_CMD_SNAPSHOT:
865 if(tStatus==MSL_IMGCAP_STATUS_OK)
866 {
867 TRACE_EVENT("Snapshot done");
868 para.state=CAM_STATE_SNAPSHOT_DONE;
869 }
870 //xrashmic 02 Aug 2006, OMAPS00087612
871 //Saving of snapshot to the filesystem has failed.
872 else if(tStatus==MSL_IMGCAP_ERROR_IOWRITE)
873 {
874 TRACE_EVENT("Snapshot not saved");
875 para.state=CAM_STATE_SNAPSHOT_SAVE_ERROR;
876 }
877 else if(tStatus==MSL_IMGCAP_ERROR_NOSPACE)
878 {
879 TRACE_EVENT("No Space in File System");
880 para.state=CAM_STATE_SNAPSHOT_NOSPACE_ERROR;
881 }
882 else
883 {
884 TRACE_EVENT("Snapshot error");
885 para.state=CAM_STATE_ERROR;
886 }
887 mfw_cam_signal(E_CAM_SNAPSHOT,&para);
888 break;
889 case MSL_CMD_PAUSE:
890 if(tStatus==MSL_IMGCAP_STATUS_OK)
891 {
892 TRACE_EVENT("Pause Done");
893 para.state=CAM_STATE_PAUSE_DONE;
894 }
895 else
896 {
897 TRACE_EVENT("Pause error");
898 para.state=CAM_STATE_ERROR;
899 }
900 mfw_cam_signal(E_CAM_PAUSE,&para);
901 break;
902 case MSL_CMD_DEINIT :
903 if(tStatus==MSL_IMGCAP_STATUS_OK)
904 {
905 TRACE_EVENT("Deint done");
906 para.state=CAM_STATE_DEINIT_DONE;
907 }
908 else
909 {
910 TRACE_EVENT("Pause error");
911 para.state=CAM_STATE_ERROR;
912 }
913 mfw_cam_signal(E_CAM_DEINIT,&para);
914 break;
915 /* April 03 2007 ER:OMAPS00116772 x0061088(Prachi) */
916 case MSL_CMD_PREVIEWDONE :
917 if(tStatus == MSL_IMGCAP_STATUS_OK)
918 {
919 TRACE_EVENT("Preview Done");
920 para.state = CAM_STATE_PREVIEW_DONE;
921 }
922 else
923 {
924 TRACE_EVENT("Preview Error");
925 para.state = CAM_STATE_ERROR;
926 }
927 mfw_cam_signal(E_CAM_PREVIEW,&para);
928 break;
929 }
930 }
931
932 /*******************************************************************************
933
934 $Function: mfw_cam_creates
935
936 $Description: This function creates the JPEG_CONTENT_DIR and creates the camera engine.
937
938 $Returns: None
939
940 $Arguments: None
941
942 *******************************************************************************/
943 T_MFW_CAM_ERROR mfw_msl_cam_create(void)
944 {
945 MSL_IMGCAP_STATUS status;
946
947 //May 17 2006, xdeepadh - LOCOSTO-DRT-OMAPS00077374
948 #ifdef FF_MMI_RFS_ENABLED
949 T_RFS_DIR dir;
950 T_RFS_RET rfsResult;
951
952 TRACE_EVENT("mfw_cam_init()");
953 rfsResult = rfs_opendir(JPEG_CONTENT_DIR,&dir);
954
955 if(RFS_ENOENT == rfsResult)
956 {
957 //Directory does not exsists, create it and initialize the table and write it to FFS
958 /*rfsResult = rfs_mkdir(JPEG_CONTENT_DIR,RFS_IRWXU);
959 if(RFS_EOK == rfsResult)
960 {
961 TRACE_EVENT("open Dir Passed");
962 }
963 else
964 TRACE_EVENT("open Dir Failed"); */
965 }
966 #else
967 T_FFS_DIR dir;
968 T_FFS_RET ffsResult;
969
970 TRACE_FUNCTION("mfw_cam_init()");
971
972 ffsResult = ffs_opendir(JPEG_CONTENT_DIR,&dir);
973 //Feb 19 2006, x0061088(Prachi)LOCOSTO-DRT-OMAPS00112518
974 #ifdef FF_MMI_RELIANCE_FFS
975 close_dir = dir;
976 #endif
977
978
979 if(EFFS_NOTFOUND == ffsResult)
980 {
981 //Directory does not exsists, create it and initialize the table and write it to FFS
982 ffsResult = ffs_mkdir(JPEG_CONTENT_DIR);
983 if(EFFS_OK == ffsResult)
984 {
985 TRACE_EVENT("Create Dir Passed");
986 }
987 else
988 TRACE_EVENT("Create Dir Failed");
989 }
990 else
991 {
992 TRACE_EVENT_P1("No directory created %d",ffsResult);
993 }
994 #endif //FF_MMI_RFS_ENABLED
995
996 status = MSL_ImgCap_Create (&imgCapHandle);
997 if(status != MSL_IMGCAP_STATUS_OK)
998 {
999 //Mar 09 2007 DRT :OMAPS00118881 x0061088(Prachi)
1000 TRACE_ERROR("Error creating handler");
1001 if(status == MSL_IMGCAP_ERROR_NOMEMORY)
1002 {
1003 TRACE_ERROR("No memory Error");
1004 return MFW_CAM_ERROR_NO_MEMORY;
1005 }
1006 else
1007 {
1008 TRACE_ERROR("Error creating handler");
1009 return MFW_CAM_ERROR;
1010 }
1011 }
1012
1013 return MFW_CAM_NO_ERROR;
1014 }
1015 /*******************************************************************************
1016
1017 $Function: mfw_cam_init
1018
1019 $Description: Initializes the camera engine.
1020
1021 $Returns: None
1022
1023 $Arguments: None
1024
1025 *******************************************************************************/
1026 T_MFW_CAM_ERROR mfw_msl_cam_init(void)
1027 {
1028 MSL_IMGCAP_STATUS status;
1029
1030 TRACE_FUNCTION("mfw_msl_cam_init()");
1031 //Do the default configuration for the camera and image components
1032
1033 status=MSL_ImgCap_Init(imgCapHandle);
1034 if(status != MSL_IMGCAP_STATUS_OK)
1035 {
1036 TRACE_ERROR("Error in initializing MSL camera");
1037 return MFW_CAM_ERROR;
1038 }
1039 return MFW_CAM_NO_ERROR;
1040 }
1041 /*******************************************************************************
1042
1043 $Function: mfw_msl_cam_Deinit
1044
1045 $Description: Deinitializes the cam
1046
1047 $Returns: None
1048
1049 $Arguments: None
1050
1051 *******************************************************************************/
1052 T_MFW_CAM_ERROR mfw_msl_cam_deinit(void)
1053 {
1054 MSL_IMGCAP_STATUS status;
1055 TRACE_FUNCTION("mfw_msl_cam_Deinit()");
1056 status = MSL_ImgCap_Deinit(imgCapHandle);
1057 if(status != MSL_IMGCAP_STATUS_OK)
1058 {
1059 TRACE_ERROR("Error in De-initializing MSL camera");
1060 return MFW_CAM_ERROR;
1061 }
1062 return MFW_CAM_NO_ERROR;
1063 }
1064
1065 /*******************************************************************************
1066
1067 $Function: mfw_cam_exit
1068
1069 $Description: Exits the camera application
1070
1071 $Returns: None
1072
1073 $Arguments: None
1074
1075 *******************************************************************************/
1076 T_MFW_CAM_ERROR mfw_msl_cam_exit(void)
1077 {
1078 MSL_IMGCAP_STATUS status;
1079 TRACE_FUNCTION("mfw_msl_cam_exit()");
1080
1081 status=MSL_ImgCap_Destroy(imgCapHandle);
1082 if(status != MSL_IMGCAP_STATUS_OK)
1083 {
1084 TRACE_ERROR("Error in exiting MSL camera");
1085 return MFW_CAM_ERROR;
1086 }
1087 return MFW_CAM_NO_ERROR;
1088 }
1089
1090 /*******************************************************************************
1091
1092 $Function: mfw_cam_launch_viewfinder
1093
1094 $Description: This function starts the viewfinder mode
1095
1096 $Returns: None
1097
1098 $Arguments: None
1099
1100 *******************************************************************************/
1101 T_MFW_CAM_ERROR mfw_msl_cam_viewfinder()
1102 {
1103 MSL_IMGCAP_STATUS status;
1104
1105 TRACE_FUNCTION("mfw_msl_cam_viewfinder()");
1106
1107 status=MSL_ImgCap_Viewfinder(imgCapHandle);
1108 if(status != MSL_IMGCAP_STATUS_OK)
1109 {
1110 TRACE_ERROR("Error in launching viewfinder");
1111 return MFW_CAM_ERROR;
1112 }
1113 return MFW_CAM_NO_ERROR;
1114
1115 }
1116
1117 /*******************************************************************************
1118
1119 $Function: mfw_cam_suspend_camera
1120
1121 $Description: This function pauses the ImgCap UCP
1122
1123 $Returns: None
1124
1125 $Arguments: None
1126
1127 *******************************************************************************/
1128 T_MFW_CAM_ERROR mfw_msl_cam_suspend_camera()
1129 {
1130 MSL_IMGCAP_STATUS status;
1131 TRACE_FUNCTION("mfw_msl_cam_suspend_camera()");
1132
1133 status=MSL_ImgCap_Pause(imgCapHandle);
1134 if(status != MSL_IMGCAP_STATUS_OK)
1135 {
1136 TRACE_ERROR("Error in pausing MSL camera");
1137 return MFW_CAM_ERROR;
1138 }
1139 return MFW_CAM_NO_ERROR;
1140 }
1141
1142 /*******************************************************************************
1143
1144 $Function: mfw_cam_snapshot
1145
1146 $Description: This function takes the snapshot. and also saves the same to FFS
1147
1148 $Returns: None
1149
1150 $Arguments: None
1151
1152 *******************************************************************************/
1153 T_MFW_CAM_ERROR mfw_msl_cam_snapshot()
1154 {
1155 MSL_IMGCAP_STATUS status;
1156 TRACE_FUNCTION("mfw_msl_cam_snapshot()");
1157
1158 status=MSL_ImgCap_Snapshot(imgCapHandle);
1159 if(status != MSL_IMGCAP_STATUS_OK)
1160 {
1161 TRACE_ERROR("Error in taking the snapshot");
1162 return MFW_CAM_ERROR;
1163 }
1164 return MFW_CAM_NO_ERROR;
1165 }
1166
1167
1168
1169 /*******************************************************************************
1170
1171 $Function: mfw_close_dir
1172
1173 $Description: This function close the directory /mm/jpeg/
1174
1175 $Returns: None
1176
1177 $Arguments: None
1178
1179 *******************************************************************************/
1180 //Feb 19 2006, x0061088(Prachi) LOCOSTO-DRT-OMAPS00112518
1181 #ifdef FF_MMI_RELIANCE_FFS
1182 void mfw_close_dir()
1183 {
1184 ffs_closedir(close_dir);
1185 return;
1186 }
1187 #endif
1188
1189 /* April 03 2007 ER:OMAPS00116772 x0061088(Prachi) */
1190 /*******************************************************************************
1191
1192 $Function: mfw_cam_setAutoSave
1193
1194 $Description: This function is used to update the MSL for Auto Save
1195
1196 $Returns: None
1197
1198 $Arguments: None
1199
1200 *******************************************************************************/
1201 T_MFW_CAM_ERROR mfw_msl_cam_setAutoSave(UBYTE autoSave)
1202 {
1203 MSL_IMGCAP_STATUS status;
1204 TRACE_FUNCTION("mfw_msl_cam_setAutoSave()");
1205
1206 status=MSL_ImgCap_SetConfig(imgCapHandle,MSL_SAVESS_CONFIGINDEX,&autoSave);
1207 if(status != MSL_IMGCAP_STATUS_OK)
1208 {
1209 TRACE_ERROR("Error in while setting for Auto Save");
1210 return MFW_CAM_ERROR;
1211 }
1212 return MFW_CAM_NO_ERROR;
1213 }
1214
1215 /* April 03 2007 ER:OMAPS00116772 x0061088(Prachi) */
1216 /*******************************************************************************
1217
1218 $Function: mfw_msl_cam_save
1219
1220 $Description: Calls MSL save
1221
1222 $Returns: None
1223
1224 $Arguments: None
1225
1226 *******************************************************************************/
1227 T_MFW_CAM_ERROR mfw_msl_cam_save(void)
1228 {
1229 MSL_IMGCAP_STATUS status;
1230 TRACE_FUNCTION("mfw_msl_cam_Deinit()");
1231
1232 status=(MSL_IMGCAP_STATUS)MSL_ImgCap_SaveEncodedBuffers(imgCapHandle);
1233 if(status != MSL_IMGCAP_STATUS_OK)
1234 {
1235 TRACE_ERROR("Error in De-initializing MSL camera");
1236 return MFW_CAM_ERROR;
1237 }
1238 return MFW_CAM_NO_ERROR;
1239 }
1240
1241
1242 #endif