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

📄 history.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
        historyData[currHistoryIndex].guiBuffer = OslMalloc(MAX_GUI_BUFFER);
        getGuiFuncPtr(historyData[currHistoryIndex].guiBuffer);

        historyData[currHistoryIndex].mallcFuncPtr = mallocFuncPtr;
        historyData[currHistoryIndex].mfreeFuncPtr = mfreeFuncPtr;
        if (getInputBufSizeFuncPtr)
        {
            MMI_ASSERT(getInputBufFuncPtr);
            inputBuf_size = (S16)getInputBufSizeFuncPtr();
            if(mallocFuncPtr)
            {
                /* Check memory free function pointer is valid */
                MMI_ASSERT(mfreeFuncPtr);
                historyData[currHistoryIndex].inputBuffer = (U8*)mallocFuncPtr(inputBuf_size + ENCODING_LENGTH + 2);
            }
            else
            {
                historyData[currHistoryIndex].inputBuffer = OslMalloc(inputBuf_size + ENCODING_LENGTH + 2);
            }
            memcpy(historyData[currHistoryIndex].inputBuffer, &inputBuf_size, 2);
            getInputBufFuncPtr(historyData[currHistoryIndex].inputBuffer + 2);
        }
    }
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
    small_history_node = 0;
#endif 
    IsBackHistory = MMI_FALSE;

    return MMI_TRUE;
}


/*****************************************************************************
 * FUNCTION
 *  GetHistory
 * DESCRIPTION
 *  Used to get the history buffer for a screen id
 * PARAMETERS
 *  scrnID          [IN]        
 *  ptrHistory      [IN]        
 * RETURNS
 *  U8 - Status , success or failure
 *****************************************************************************/
U8 GetHistory(U16 scrnID, history *ptrHistory)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S16 count = 0;
    U8 Status = ST_FAILURE;
    U16 nSize;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_GET_HIST_HDLR, scrnID, currHistoryIndex));

    count = currHistoryIndex;
    do
    {
        if (scrnID == historyData[count].scrnID)
        {
            ptrHistory->entryFuncPtr = historyData[count].entryFuncPtr;
            ptrHistory->scrnID = historyData[count].scrnID;
            if (historyData[count].guiBuffer)
            {
                memcpy(ptrHistory->guiBuffer, historyData[count].guiBuffer, MAX_GUI_BUFFER);
            }
            else
            {
                memset(ptrHistory->guiBuffer, 0, MAX_GUI_BUFFER);
            }
            if (historyData[count].inputBuffer)
                /* 2 Bytes Are Added By UI To Keep Size Of InputBuffer Internally In AddNHistory */
            {
                memcpy(&nSize, historyData[count].inputBuffer, 2);
                memcpy(
                    ptrHistory->inputBuffer,
                    historyData[count].inputBuffer + 2,
                    (nSize > MAX_INPUT_BUFFER) ? MAX_INPUT_BUFFER : nSize);
            }
            else
            {
                memset(ptrHistory->inputBuffer, 0, MAX_INPUT_BUFFER);
            }
            Status = ST_SUCCESS;
            break;
        }

        if (count > MIN_HISTORY + 1 && count < MAX_HISTORY)
        {
            --count;
        }
        else
        {
            if (bRoundOffFlag)
            {
                count = MAX_HISTORY - 1;
            }
            else
            {
                break;  /* Status is by default FAILURE so no need to set again */
            }
        }

    } while ((count != currHistoryIndex) && (historyData[count].entryFuncPtr != NULL));

    return Status;

}


/*****************************************************************************
 * FUNCTION
 *  GetHistoryPointer
 * DESCRIPTION
 *  Used to get the reference of the history buffer for a screen id
 * PARAMETERS
 *  scrnID          [IN]        
 *  ptrHistory      [IN]        
 * RETURNS
 *  U8 - Status
 *****************************************************************************/
U8 GetHistoryPointer(U16 scrnID, historyNode **ptrHistory)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S16 count = 0;
    U8 Status = ST_FAILURE;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_GET_HIST_SCRID_HDLR, scrnID, currHistoryIndex));

    count = currHistoryIndex;
    do
    {
        if (scrnID == historyData[count].scrnID)
        {
            *ptrHistory = &historyData[count];
            Status = ST_SUCCESS;
            break;
        }

        if (count > MIN_HISTORY + 1 && count < MAX_HISTORY)
        {
            --count;
        }
        else
        {
            if (bRoundOffFlag)
            {
                count = MAX_HISTORY - 1;
            }
            else
            {
                break;  /* Status is by default FAILURE so no need to set again */
            }
        }

    } while ((count != currHistoryIndex) && (historyData[count].entryFuncPtr != NULL));

    return Status;

}


/*****************************************************************************
 * FUNCTION
 *  GetHistoryScrID
 * DESCRIPTION
 *  Used to get the reference of the history buffer for a screen id
 *  
 *  Please change to use GetHistoryPointer,
 *  rather than GetHistoryScrID
 * PARAMETERS
 *  scrnID          [IN]        
 *  ptrHistory      [IN]        
 * RETURNS
 *  U8 - Status
 *****************************************************************************/
