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

📄 events.c

📁 MTK平台QQ移植
💻 C
📖 第 1 页 / 共 5 页
字号:
#include "Wgui_categories_util.h"
#include "wgui_draw_manager.h"

#include "IdleAppDef.h"
#include "CommonScreensenum.h"

#include "SimDetectionGexdcl.h"
#include "SimDetectionGprot.h"
#include "SettingDefs.h"
#include "SettingsGdcl.h"
#ifdef __MMI_TOUCH_SCREEN__
#include "wgui_touch_screen.h"
#endif 
#include "MMI_trc.h"
#include "QuickAccessMenuItem_def.h"
#ifdef __MMI_WGUI_MINI_TAB_BAR__
#include "wgui_tab_bars.h"
#endif 
/* added by MK */
#ifdef __MMI_EMAIL__
#include "EmailAppGProt.h"
#endif // #ifdef __MMI_EMAIL__
#include "gv.h"
#include "tst_def.h"

/*
 * Define
 */
#define INTERRUPT_EVENT_GREOUP_SIZE     (4)
#define IS_INTERRUPT_EVENT_GROUP(x)    (((x)&MMI_INT_EVENT_GROUP_MASK) == MMI_INT_EVENT_GROUP_MASK)

/* for profiling */
#if 0
/* under construction !*/
#endif

#define MMI_EVENT_INVALID  0

/*
 * Data Type
 */
typedef struct
{
    U16 groupID;
    U16 eventID[INTERRUPT_EVENT_GREOUP_SIZE];
} InterruptGroupInfo;


typedef enum
{
    MMI_FRM_REPORT_SCREEN_STATE_PASSIVE,   /* only report screen id when receiving request command */
    MMI_FRM_REPORT_SCREEN_STATE_AUTO,      /* only report popup screen id in active */
    MMI_FRM_REPORT_SCREEN_STATE_ACTIVE,    /* report all screen id in active */
    MMI_FRM_REPORT_SCREEN_STATE_MAX
}mmi_frm_report_screen_state_enum;

/* 
 *   Extern Varibales 
 */
extern U8 gIsHelpEnabled;
extern U8 gIsInSATCall;
extern MMI_BOOL  mmi_is_orderly_exit_screen; 

#ifdef __MMI_SUBLCD_MASTER_MODE__
extern FuncPtr currKeyFuncPtrs[MAX_KEYS][MAX_KEY_TYPE];
extern FuncPtr currKeyFuncPtrs_slave[MAX_KEYS][MAX_KEY_TYPE];
extern FuncPtr currKeyFuncPtrs_master[MAX_KEYS][MAX_KEY_TYPE];
#else
extern FuncPtr currKeyFuncPtrs[MAX_KEYS][MAX_KEY_TYPE];
#endif

hiliteInfo maxHiliteInfo[MAX_HILITE_HANDLER];       /* available hilite func ptrs  */
U8 hintData[MAX_SUB_MENUS][MAX_SUB_MENU_HINT_SIZE];
U8 subMenuData[MAX_SUB_MENUS][MAX_SUB_MENU_SIZE];
PU8 subMenuDataPtrs[MAX_SUB_MENUS];
PU8 hintDataPtrs[MAX_SUB_MENUS];

/* 
 *   Local Variables 
 */

/*
 * If we add new interrupt event group id
 * , we fill the table to establish the mapping events table.
 */
static InterruptGroupInfo interruptGroupEventTable[] = 
{
    {MMI_SMS_INT_EVENT_GROUP,
     {PRT_MSG_ID_MMI_SMS_DELIVER_MSG_IND,
      PRT_MSG_ID_MMI_SMS_STATUS_REPORT_IND,
      PRT_MSG_ID_MMI_SMS_MSG_WAITING_IND,
      0 /* end at 0 */
      }
     }
#if defined(__MMI_FILE_MANAGER__)
    ,{MMI_CARD_PLUG_EVENT_GROUP,
     {MSG_ID_FMT_MMI_CARD_PLUG_IN_IND,
      MSG_ID_FMT_MMI_CARD_PLUG_OUT_IND,
      0 /* end at 0 */
      }
     }
#endif /* __MMI_FILE_MANAGER__ */
};

