blob: 7d3fc90324fcfd3e928fc86a4e6d24f1bba868db [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/*****************************************************************************
2 * °æ±¾ËùÓÐ (C)2019ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾
3 * Ä£¿éÃû £ºZCORE Ó¦Óà DEMO
4 * ÎļþÃû zcoredemo.c
5 * ʵÏÖ¹¦ÄÜ£ºÓ¦ÓÃ×¢²á£¬Æô¶¯£¬´´½¨´°¿ÚµÈ²Ù×÷
6 * ×÷Õß £º
7 * °æ±¾ £º
8 * Íê³ÉÈÕÆÚ£º2019.12.20
9 *****************************************************************************/
10
11/******************************************************************************
12 * Í·Îļþ°üº¬ *
13 *****************************************************************************/
14#include "fw_ams.h"
15#include "zbl_cc_interface.h"
16
17
18
19/**---------------------------------------------------------------------------*
20 ** Compiler Flag *
21 **--------------------------------------------------------------------------*/
22#ifdef __cplusplus
23 extern "C"
24 {
25#endif
26/******************************************************************************
27 * ³£Á¿ *
28 *****************************************************************************/
29
30/******************************************************************************
31 * ºê *
32 *****************************************************************************/
33#define APP_DEMO_DEFAULT_CHNL "AMS_APP_DEF_CHNL_DEMO"
34#define THEME_PATH "/flash/app2/system/res/display_setting/theme"
35
36#define PHONEWIN_WIDTH 240
37#define PHONEWIN_HEIGHT 320
38#define CAPTIONBAR_H 36
39#define SOFTKEYBAR_H 50
40
41
42/*ÆÕͨ×Ö·û´®µÄλÖóߴç*/
43#define STR_RECT_LX 1
44#define STR_RECT_LY 68
45#define STR_RECT_W PHONEWIN_WIDTH
46#define STR_RECT_H PHONEWIN_HEIGHT
47
48#define MAINWINDOW_LX 0
49#define MAINWINDOW_TY CAPTIONBAR_H
50#define MAINWINDOW_W PHONEWIN_WIDTH
51#define MAINWINDOW_H (PHONEWIN_HEIGHT - CAPTIONBAR_H - SOFTKEYBAR_H)
52
53//Ó¦ÓÃ×Ô¶¨Òå´°¿ÚÏûÏ¢
54#define MSG_MYMESSAGE1 (MSG_USER+1)
55#define MSG_MYMESSAGE2 (MSG_USER+2)
56#define SYSTEMTEST_TIMER (MSG_USER+101)
57
58/******************************************************************************
59 * Êý¾ÝÀàÐÍ *
60 *****************************************************************************/
61enum
62{
63 APP_ID_DEMO = APP_ID_LOCAL_BASE+1, //01
64};
65
66/******************************************************************************
67 * ¾Ö²¿º¯ÊýÔ­ÐÍ *
68 *****************************************************************************/
69SINT32 app_demo_chnl_msg_proc(UINT32 msg_id, VOID* param, UINT32 msg_size,VOID *add_data);
70SINT32 app_demo_start(APP_START_PARAM *param);
71SINT32 app_demo_stop(APP_STOP_PARAM *param);
72SINT32 app_demo_pause(APP_PAUSE_PARAM *param);
73SINT32 app_demo_resume(APP_RESUME_PARAM *param);
74void create_demo_dlg_window(HWND hHostWin);
75void create_demo_main_window(HWND hHostWin);
76
77
78/******************************************************************************
79 * È«¾Ö±äÁ¿ *
80 *****************************************************************************/
81/* ¶¨ÒåÓ¦ÓÃÐÅÏ¢ */
82APP_STATIC_INFO app_static_infos[] = {
83 { APP_ID_DEMO, "Demo", TYPE_LOCAL, APP_PRI_NORMAL, app_demo_start, app_demo_stop, app_demo_pause, app_demo_resume },
84};
85UINT32 app_num = sizeof(app_static_infos) / sizeof(app_static_infos[0]);
86
87//È«¾ÖÓ¦ÓÃÆÕͨÖ÷´°¿Ú¾ä±ú
88HWND gDemohMainWnd = NULL;
89RECT demo_strrect={STR_RECT_LX,STR_RECT_LY-32,STR_RECT_W,STR_RECT_H};
90
91/******************************************************************************
92 * È«¾Öº¯ÊýʵÏÖ *
93 *****************************************************************************/
94//Ó¦ÓÃÆÕͨÖ÷´°¿Ú¹ý³Ì
95static int demo_main_window_proc( HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
96{
97 switch (message)
98 {
99 case MSG_CREATE://´¦Àí´°¿Ú´´½¨£¬
100 //¿ÉÒÔ½øÐд°¿ÚÏà¹Ø×´Ì¬±äÁ¿µÄ³õʼ»¯
101 break;
102
103 case MSG_PAINT://´¦Àí´°¿ÚË¢ÐÂ
104 {
105 HDC hdc;
106 RECT draw_rect;
107 PLOGFONT pNewFont;
108
109 hdc = BeginPaint(hWnd);//»ñµÃÏÔʾÉ豸ÉÏÏÂÎľä±ú
110 GetWindowRect(hWnd,&draw_rect);//»ñÈ¡´°¿Ú¾ØÐÎÇøÓò
111 SetBrushColor(hdc, PIXEL_balck);//ÉèÖû­±ÊÑÕÉ«
112 FillBox(hdc, 0, 0, PHONEWIN_WIDTH, PHONEWIN_HEIGHT);//Ìî³ä´°¿Ú±³¾°É«
113 pNewFont=CreateLogFont(FONT_TYPE_NAME_BITMAP_RAW,"song","GB18030",FONT_WEIGHT_REGULAR,FONT_SLANT_ROMAN,FONT_SETWIDTH_NORMAL,FONT_SPACING_CHARCELL,FONT_UNDERLINE_NONE,FONT_STRUCKOUT_NONE,16,0);//´´½¨×ÖÌå
114 SelectFont(hdc, pNewFont);//ʹÓÃ16ºÅËÎÌåGB18030×ÖÌå
115
116 SetTextColor(hdc,PIXEL_lightwhite);//ÉèÖû­±ÊÑÕÉ«
117 SetBkMode(hdc,BM_TRANSPARENT);//ÉèÖÃ͸Ã÷ģʽ
118 DrawText(hdc, "Deal Window Paint", -1, &demo_strrect, DT_LEFT);//Ìî³ä´°¿ÚÏÔʾÎÄ×Ö
119
120 DestroyLogFont(pNewFont);//ÊÍ·Å×ÖÌå
121
122 EndPaint(hWnd, hdc);//ÊÍ·ÅÏÔʾÉ豸ÉÏÏÂÎľä±ú
123 return 0;
124 }
125 break;
126
127 case MSG_MYMESSAGE2: //´¦Àí×Ô¶¨ÒåÏûÏ¢
128 {
129 SendMessage(hWnd, MSG_CLOSE, 0, 0);//¹Ø±Õ´°¿Ú
130 }
131 break;
132
133 case MSG_KEYLONGPRESS: //´¦Àí³¤°´¼ü
134 {
135 if (wParam == SCANCODE_ESCAPE) //µçÔ´¼ü
136 {
137 SendMessage(hWnd, MSG_CLOSE, 0, 0);//¹Ø±Õ´°¿Ú
138 return 0;
139 }
140 }
141 break;
142
143 case MSG_KEYDOWN://´¦Àí°´¼üÏûÏ¢
144 if (wParam == SCANCODE_F4) //ok¼ü
145 {
146 create_demo_dlg_window(hWnd);//´´½¨Ó¦ÓÿؼþÄ£°å´°¿Ú
147 }
148 break;
149
150 case MSG_CLOSE://´¦Àí¹Ø±Õ
151 {
152 DestroyMainWindowIndirect(hWnd);//Ïú»ÙÖ÷´°¿Ú
153 //PostQuitMessage(hWnd);//¿ÉÒÔÍ˳öÓ¦ÓÃÈ«²¿´°¿ÚÏûÏ¢´¦Àí£¬½áÊøÓ¦ÓóÌÐòÏß³Ì
154 return 0;
155 }
156 break;
157
158 default:
159 break;
160 }
161
162 return DefaultMainWinProc(hWnd, message, wParam, lParam);//´«µÝ¸øÄ¬ÈÏ´°¿Ú¹ý³Ì´¦Àí
163}
164
165
166
167//´´½¨Ó¦ÓÃÆÕͨÖ÷´°¿Ú
168void create_demo_main_window(HWND hHostWin)
169{
170
171 MAINWINCREATE CreateInfo;
172 CreateInfo.dwStyle = WS_VISIBLE;
173 CreateInfo.dwExStyle = WS_EX_TRANSPARENT;
174 CreateInfo.spCaption = "normal main window";
175 CreateInfo.hMenu = 0;
176 CreateInfo.hCursor = 0;
177 CreateInfo.hIcon = 0;
178 CreateInfo.MainWindowProc = demo_main_window_proc;
179 CreateInfo.lx = 0;
180 CreateInfo.ty = 0;
181 CreateInfo.rx = PHONEWIN_WIDTH;
182 CreateInfo.by = PHONEWIN_HEIGHT;
183 CreateInfo.iBkColor = PIXEL_lightwhite;
184 CreateInfo.dwAddData = 0;
185 CreateInfo.hHosting = hHostWin;
186 gDemohMainWnd = CreateMainWindow(&CreateInfo);
187}
188
189//Ó¦ÓÿؼþÄ£°å´°¿Ú¹ý³Ì
190static int demo_dlg_window_proc(HWND hParent,int message,WPARAM wParam,LPARAM lParam)
191{
192 switch (message)
193 {
194 case MSG_INITDIALOG://¿Ø¼þ´´½¨Ö®ºó´¦Àí
195 {
196 }
197 break;
198
199 case MSG_MYMESSAGE1: //´¦Àí×Ô¶¨ÒåÏûÏ¢
200 {
201 SendMessage(hParent, MSG_CLOSE, 0, 0);//¹Ø±Õ´°¿Ú
202 SendNotifyMessage(gDemohMainWnd, MSG_MYMESSAGE2, 0, 0);
203 }
204
205 case MSG_CREATE://´°¿Ú´´½¨Ö®ºó´¦Àí
206 SetTimer(hParent,SYSTEMTEST_TIMER,100*6);//ÉèÖö¨Ê±Æ÷
207 break;
208
209 case MSG_ACTIVE://´°¿Ú»ñµÃ½¹µãÖ®ºó´¦Àí
210 break;
211
212 case MSG_KEYDOWN://´¦Àí°´¼üÏûÏ¢
213 if (wParam == SCANCODE_ESCAPE) //³¤°´µçÔ´¼ü
214 {
215 SendMessage(hParent, MSG_CLOSE, 0, 0);//¹Ø±Õ´°¿Ú
216 return 0;
217 }
218 break;
219
220 case MSG_TIMER://´¦Àí´°¿Ú¶¨Ê±Æ÷³¬Ê±ÏûÏ¢
221 KillTimer(hParent, SYSTEMTEST_TIMER);//Ïú»Ù¶¨Ê±Æ÷
222 SendMessage(hParent,MSG_PAINT,0,0);//ˢд°¿ÚÏÔʾ
223 break;
224
225 case MSG_PAINT://´¦Àí´°¿ÚË¢ÐÂÏûÏ¢
226 return 0;
227
228 case MSG_CLOSE://´¦Àí´°¿Ú¹Ø±ÕÏûÏ¢
229 DestroyMainWindow(hParent);//ɾ³ý¿Ø¼þÄ£°å´°¿Ú
230 break;
231
232 default:
233 break;
234 }
235 return DefaultMainWinProc(hParent,message,wParam,lParam);
236}
237
238//´´½¨Ó¦ÓÿؼþÄ£°å´°¿Ú
239void create_demo_dlg_window(HWND hHostwnd)
240{
241 static DLGTEMPLATE tDemoDlg = //ÅäÖõĿؼþÄ£°åÊý¾Ý
242 {
243 WS_VISIBLE,
244 WS_EX_TRANSPARENT,
245 MAINWINDOW_LX,
246 MAINWINDOW_TY,
247 MAINWINDOW_W,
248 MAINWINDOW_H,
249 "Dlg window",
250 0, 0,
251 0,
252 0,
253 0
254 };
255 CreateMainWindowIndirectParam(&tDemoDlg,hHostwnd,demo_dlg_window_proc,0);
256}
257
258// app_demo Èë¿Ú
259VOID main(int argc, char * argv[])
260{
261
262 //ZCOREϵͳִÐгõʼ»¯¹¤×÷
263
264 //×¢²á²¢Æô¶¯Ó¦ÓÃ,ÐèÒªÓëÆäËûÓ¦ÓÃÒ»Æð¼¯³É×¢²á
265 tp_ams_register_apps(app_static_infos, app_num); //×¢²áËùÓÐÓ¦ÓÃ
266
267 START_APP_CTRL_INFO info = {APP_ID_DEMO, FALSE, NULL}; //²»¿¼ÂǸ½¼Ó²ÎÊýµÄÇé¿ö
268 tp_ams_start_app(&info);
269
270}
271
272//Ó¦ÓÃITCͨµÀÏûÏ¢´¦Àíº¯Êý
273SINT32 app_demo_chnl_msg_proc(UINT32 msg_id, VOID* param, UINT32 msg_size,VOID *add_data)
274{
275 switch (msg_id)
276 {
277 case ZBL_CC_INCOMING_CALL_IND:;//´¦ÀíZBL_CC_INCOMING_CALL_INDµçÐÅÒµÎñITCͨµÀÏûÏ¢
278 STOP_APP_CTRL_INFO app_info = {APP_ID_DEMO, NULL};
279 tp_ams_stop_app(&app_info);//Í£Ö¹Ó¦ÓÃ
280 break;
281
282 default:
283 break;
284 }
285 return 0;
286}
287
288SINT32 app_demo_start(APP_START_PARAM *param)
289{
290
291 HWND hAppHostWin = (HWND) tp_ams_get_active_app_hostwnd();//»ñȡǰ̨ӦÓÃAMS ºǫ́Ö÷´°¿Ú
292 tp_comm_channel_create(APP_DEMO_DEFAULT_CHNL, app_demo_chnl_msg_proc,NULL);//´´½¨Ò»¸öitc ͨµÀ£¬²¢×¢²áITCͨµÀÏûÏ¢´¦Àíº¯Êý
293 tp_comm_channel_reg_msg(APP_DEMO_DEFAULT_CHNL,ZBL_CC_INCOMING_CALL_IND);//×¢²áZBL_CC_INCOMING_CALL_INDµçÐÅÒµÎñITCͨµÀÏûÏ¢
294 create_demo_main_window(hAppHostWin);
295 return 0;
296}
297
298SINT32 app_demo_stop(APP_STOP_PARAM *param)
299{
300 tp_comm_channel_unreg_msg(APP_DEMO_DEFAULT_CHNL, ZBL_CC_INCOMING_CALL_IND);
301 tp_comm_channel_destroy(APP_DEMO_DEFAULT_CHNL);
302 return 0;
303}
304
305SINT32 app_demo_pause(APP_PAUSE_PARAM *param)
306{
307 return 0;
308}
309
310SINT32 app_demo_resume(APP_RESUME_PARAM *param)
311{
312 return 0;
313}
314
315
316//ÒÔÏÂÊÇ´ò×®º¯Êý
317#include "ezicmn.h"
318
319VOID mmi_log_save(const VOID *pFormat, ...)
320{
321}
322
323unsigned short UniCodeToGB(const unsigned short unicodeIndex)
324{
325}
326
327
328ZI8UCHAR Zi8GetCharInfo3
329 ( ZI8WCHAR wc,
330 PZI8WCHAR pCharInfoBuffer,
331 ZI8UCHAR MaxInfoBuffer,
332 ZI8UCHAR GetMode,
333 PZI8WCHAR pElements,
334 ZI8UCHAR uElementCount
335 ZI8_GBL_PARM )
336{
337
338}
339
340ZI8UCHAR Zi8CopyWordListW
341 ( PZI8WCHAR pDestination,
342 ZI8UCHAR MaxChar,
343 PZI8WCHAR pWordList,
344 ZI8UCHAR index
345 ZI8_GBL_PARM )
346{
347
348}
349
350/**--------------------------------------------------------------------------*
351 ** Compiler Flag *
352 **-------------------------------------------------------------------------*/
353#ifdef __cplusplus
354 }
355#endif