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

📄 mmiautopower.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 4 页
字号:
/*******************************************************************************

                    CONDAT (UK)

********************************************************************************                                                                              

 This software product is the property of Condat (UK) Ltd and may not be
 disclosed to any third party without the express permission of the owner.                                 
                                                                              
********************************************************************************

 $Project name:	Basic MMI                                                      
 $Project code:	BMI (6349)                                                           
 $Module:		autopower
 $File:		    Mmiautopower.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
                                                                               
********************************************************************************
                                                                              
 Description

    This provides the main autopower functionality

  
********************************************************************************
 $History: MmiToolkit.c

    25/10/00			Original Condat(UK) BMI version.
    15/08/2002          gdy add
       
 $End

*******************************************************************************/
/******************************************************************************
                                                                              
                                Include Files
                                                                              
*******************************************************************************/
#define CLEAR_BOTTOM_ZONE dspl_Clear( KEY_AREA );
#define ENTITY_MFW

/* includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#if defined (NEW_FRAME)

    #include "typedefs.h"
    #include "vsi.h"
    #include "pei.h"
    #include "custom.h"
    #include "gsm.h"

#else

    #include "stddefs.h"
    #include "custom.h"
    #include "gsm.h"
    #include "vsi.h"

#endif
#include "MmiBookShared.h"
#include "MmiEditor.h"
#include "Mfw_edt.h"
#include "MmiDialogs.h"


#include "p_sim.h"

#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_edt.h"
#include "mfw_tim.h"
#include "mfw_phb.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_lng.h"
#include "mfw_sat.h"
#include "mfw_kbd.h"
#include "mfw_nm.h"
#include "mfw_sms.h"

#include "dspl.h"

#include "MmiMmi.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiIdle.h"
#include "MmiSoftkeys.h"
#include "MmiIcons.h"
#include "MmiMenu.h"
#include "MmiMain.h"
#include "MmiStart.h"
#include "MmiPins.h"
#include "MmiSettings.h"
#include "Gamedisplay.h"
#include "Mmitoolkit_timer.h"

#include "MmiEditor.h"
#include "MmiBookShared.h"
#include "MmiSmsMenu.h"
//#include "MmiStopwatch.h"
#include "Mmieditor.h"
#include "Mmieditor_i.h"
#include "Mmisounds.h"
#include "Mmilists.h"
//#include "Mmitoolkit.h"
#include "Mmitimedate.h"
#include "Mmiautopower.h"
#include "Rtc_api.h"

#include "gdi.h"
#include "Audio.h"
#include "MmiSounds.h"
#include "MmiResources.h"

#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
//#include "bmieastapi.h"

//wyj
#include "TdDisplay.h"

/******************************************************************************
                                                                              
                                                                                                             
*******************************************************************************/
typedef struct
{
    T_MMI_CONTROL     mmi_control;
    T_MFW_HND         parent_win;
    T_MFW_HND         editor_handle;
    T_MFW_HND         win;
    T_MFW_HND         info_tim;
    T_MFW_HND         kbd;
    T_EDITOR_DATA     editor_data;
    int               id;                 
    int               positon;
    BOOL              power_switch;
    BOOL              AMANDPM;
    char              time[6];
    char              ontime[6];
    char              offtime[6];
    MfwEdtAttr        editAttr;
    UBYTE             index;
}autodata;

typedef struct
{
    T_MMI_CONTROL     mmi_control;
    T_MFW_HND         parent_win;
    T_MFW_HND         win;
    T_MFW_HND         info_tim;
    T_MFW_HND         kbd;
    int               tim_num;
}confirmdata;

typedef struct
{
    T_MMI_CONTROL     mmi_control;
    T_MFW_HND         parent_win;
    T_MFW_HND         win;  
    T_MFW_HND         kbd;
}auto_browse_data;


typedef enum
{
    OPENTIME=0,
    CLOSETIME
}INTPUTSTATUS;

typedef enum
{
    AUTOPOWERON=0,
    AUTOPOWEROFF,
    DEACTIVIATE,
    AUTODESTROY
}AUTOSTATUS;


int static              time_status = OPENTIME;
extern T_RTC_DATE_TIME  timedate;
static MfwHnd           confirmtim;

extern void goodbye_cb (void);
extern      showGoodBye(T_MFW_HND win);

extern                      autopower_flag;
extern T_MFW_HND            alarm_win;
extern T_call               call_data;
extern BOOL                 call_win_flag;
/* 2004/05/20 yhf remove */
//extern const unsigned char	left_key_mask[];
//extern const unsigned char	right_key_mask[];


