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

📄 mmiectimedate.c

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

                    Mobile Innovation

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

 This software product is the property of Mobile Innovation 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:		MMI
 $File:		    MmiEcTimeDate.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		zhu guangzhao                                                      
 $Date:		2002.8.26                                       
                                                                               
********************************************************************************
                                                                              
 Description:

  

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

ver 1.0
*******************************************************************************/


#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 "mfw_sys.h"
#include "p_sim.h"

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

//#include "mfw_sys.h"

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

#include "mfw_mfw.h"
#include "mfw_win.h"

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

#include "dspl.h"

#include "gdi.h" //ES!!

#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 "MmiIdle.h"
#include "MmiStart.h"
#include "MmiPins.h"
#include "MmiecTimeDate.h"
#include "MmiSounds.h"
#include "audio.h"
#include "cus_aci.h"
#include "p_sim.h"

#include "rtc_api.h"  // zgz add,2002.8.15 Mobile Innovation
#include "mmisettings.h"
//#include "bmieastapi.h"
#include "mmibookshared.h"
#include "Gamedisplay.h"
#include "mmiouterIdle.h" //2004-04-05 Sunny add

//wyj
#include "TdDisplay.h"
//#include "mmiicnother.h"  //2004/05/17 yhf add


#define CLEAR_BOTTOM_ZONE dspl_Clear( KEY_AREA );

extern const unsigned char alarmBit[];
extern const unsigned char alarmBitMask;
//extern const unsigned char icnMnuListBkg[];// 2004/05/20 yhf remove

extern              Draw_Line;
static T_MFW_HND    tida_win  = NULL;
static uint8        tmpSwitch = 0;//gdy add

typedef struct
{
    T_MMI_CONTROL   mmi_control;
    T_MFW_HND       parent_win;
    T_MFW_HND       win;
    T_MFW_HND       kbd_win;
    T_MFW_HND       tim_win;
    CLOCK           temp_time;
    char            date_string[12];
    char            time_string[10];  
    int             index;
    int             id;  
    BOOL            AMPM_index;
    int             position_flag;// 1-设时间	2-设小时制 3-设AM/PM
    int             tmode_flag;   // 1-12小时制 2-24小时制
} tidaData;//wyj

typedef struct
{
    T_MMI_CONTROL    mmi_control;
    T_MFW_HND        parent_win;
    T_MFW_HND        win;
    T_MFW_HND        kbd_win;
}browseAlarmData;

/* 时间日期设置 */
static T_MFW_HND    timedate_create(T_MFW_HND parent_window);//gdy add
static void         tida_DialogCB (T_MFW_HND win, USHORT event, SHORT value, void * parameter);//gdy add
static int          timeDate_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);//gdy add
static T_MFW_CB     timedate_tim_cb(MfwEvt e, MfwTim *tc);//gdy add
static int          timedate_kbd_cb(MfwEvt e, MfwKbd *kc);//gdy add
static void         timedate_destroy (T_MFW_HND own_window);//gdy add
static void         tida_dialog_cb(T_MFW_HND win, USHORT event, UBYTE reason);//gdy add infodialog cb

/* 检查输入 */
static int          check_time(T_MFW_HND win, tidaData * edt_data); //日期时间检查
static int          check_date(T_MFW_HND win, tidaData * edt_data); //日期时间检查
static int          check_time1(T_MFW_HND win, void* edt_dat);      //闹钟检查
static int          check_date1(T_MFW_HND win, void * edt_dat);     //闹钟检查