static U16 currMaxHiliteInfo;               /* currently max hilite info */
static U16 maxProtocolEvent;
static U16 usedProtocolEvent;
static U16 maxInterruptEvent;
static U16 currParentID;                    /* current parent item id */
static U16 currHiliteID;
static FuncPtr currEntryFuncPtr;
static U16 currExitScrnID, currTopScrnID;   /* curr exit func ptr with scrn id */
static FuncPtr currExitFuncPtr;
static PseventInfo protocolEventHandler[MAX_PROTOCOL_EVENT];
static PsInteventInfo interruptEventHandler[MAX_INTERRUPT_EVENT];
static MMI_BOOL mmu_frm_execute_scrn_exit_handler = MMI_FALSE;

static mmi_frm_report_screen_state_enum mmi_frm_report_screen_state = MMI_FRM_REPORT_SCREEN_STATE_PASSIVE;

/* 
 *   Local Functions 
 */
static void SetGenericExitHandler(U16 scrnID, FuncPtr exitFuncPtr, FuncPtr entryFuncPtr);
static MMI_BOOL QueryInterruptHandler(U16 eventID, PsIntFuncPtr *funcPtr, PsIntFuncPtr *postfuncPtr);

static void mmi_frm_dump_screen_id(void);
static void mmi_proc_inject_string(void * in);

/* 
 *   Global Functions 
 */
extern void EmergencyCallCheck(S16 keyCode, S16 keyType);
extern U16 GetTotalCallCount(void);

#ifdef __MMI_SCREEN_SNAPSHOT__
extern void mmi_camera_scr_snapshot(void);
#endif 


/*****************************************************************************
 * FUNCTION
 *  InitEvents
 * DESCRIPTION
 *  This function is used for initialize event handlers
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void InitEvents(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 keyCode = 0;
    U16 keyType = 0;
    U16 count   = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_INIT));

    for (keyCode = 0; keyCode < MAX_KEYS; keyCode++)
    {
        for (keyType = 0; keyType < MAX_KEY_TYPE; keyType++)
        {
            currKeyFuncPtrs[keyCode][keyType] = NULL;
        #ifdef __MMI_SUBLCD_MASTER_MODE__
            currKeyFuncPtrs_slave[keyCode][keyType] = NULL;
            currKeyFuncPtrs_master[keyCode][keyType] = NULL;
        #endif

        }
    }

    currEntryFuncPtr = NULL;

    currExitScrnID   = 0;
    currTopScrnID    = 0;
    currExitFuncPtr  = NULL;

    mmu_frm_execute_scrn_exit_handler = MMI_FALSE;

    /* JL remove to outside init InitHistory(); */

    currMaxHiliteInfo = 0;
    currParentID      = 0;

    maxProtocolEvent  = 0;
    usedProtocolEvent = 0;

    /* MTK added by JL for PS interrupt */
    maxInterruptEvent = 0;

    /* //////// initilaize the timer, protocol & hardware events with func ptrs /////// */
    for (count = 0; count < MAX_PROTOCOL_EVENT; count++)
    {
        protocolEventHandler[count].eventID      = 0;
        protocolEventHandler[count].entryFuncPtr = NULL;
    }

    for (count = 0; count < MAX_HILITE_HANDLER; count++)
    {
        maxHiliteInfo[count].entryFuncPtr = NULL;
        maxHiliteInfo[count].hintFuncPtr  = NULL;
    }
    for (count = 0; count < MAX_SUB_MENUS; count++)
    {
        subMenuDataPtrs[count] = subMenuData[count];
    }

    /* MTK added by JL for PS interrupt */
    for (count = 0; count < MAX_INTERRUPT_EVENT; count++)
    {
        interruptEventHandler[count].eventID         = (U16) NULL;
        interruptEventHandler[count].entryIntFuncPtr = NULL;
        interruptEventHandler[count].postIntFuncPtr  = NULL;
    }

    /* ////////////////////////////////////////////////////////////////////////////////////// */
    SetProtocolEventHandler(mmi_proc_inject_string, MSG_ID_TST_INJECT_STRING);
}