/* 自动开关机窗口相关 */
static T_MFW_HND    auto_create(MfwHnd parent_window);
static void         auto_DialogCB(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int          auto_kbd_cb (MfwEvt e, MfwKbd *kc);
void                auto_dialog_cb(T_MFW_HND win, USHORT event, UBYTE reason);
static int          auto_win_cb(T_MFW_EVENT event,T_MFW_WIN * win);
void                auto_destroy (T_MFW_HND own_window);

static void         reset_edt_attr_sett2(U16 winPx,U16 winPy,U16 winSx,U16 winSy,U8 fgColor,U8 font,U8 mode,
                                         U8 *controls, char *text,U16 size,MfwEdtAttr* attr,U8 dsplTitle);
/* 关机控制相关窗口 */
static T_MFW_HND    ConAutopower_create(MfwHnd parent_window);
static int          conAuto_win_cb(T_MFW_EVENT event,T_MFW_WIN * win);
static void         confirm_DialogCB(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int          confirm_kbd_cb (MfwEvt e, MfwKbd *kc);
void                conAuto_destroy (T_MFW_HND own_window);
static T_MFW_CB     confirm_tim_cb(T_MFW_EVENT event, T_MFW_TIM *tc);
static void         confirm_cb();
extern T_MFW_CB     autopower_tim_cb(MfwEvt e, MfwTim *tc);

/* 查看窗口相关 */
static T_MFW_HND    auto_browse_create(MfwHnd parent_window);
static void         autoBrowse_DialogCB(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int          autoBrowse_kbd_cb(MfwEvt e, MfwKbd *kc);
static void         autoBrowse_destroy(T_MFW_HND own_window);
void                autoBrowse_dialog_cb(T_MFW_HND win, USHORT event, UBYTE reason);

/* 2003.10.16 wyj 加入对自动关机设置输入框的检查 */
static void checkAutoNumInput(autodata *data, U8 keynum);
static void checkAutoLeftInput(autodata *data);
static void checkAutoRightInput(autodata *data);

/* 自动开关机 */
extern const TD_Rect    AU_input_rect;  
extern const TD_Attri   AU_input_attr1; 
extern const TD_Attri   AU_input_attr2;
extern const TD_Line    AU_index_l; 
extern const Color      AU_index_c; 
extern const TD_Rect    AU_SW_rect; 
extern const TD_Attri   AU_SW_attr;
extern const TD_Rect    AU_AP_rect; 
extern const TD_Attri   AU_AP_attr;


/* 查看状态菜单处理函数 */
int autoBrowse(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND           parent_win  = mfwParent( mfw_header());
    T_MFW_HND           win         = auto_browse_create(parent_win);

    if( win NEQ NULL )
    {
        SEND_EVENT (win, 0, 0, 0);
    }

    return 1;
}

/* 自动开关机的菜单响应函数 */
int autopoweron(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND           parent_win  = mfwParent( mfw_header());
    T_MFW_HND           win         = auto_create(parent_win);

    TRACE_EVENT("test for autopower");
    //zgzTraceData("FFS_flashData.opentime:",FFS_flashData.opentime);
    //zgzTraceData("FFS_flashData.closetime:",FFS_flashData.closetime);
    //TraceInt(FFS_flashData.closetime); 

    TRACE_EVENT("autopoweropen");

    if( win NEQ NULL )
    {
        SEND_EVENT (win, AUTOPOWERON, 0, 0);
    }

    return 1;
}

/* 自动关机菜单项的响应函数 */
int autopoweroff(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND           parent_win  = mfwParent( mfw_header());
    T_MFW_HND           win         = auto_create(parent_win);

    TRACE_EVENT("test for autopower");
    //zgzTraceData("FFS_flashData.opentime:",FFS_flashData.opentime);
    //zgzTraceData("FFS_flashData.closetime:",FFS_flashData.closetime);
    //TraceInt(FFS_flashData.closetime); 

    TRACE_EVENT("autopoweropen");

    if( win NEQ NULL )
    {
        SEND_EVENT (win, AUTOPOWEROFF, 0, 0);
    }

    return 1;
}

/* 关闭菜单项的响应函数 */
int autopowerclose(MfwMnu * m, MfwMnuItem * i)
{
    T_MFW_HND           parent_win = mfwParent( mfw_header());
    T_DISPLAY_DATA  display_info;
    // T_MFW_HND       	win    = auto_create(parent_win);
    //  T_RTC_DATE_TIME  date_time;
    //  T_RV_RETURN return_path;  
    //  char string[5];

    FFS_flashData.poweron_switch    = 0;
    FFS_flashData.poweroff_switch   = 0;

    dialog_info_init(&display_info);

    display_info.TextId2    = TxtDeActivated;
    display_info.Time       = FOREVER;
    display_info.iconindex  = REMIND_COMPLETE;

    info_dialog(parent_win, &display_info); 
    // if (win NEQ NULL)
    //    {
    //       	SEND_EVENT (win, DEACTIVIATE, 0, 0);
    //    } 

    return 1;
}
/* 查看状态的窗口创建函数 */
static T_MFW_HND auto_browse_create(MfwHnd parent_window)
{
    auto_browse_data *data = (auto_browse_data*)ALLOC_MEMORY (sizeof (auto_browse_data));
    T_MFW_WIN        *win;

    TRACE_EVENT("timer_create");
    if( data EQ NULL )
    {
        return NULL;
    }

    // Create window handler
    data->win = win_create (parent_window, 0, E_WIN_VISIBLE, 0);
    if( data->win EQ NULL )
    {
        return NULL;
    }
    // connect the dialog data to the MFW-window
    data->mmi_control.dialog    = (T_DIALOG_FUNC)autoBrowse_DialogCB;
    data->mmi_control.data      = data;
    win                         = ((T_MFW_HDR *)data->win)->data;
    win->user                   = (void *)data;
    data->parent_win            = parent_window;

    data->kbd = kbd_create(data->win,KEY_ALL,(T_MFW_CB)autoBrowse_kbd_cb);    


    return data->win;
}

/* 查看状态的事件处理函数 */
static void autoBrowse_DialogCB(T_MFW_HND win, USHORT event, SHORT value, void * parameter)
{
    T_MFW_WIN           *win_data   = ((T_MFW_HDR *)win)->data;
    auto_browse_data    *data       = (auto_browse_data*)win_data->user;
    T_DISPLAY_DATA      display_info;
    game_Line           line;
    char                string[8];

    dspl_ClearAll();
    /*  显示"已关闭"窗口 */
    if( (!FFS_flashData.poweron_switch)&&(!FFS_flashData.poweroff_switch) )

⌨️ 快捷键说明

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