/* 闹钟设置 */
static void         date_time_edt_destroy  (T_MFW_HND own_window);
static T_MFW_HND    date_time_edt_create(T_MFW_HND parent_window);
static int          tida_edt_kbd_cb (MfwEvt e, MfwKbd *kc);
static void         tida_editor(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int          tida_edt_win_cb  (T_MFW_EVENT event,T_MFW_WIN * win);
static int          tida_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static void         tida_main(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static void         date_time_destroy  (T_MFW_HND own_window);
static T_MFW_HND    date_time_create (T_MFW_HND parent_window);


static void         reset_edt_attr_sett(U16 winPx,U16 winPy,U16 winSx,U16 winSy,U8 fgColor,U8 font,U8 mode,
                                        U8 *controls, char *text,U16 size,MfwEdtAttr* attr);

static int          updateRtcDate(Date newDate);  // zgz,2002.8.15 Mobile Innovation
static int          updateRtcClock(CLOCK newClock);  // zgz,2002.8.15 Mobile Innovation



//zgz,2002.8.23  functions define for the world time
static T_MFW_HND    worldTime_create (T_MFW_HND parent_window);
static int          worldTime_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static T_MFW_CB     worldTime_tim_cb(T_MFW_EVENT event, T_MFW_TIM *tc);
static void         worldTime_main(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static void         worldTime_destroy(T_MFW_HND own_window);
static int          wt_kbd_cb(MfwEvt e, MfwKbd *kc);
static int          getLastDate(Date *d); // set d to it's last date
static int          getNextDate(Date *d); // set d to it's next date
static void         drawTimeZoneLine(int timezone); //timezone from 0 to 24
static int          adjustTimeDate(int curTimeZone);


static T_MFW_HND    weeklyAlarmStart(T_MFW_HND parent);
static T_MFW_HND    weeklyAlarmCreate(T_MFW_HND parent_window);
static void         weeklyAlarmCb(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int          weeklyAlarmWinCb(T_MFW_EVENT event, T_MFW_WIN * win);
static void         weeklyAlarmMenuCb(T_MFW_HND * Parent, ListMenuData * ListData);
static void         weeklyAlarmDestroy(T_MFW_HND own_window);

static T_MFW_HND    browseAlarm_create(T_MFW_HND parent_window);
static void         browseAlarm_DialogCb(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int          browseAlarm_kbd_cb (MfwEvt e, MfwKbd *kc);
static void         browseAlarm_destroy(T_MFW_HND own_window);




/*bmpWidth:120,bmpHigh:80*/

/*After convert 24-bit bmp to 16-bit(565) bmp,
    the datas of 16-bit bmp as follows:*/
/*Note:	RG is combined to make Data[1],GB is combined to make Data[0]. 
    This file is arranged by Data[0],Data[1],...,and so on */

/* 2004/05/20 yhf remove */
/*extern const unsigned char world_bmp[];
extern const unsigned char gImage_bar[];
extern const unsigned char left_key[];
extern const unsigned char left_key_mask[];
extern const unsigned char right_key[];
extern const unsigned char right_key_mask[];*/




const  char *weekdays[] =
{
    "\x80\x65\xe5\x00\x00", //日
    "\x80\x4e\x00\x00\x00", //一
    "\x80\x4e\x8c\x00\x00", //二
    "\x80\x4e\x09\x00\x00", //三
    "\x80\x56\xdb\x00\x00", //四
    "\x80\x4e\x94\x00\x00", //五
    "\x80\x51\x6d\x00\x00", //六
};

const char *weekdayes[] =
{
    "Sun","Mon","Tue","Wed","Thu","Fri","Sat"
};

static      MfwHnd  win;                      /* our window               */
static      DisplayData DisplayInfo;
T_MFW_HND   weeklyAlarm_win;

#define MAX_DIG_TIDA		20	        /* size of buffer (??)  */
#define MAX_LEN_DATE		11	        /* maximum number of digits date*/
#define MAX_LEN_TIME		6	        /* maximum number of digits time*/
#define DATE_TEXT_X         28
#define DATE_TEXT_Y         16

typedef enum
{
    DAILY_ALARM,
    WEEKLY_ALARM,
    SETTING
} timeDateMode;

typedef struct
{
    T_MMI_CONTROL     mmi_control;
    T_MFW_HND         parent_win;
    T_MFW_HND         tida_win;
    T_MFW_HND         weAl_win;  // weekly alarm win.
    USHORT            display_id1;
    USHORT            display_id2;
    DAT_TIME_CASE_EC  state;               /* setting state            */
    //UBYTE				mode;				//whether we're setting the current time/date or alarm.
} T_tida;

typedef struct
{
    T_MMI_CONTROL     mmi_control;
    T_MFW_HND         parent_win;
    T_MFW_HND         tida_edt_win;
    T_MFW_HND         kbd_handle;
    T_MFW_HND         kbd_long_handle;
    T_MFW_HND         editor_handle;
    T_MFW_HND         tim_out_handle;
    DAT_TIME_CASE_EC  state;               /* setting state            */
    char              edtbuf1[MAX_DIG_TIDA];
    BOOL              position;
    BOOL              AMANDPM;
    MfwEdtAttr        edit1Attr;
    UBYTE             index;
}T_tida_edt;


typedef struct
{
    T_MMI_CONTROL     mmi_control;
    T_MFW_HND         parent_win;
    T_MFW_HND         wt_win;
    T_MFW_HND         tim_win;
    USHORT            display_id;
    int               curTZ;          // current time zone. from 0 to 24
    int               curCity;  //current city indication at curTZ. from 1 to Total Nums.
} T_worldtime;

/* REASONS */
typedef enum
{
    WT_INITIAL,
    WT_UPDATE,
    WT_SETTED,
    WT_DESTROY
}WORLD_TIME_EVENT;

const int w12TxtId[] = {1, TxtKwajalein};  //The text ID of cities in west 12 zone.  the first element indicate the City Nums.
const int w11TxtId[] = {2, TxtMidwayIs, TxtSamoa};
const int w10TxtId[] = {2, TxtHawaii, TxtHonolulu};
const int w09TxtId[] = {1, TxtAlaska};
const int w08TxtId[] = {2, TxtLosAngeles, TxtSanFrancisco};
const int w07TxtId[] = {1, TxtDenver};
const int w06TxtId[] = {2, TxtChicago, TxtMexicoCity};
const int w05TxtId[] = {3, TxtNewYork, TxtLima, TxtMontreal};
const int w04TxtId[] = {2, TxtSantiago, TxtLaPaz};
const int w03TxtId[] = {2, TxtBrasilia, TxtRioDeJaneiro};
const int w02TxtId[] = {1, TxtMidAtlantic};
const int w01TxtId[] = {1, TxtCapeVerdeIs};
const int w00TxtId[] = {3, TxtLondon, TxtCasablanca, TxtLisbon};
const int e01TxtId[] = {4, TxtRome, TxtBerlin, TxtParis, TxtMadrid};
const int e02TxtId[] = {3, TxtAthens, TxtEasternEurope, TxtHelsinki};
const int e03TxtId[] = {3, TxtBaghdad, TxtKoweit, TxtMoscow};
const int e04TxtId[] = {1, TxtTbilisi};
const int e05TxtId[] = {1, TxtIslamabad};
const int e06TxtId[] = {2, TxtAlmaty, TxtDhaKa};
const int e07TxtId[] = {2, TxtBangkok, TxtJaKarta};
const int e08TxtId[] = {3, TxtBeiJing, TxtHongkong, TxtSingapore};
const int e09TxtId[] = {2, TxtSeoul, TxtTokyo};
const int e10TxtId[] = {3, TxtGuam, TxtSydney, TxtVladivostok};
const int e11TxtId[] = {1, TxtSolomonIs};
const int e12TxtId[] = {3, TxtFiji, TxtMarshallIs, TxtWellington};

const int *cityTxtid[] = {
    w12TxtId,
    w11TxtId,
    w10TxtId,
    w09TxtId,
    w08TxtId,
    w07TxtId,
    w06TxtId,
    w05TxtId,
    w04TxtId,
    w03TxtId,
    w02TxtId,
    w01TxtId,
    w00TxtId,
    e01TxtId,
    e02TxtId,
    e03TxtId,
    e04TxtId,
    e05TxtId,
    e06TxtId,
    e07TxtId,
    e08TxtId,
    e09TxtId,
    e10TxtId,
    e11TxtId,
    e12TxtId
};

static const uint8 weekMask[] ={
    SUNDAY_M,
    MONDAY_M,
    TUESDAY_M,
    WEDNESDAY_M,
    THURSDAY_M,
    FRIDAY_M,
    SATURDAY_M
};

static MfwMnuAttr weeklyAlarm_menuAttrib =
{
    0,
    &menuWeeklyArea,
    MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu       */
    -1,                                 /* use default font         */
    NULL,                               /* with these items         */

⌨️ 快捷键说明

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