/***************************************************************************** | |
* °æ±¾ËùÓÐ (C)2019ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾ | |
* Ä£¿éÃû £ºZCORE Ó¦Óà DEMO | |
* ÎļþÃû zcoredemo.c | |
* ʵÏÖ¹¦ÄÜ£ºÓ¦ÓÃ×¢²á£¬Æô¶¯£¬´´½¨´°¿ÚµÈ²Ù×÷ | |
* ×÷Õß £º | |
* °æ±¾ £º | |
* Íê³ÉÈÕÆÚ£º2019.12.20 | |
*****************************************************************************/ | |
/****************************************************************************** | |
* Í·Îļþ°üº¬ * | |
*****************************************************************************/ | |
#include "fw_ams.h" | |
#include "zbl_cc_interface.h" | |
/**---------------------------------------------------------------------------* | |
** Compiler Flag * | |
**--------------------------------------------------------------------------*/ | |
#ifdef __cplusplus | |
extern "C" | |
{ | |
#endif | |
/****************************************************************************** | |
* ³£Á¿ * | |
*****************************************************************************/ | |
/****************************************************************************** | |
* ºê * | |
*****************************************************************************/ | |
#define APP_DEMO_DEFAULT_CHNL "AMS_APP_DEF_CHNL_DEMO" | |
#define THEME_PATH "/flash/app2/system/res/display_setting/theme" | |
#define PHONEWIN_WIDTH 240 | |
#define PHONEWIN_HEIGHT 320 | |
#define CAPTIONBAR_H 36 | |
#define SOFTKEYBAR_H 50 | |
/*ÆÕͨ×Ö·û´®µÄλÖóߴç*/ | |
#define STR_RECT_LX 1 | |
#define STR_RECT_LY 68 | |
#define STR_RECT_W PHONEWIN_WIDTH | |
#define STR_RECT_H PHONEWIN_HEIGHT | |
#define MAINWINDOW_LX 0 | |
#define MAINWINDOW_TY CAPTIONBAR_H | |
#define MAINWINDOW_W PHONEWIN_WIDTH | |
#define MAINWINDOW_H (PHONEWIN_HEIGHT - CAPTIONBAR_H - SOFTKEYBAR_H) | |
//Ó¦ÓÃ×Ô¶¨Òå´°¿ÚÏûÏ¢ | |
#define MSG_MYMESSAGE1 (MSG_USER+1) | |
#define MSG_MYMESSAGE2 (MSG_USER+2) | |
#define SYSTEMTEST_TIMER (MSG_USER+101) | |
/****************************************************************************** | |
* Êý¾ÝÀàÐÍ * | |
*****************************************************************************/ | |
enum | |
{ | |
APP_ID_DEMO = APP_ID_LOCAL_BASE+1, //01 | |
}; | |
/****************************************************************************** | |
* ¾Ö²¿º¯ÊýÔÐÍ * | |
*****************************************************************************/ | |
SINT32 app_demo_chnl_msg_proc(UINT32 msg_id, VOID* param, UINT32 msg_size,VOID *add_data); | |
SINT32 app_demo_start(APP_START_PARAM *param); | |
SINT32 app_demo_stop(APP_STOP_PARAM *param); | |
SINT32 app_demo_pause(APP_PAUSE_PARAM *param); | |
SINT32 app_demo_resume(APP_RESUME_PARAM *param); | |
void create_demo_dlg_window(HWND hHostWin); | |
void create_demo_main_window(HWND hHostWin); | |
/****************************************************************************** | |
* È«¾Ö±äÁ¿ * | |
*****************************************************************************/ | |
/* ¶¨ÒåÓ¦ÓÃÐÅÏ¢ */ | |
APP_STATIC_INFO app_static_infos[] = { | |
{ APP_ID_DEMO, "Demo", TYPE_LOCAL, APP_PRI_NORMAL, app_demo_start, app_demo_stop, app_demo_pause, app_demo_resume }, | |
}; | |
UINT32 app_num = sizeof(app_static_infos) / sizeof(app_static_infos[0]); | |
//È«¾ÖÓ¦ÓÃÆÕͨÖ÷´°¿Ú¾ä±ú | |
HWND gDemohMainWnd = NULL; | |
RECT demo_strrect={STR_RECT_LX,STR_RECT_LY-32,STR_RECT_W,STR_RECT_H}; | |
/****************************************************************************** | |
* È«¾Öº¯ÊýʵÏÖ * | |
*****************************************************************************/ | |
//Ó¦ÓÃÆÕͨÖ÷´°¿Ú¹ý³Ì | |
static int demo_main_window_proc( HWND hWnd, int message, WPARAM wParam, LPARAM lParam) | |
{ | |
switch (message) | |
{ | |
case MSG_CREATE://´¦Àí´°¿Ú´´½¨£¬ | |
//¿ÉÒÔ½øÐд°¿ÚÏà¹Ø×´Ì¬±äÁ¿µÄ³õʼ»¯ | |
break; | |
case MSG_PAINT://´¦Àí´°¿ÚˢР| |
{ | |
HDC hdc; | |
RECT draw_rect; | |
PLOGFONT pNewFont; | |
hdc = BeginPaint(hWnd);//»ñµÃÏÔʾÉ豸ÉÏÏÂÎľä±ú | |
GetWindowRect(hWnd,&draw_rect);//»ñÈ¡´°¿Ú¾ØÐÎÇøÓò | |
SetBrushColor(hdc, PIXEL_balck);//ÉèÖû±ÊÑÕÉ« | |
FillBox(hdc, 0, 0, PHONEWIN_WIDTH, PHONEWIN_HEIGHT);//Ìî³ä´°¿Ú±³¾°É« | |
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);//´´½¨×ÖÌå | |
SelectFont(hdc, pNewFont);//ʹÓÃ16ºÅËÎÌåGB18030×ÖÌå | |
SetTextColor(hdc,PIXEL_lightwhite);//ÉèÖû±ÊÑÕÉ« | |
SetBkMode(hdc,BM_TRANSPARENT);//ÉèÖÃ͸Ã÷ģʽ | |
DrawText(hdc, "Deal Window Paint", -1, &demo_strrect, DT_LEFT);//Ìî³ä´°¿ÚÏÔʾÎÄ×Ö | |
DestroyLogFont(pNewFont);//ÊÍ·Å×ÖÌå | |
EndPaint(hWnd, hdc);//ÊÍ·ÅÏÔʾÉ豸ÉÏÏÂÎľä±ú | |
return 0; | |
} | |
break; | |
case MSG_MYMESSAGE2: //´¦Àí×Ô¶¨ÒåÏûÏ¢ | |
{ | |
SendMessage(hWnd, MSG_CLOSE, 0, 0);//¹Ø±Õ´°¿Ú | |
} | |
break; | |
case MSG_KEYLONGPRESS: //´¦Àí³¤°´¼ü | |
{ | |
if (wParam == SCANCODE_ESCAPE) //µçÔ´¼ü | |
{ | |
SendMessage(hWnd, MSG_CLOSE, 0, 0);//¹Ø±Õ´°¿Ú | |
return 0; | |
} | |
} | |
break; | |
case MSG_KEYDOWN://´¦Àí°´¼üÏûÏ¢ | |
if (wParam == SCANCODE_F4) //ok¼ü | |
{ | |
create_demo_dlg_window(hWnd);//´´½¨Ó¦ÓÿؼþÄ£°å´°¿Ú | |
} | |
break; | |
case MSG_CLOSE://´¦Àí¹Ø±Õ | |
{ | |
DestroyMainWindowIndirect(hWnd);//Ïú»ÙÖ÷´°¿Ú | |
//PostQuitMessage(hWnd);//¿ÉÒÔÍ˳öÓ¦ÓÃÈ«²¿´°¿ÚÏûÏ¢´¦Àí£¬½áÊøÓ¦ÓóÌÐòÏß³Ì | |
return 0; | |
} | |
break; | |
default: | |
break; | |
} | |
return DefaultMainWinProc(hWnd, message, wParam, lParam);//´«µÝ¸øÄ¬ÈÏ´°¿Ú¹ý³Ì´¦Àí | |
} | |
//´´½¨Ó¦ÓÃÆÕͨÖ÷´°¿Ú | |
void create_demo_main_window(HWND hHostWin) | |
{ | |
MAINWINCREATE CreateInfo; | |
CreateInfo.dwStyle = WS_VISIBLE; | |
CreateInfo.dwExStyle = WS_EX_TRANSPARENT; | |
CreateInfo.spCaption = "normal main window"; | |
CreateInfo.hMenu = 0; | |
CreateInfo.hCursor = 0; | |
CreateInfo.hIcon = 0; | |
CreateInfo.MainWindowProc = demo_main_window_proc; | |
CreateInfo.lx = 0; | |
CreateInfo.ty = 0; | |
CreateInfo.rx = PHONEWIN_WIDTH; | |
CreateInfo.by = PHONEWIN_HEIGHT; | |
CreateInfo.iBkColor = PIXEL_lightwhite; | |
CreateInfo.dwAddData = 0; | |
CreateInfo.hHosting = hHostWin; | |
gDemohMainWnd = CreateMainWindow(&CreateInfo); | |
} | |
//Ó¦ÓÿؼþÄ£°å´°¿Ú¹ý³Ì | |
static int demo_dlg_window_proc(HWND hParent,int message,WPARAM wParam,LPARAM lParam) | |
{ | |
switch (message) | |
{ | |
case MSG_INITDIALOG://¿Ø¼þ´´½¨Ö®ºó´¦Àí | |
{ | |
} | |
break; | |
case MSG_MYMESSAGE1: //´¦Àí×Ô¶¨ÒåÏûÏ¢ | |
{ | |
SendMessage(hParent, MSG_CLOSE, 0, 0);//¹Ø±Õ´°¿Ú | |
SendNotifyMessage(gDemohMainWnd, MSG_MYMESSAGE2, 0, 0); | |
} | |
case MSG_CREATE://´°¿Ú´´½¨Ö®ºó´¦Àí | |
SetTimer(hParent,SYSTEMTEST_TIMER,100*6);//ÉèÖö¨Ê±Æ÷ | |
break; | |
case MSG_ACTIVE://´°¿Ú»ñµÃ½¹µãÖ®ºó´¦Àí | |
break; | |
case MSG_KEYDOWN://´¦Àí°´¼üÏûÏ¢ | |
if (wParam == SCANCODE_ESCAPE) //³¤°´µçÔ´¼ü | |
{ | |
SendMessage(hParent, MSG_CLOSE, 0, 0);//¹Ø±Õ´°¿Ú | |
return 0; | |
} | |
break; | |
case MSG_TIMER://´¦Àí´°¿Ú¶¨Ê±Æ÷³¬Ê±ÏûÏ¢ | |
KillTimer(hParent, SYSTEMTEST_TIMER);//Ïú»Ù¶¨Ê±Æ÷ | |
SendMessage(hParent,MSG_PAINT,0,0);//ˢд°¿ÚÏÔʾ | |
break; | |
case MSG_PAINT://´¦Àí´°¿ÚË¢ÐÂÏûÏ¢ | |
return 0; | |
case MSG_CLOSE://´¦Àí´°¿Ú¹Ø±ÕÏûÏ¢ | |
DestroyMainWindow(hParent);//ɾ³ý¿Ø¼þÄ£°å´°¿Ú | |
break; | |
default: | |
break; | |
} | |
return DefaultMainWinProc(hParent,message,wParam,lParam); | |
} | |
//´´½¨Ó¦ÓÿؼþÄ£°å´°¿Ú | |
void create_demo_dlg_window(HWND hHostwnd) | |
{ | |
static DLGTEMPLATE tDemoDlg = //ÅäÖõĿؼþÄ£°åÊý¾Ý | |
{ | |
WS_VISIBLE, | |
WS_EX_TRANSPARENT, | |
MAINWINDOW_LX, | |
MAINWINDOW_TY, | |
MAINWINDOW_W, | |
MAINWINDOW_H, | |
"Dlg window", | |
0, 0, | |
0, | |
0, | |
0 | |
}; | |
CreateMainWindowIndirectParam(&tDemoDlg,hHostwnd,demo_dlg_window_proc,0); | |
} | |
// app_demo Èë¿Ú | |
VOID main(int argc, char * argv[]) | |
{ | |
//ZCOREϵͳִÐгõʼ»¯¹¤×÷ | |
//×¢²á²¢Æô¶¯Ó¦ÓÃ,ÐèÒªÓëÆäËûÓ¦ÓÃÒ»Æð¼¯³É×¢²á | |
tp_ams_register_apps(app_static_infos, app_num); //×¢²áËùÓÐÓ¦Óà | |
START_APP_CTRL_INFO info = {APP_ID_DEMO, FALSE, NULL}; //²»¿¼ÂǸ½¼Ó²ÎÊýµÄÇé¿ö | |
tp_ams_start_app(&info); | |
} | |
//Ó¦ÓÃITCͨµÀÏûÏ¢´¦Àíº¯Êý | |
SINT32 app_demo_chnl_msg_proc(UINT32 msg_id, VOID* param, UINT32 msg_size,VOID *add_data) | |
{ | |
switch (msg_id) | |
{ | |
case ZBL_CC_INCOMING_CALL_IND:;//´¦ÀíZBL_CC_INCOMING_CALL_INDµçÐÅÒµÎñITCͨµÀÏûÏ¢ | |
STOP_APP_CTRL_INFO app_info = {APP_ID_DEMO, NULL}; | |
tp_ams_stop_app(&app_info);//Í£Ö¹Ó¦ÓÃ | |
break; | |
default: | |
break; | |
} | |
return 0; | |
} | |
SINT32 app_demo_start(APP_START_PARAM *param) | |
{ | |
HWND hAppHostWin = (HWND) tp_ams_get_active_app_hostwnd();//»ñȡǰ̨ӦÓÃAMS ºǫ́Ö÷´°¿Ú | |
tp_comm_channel_create(APP_DEMO_DEFAULT_CHNL, app_demo_chnl_msg_proc,NULL);//´´½¨Ò»¸öitc ͨµÀ£¬²¢×¢²áITCͨµÀÏûÏ¢´¦Àíº¯Êý | |
tp_comm_channel_reg_msg(APP_DEMO_DEFAULT_CHNL,ZBL_CC_INCOMING_CALL_IND);//×¢²áZBL_CC_INCOMING_CALL_INDµçÐÅÒµÎñITCͨµÀÏûÏ¢ | |
create_demo_main_window(hAppHostWin); | |
return 0; | |
} | |
SINT32 app_demo_stop(APP_STOP_PARAM *param) | |
{ | |
tp_comm_channel_unreg_msg(APP_DEMO_DEFAULT_CHNL, ZBL_CC_INCOMING_CALL_IND); | |
tp_comm_channel_destroy(APP_DEMO_DEFAULT_CHNL); | |
return 0; | |
} | |
SINT32 app_demo_pause(APP_PAUSE_PARAM *param) | |
{ | |
return 0; | |
} | |
SINT32 app_demo_resume(APP_RESUME_PARAM *param) | |
{ | |
return 0; | |
} | |
//ÒÔÏÂÊÇ´ò×®º¯Êý | |
#include "ezicmn.h" | |
VOID mmi_log_save(const VOID *pFormat, ...) | |
{ | |
} | |
unsigned short UniCodeToGB(const unsigned short unicodeIndex) | |
{ | |
} | |
ZI8UCHAR Zi8GetCharInfo3 | |
( ZI8WCHAR wc, | |
PZI8WCHAR pCharInfoBuffer, | |
ZI8UCHAR MaxInfoBuffer, | |
ZI8UCHAR GetMode, | |
PZI8WCHAR pElements, | |
ZI8UCHAR uElementCount | |
ZI8_GBL_PARM ) | |
{ | |
} | |
ZI8UCHAR Zi8CopyWordListW | |
( PZI8WCHAR pDestination, | |
ZI8UCHAR MaxChar, | |
PZI8WCHAR pWordList, | |
ZI8UCHAR index | |
ZI8_GBL_PARM ) | |
{ | |
} | |
/**--------------------------------------------------------------------------* | |
** Compiler Flag * | |
**-------------------------------------------------------------------------*/ | |
#ifdef __cplusplus | |
} | |
#endif |