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

📄 pwroncharger.c

📁 MTK6226修改平台UI的文件介绍
💻 C
📖 第 1 页 / 共 5 页
字号:
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ClearInputEventHandler(MMI_DEVICE_ALL);
}


/*****************************************************************************
 * FUNCTION
 *  PreChrKeyPadDummyHdlr
 * DESCRIPTION
 *  Keypad dummy function when pre-charge stage.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void PreChrKeyPadDummyHdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    DisplayPopup((U8*) GetString(STR_LOW_BATTERY), IMG_GLOBAL_WARNING, 0, UI_POPUP_NOTIFYDURATION_TIME, WARNING_TONE);
    return;
}
#endif /* MMI_ON_HARDWARE_P */ 


/*****************************************************************************
 * FUNCTION
 *  InitializeChargingScr
 * DESCRIPTION
 *  Initialization for power on charger.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void InitializeChargingScr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    InitUnicodeSupport();

    gdi_init();

    PhnsetReadGPIOSetting();

#ifdef __MMI_USB_SUPPORT__
    InitMMIUsbContext();
#endif 

    InitFramework();

    InitHardwareEvents();
    InitTime();
    InitMMI_App();
    setup_UI_wrappers();
    PopulateResData();
    initialize_UI_demo();
    ShowChargingScr();

    InitProfileApp();

    /* Precharge Power On */
#ifdef MMI_ON_HARDWARE_P
    if (g_pwr_context.PowerOnMode == POWER_ON_PRECHARGE)
    {
        SetProtocolEventHandler(PreChargeEnd, MSG_ID_MMI_EQ_LEAVE_PRECHARGE_IND);
    }
#endif /* MMI_ON_HARDWARE_P */ 

    TurnOnBacklight(1);

    InitDownloadNVRAM();
    initnvramprofapp();
    InitSettingNVRAM();
#if defined(__MMI_RING_COMPOSER__) && defined(__MMI_IMELODY_SUPPORT__)
    InitRingToneComposer();
#endif 

#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    PmgInitExtMelodyStruct();
#endif 

    InitAlarmFrameWork();

    StartLEDPatternCharging();
    g_charbat_context.PowerOnCharger = 1;
    AnimateStatusIcon(STATUS_ICON_SUBLCD_BATTERY_STRENGTH);
    UpdateStatusIcons();
    InitChargerPwrOn();
#ifdef MMI_ON_HARDWARE_P
    /* To wake up pending alarm */
    PendingAlarmReminder();
#endif /* MMI_ON_HARDWARE_P */ 
}


/*****************************************************************************
 * FUNCTION
 *  AlarmDisplayCharging
 * DESCRIPTION
 *  Handling of Charger connected on Power on Alarm screen.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void AlarmDisplayCharging(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_charbat_context.PowerOnCharger = 1;
    g_charbat_context.isChargerConnected = 1;
    StartLEDPatternCharging();
    ShowChargingScr();

    if (g_charbat_context.ChargingComplete)
    {
        HideStatusIcon(STATUS_ICON_SUBLCD_BATTERY_STRENGTH);
        ShowStatusIcon(STATUS_ICON_SUBLCD_BATTERY_STRENGTH);
    }
    else
    {
        AnimateStatusIcon(STATUS_ICON_SUBLCD_BATTERY_STRENGTH);
    }

    UpdateStatusIcons();
    InitChargerPwrOn();
}


/*****************************************************************************
 * FUNCTION
 *  ShowChargingScr
 * DESCRIPTION
 *  Show charging screen when phone bootup bcos of charger.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ShowChargingScr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 *guiBuffer;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    guiBuffer = GetCurrGuiBuffer(SCR_CHARGER_POWER_ON);

    EntryNewScreen(SCR_CHARGER_POWER_ON, ExitChargingScr, NULL, NULL);
    entry_full_screen();
    DinitHistory();
#ifdef MMI_ON_HARDWARE_P
    if (g_pwr_context.PowerOnMode == POWER_ON_PRECHARGE)
    {
        ShowCategory9Screen(0, IMG_CHARGER_POWER_ON, NULL);
    #ifndef __MMI_POWER_ON_OFF_BY_POWER_KEY__
        SetKeyHandler(PreChrKeyPadDummyHdlr, KEY_END, KEY_LONG_PRESS);
    #endif
        SetKeyHandler(PreChrKeyPadDummyHdlr, KEY_POWER, KEY_LONG_PRESS);    
        SetProtocolEventHandler(PreChargeEnd, MSG_ID_MMI_EQ_LEAVE_PRECHARGE_IND);
    }
    else
#endif /* MMI_ON_HARDWARE_P */ 
    {
        ShowCategory9Screen(0, IMG_CHARGER_POWER_ON, NULL);
    #ifndef __MMI_POWER_ON_OFF_BY_POWER_KEY__
        SetKeyHandler(ChargingPwnOnThanPwnOn, KEY_END, KEY_LONG_PRESS);
    #endif
        SetKeyHandler(ChargingPwnOnThanPwnOn, KEY_POWER, KEY_LONG_PRESS);            
    }

    ShowSubLCDScreen(ShowSubLCDChargingScr);
