GBC_Camera_Interface.c
5.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/*******************************************************************************
* Filename:
* ---------
* GBC_Camera.c
*
* Project:
* --------
* GBC_Project
*
* Description:
* ------------
*
*
* Author:
* -------
* RenFeng
*
*******************************************************************************/
#if (defined __GBC_LOAD_APP_SWITCH_ON__ && defined __MTK_TARGET__)
/****************************************************************************
* Include Files
*****************************************************************************/
#include "MMI_include.h"
#include "l1audio.h"
//#include "GBC_mtk_option.h"
//#include "GBC_Adap_Tools.h"
//#include "GBC_system_interface.h"
#include "GBC_mtk_option.h"
#include "GBC_Camera_Interface.h"
#include "MMI_features_camera.h"
#include "mdi_datatype.h"
#include "mmi_rp_app_camera_def.h"
#ifdef __GBC_MTK_11B//add by qlf
//#include "mmi_rp_app_camco_def.h"
#endif
#define ___log(...)
extern const S16 GBK_ui_device_width;
extern const S16 GBC_ui_device_height;
kal_bool g_GBC_Cam_Runing;
#include "mmi_rp_app_camco_def.h"
int GBC_Camera_Get_Next_FileName(WCHAR* path)
{
S16 error;
WCHAR buffer[20] = {0};
U16 captured_file_no;
ReadValue(NVRAM_CAM_FILENAME_SEQ_NO, &captured_file_no, DS_SHORT, &error);
if ( captured_file_no == 0xffff)
{
captured_file_no = 1; /* init value */
}
else
{
if ( captured_file_no > 9999) /* more than 4 digits */
{
captured_file_no = 1;
}
}
___log("»ñÈ¡ÏàÆ¬ÐòÁкÅ,µ±Ç°ÊÇ%d",captured_file_no);
GBC_Get_Storage_File_Path((S8*)path);
kal_wsprintf((unsigned short *)buffer,"MG_%04d.jpg",captured_file_no);
kal_wstrcat(path,buffer);
captured_file_no+=1;
WriteValue(NVRAM_CAM_FILENAME_SEQ_NO, &captured_file_no, DS_SHORT, &error);
return 0;
}
#include "menucuigprot.h"
#include "CameraCuiGprot.h"
extern WCHAR g_gbcp_ext_filepath[];
extern int g_gbcp_run_mode;
U16 mmi_ucs2_to_asc(CHAR *pOutBuffer, CHAR *pInBuffer);
static mmi_ret mmi_tmf_main_proc(mmi_event_struct *evt)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/* Menu cui revise */
cui_menu_event_struct *menu_event;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
menu_event = (cui_menu_event_struct*)evt;
// cui_menu_close(menu_event->sender_id);
GBCTRACE("Camera_Interface %d,%d",evt->evt_id,menu_event->parent_menu_id);
GBCTRACE("EVT_ID_CUI_MENU_LIST_ENTRY %d,%d",CUI_CAMERA_EVENT_RESULT_SUCCESS,EVT_ID_CUI_MENU_CLOSE_REQUEST);
switch (evt->evt_id)
{
#if 1//(defined(__MMI_VIDEO_RECORDER__) || defined(__MMI_CAMERA__))
#if 1//def __MMI_CAMERA__
case CUI_CAMERA_EVENT_RESULT_SUCCESS:
{
CHAR tmp[512];
GBCTRACE("CUI_CAMERA_EVENT_RESULT_SUCCESS");
g_gbcp_run_mode = 1;
kal_wstrcpy(g_gbcp_ext_filepath,(WCHAR *)((cui_camera_event_struct*)evt)->file_path);
mmi_ucs2_to_asc(tmp,(CHAR *)g_gbcp_ext_filepath);
GBCTRACE("%s",tmp);
cui_menu_close(menu_event->sender_id);
}
break;
case CUI_CAMERA_EVENT_RESULT_FAILED:
{
cui_camera_close(((cui_camera_event_struct*)evt)->sender_id);
}
break;
case CUI_CAMERA_EVENT_RESULT_CLOSE_ME:
{
cui_camera_close(((cui_camera_event_struct*)evt)->sender_id);
}
break;
#endif /* __MMI_CAMERA__ */
#endif /* (defined(__MMI_VIDEO_RECORDER__) || defined(__MMI_CAMERA__)) && !defined(__MMI_CAMCORDER__) */
case EVT_ID_GROUP_DELETE_REQ_IN_END_KEY:
case EVT_ID_GROUP_GOBACK_IN_END_KEY:
case EVT_ID_MEM_FREE_ASM:
#ifdef __MMI_CAMERA__
if (((cui_camera_event_struct*)evt)->sender_id != GRP_ID_INVALID)
{
cui_camera_close(((cui_camera_event_struct*)evt)->sender_id);
}
#endif
break;
default:
GBCTRACE("default");
if (((cui_camera_event_struct*)evt)->sender_id != GRP_ID_INVALID)
{
cui_camera_close(((cui_camera_event_struct*)evt)->sender_id);
}
break;
}
return MMI_RET_OK;
}
S32 GBC_camera_preview_start(gdi_handle preview_handle,kal_bool isUpdate_LCD)
{}
int GBC_camera_power_off(void)
{
return 0;
}
int GBC_camera_preview_stop(void)
{
return 0;
}
extern kal_bool isChinese;
extern const U16 GBC_str_Tcard_not_enough[];
extern const U8 GBC_str_Tcard_not_enough_eng[];
int GBC_camera_power_on(void)
{
MMI_ID tmp_gid;
MMI_ID tmp_sid;
MMI_ID camera_cui_gid;
if(!GBC_check_card_max_free_size(100, gbcp_t_card_drv()))
{
if(isChinese == 1)
{
#if defined (__MX215_BIRD_BER_E2499_PAGE__)
mmi_popup_display((WCHAR*)((UI_string_type) GetString(STR_GLOBAL_INSERT_MEMORY_CARD)), MMI_EVENT_SUCCESS, NULL);
#else
GBC_display_pop_unicode((U8*)GBC_str_Tcard_not_enough);
#endif
}
else
{
GBC_display_pop_unicode((U8*)GBC_str_Tcard_not_enough_eng);
}
return -1;
}
g_gbcp_run_mode = 0;
tmp_gid = mmi_frm_group_create(GRP_ID_ROOT, GRP_ID_AUTO_GEN, mmi_tmf_main_proc, NULL);
tmp_sid = mmi_frm_group_enter(tmp_gid, MMI_FRM_NODE_SMART_CLOSE_FLAG);
if(tmp_sid>0)
{
camera_cui_gid = cui_camera_create(tmp_sid);
if (camera_cui_gid > 0)
{
cui_camera_run_struct camera_struct;
cui_camera_struct_init(&camera_struct);
cui_camera_run(camera_cui_gid, &camera_struct);
}
}
g_GBC_Cam_Runing = TRUE;
return 0;
}
int GBC_camera_capture_to_memory(U8 **buf_pp, U32 *captured_size,S8 *file_name)
{
return mdi_camera_capture_to_memory(buf_pp, captured_size,file_name);
}
kal_bool GBC_Cam_Is_Running(void)
{
return g_GBC_Cam_Runing;
}
/////////////////////////////////////////////////////////////////////////////////////////
#endif //#if (defined __GBC_LOAD_APP_SWITCH_ON__ && defined __MTK_TARGET__)