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

📄 plx_almsg.c

📁 mtk wap和mms代码。。适应mtk 25。26平台
💻 C
字号:
/**************************************************************************\
*
*                      Pollex Mobile Platform
*
* Copyright (c) 2004 by Pollex Mobile Software Co., Ltd.  
*                       All Rights Reserved
*
* Model   :
*
* Purpose :
*  
* Author  : 
*
*-------------------------------------------------------------------------
*
* $Archive::                                                       $
* $Workfile::                                                      $
* $Revision::    $     $Date::                                     $
* 
\**************************************************************************/

#include "stack_common.h"
#include "stack_msgs.h"
#include "eventsgprot.h"
#include "QueueGprot.h"
#include "protocolevents.h"  // for test MSG_ID_APP_SOC_NOTIFY_IND
//#include "stack_config.h"
#include "taskinit.h"
#include "window.h"

#define PLX_MSG_MAX_NUM     200
#define PLX_DEAL_MSGS_ONCE  1

typedef struct tag_PLX_MSG{
    HWND    hWnd;
    UINT    Msg;
    WPARAM  wParam;
    LPARAM  lParam;
}PLX_MSG;

typedef struct tagWINOBJ
{
    WNDPROC     pfnWndProc;     // 窗口对应的窗口函数
} WINOBJ, *PWINOBJ;

typedef struct tag_plx_msg_struct{
    int       q_read;
    int       q_write;
    int       q_msgs;
    PLX_MSG   q_plx_msg[PLX_MSG_MAX_NUM];
}plx_msg_struct;

static int plx_posting = 0;
static plx_msg_struct  g_plx_msg;


static void  pollex_event_handler(void * ptr);
static int plx_dispatch_msg(void);
static void plx_post_to_mtk_q(void);
/*********************************************************************
* Function	   
* Purpose      
* Params	   
* Return	 	   
* Remarks	   
**********************************************************************/
static void plx_post_to_mtk_q(void)
{    
    MYQUEUE Message;
    Message.oslSrcId = MOD_MMI;
    Message.oslDestId = MOD_MMI;
    Message.oslMsgId = MSG_ID_POLLEX;
    Message.oslDataPtr = NULL;
    Message.oslPeerBuffPtr = NULL;
    OslMsgSendExtQueue(&Message);
    SetProtocolEventHandler(pollex_event_handler, MSG_ID_POLLEX );
}
/*********************************************************************
* Function	   
* Purpose      
* Params	   
* Return	 	   
* Remarks	   
**********************************************************************/
static int plx_dispatch_msg(void)
{
    PLX_MSG *pmsg;
    PLXWNDPROC func;
    HWND hWnd;
    UINT Msg;
    WPARAM wParam;
    LPARAM lParam;

    if ( g_plx_msg.q_read == g_plx_msg.q_write && g_plx_msg.q_msgs != PLX_MSG_MAX_NUM )
        return 0;
    
    pmsg = (PLX_MSG *)&(g_plx_msg.q_plx_msg[g_plx_msg.q_read]); 
    hWnd = (HWND)pmsg->hWnd;
    
    if ( PlxIsWindow( hWnd ) )
        func = (PLXWNDPROC)(((PWINOBJ)hWnd)->pfnWndProc); 
    else
        func = (PLXWNDPROC)( hWnd ); 
    
    Msg    = pmsg->Msg;
    wParam = pmsg->wParam;
    lParam = pmsg->lParam;
    
	if (func != NULL)
	{
		(*func)(hWnd, pmsg->Msg, pmsg->wParam, pmsg->lParam );
	}
    
    g_plx_msg.q_read++;
    if ( g_plx_msg.q_read == PLX_MSG_MAX_NUM )
        g_plx_msg.q_read = 0;
    g_plx_msg.q_msgs --;
    return 1;
}

/*********************************************************************
* Function	   
* Purpose      
* Params	   
* Return	 	   
* Remarks	   
**********************************************************************/
static void  pollex_event_handler(void * ptr)
{
    int i;

    for ( i = 0; i < PLX_DEAL_MSGS_ONCE; i++) {
        plx_dispatch_msg();
    }

    if ( g_plx_msg.q_msgs > 0)
        plx_post_to_mtk_q();
	else
		plx_posting = 0;
}

/*********************************************************************
* Function	   
* Purpose      
* Params	   
* Return	 	   
* Remarks	   
**********************************************************************/
BOOL PlxPostMessage(HWND hWnd,  UINT Msg,  WPARAM wParam, LPARAM lParam)
{
    PLX_MSG *pmsg;
    
    if ( hWnd == NULL )
        return 0;

    if ( g_plx_msg.q_msgs >= PLX_MSG_MAX_NUM )
        return 0;

    pmsg = (PLX_MSG *)&(g_plx_msg.q_plx_msg[g_plx_msg.q_write]); 
    pmsg->hWnd = hWnd;
    pmsg->Msg  = Msg;
    pmsg->wParam = wParam;
    pmsg->lParam = lParam;

    g_plx_msg.q_write++;
    if ( g_plx_msg.q_write >= PLX_MSG_MAX_NUM )
        g_plx_msg.q_write = 0;
    g_plx_msg.q_msgs ++;
    
    if ( ! plx_posting ) {
        plx_posting = 1;
        plx_post_to_mtk_q();
    }

    return 1;
}

/*********************************************************************
* Function	   
* Purpose      
* Params	   
* Return	 	   
* Remarks	   
**********************************************************************/

⌨️ 快捷键说明

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