U8 GetHistoryScrID(U16 scrnID, historyNode **ptrHistory)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return GetHistoryPointer(scrnID, ptrHistory);
}


/*****************************************************************************
 * FUNCTION
 *  GetNHistory
 * DESCRIPTION
 *  Used to get the history for a screen id, and also the history buffer size
 * PARAMETERS
 *  scrnID          [IN]        
 *  ptrHistory      [IN]        
 * RETURNS
 *  U8 - Status
 *****************************************************************************/
U8 GetNHistory(U16 scrnID, history *ptrHistory)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S16 count = 0;
    U8 Status = ST_FAILURE;
    U16 size;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_GET_NHIST_HDLR, scrnID, currHistoryIndex));

    count = currHistoryIndex;
    do
    {
        if (scrnID == historyData[count].scrnID)
        {
            ptrHistory->entryFuncPtr = historyData[count].entryFuncPtr;
            ptrHistory->scrnID = historyData[count].scrnID;
            if (historyData[count].guiBuffer)
            {
                memcpy(ptrHistory->guiBuffer, historyData[count].guiBuffer, MAX_GUI_BUFFER);
            }
            else
            {
                memset(ptrHistory->guiBuffer, 0, MAX_GUI_BUFFER);
            }
            if (historyData[count].inputBuffer)
            {
                memcpy((PS8) & size, historyData[count].inputBuffer, 2);
                memcpy(ptrHistory->inputBuffer, (PS8) (historyData[count].inputBuffer + 2), size);
            }
            else
            {
                memset(ptrHistory->inputBuffer, 0, MAX_INPUT_BUFFER);
            }
            Status = ST_SUCCESS;
            break;
        }

        if (count > MIN_HISTORY + 1 && count < MAX_HISTORY)
        {
            --count;
        }
        else
        {
            if (bRoundOffFlag)
            {
                count = MAX_HISTORY - 1;
            }
            else
            {
                break;  /* Status is by default FAILURE so no need to set again */
            }
        }

    } while ((count != currHistoryIndex) && (historyData[count].entryFuncPtr != NULL));

    return Status;

}


/*****************************************************************************
 * FUNCTION
 *  CheckIsBackHistory
 * DESCRIPTION
 *  Is in GoBackHistory
 *  
 *  This is typically used by entry function
 * PARAMETERS
 *  void
 * RETURNS
 *  pBOOL
 *****************************************************************************/
pBOOL CheckIsBackHistory(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return IsBackHistory;
}


/*****************************************************************************
 * FUNCTION
 *  GoBackHistory
 * DESCRIPTION
 *  deletes previous screen history
 *  
 *  This is used to delete previous screen history
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
#if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
extern BOOL DirectMode;
extern void CallBackPowerOnAnimationCompleteWrapper(void);
#endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */ 

void GoBackHistory(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
#if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
    BOOL Exit_From_FM = (DirectMode && currHistoryIndex == -1);
#endif 

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
    if (redraw_in_small_screen_proceduer())
    {
        return;
    }
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 

    MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_GO_BACK_HIST_HDLR));

    ExecutePopHistory();

#if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
    if (Exit_From_FM)
    {
        CallBackPowerOnAnimationCompleteWrapper();
    }
#endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */ 

}


/*****************************************************************************
 * FUNCTION
 *  GoBackToHistory
 * DESCRIPTION
 *  Goes back to specified screen
 * PARAMETERS
 *  scrnid      [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
U8 GoBackToHistory(U16 scrnid)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S16 count = 0;
    U8 Status = ST_FAILURE;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
    if (redraw_in_small_screen_proceduer())
    {
        return ST_SUCCESS;
    }
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 

    MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_GO_BACK_TO_HIST_HDLR, scrnid));

    count = currHistoryIndex;

    do
    {
        if (historyData[currHistoryIndex].scrnID == scrnid)
        {
            Status = ST_SUCCESS;
            break;
        }

        /* Chack added when amit is doing testing on h/w for call management */
        if (currHistoryIndex > 0)
        {
            if (decrement() == MMI_HIST_STOP_DELETING)
            {
                /* We abort the process here and don't handle original requirement */
                Status = ST_SUCCESS;
                break;
            }
        }
    } while ((count != currHistoryIndex) && (historyData[currHistoryIndex].entryFuncPtr != NULL)
             && (currHistoryIndex > 0));

    if (Status)
    {
        ExecutePopHistory();
    }
    else if (currHistoryIndex > -1)
    {
        /* To make sure the callback will run at topist screen */
        ExecTopScrnCallbackHandler();
        (*(historyData[0].entryFuncPtr)) ();
        currHistoryIndex = -1;
    }

    return Status;
}


/*****************************************************************************
 * FUNCTION
 *  GoBacknHistory
 * DESCRIPTION
 *  Goes 'n' screens back
 * PARAMETERS
 *  nHistory        [IN]        
 * RETURNS

⌨️ 快捷键说明

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