⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmitask.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
        else
        {
            return MMI_FALSE;
        }
        i++;
        if (i > INPUT_MODE_MAX_NUM)
        {
            ASSERT(0);
        }
    }
}


/*****************************************************************************
 * FUNCTION
 *  InitIMESetting
 * DESCRIPTION
 *  To Initialize IME,
 *  
 *  This is used to To Initialize IME,.
 * PARAMETERS
 *  IMEArray            [IN]        
 *  allIME              [OUT]       
 *  englishOnlyIME      [OUT]       
 *  PreferedIME         [OUT]       
 * RETURNS
 *  void
 *****************************************************************************/
void InitIMESetting(const sIMEModeDetails *IMEArray, U8 *allIME, U8 *englishOnlyIME, U16 *PreferedIME)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int i = 0, j = 0, k = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (;;)
    {
        if ((0xff) != IMEArray[i].IME_Mode_ID)
        {
            /* W05.34 Fix Compile Warning */
            if (!IMECheck((U8) IMEArray[i].IME_Mode_ID, MMI_implement_input_mode_set))
            {
                ASSERT(0);
            }
            allIME[i] = IMEArray[i].IME_Mode_ID;
        #ifdef __MMI_PREFER_INPUT_METHOD__
            if ((NULL != PreferedIME) && (0 != IMEArray[i].IME_Type_ID))
            {
                PreferedIME[k] = IMEArray[i].IME_Type_ID;
                k++;
            }
        #endif /* __MMI_PREFER_INPUT_METHOD__ */ 
            if (IMEArray[i].English_Only_Flag)
            {
                englishOnlyIME[j] = IMEArray[i].IME_Mode_ID;
                j++;
            }
            i++;
        }
        else
        {
            break;
        }
        if (i > INPUT_MODE_MAX_NUM)
        {
            ASSERT(0);
        }
    }
    allIME[i] = 0xff;
    PreferedIME[k] = 0xffff;
    englishOnlyIME[j] = 0xff;
}


/*****************************************************************************
 * FUNCTION
 *  InitIMEQSearch
 * DESCRIPTION
 *  To Initialize IME,
 *  
 *  This is used to To Initialize IME,.
 * PARAMETERS
 *  IMEQArray       [IN]        
 *  QuickIME        [OUT]       
 * RETURNS
 *  void
 *****************************************************************************/
void InitIMEQSearch(const sIMEModeDetails *IMEQArray, U8 *QuickIME)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int i = 0, j = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (;;)
    {
        if ((0xff) != IMEQArray[i].IME_Mode_ID)
        {
            i++;
            QuickIME[j] = IMEQArray[i - 1].IME_Mode_ID;
            j++;
        }
        else
        {
            break;
        }
        if (i > INPUT_MODE_MAX_NUM)
        {
            ASSERT(0);
        }
    }
    QuickIME[j] = 0xff;
}


/*****************************************************************************
 * FUNCTION
 *  InitIME
 * DESCRIPTION
 *  To Initialize IME,
 *  
 *  This is used to To Initialize IME,.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void InitIME(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    // #if defined(__MMI_MULTIPLE_BIN_IME__)||defined(__MMI_MULTIPLE_BIN_LANG_PACK__)
#ifdef __MMI_PREFER_INPUT_METHOD__
    InitIMESetting(gIMEModeArray, MMI_all_input_mode_set, MMI_english_input_mode_set, MMI_all_prefered_input_mode_set);
#else 
    InitIMESetting(gIMEModeArray, MMI_all_input_mode_set, MMI_english_input_mode_set, NULL);
#endif 
    InitIMEQSearch(gIMEQSearchModeArray, MMI_qsearch_input_mode_set);
    // #endif
#ifdef __MMI_T9__
    InitInputMethod();
#elif defined __MMI_ZI__
    InitZiInputMethod();
//KP Jerry add on 2007-3-8 start
#elif defined __MMI_CSTAR__
    InitCstarInputMethod();
//KP Jerry add on 2007-3-8 end
#elif defined __MMI_KA__
    InitKonkaInputMethod();
#elif defined __MMI_ITAP__
/* under construction !*/
#endif 
}

