标签:回调函数 问题 oct llb 模块 信息 资源管理 获取 enable
在海思PDT_Init
下有一个这样的函数HI_PDT_UI_Init()
:
/*public, it should be called by main()*/
HI_S32 HI_PDT_UI_Init(HI_VOID)
{
HI_S32 s32Ret = HI_SUCCESS;
s32Ret = PDT_UI_StartLCD();
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
#ifdef CFG_TIME_MEASURE_ON
HI_PrintBootTime("UI");
#endif
s32Ret = PDT_UI_COMM_SubscribeEvents();
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
s32Ret = PDT_UI_POWERCTRL_Init();
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
return HI_SUCCESS;
}
HI_S32 PDT_UI_StartLCD(HI_VOID)
{
HI_S32 s32Ret = HI_SUCCESS;
HI_HAL_SCREEN_ATTR_S stScreenAttr = {};
HI_S32 s32ScreenWidth = 0;
HI_S32 s32ScreenHeight = 0;
s_bLCD = HI_TRUE;
s32Ret = PDT_UI_InitHigv();
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
s32Ret = PDT_UI_WINMNG_Init();
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
if(INVALID_HANDLE == s_LCDLayerHandle)
{
/* GetLayer Id */
HIGO_LAYER_E enLayerId = HIGO_LAYER_HD_0;
s32Ret = PDT_UI_GetLayerId(HI_PDT_WORKMODE_NORM_REC, &enLayerId);
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
#ifdef CONFIG_SCREEN
s32Ret = HI_HAL_SCREEN_GetAttr(HI_HAL_SCREEN_IDX_0, &stScreenAttr);
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
#endif
s32ScreenWidth = (HI_S32)stScreenAttr.stAttr.u32Width;
s32ScreenHeight = (HI_S32)stScreenAttr.stAttr.u32Height;
HIGO_LAYER_INFO_S LayerInfo = {
s32ScreenWidth, s32ScreenHeight, /* Screen */
LCD_XML_LAYOUT_WIDTH, LCD_XML_LAYOUT_HEIGHT, /* Canvas, same as the window width,height in XML */
s32ScreenWidth, s32ScreenHeight, /* Display */
HIGO_LAYER_FLUSH_OVER, HIGO_LAYER_DEFLICKER_AUTO, HIGO_PF_4444, enLayerId};
MLOGD(GREEN"Create layer, Screen[%u * %u], Canvas[%u * %u], Display[%u * %u]\n"NONE,
s32ScreenWidth, s32ScreenHeight,
LCD_XML_LAYOUT_WIDTH, LCD_XML_LAYOUT_HEIGHT,
s32ScreenWidth, s32ScreenHeight);
/* create graphical layer */
s32Ret = HI_GV_Layer_Create(&LayerInfo, &s_LCDLayerHandle);
HI_APPCOMM_CHECK_RETURN(s32Ret, s32Ret);
#if defined(CONFIG_VERTICAL_SCREEN)
HIGV_ROTATE_E enRotate = HIGV_ROTATE_90;
#else
HIGV_ROTATE_E enRotate = HIGV_ROTATE_NONE;
#endif
s32Ret = HI_GV_Layer_SetRotateMode(s_LCDLayerHandle, enRotate);
HI_APPCOMM_CHECK_RETURN(s32Ret, s32Ret);
}
s32Ret = HI_GV_Layer_SetDefault(s_LCDLayerHandle);
s32Ret |= HI_GV_PARSER_LoadViewById(ALARM_WINDOW);
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
s32Ret = HI_GV_Widget_Hide(DIALOG_WINDOW_GROUPBOX_FORMAT);
s32Ret = PDT_UI_WINMNG_StartWindow(HOME_PAGE,HI_FALSE);
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
s32Ret = HI_PDT_MEDIA_SetDisplayGraphicCSC();
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
s32Ret = PDT_UI_COMM_InitKeyTone();
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
return HI_SUCCESS;
}
UI流程图:
下面如注释:
/* public section between LCD and HDMI initialization*/
static HI_S32 PDT_UI_InitHigv(HI_VOID)
{
HI_S32 s32Ret = HI_SUCCESS;
#if defined(CFG_LCD_TOUCHPAD_ON)
s32Ret = PDT_UI_RegisterTouchDevice(); //这里是注册触摸屏的代码,注册相应的回调函数
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
#endif
s32Ret = HI_GV_SetVsyncType(HIGV_VSYNC_HW); //设置 VSYNC 的信号源类型,HIGV_VSYNC_HW在hi_gv_app.h里面
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
s32Ret = HI_GV_Init();
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
if(s_bLCD)
{
s32Ret = HI_GV_SetSWVsyncPeriod(16666); /** us */
s32Ret |= HI_GV_SetLostFrameThreshold(8000); /** us */
}
else
{
s32Ret = HI_GV_SetSWVsyncPeriod(33333); /** us */
s32Ret |= HI_GV_SetLostFrameThreshold(15000); /** us */
}
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
HI_GV_Log_SetLevel(HI_NULL, HIGV_LOG_FATAL);
s32Ret = HI_GV_PARSER_Init();
/* set widget event callback function */
s32Ret |= HI_GV_PARSER_SetWidgetEventFunc(g_pfunHIGVAppEventFunc, ARRAY_SIZE(g_pfunHIGVAppEventFunc));
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
s32Ret = HI_GV_ScrollGrid_RegisterWidget();
PDT_UI_CHECK_RET_WITHOUT_RETURN(s32Ret, "RegisterWidget");
/* load higv.bin file for parser */
s32Ret = HI_GV_PARSER_LoadFile("./higv.bin");
if (HI_SUCCESS != s32Ret)
{
MLOGE("LoadFile ret:%x\n", s32Ret);
HI_GV_Deinit();
HI_GV_PARSER_Deinit();
return HI_FAILURE;
}
s32Ret = HI_GV_SetVsyncLostFrame(HI_FALSE);
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
s32Ret = HI_GV_Lan_Register(LANG_EN_FILE, FONT18, LAN_ENGLISH);
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
s32Ret = HI_GV_Lan_Register(LANG_CN_FILE, FONT18, LAN_CHINESE);
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
HI_CHAR szContent[SETTING_CONTENT_SIZE];
HI_CHAR szLanId[SETTING_CONTENT_SIZE];
s32Ret = PDT_UI_COMM_GetParamValueDesc(HI_PDT_WORKMODE_BUTT, HI_PDT_PARAM_TYPE_LANGUAGE, szContent, SETTING_CONTENT_SIZE);
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
s32Ret = PDT_UI_COMM_GetStringByString(szContent, szLanId, SETTING_CONTENT_SIZE);
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
s32Ret = HI_GV_Lan_Change(szLanId);
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
//启动一个新线程,开启相应的应用界面
s32Ret = pthread_create(&s_UiThread, NULL, (HI_VOID *)PDT_UI_StartApp, NULL);
if (0 != s32Ret)
{
MLOGE("pthread_create ret:%#x\n", s32Ret);
return HI_FAILURE;
}
return HI_SUCCESS;
}
HI_S32 PDT_UI_RegisterTouchDevice(HI_VOID)
{
HI_S32 s32Ret = HI_SUCCESS;
HIGV_TOUCH_DEVICE_INPUT_S stInputDevice = {};
stInputDevice.OpenDevice = HI_HAL_TOUCHPAD_Start;
stInputDevice.CloseDevie = HI_HAL_TOUCHPAD_Stop;
stInputDevice.ReadData = PDT_UI_ReadTouchData;
s32Ret = HI_GV_Gesture_RegisterDevice(&stInputDevice); //触摸手势注册入口
s32Ret |= HI_GV_Gesture_SetTouchHook(PDT_UI_TouchHook); //设置触摸回调钩子函数。
HI_APPCOMM_CHECK_RETURN(s32Ret,s32Ret);
return HI_SUCCESS;
}
这个函数是获取到设备的能力和特性
//找到addr中的对应bit.看其是否为1。
static inline HI_S32 HAL_TOUCHPAD_InputBitCheck(HI_S32 bit, const volatile HI_U32* addr)
{
return 1UL & (addr[HAL_TOUCHAPD_BITWORD(bit)] >> (bit & (HAL_TOUCHAPD_BITLONG - 1)));
}
HI_S32 HI_HAL_TOUCHPAD_Start(HI_S32* ps32Fd)
{
HAL_TOUCHPAD_CHECK_INIT();
HI_APPCOMM_CHECK_POINTER(ps32Fd, HI_HAL_EINVAL);
HI_S32 s32Ret = HI_SUCCESS;
HI_U32 au32Inputbits[(ABS_MAX + 31) / 32];
if (HAL_FD_INITIALIZATION_VAL != s_s32TOUCHPADfd)
{
MLOGE("touchpad already started\n");
return HI_HAL_ENOSTART;
}
memset(&s_stHALTOUCHPADMtInput, 0, sizeof(HAL_TOUCHPAD_MTINPUT_S));
s_s32TOUCHPADfd = open(HAL_TOUCHAPD_DEV, O_RDONLY);
if (s_s32TOUCHPADfd < 0)
{
MLOGE("open /dev/input/event0 err,errno(%d)\n",errno);
return HI_HAL_EINVOKESYS;
}
s32Ret = ioctl(s_s32TOUCHPADfd, EVIOCGBIT(EV_ABS, sizeof(au32Inputbits)), au32Inputbits);
if (s32Ret < 0)
{
MLOGE("open ioctl err,errno(%d)\n",errno);
close(s_s32TOUCHPADfd);
s_s32TOUCHPADfd = HAL_FD_INITIALIZATION_VAL;
return HI_HAL_EINVOKESYS;
}
if ( ( 0 == HAL_TOUCHPAD_InputBitCheck(ABS_MT_POSITION_X, au32Inputbits) )
|| ( 0 == HAL_TOUCHPAD_InputBitCheck(ABS_MT_POSITION_Y, au32Inputbits) )
|| ( 0 == HAL_TOUCHPAD_InputBitCheck(ABS_MT_TOUCH_MAJOR, au32Inputbits) )
)
{
MLOGE("error: could not support the device\n");
MLOGE("EV_SYN=%d\n", HAL_TOUCHPAD_InputBitCheck(EV_SYN, au32Inputbits));
MLOGE("EV_ABS=%d\n", HAL_TOUCHPAD_InputBitCheck(EV_ABS, au32Inputbits));
MLOGE("ABS_MT_POSITION_X=%d\n", HAL_TOUCHPAD_InputBitCheck(ABS_MT_POSITION_X, au32Inputbits));
MLOGE("ABS_MT_POSITION_Y=%d\n", HAL_TOUCHPAD_InputBitCheck(ABS_MT_POSITION_Y, au32Inputbits));
MLOGE("ABS_MT_TOUCH_MAJOR=%d\n", HAL_TOUCHPAD_InputBitCheck(ABS_MT_TOUCH_MAJOR, au32Inputbits));
close(s_s32TOUCHPADfd);
s_s32TOUCHPADfd = HAL_FD_INITIALIZATION_VAL;
return HI_HAL_EINTER;
}
*ps32Fd = s_s32TOUCHPADfd;
return HI_SUCCESS;
}
关闭设备;
HI_S32 HI_HAL_TOUCHPAD_Stop(HI_VOID)
{
HAL_TOUCHPAD_CHECK_INIT();
HAL_TOUCHPAD_CHECK_FD();
HI_S32 s32Ret = HI_SUCCESS;
s32Ret = close(s_s32TOUCHPADfd);
if (HI_SUCCESS != s32Ret)
{
MLOGD("close err,errno(%d)\n",errno);
return HI_HAL_EINVOKESYS;
}
s_s32TOUCHPADfd = HAL_FD_INITIALIZATION_VAL;
return HI_SUCCESS;
}
读取input设备输入信息:
static HI_S32 HAL_TOUCHPAD_ReadInputEventStatic(HAL_TOUCHPAD_MTSAMPLE_S* pstMtSamp)
{
struct input_event stInputEvent;
HI_S32 s32Ret = HI_SUCCESS;
HI_BOOL bDataReadCompleted = HI_FALSE;
HI_S32 s32Pushed = 0;
/** parm ps32Level check */
if (NULL == pstMtSamp)
{
MLOGE("pstMtSamp is null\n");
return HI_FAILURE;
}
/** init check */
if (HAL_FD_INITIALIZATION_VAL == s_s32TOUCHPADfd)
{
MLOGE("touchpad not initialized\n");
return HI_FAILURE;
}
while (HI_FALSE == bDataReadCompleted)
{
s32Ret = read(s_s32TOUCHPADfd, &stInputEvent, sizeof(struct input_event));
if (s32Ret < (HI_S32)sizeof(struct input_event))
{
/** no more data */
MLOGW("s32Ret(%d) <sizeof(struct input_event)(%d)\n",(HI_S32)s32Ret,(HI_S32)sizeof(struct input_event));
break;
}
switch (stInputEvent.type)
{
/** key 0x1*/
case EV_KEY:
//MLOGD("event=EV_KEY:\n");
switch (stInputEvent.code)
{
/** 14a 0 */
case BTN_TOUCH:
(&s_stHALTOUCHPADMtInput)->au32Pressure[(&s_stHALTOUCHPADMtInput)->s32Slot] = stInputEvent.value;
(&s_stHALTOUCHPADMtInput)->as32Filled[(&s_stHALTOUCHPADMtInput)->s32Slot] = 1;
break;
}
break;
/** 0x00 */
case EV_SYN:
switch (stInputEvent.code)
{
case SYN_REPORT:
case SYN_MT_REPORT:
default:
//MLOGD("event=%d.code=%d\n", stInputEvent.type, stInputEvent.code);
{
s32Pushed = HAL_TOUCHPAD_PushSamp(&s_stHALTOUCHPADMtInput, &stInputEvent, pstMtSamp);
pstMtSamp += s32Pushed;
bDataReadCompleted = HI_TRUE;
}
break;
}
break;
/** 0x3 */
case EV_ABS:
switch (stInputEvent.code)
{
/** 0x3a Pressure on contact area */
case ABS_PRESSURE:
//MLOGD("event.code=ABS_PRESSURE.v=%d\n", stInputEvent.value);
(&s_stHALTOUCHPADMtInput)->au32Pressure[(&s_stHALTOUCHPADMtInput)->s32Slot] = stInputEvent.value;
break;
/** 0x2f MT slot being modified */
case ABS_MT_SLOT:
//MLOGD("event.code=ABS_MT_SLOT.v=%d\n", stInputEvent.value);
if (stInputEvent.value < 0)
{
break;
}
(&s_stHALTOUCHPADMtInput)->s32Slot = stInputEvent.value;
if ((&s_stHALTOUCHPADMtInput)->s32Slot >= HAL_TOUCHAPD_MAX_POINT_NUM)
{
//MLOGD("slot limit error. MAX_POINT_NUM=%d. temp slot=%d\n", MAX_POINT_NUM, (&s_stmtinput)->temp_slot);
(&s_stHALTOUCHPADMtInput)->s32Slot = 0;
}
break;
/** 0X30 Major axis of touching ellipse */
case ABS_MT_TOUCH_MAJOR:
//MLOGD("event.code=ABS_MT_TOUCH_MAJOR.v=%d\n", stInputEvent.value);
(&s_stHALTOUCHPADMtInput)->au32Pressure[(&s_stHALTOUCHPADMtInput)->s32Slot] = stInputEvent.value;
(&s_stHALTOUCHPADMtInput)->as32Filled[(&s_stHALTOUCHPADMtInput)->s32Slot] = 1;
break;
/** 0X35 */
case ABS_MT_POSITION_X:
//MLOGD("event.code=ABS_MT_POSITION_X.v=%d\n", stInputEvent.value);
(&s_stHALTOUCHPADMtInput)->as32X[(&s_stHALTOUCHPADMtInput)->s32Slot] = stInputEvent.value;
(&s_stHALTOUCHPADMtInput)->au32Pressure[(&s_stHALTOUCHPADMtInput)->s32Slot] = 1;
(&s_stHALTOUCHPADMtInput)->as32Filled[(&s_stHALTOUCHPADMtInput)->s32Slot] = 1;
break;
/** 0X36 */
case ABS_MT_POSITION_Y:
//MLOGD("event.code=ABS_MT_POSITION_Y.v=%d\n", stInputEvent.value);
(&s_stHALTOUCHPADMtInput)->as32Y[(&s_stHALTOUCHPADMtInput)->s32Slot] = stInputEvent.value;
(&s_stHALTOUCHPADMtInput)->au32Pressure[(&s_stHALTOUCHPADMtInput)->s32Slot] = 1;
(&s_stHALTOUCHPADMtInput)->as32Filled[(&s_stHALTOUCHPADMtInput)->s32Slot] = 1;
break;
/** 0X39 */
case ABS_MT_TRACKING_ID:
//MLOGD("event.code=ABS_MT_TRACKING_ID.v=%d\n", stInputEvent.value);
if (stInputEvent.value == -1)
{
(&s_stHALTOUCHPADMtInput)->as32Filled[(&s_stHALTOUCHPADMtInput)->s32Slot] = 1;
}
break;
}
break;
}
}
return HI_SUCCESS;
}
HI_S32 HI_HAL_TOUCHPAD_ReadInputEvent(HI_HAL_TOUCHPAD_INPUTINFO_S* pstInputData)
{
HI_APPCOMM_CHECK_POINTER(pstInputData, HI_HAL_EINVAL);
HAL_TOUCHPAD_CHECK_INIT();
HAL_TOUCHPAD_CHECK_FD();
HI_S32 s32Ret = HI_SUCCESS;
HAL_TOUCHPAD_MTSAMPLE_S astMtSample[HAL_TOUCHAPD_MAX_POINT_NUM];
memset(&astMtSample,'\0',sizeof(astMtSample));
s32Ret = HAL_TOUCHPAD_ReadInputEventStatic(astMtSample); //读取设备的内容
if (HI_SUCCESS != s32Ret)
{
MLOGD("read_input_event err\n");
return HI_HAL_EINTER;
}
if (HI_TRUE == s_bHALTPUCHPADEnable)
{
pstInputData->s32ID = astMtSample[0].s32ID;
pstInputData->u32Pressure = astMtSample[0].u32Pressure;
pstInputData->s32X = astMtSample[0].s32X;
pstInputData->s32Y = astMtSample[0].s32Y;
pstInputData->u32TimeStamp = (astMtSample[0].tv.tv_sec) * 1000 + (astMtSample[0].tv.tv_usec) / 1000;
}
else
{
pstInputData->s32ID = 0;
pstInputData->u32Pressure = 0;
pstInputData->s32X = 0;
pstInputData->s32Y = 0;
pstInputData->u32TimeStamp = 0;
}
return HI_SUCCESS;
}
在ui_init.c
中:
static HI_VOID * PDT_UI_StartApp(HI_VOID* pVoid)
{
HI_S32 s32Ret;
//创建应用程序
s32Ret = HI_GV_App_Create("MainApp", (HIGV_HANDLE *)&s_AppHandle);
if (HI_SUCCESS != s32Ret)
{
HI_GV_Deinit();
HI_GV_PARSER_Deinit();
return NULL;
}
prctl(PR_SET_NAME, __FUNCTION__, 0, 0, 0);
/*HI_GV_App_Start will not return until HI_GV_App_Stop is called. */
//启动应用界面
s32Ret = HI_GV_App_Start(s_AppHandle);
HI_APPCOMM_CHECK_RETURN(s32Ret, NULL);
return NULL;
}
HiGV 是一个轻量级的 GUI 系统,主要是为芯片平台提供统一的轻量级、高效、易用的 GUI 解决方案。该系统采用分层机制实现,其中底层图形库依赖 SDK 中 HiGO 库,而 HiGO 建立在基本的图形驱动(FrameBuffer、芯片 2D 加速驱动、图片编解码等)之上,如图 1-1 所示。
HiGV 吸取了优秀图形系统设计思想,采用大量成熟的设计模式,使用了 XML 标记语言进行界面描述,具有统一高效的系统资源管理功能,并且 HiGV 还提供了丰富的控件。另外,为了解决易用性问题,还提供了快速可视化界面开发工具 HiGVBuilder 来帮助用户进行界面开发。
架构中主要模块的功能如下:
通常,一个 HiGV 工程除了 main 函数外,还有其他几个重要的组成部分:
UI 由若干个 HiGV 控件组成,这些控件可以使用 xml 文件描述,也可以通过调用HiGV 的接口创建。
通常使用 xml 文件描述界面及界面使用的资源数据,xml 描述界面方便易用,可以省略大量的控件创建代码,HiGV 还会自动生成控件句柄,详见 Xml 文件描述。也可以直接调用 HiGV 的接口创建界面控件,接口创建控件需要大量的变量放置这些控件的句柄以便于对这些控件进行操作,调用接口方式多用于动态创建或销毁控件。
如下以简单的 Hello World 程序为例,通过该例子来说明 XML 文件、描述界面事件文
件、界面元素属性及事件的关联关系。
Hello World 程序要求为:
XML 描述文件为
<view
id = “hello_sample” <!—view name-->
onload = “”
unload = “”>
<window
id = “hello_sample” <!—window name-->
top = “0” <!—widget pos-->
left = “0”
width = “720”
height = “576”
normalskin = “commonpic_skin_colorkey” <!—normal skin-->
transparent = “no”
colorkey = “0xff0000ff”
isrelease = “yes”
opacity = “255”
winlevel = “0”
onshow = “hello_window_onshow”> <!—onshow call back-->
<button
id = “hello_button_ok” <!—ok button ID-->
top = “285”
left = “235”
width = “246”
height = “40”
normalskin = “commonpic_normalskin_button”
disableskin = “”
highlightskin = “”
activeskin = “commonpic_activeskin_button” <!—active state
skin-->
transparent = “no”
isrelease = “no”
text = “ID_STR_OK” <!—multi language ID-->
alignment = “hcenter|vcenter”
onclick = “hello_button_onclick”/> <!—onclick call back-->
<label
id = “hello_label_helpinfo” <!—label ID-->
top = “200”
left = “235”
width = “246”
height = “50”
normalskin = “common_skin_black”
disableskin = “”
highlightskin = “”
activeskin = “”
transparent = “yes”
isrelease = “no”
text = ""
alignment = "hcenter|vcenter"/>
</window>
</view>
UI_XXX.c :
/**Window onshow call back*/
HI_S32 hello_window_onshow (HI_HANDLE hWidget,HI_U32 wParam, HI_U32lParam)
{
return HIGV_PROC_GOON;
}
/**OK button onclick call back*/
HI_S32 hello_button_onclick (HI_HANDLE hWidget,HI_U32 wParam,
HI_U32lParam)
{
HI_S32 s32Ret;
/**Change the label content*/
s32Ret = HI_GV_Widget_SetText(hello_label_helpinfo, “Hello World!”);
return HIGV_PROC_GOON;
}
Main.c:
#define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 720
#define PROJECT_ID hello_sample //from xml
HI_S32 main(HI_S32 argc, HI_CHAR *argv[])
{
HI_S32 Ret;
HI_S32 g_hApp ;
/** The layer info, layer width is 1280 and height is 720. The pixel
format is HIGO_PF_8888, Each pixel occupies 32 bits, and the A/R/G/B
components each occupies 8 bits. Use Dual buffers supported .*/
HIGO_LAYER_INFO_S LayerInfo = {SCREEN_WIDTH, SCREEN_HEIGHT,
SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT,
(HIGO_LAYER_FLUSHTYPE_E)(HIGO_LAYER_BUFFER_DOUBLE),
HIGO_LAYER_DEFLICKER_AUTO,
HIGO_PF_8888, HIGO_LAYER_HD_0};
/**higv init*/
Ret = HI_GV_Init();
if (HI_SUCCESS != Ret)
{
return Ret;
}
/**Init parser module to parser binary file from xml.*/
Ret = HI_GV_PARSER_Init();
if (HI_SUCCESS != Ret)
{
printf("HI_GV_PARSER_Init failed! Return: %d\n",Ret);
return Ret;
}
/**Load higv.bin*/
Ret = HI_GV_PARSER_LoadFile("./higv.bin");
if (HI_SUCCESS != Ret)
{
HI_GV_Deinit();
HI_GV_PARSER_Deinit();
return Ret;
}
/**Create layer for draw graphics*/
HI_HANDLE LAYER_0 = INVALID_HANDLE;
Ret = HI_GV_Layer_Create(&LayerInfo, &LAYER_0);
if (HI_SUCCESS != Ret)
{
printf("HI_GV_Layer_CreateEx failed! Return: %x \n",Ret);
HI_GV_Deinit();
HI_GV_PARSER_Deinit();
return Ret;
}
else
printf("LAYER_0 create ok ...\n");
/**Load view,PROJECT_ID is view ID from xml file. Create all child
widget of PROJECT_ID.*/
Ret = HI_GV_PARSER_LoadViewById(PROJECT_ID);
if (HI_SUCCESS != Ret)
{
printf("HI_GV_PARSER_LoadViewById failed! Return: %x\n",Ret);
HI_GV_Deinit();
HI_GV_PARSER_Deinit();
return Ret;
}
/**Create HiGV app.*/
Ret = HI_GV_App_Create("MainApp", (HI_HANDLE*)&g_hApp);
if (HI_SUCCESS != Ret)
{
printf("HI_GV_App_Create failed! Return: %d\n",Ret);
HI_GV_Deinit();
HI_GV_PARSER_Deinit();
return Ret;
}
/**Show window.*/
Ret = HI_GV_Widget_Show(PROJECT_ID);
if(Ret !=0)
printf("HI_GV_Widget_Show() failed ....: %d \n",Ret);
Ret = HI_GV_Widget_Active(PROJECT_ID);
if(Ret !=0)
printf("HI_GV_Widget_Active() failed ....: %d \n",Ret);
/*Start HiGV app*/
HI_GV_App_Start(g_hApp);
/** If the HiGV app over, the HI_GV_App_Start will be return.*/
HI_GV_App_Destroy(g_hApp);
HI_GV_PARSER_Deinit();
HI_GV_App_Stop(g_hApp);
return 0;
}
程序运行后,当按下“OK”键,产生 onclick 事件,导致调用 hello_button_onclick 函数,在该函数中修改文本框内容为“Hello World!”。如图 1-2、图 1-3 所示。
标签:回调函数 问题 oct llb 模块 信息 资源管理 获取 enable
原文地址:https://www.cnblogs.com/linhaostudy/p/11226606.html