/*****************************************************************************
 * FUNCTION
 *  DeInitFramework_KeyAndEventHandler
 * DESCRIPTION
 *  This function is used for Deinitialize key and event handlers
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void DeInitFramework_KeyAndEventHandler(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 keyCode = 0;
    U16 keyType = 0;
    U16 count   = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT_KEY_EVENT));

    for (keyCode = 0; keyCode < MAX_KEYS; keyCode++)
    {
        for (keyType = 0; keyType < MAX_KEY_TYPE; keyType++)
        {
            currKeyFuncPtrs[keyCode][keyType] = NULL;
        #ifdef __MMI_SUBLCD_MASTER_MODE__
            currKeyFuncPtrs_slave[keyCode][keyType] = NULL;
            currKeyFuncPtrs_master[keyCode][keyType] = NULL;
        #endif
        }
    }

    currEntryFuncPtr = NULL;

    currExitScrnID = 0;
    currTopScrnID = 0;
    currExitFuncPtr = NULL;

    currMaxHiliteInfo = 0;
    currParentID = 0;

    maxProtocolEvent = 0;
    usedProtocolEvent = 0;

    /* //////// initilaize the timer, protocol & hardware events with func ptrs /////// */
    for (count = 0; count < MAX_PROTOCOL_EVENT; count++)
    {
        protocolEventHandler[count].eventID = 0;
        protocolEventHandler[count].entryFuncPtr = NULL;
    }

    for (count = 0; count < MAX_HILITE_HANDLER; count++)
    {
        maxHiliteInfo[count].entryFuncPtr = NULL;
        maxHiliteInfo[count].hintFuncPtr = NULL;
    }

}


/*****************************************************************************
 * FUNCTION
 *  DeInitFramework_History
 * DESCRIPTION
 *  This function is used for Deinitialize History.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void DeInitFramework_History(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT_HISTORY));

    /* to handle key events before finish power off */
    InitKeypadBeforePWRON();

    DinitHistory();
    DinitSubLCDHistory();
}


/*****************************************************************************
 * FUNCTION
 *  DeInitFramework
 * DESCRIPTION
 *  This function is used for De-initialize history & event handlers
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void DeInitFramework(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT));

    DeInitFramework_KeyAndEventHandler();
    DeInitFramework_History();
}


/*****************************************************************************
 * FUNCTION
 *  ExecuteCurrProtocolHandler
 * DESCRIPTION
 *  This function is used for executes current protocol func handler.
 * PARAMETERS
 *  eventID         [IN]  Unique Protocol/System EventID       
 *  MsgStruct       [IN]  The pointer to the message.      
 *  mod_src         [IN]  Source module ID.     
 *  peerBuf         [IN]  The pointer to the peer buffe.       
 * RETURNS
 *  void
 *****************************************************************************/
void ExecuteCurrProtocolHandler(U16 eventID, void *MsgStruct, int mod_src, void *peerBuf)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 count = 0;

    /* PsExtFuncPtr currFuncPtr = NULL; */
    PsExtPeerFuncPtr currFuncPtr = NULL;
    PsIntFuncPtr IntFunc = NULL, PostIntFunc = NULL;
    PsExtPeerIntFuncPtr currInterruptFuncPtr = NULL, currPostInterruptFuncPtr = NULL;
    U8 interrup_result = MMI_FALSE; /* False not handle interrupt, True will handle */

#if defined (MMI_EVENT_PROFILING)
    kal_uint32 start_tick, end_tick;
    static kal_uint32 accu_ticks = 0;
    static U32 accu_count = 0;
#endif /* defined (MMI_EVENT_PROFILING) */ 

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __XHC_APPLICATION__ //xhc start 网络消息钩子,防止与其它第三方应用在网络协议方面冲突
    //此处修改只针对07A及更早的版本,07B及以后版本此处将移到了文件Event_handler.c中
    if (XHC_execute_protocol_handler(eventID, MsgStruct) == TRUE)
    {
        return;
    }
#endif //__XHC_APPLICATION__ //xhc end

#if defined (MMI_EVENT_PROFILING)
    kal_get_time(&start_tick);
#endif 

⌨️ 快捷键说明

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