#ifndef __MMI_SUBLCD_CHARGING_HIDE_STATUS_BAR__
    ShowStatusIcon(STATUS_ICON_SUBLCD_BATTERY_STRENGTH);
    UpdateStatusIcons();
#endif /* __MMI_SUBLCD_CHARGING_HIDE_STATUS_BAR__ */ 

    g_charbat_context.PowerOnChargingPeriod = 1;

}


/*****************************************************************************
 * FUNCTION
 *  ExitChargingScr
 * DESCRIPTION
 *  Exit power on charging screen.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ExitChargingScr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    history Scr;    /* Variable to hold the history data */
    S16 nHistory = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    Scr.scrnID = SCR_CHARGER_POWER_ON;
    Scr.entryFuncPtr = ShowChargingScr;
    pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) & nHistory);
    AddHistory(Scr);
    leave_full_screen();
    g_charbat_context.PowerOnChargingPeriod = 0;
}


/*****************************************************************************
 * FUNCTION
 *  ShowSubLCDChargingScr
 * DESCRIPTION
 *  Show power on charging screen on SUBLCD.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ShowSubLCDChargingScr(void)
{
#ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (!IsClamClose())
    {
        ExecSubLCDCurrExitHandler();
        ShowCategory310Screen(get_string(STR_GLOBAL_LOGO));
        SetSubLCDExitHandler(ExitSubLCDChargingScr);
    }
    else
    {
        ExecSubLCDCurrExitHandler();
        ShowCategory304Screen(IMG_SUBLCD_CHARGER_POWER_ON, 0);
        SetSubLCDExitHandler(ExitSubLCDChargingScr);
    }
#else /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
    ExecSubLCDCurrExitHandler();
    ShowCategory304Screen(IMG_SUBLCD_CHARGER_POWER_ON, 0);
    SetSubLCDExitHandler(ExitSubLCDChargingScr);
#endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
}


/*****************************************************************************
 * FUNCTION
 *  ExitSubLCDChargingScr
 * DESCRIPTION
 *  Exit power on charging screen from sublcd.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ExitSubLCDChargingScr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SubLCDHistoryNode SubLCDHistory;

    SubLCDHistory.entryFuncPtr = ShowSubLCDChargingScr;
    AddSubLCDHistory(&SubLCDHistory);
}


/*****************************************************************************
 * FUNCTION
 *  InitChargerPwrOn
 * DESCRIPTION
 *  Initialise protocol handlers for power on charger.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void InitChargerPwrOn()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetProtocolEventHandler(BatteryStatusRsp, PRT_BATTERY_STATUS_IND);
#ifdef MMI_ON_HARDWARE_P
    SetProtocolEventHandler(PowerOffRsp, MSG_ID_MMI_EQ_POWER_OFF_RSP);
#endif 
}


/*****************************************************************************
 * FUNCTION
 *  ChargingPwnOnThanPwnOn
 * DESCRIPTION
 *  Fn to be called to power on the phone for long press of End key during power
 *  on charger.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ChargingPwnOnThanPwnOn()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* MMI should detect keypad power on itself when charging */
    MYQUEUE Message;
    mmi_eq_power_on_req_struct *myMsgPtr;

#if (defined(__MMI_SUBLCD__) && defined(MMI_ON_HARDWARE_P))
    lcd_power_on(SUB_LCD, 0);
#endif 

    LCDBackLightOff();

    myMsgPtr = (mmi_eq_power_on_req_struct*) OslConstructDataPtr(sizeof(mmi_eq_power_on_req_struct));
    myMsgPtr->fun = 1;
    myMsgPtr->rst = 0;
    PRINT_INFORMATION(("[DevMngr-PMIC] CHARGER POWERKEY_ON"));
    Message.oslSrcId = MOD_MMI;
    Message.oslDestId = MOD_L4C;
    Message.oslMsgId = MSG_ID_MMI_EQ_POWER_ON_REQ;
    Message.oslDataPtr = (oslParaType*) myMsgPtr;
    Message.oslPeerBuffPtr = NULL;
    OslMsgSendExtQueue(&Message);
    g_charbat_context.PowerOnCharger = 0;
}


/*****************************************************************************
 * FUNCTION
 *  BatteryStatusRsp
 * DESCRIPTION
 *  Call back function for battery status indication.
 * PARAMETERS
 *  info        [?]     
 * RETURNS
 *  void
 *****************************************************************************/
void BatteryStatusRsp(void *info)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MYQUEUE Message;
    mmi_eq_battery_status_ind_struct *p = (mmi_eq_battery_status_ind_struct*) info;

⌨️ 快捷键说明

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