77范文网 - 专业文章范例文档资料分享平台

minigui代码分析(5)

来源:网络收集 时间:2019-03-28 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

#endif

#ifdef _L7200_IAL

{\, InitL7200Input, TermL7200Input}, #endif

#ifdef _ARM3000_IAL

{\, InitARM3000Input, TermARM3000Input}, #endif

#ifdef _EMBEST2410_IAL

{\, InitEMBEST2410Input, TermEMBEST2410Input}, #endif

#ifdef _EM8620_IAL

{\, InitEm8620Input, TermEm8620Input}, #endif

#ifdef _EM86_IAL

{\, InitEm86Input, TermEm86Input}, #endif

#ifdef _EM85_IAL

{\, InitEm85Input, TermEm85Input}, #endif

#ifdef _FFT7202_IAL

{\, InitFFTInput, TermFFTInput}, #endif

#ifdef _UTPMC_IAL

{\, InitUTPMCInput, TermUTPMCInput}, #endif

#ifdef _DM270_IAL

{\, InitDM270Input, TermDM270Input}, #endif

#ifdef _EVMV10_IAL

{\, InitXscaleEVMV10Input, TermXscaleEVMV10Input}, #endif

#ifdef _FXRM9200_IAL

{\, InitRm9200Input, TermRm9200Input}, #endif

#ifdef _ABSSIG_IAL

{\, InitABSSIGInput, TermABSSIGInput}, #endif

#ifdef _SKYEYE_EP7312_IAL

{\, InitSkyEyeEP7312Input, TermSkyEyeEP7312Input}, #endif

#ifdef _FIGUEROA_IAL

{\, InitFiguerOAInput, TermFiguerOAInput}, #endif

#ifdef _HI3510_IAL

{\, InitHI3510Input, TermHI3510Input}, #endif

#ifdef _HI3610_IAL

{\, InitHI3610Input, TermHI3610Input}, #endif

/* ... end of board-specific IAL engines */ };

3、函数流程

INPUT* __mg_cur_input;

#define NR_INPUTS (sizeof (inputs) / sizeof (INPUT))

int InitIAL (void) {

int i;

char engine [LEN_ENGINE_NAME + 1]; //输入引擎名称 char mdev [MAX_PATH + 1]; //路径 char mtype[LEN_MTYPE_NAME + 1]; //类型

if (NR_INPUTS == 0) //如果没有输入引擎,返回错误信息 return ERR_NO_ENGINE;

//将system的ial_engine段的值复制给engine指向的地址

if (GetMgEtcValue (\, \, engine, LEN_ENGINE_NAME) < 0) return ERR_CONFIG_FILE;

if (GetMgEtcValue (\, \, mdev, MAX_PATH) < 0) return ERR_CONFIG_FILE;

if (GetMgEtcValue (\, \, mtype, LEN_MTYPE_NAME) < 0) return ERR_CONFIG_FILE;

//找到与engine相等的字符串,由此来确定当前的输入引擎__mg_cur_input for (i = 0; i < NR_INPUTS; i++) {

if (strncmp (engine, inputs[i].id, LEN_ENGINE_NAME) == 0) { __mg_cur_input = inputs + i; break; } }

//如果当前输入引擎为空 if (__mg_cur_input == NULL) {

fprintf (stderr, \, engine); if (NR_INPUTS) { //输入引擎数组不为空

__mg_cur_input = inputs;//当前输入引擎为输入引擎数组的第一个 fprintf (stderr, \, __mg_cur_input->id); }

else

return ERR_NO_MATCH; }

//将mdev存储的路径字符串复制给__mg_cur_input->mdev strcpy (__mg_cur_input->mdev, mdev);

//根据输入引擎选择对应的输入初始化函数对输入进行初始化 if (!IAL_InitInput (__mg_cur_input, mdev, mtype)) { fprintf (stderr, \); return ERR_INPUT_ENGINE; } return 0; }

4、QVFB输入引擎初始化InitQVFBInput

BOOL InitQVFBInput (INPUT* input, const char* mdev, const char* mtype) {

char file [50]; int display;

fprintf(stderr,\); #ifdef _INCORE_RES

/* Define if build MiniGUI for no file I/O system */ /* #undef _INCORE_RES */ //#define _INCORE_RES 1 display = 0; #endif

/* open mouse pipe */

sprintf (file, QT_VFB_MOUSE_PIPE, display); if ((mouse_fd = open (file, O_RDONLY)) < 0) {

fprintf (stderr, \); return FALSE; }

/* open keyboard pipe */

sprintf (file, QT_VFB_KEYBOARD_PIPE, display); if ((kbd_fd = open (file, O_RDONLY)) < 0) {

fprintf (stderr, \); return FALSE; }

input->update_mouse = mouse_update; input->get_mouse_xy = mouse_getxy; input->set_mouse_xy = NULL;

input->get_mouse_button = mouse_getbutton; input->set_mouse_range = NULL; input->suspend_mouse= NULL; input->resume_mouse = NULL;

input->update_keyboard = keyboard_update; input->get_keyboard_state = keyboard_getstate; input->suspend_keyboard = NULL; input->resume_keyboard = NULL; input->set_leds = NULL;

input->wait_event = wait_event;

init_code_map ();

return TRUE; }

5、GetValueFromEtc

typedef struct _ETC_S {

/** Allocated number of sections */ int sect_nr_alloc; /** Number of sections */ int section_nr; /** Pointer to section arrays */ PETCSECTION sections; } ETC_S;

typedef struct _ETCSECTION {

/** Allocated number of keys */ int key_nr_alloc; /** Key number in the section */ int key_nr; /** Name of the section */ char *name; /** Array of keys */

char** keys; /** Array of values */

char** values; } ETCSECTION;

typedef ETCSECTION* PETCSECTION; typedef unsigned int GHANDLE; * Parameter:

* pEtcFile: etc file path name. * pSection: Section name. * pKey: Key name.

* pValue: The buffer will store the value of the key. * iLen: The max length of value string. * Return:

* int meaning

* ETC_FILENOTFOUND The etc file not found. * ETC_SECTIONNOTFOUND The section is not found. * ETC_EKYNOTFOUND The Key is not found. * ETC_OK OK.

在pSection指向的分区的pKey段找到iLen长度的字符串赋给pValue指向的字符串 int GUIAPI GetValueFromEtc (GHANDLE hEtc, const char* pSection, const char* pKey, char* pValue, int iLen) {

int i, empty_section = -1; ETC_S *petc = (ETC_S*) hEtc; PETCSECTION psect = NULL;

if (!petc || !pValue) return -1;

for (i=0; isection_nr; i++) { psect = petc->sections + i; if (!psect->name) { empty_section = i; continue; }

if (strcmp (psect->name, pSection) == 0) { break; } }

if (i >= petc->section_nr) { if (iLen > 0)

return ETC_SECTIONNOTFOUND; else {

if (petc->sect_nr_alloc <= 0) return ETC_READONLYOBJ;

if (empty_section >= 0)

psect = petc->sections + empty_section; else {

psect = etc_NewSection (petc); }

if (psect->name == NULL) { psect->key_nr = 0;

psect->name = FixStrDup (pSection);

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库minigui代码分析(5)在线全文阅读。

minigui代码分析(5).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/548836.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: