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

📄 wrapper.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
-------------------------------------------------------------------*/


/*****************************************************************************
 * FUNCTION
 *  IsMyTimerExist
 * DESCRIPTION
 *  
 * PARAMETERS
 *  nTimerId        [IN]        
 * RETURNS
 *  
 *****************************************************************************/
BOOL IsMyTimerExist(U16 nTimerId)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (TimerExist[nTimerId] == 1)
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }
}

/*-------------------------------------------------------------------
Function Name  :  KillObjects
Description    :  This module kills the object but 
               currently of no use
Input       :  null
Output         :  bool
-------------------------------------------------------------------*/


/*****************************************************************************
 * FUNCTION
 *  KillObjects
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  
 *****************************************************************************/
U16 KillObjects(void)
{
#ifdef MMI_ON_WIN32
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 i;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (i = 9; i < TOTAL_TASKS; i++)
    {
        OslIntDleteTask(task_info_g1[i].task_id);
        OslDeleteMsgQ(task_info_g1[i].task_ext_qid);
    }
    OslIntCancelTimer(TimerCallBackHdlr);
    OslIntDeleteTimer(TimerCallBackHdlr);
    for (i = 0; i < MAX_TIMERS; i++)
        if (TimerExist[i])
        {
            OslStopSoftTimer(i);
        }

#endif /* MMI_ON_WIN32 */ 
    return TRUE;
}

/*-------------------------------------------------------------------
Function Name  :  OslIntCreateTimer
Description    :  This module creates the timer
Input       :  timer name
Output         :  timer ID
-------------------------------------------------------------------*/


/*****************************************************************************
 * FUNCTION
 *  OslIntCreateTimer
 * DESCRIPTION
 *  
 * PARAMETERS
 *  timer_name      [IN]        
 * RETURNS
 *  
 *****************************************************************************/
oslTimerid OslIntCreateTimer(PS8 timer_name)
{
#ifdef MMI_ON_WIN32
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    win32_timerid *tmrid;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    tmrid = (win32_timerid*) OslMalloc(sizeof(win32_timerid));
    strcpy(tmrid->tmr_name, timer_name);
    tmrid->tmr_handler = 0;
    tmrid->tmr_timeout = 0;
    tmrid->tmr_callback = NULL;
    tmrid->tmr_callback_arg = NULL;
    return tmrid;
#else /* MMI_ON_WIN32 */ 
    return NULL;
#endif /* MMI_ON_WIN32 */ 
}

/*-------------------------------------------------------------------
Function Name  :  OslIntSetTimer
Description    :  This module sets the timer
Input       :  oslTimerid timerid, 
               oslTimerFuncPtr func_ptr,
               void * funcArg,
               U32 timeDurationMsec
Output         :  bool
-------------------------------------------------------------------*/


/*****************************************************************************
 * FUNCTION
 *  OslIntSetTimer
 * DESCRIPTION
 *  
 * PARAMETERS
 *  timerid                 [IN]        
 *  func_ptr                [IN]        
 *  funcArg                 [?]         
 *  timeDurationMsec        [IN]        
 * RETURNS
 *  
 *****************************************************************************/
OSLSTATUS OslIntSetTimer(oslTimerid timerid, oslTimerFuncPtr func_ptr, void *funcArg, U32 timeDurationMsec)
{
#ifdef MMI_ON_WIN32
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    extern HWND hWnd;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    timerid->tmr_callback = func_ptr;
    timerid->tmr_callback_arg = funcArg;
    timerid->tmr_timeout = timeDurationMsec;
    timerid->tmr_handler = SetTimer(hWnd, (U32) timerid, timeDurationMsec, NULL);
#endif /* MMI_ON_WIN32 */ 
    return OSL_SUCCESS;
}

/*-------------------------------------------------------------------
Function Name  :  OslIntCancelTimer
Description    :  This module cancels the timer
Input       :  timerID
Output         :  bool
-------------------------------------------------------------------*/


/*****************************************************************************
 * FUNCTION
 *  OslIntCancelTimer
 * DESCRIPTION
 *  
 * PARAMETERS
 *  timerid     [IN]        
 * RETURNS
 *  
 *****************************************************************************/
OSLSTATUS OslIntCancelTimer(oslTimerid timerid)
{
#ifdef MMI_ON_WIN32
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    extern HWND hWnd;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    KillTimer(hWnd, (U32) timerid);
#endif /* MMI_ON_WIN32 */ 
    return OSL_SUCCESS;
}

/*-------------------------------------------------------------------
Function Name  :  OslIntDeleteTimer 
Description    :  This module delets the timer
Input       :  timerID
Output         :  bool
-------------------------------------------------------------------*/


/*****************************************************************************
 * FUNCTION
 *  OslIntDeleteTimer
 * DESCRIPTION
 *  
 * PARAMETERS
 *  timerid     [IN]        
 * RETURNS
 *  
 *****************************************************************************/
OSLSTATUS OslIntDeleteTimer(oslTimerid timerid)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef MMI_ON_WIN32
    OslMfree(timerid);
#endif 
    return OSL_SUCCESS;
}

/*-------------------------------------------------------------------
Function Name  :  OslIntStartSoftTimer 
Description    :  This module starts the soft timer
Input       :  timerID
Output         :  bool
-------------------------------------------------------------------*/


/*****************************************************************************
 * FUNCTION
 *  OslIntStartSoftTimer
 * DESCRIPTION
 *  
 * PARAMETERS
 *  nTimerId                [IN]        
 *  func_ptr                [IN]        
 *  funcArg                 [?]         
 *  timeDurationMsec        [IN]        
 * RETURNS
 *  
 *****************************************************************************/
OSLSTATUS OslIntStartSoftTimer(unsigned short nTimerId, oslTimerFuncPtr func_ptr, void *funcArg, U32 timeDurationMsec)
{
#ifdef MMI_ON_WIN32
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    oslSoftTimerid TempTimerId;
    U32 nRoundOffMSec;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (timeDurationMsec % TIMER_CALLBACK_RESOLUTION)
    {
        nRoundOffMSec = ((timeDurationMsec / TIMER_CALLBACK_RESOLUTION) + 1) * TIMER_CALLBACK_RESOLUTION;
    }
    else
    {
        nRoundOffMSec = timeDurationMsec;
    }
    TempTimerId = OslMalloc(sizeof(win32_soft_timerid));
    TempTimerId->tmr_callback = func_ptr;
    TempTimerId->tmr_callback_arg = funcArg;
    TempTimerId->tmr_timeout = nRoundOffMSec;
    TempTimerId->tmr_count = TempTimerId->tmr_timeout;
    TempTimerId->tmr_state = OSL_RUN;
    EnterCriticalSection(&TimerCS);
    TimerId[nTimerId] = TempTimerId;
    LeaveCriticalSection(&TimerCS);
#endif /* MMI_ON_WIN32 */ 
    return OSL_SUCCESS;

}

/*-------------------------------------------------------------------
Function Name  :  OslIntStopSoftTimer 
Description    :  This module stops the soft timer
Input       :  timerID
Output         :  bool
-------------------------------------------------------------------*/


/*****************************************************************************
 * FUNCTION
 *  OslIntStopSoftTimer
 * DESCRIPTION
 *  
 * PARAMETERS
 *  nTimerId        [IN]        
 * RETURNS
 *  
 *****************************************************************************/
OSLSTATUS OslIntStopSoftTimer(unsigned short nTimerId)
{
#ifdef MMI_ON_WIN32
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    EnterCriticalSection(&TimerCS);
    if (TimerId[nTimerId] != NULL)
    {
        OslMfree(TimerId[nTimerId]);
        TimerId[nTimerId] = NULL;
    }
    LeaveCriticalSection(&TimerCS);
#endif /* MMI_ON_WIN32 */ 
    return OSL_SUCCESS;
}

⌨️ 快捷键说明

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