/* __CUSTPACK_MULTIBIN     Terry   END */


/*****************************************************************************
 * FUNCTION
 *  InitFramework
 * DESCRIPTION
 *  To Initialize framework,
 *  
 *  This is used to To Initialize framework,.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void InitFramework(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 
     * Initialize events handler  
     */
    InitEvents();
    /* 
     * Initialize keyprocess 
     */
    InitProcessKeyEvent();
    /* 
     * Initialize history 
     */
    InitHistory(NULL, SubLCDIdleScreen);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_enable_str_dump
 * DESCRIPTION
 *  The message handler of MSG_ID_MMI_EQ_STR_ENABLE_REQ_IND
 *  
 * PARAMETERS
 *  void*           [IN]
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_enable_str_dump(void *info)
{
#ifdef __MTK_TARGET__
    mmi_eq_str_enable_req_ind_struct *data = (mmi_eq_str_enable_req_ind_struct *)info;
    mmi_at_general_res_req_struct *rsp_msg;
#ifndef __MMI_SUPPORT_DUMP_SCREEN_STRING__
    kal_bool ret = KAL_FALSE;
#else
    kal_bool ret = KAL_TRUE;
    
    g_mmi_frm_cntx.dump_screen_info.is_enable = (MMI_BOOL)(data->enable);
    g_mmi_frm_cntx.dump_screen_info.hightlight_type = 0;
    g_mmi_frm_cntx.dump_screen_info.backup_hightlight_type = 0;
    g_mmi_frm_cntx.dump_screen_info.y = 0;
    g_mmi_frm_cntx.dump_screen_info.backup_y = 0;
    g_mmi_frm_cntx.dump_screen_info.combined_chars_x = 0;
    g_mmi_frm_cntx.dump_screen_info.combined_chars_y = 0;
    memset(g_mmi_frm_cntx.dump_screen_info.backup_string, 0, MMI_SCREEN_STR_MAX_LENGTH);
#endif
    
    /* confirm the message */
    rsp_msg = (mmi_at_general_res_req_struct *)	OslConstructDataPtr( sizeof(mmi_at_general_res_req_struct) );
    rsp_msg->result = ret;
    SendMsg2AT(MSG_ID_MMI_AT_GENERAL_RES_REQ, (void *)rsp_msg, NULL);
#endif
}


/*****************************************************************************
 * FUNCTION
 *  mmi_str_cmd_ind
 * DESCRIPTION
 *  The message handler of MSG_ID_MMI_EQ_STR_REQ_IND
 *  
 * PARAMETERS
 *  void*           [IN]
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_str_cmd_ind(void *info)
{
#ifdef __MTK_TARGET__
    mmi_eq_str_req_ind_struct *data = (mmi_eq_str_req_ind_struct *)info;
    mmi_at_general_res_req_struct *rsp_msg;

    MMI_ASSERT(data->length <= MMI_SCREEN_STR_MAX_LENGTH);
    /* process the string command here */

    /* confirm the message */
    rsp_msg = (mmi_at_general_res_req_struct *)	OslConstructDataPtr( sizeof(mmi_at_general_res_req_struct) );
    rsp_msg->result = KAL_TRUE;
    SendMsg2AT(MSG_ID_MMI_AT_GENERAL_RES_REQ, (void *)rsp_msg, NULL);
#endif
}


#ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__

// #define ENABLE_DUMP_SCREEN_STRING_TRACE

extern MMI_BOOL mmi_trace_screen_string(S32 x, S32 y, U8 *str, S32 len, S32 Bordered);

/*****************************************************************************
 * FUNCTION
 *  mmi_no_more_str_hdlr
 * DESCRIPTION
 *  Sending the termination of dumpping screen string
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_no_more_str_hdlr(void)
{
    mmi_eq_str_res_req_struct *rsp_msg;

    if (UCS2Strlen(g_mmi_frm_cntx.dump_screen_info.combined_chars))
    {
        mmi_trace_screen_string(
                g_mmi_frm_cntx.dump_screen_info.combined_chars_x,
                g_mmi_frm_cntx.dump_screen_info.combined_chars_y,
                (U8*)g_mmi_frm_cntx.dump_screen_info.combined_chars,
                UCS2Strlen(g_mmi_frm_cntx.dump_screen_info.combined_chars),
                0);
    }
    memset(g_mmi_frm_cntx.dump_screen_info.combined_chars, 0, ENCODING_LENGTH);
    g_mmi_frm_cntx.dump_screen_info.allow_dump_screen_str = MMI_FALSE;
    g_mmi_frm_cntx.dump_screen_info.hightlight_type = 0;
    g_mmi_frm_cntx.dump_screen_info.backup_hightlight_type = 0;
    g_mmi_frm_cntx.dump_screen_info.y = 0;
    g_mmi_frm_cntx.dump_screen_info.backup_y = 0;
    g_mmi_frm_cntx.dump_screen_info.combined_chars_x = 0;
    g_mmi_frm_cntx.dump_screen_info.combined_chars_y = 0;
#ifdef __MTK_TARGET__
    rsp_msg = (mmi_eq_str_res_req_struct *)	OslConstructDataPtr( sizeof(mmi_eq_str_res_req_struct) );
    kal_sprintf((char*)rsp_msg->data_string, "%d", MMI_SCREEN_NO_STR);
    rsp_msg->length = strlen((char*)rsp_msg->data_string);
    SendMsg2AT(MSG_ID_MMI_EQ_STR_RES_REQ, (void *)rsp_msg, NULL);
#elif !defined(MMI_ON_WIN32)
#ifdef ENABLE_DUMP_SCREEN_STRING_TRACE
    kal_printf("\n <<END>> \n");
#endif
#endif
}


/*****************************************************************************
 * FUNCTION
 *  mmi_trace_screen_string
 * DESCRIPTION
 *  Sending the screen string
 *  
 * PARAMETERS
 *  x           [IN]
 *  y           [IN]
 *  str         [IN]
 *  len         [IN]
 *  Bordered    [IN]
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
MMI_BOOL mmi_trace_screen_string(S32 x, S32 y, U8 *str, S32 len, S32 Bordered)
{
    MMI_BOOL ret = MMI_FALSE;
#ifdef __MTK_TARGET__
    mmi_eq_str_res_req_struct *rsp_msg;
#elif !defined(MMI_ON_WIN32)
    U8 data_string[200];
#endif

    /* If having combined_chars, dump the string first */
    if (UCS2Strlen(g_mmi_frm_cntx.dump_screen_info.combined_chars))
    {
    #ifdef __MTK_TARGET__
        rsp_msg = (mmi_eq_str_res_req_struct *)	OslConstructDataPtr( sizeof(mmi_eq_str_res_req_struct) );
        kal_sprintf((char*)rsp_msg->data_string, "%d,(%d,%d),%d,", 
                        1,  /* Normal string */
                        g_mmi_frm_cntx.dump_screen_info.combined_chars_x,
                        g_mmi_frm_cntx.dump_screen_info.combined_chars_y,
                        UCS2Strlen(g_mmi_frm_cntx.dump_screen_info.combined_chars));

        rsp_msg->length = strlen((char*)rsp_msg->data_string);
        UCS2Strncpy((S8*)(rsp_msg->data_string+rsp_msg->length), (S8*)g_mmi_frm_cntx.dump_screen_info.combined_chars, MMI_SCREEN_COMBINED_CHAR_MAX_LENGTH/ENCODING_LENGTH);
        rsp_msg->length += UCS2Strlen(g_mmi_frm_cntx.dump_screen_info.combined_chars)*ENCODING_LENGTH;

        MMI_ASSERT(rsp_msg->length <= MMI_SCREEN_STR_MAX_LENGTH);
        SendMsg2AT(MSG_ID_MMI_EQ_STR_RES_REQ, (void *)rsp_msg, NULL);
    #elif !defined(MMI_ON_WIN32)
        kal_sprintf((char*)data_string, "%d,(%d,%d),%d,", 
                        1,  /* Normal string */
                        g_mmi_frm_cntx.dump_screen_info.combined_chars_x,
                        g_mmi_frm_cntx.dump_screen_info.combined_chars_y,
                        UCS2Strlen(g_mmi_frm_cntx.dump_screen_info.combined_chars));

    #ifdef ENABLE_DUMP_SCREEN_STRING_TRACE
        kal_printf(data_string);
        kal_printf("%c%c%c%c%c ...",g_mmi_frm_cntx.dump_screen_info.combined_chars[0], g_mmi_frm_cntx.dump_screen_info.combined_chars[2], 
                                    g_mmi_frm_cntx.dump_screen_info.combined_chars[4], g_mmi_frm_cntx.dump_screen_info.combined_chars[6],
                                    g_mmi_frm_cntx.dump_screen_info.combined_chars[8]);
        kal_printf(" ++++ \n");
    #endif /* ENABLE_DUMP_SCREEN_STRING_TRACE */
    #endif

    }

    /* Dump the screen string */
    if (g_mmi_frm_cntx.dump_screen_info.is_enable
        && (g_mmi_frm_cntx.dump_screen_info.allow_dump_screen_str
            || g_mmi_frm_cntx.dump_screen_info.allow_dump_dm_screen))
    {
        /* check if the string is the same */
        if (UCS2Strlen((S8*)str) && 
            (UCS2Strcmp((S8*)str, g_mmi_frm_cntx.dump_screen_info.backup_string) != 0 || g_mmi_frm_cntx.dump_screen_info.y != y))
        {
            UCS2Strncpy(g_mmi_frm_cntx.dump_screen_info.backup_string, (S8*)str, MMI_SCREEN_STR_MAX_LENGTH/ENCODING_LENGTH);
            g_mmi_frm_cntx.dump_screen_info.y = y;

            if (g_mmi_frm_cntx.dump_screen_info.backup_hightlight_type &&
                g_mmi_frm_cntx.dump_screen_info.backup_y == y)
            {
                g_mmi_frm_cntx.dump_screen_info.hightlight_type = g_mmi_frm_cntx.dump_screen_info.backup_hightlight_type;
            }
            /*
            else
            {
                g_mmi_frm_cntx.dump_screen_info.backup_y = 0;
                g_mmi_frm_cntx.dump_screen_info.hightlight_type = 0;
            }
            */
        #ifdef __MTK_TARGET__

            rsp_msg = (mmi_eq_str_res_req_struct *)	OslConstructDataPtr( sizeof(mmi_eq_str_res_req_struct) );
            kal_sprintf((char*)rsp_msg->data_string, "%d,(%d,%d),%d,", 
                            (g_mmi_frm_cntx.dump_screen_info.hightlight_type>0)?MMI_SCREEN_HIGHLIGHT_STR:MMI_SCREEN_NORMAL_STR,
                            x, 
                            y,
                            UCS2Strlen(g_mmi_frm_cntx.dump_screen_info.backup_string));
            rsp_msg->length = strlen((char*)rsp_msg->data_string);
            UCS2Strcpy((S8*)(rsp_msg->data_string+rsp_msg->length), g_mmi_frm_cntx.dump_screen_info.backup_string);
            rsp_msg->length += UCS2Strlen(g_mmi_frm_cntx.dump_screen_info.backup_string)*ENCODING_LENGTH;

            MMI_ASSERT(rsp_msg->length <= MMI_SCREEN_STR_MAX_LENGTH);
            SendMsg2AT(MSG_ID_MMI_EQ_STR_RES_REQ, (void *)rsp_msg, NULL);
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -