mmiouteridle.c
来自「是一个手机功能的模拟程序」· C语言 代码 · 共 1,532 行 · 第 1/3 页
C
1,532 行
/******************************************************************************
$Project name: Basic MMI
$File: tdouterIdle.c
$Author: talcon hu
$Date: 2003-12-12
$Description:外屏实现implement file
$History:
*******************************************************************************/
#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 "p_sim.h"
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_lng.h"
#include "mfw_edt.h"
#include "mfw_cm.h"
#include "mfw_phb.h"
#include "mfw_sms.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_tim.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "mfw_sat.h"
#include "dspl.h"
#include "MmiMmi.h"
#include "ksd.h"
#include "psa.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMain.h"
#include "MmiStart.h"
#include "MmiMenu.h"
#include "MmiBookController.h"
#include "MmiBookUtils.h"
#include "MmiCall.h"
#include "MmiNetwork.h"
#include "MmiIcons.h"
#include "MmiEditor.h"
#include "MmiSounds.h"
#include "MmiUserData.h"
#include "MmiSoftKeys.h"
#include "MmiPins.h"
#include "MmiDialogs.h"
#include "MmiIdle.h"
#include "MmiNetwork.h"
#include "MmiSettings.h"
#include "MmiSmsIdle.h"
#include "mfw_ffs.h"
#include "MmiSmsBroadcast.h"
#include "MmiCPHS.h"
#ifdef MMI_HOMEZONE_ENABLED
#include "MmiHomezone.h" /* SPR759 - SH*/
#endif
#include "gdi.h"
#include "audio.h"
#include "GameDisplay.h"//zy add 09/18
#include "cus_aci.h"
#include "p_sim.h"
//GW-Remove? #include "pcm.h"
#include "pwr.h" //hxl add for charger
#include "mmicharging.h"
#include "mmiservices.h" //wufei add
#include "fieldtest.h"
#include "L1tm_cust_add.h" //hxl add for pcsync 2003-1-5
#ifdef QQFUNC//hxl add for qq func switch,2003-3-24
#include "mmiqq.h"
#endif
#include "td.h"
/*2003/11/20,talcon add */
//#define TDTRACE 1
#include "mmiutilapi.h"
#include "mmiouterIdle.h"
#include "mmiiconresource.h"
#include "..\bmi\icons\OuterScreenIcn.h"//shiheng 0810 add
#ifndef OUTERIDLE_FOR_FTA
#define TIME_OUTERIDLEANIM 700
T_outerIdle outerIdledata;
static U32 GlobalIconStatus_Outer; //2004/03/11 Sunny add
static U32 GlobalStatusNeedAnimation;//2004-04-22 Sunny add
static char *GlobalPar_Outer;
static UBYTE IsMissedCallAndSms = 0;//2004-04-02 Sunny add
extern UBYTE OlderCurrentBatPicNum; //2004-04-01 Sunny add
extern int NotCharingMode; /* 2004/07/05 sunsj modify */
extern T_idle idle_data; // 2004/07/12 yhf add
//private
int outerIdle_tim (MfwEvt e, MfwTim *t);
int outerIdleRefresh_tim(MfwEvt e, MfwTim *t);//2004/03/11 Sunny add
void drawOuterIdleZone1();
void drawOuterIdleZone2();
void drawOuterIdle();
void drawOuterIdleMissedCallAndSms();//2004-04-02 Sunny add
//2004/03/11 Sunny add
void DrawOuterNotifyIcon();
void DrawOuterSeceneMode(U8 scenestatus);
void InitialIconState();
void DisplayIncomingCall(char *par);//2004/03/23 Sunny add
//2004/03/11 Sunny add end
//extern declareation
extern const MfwIcnAttr OTsmsicns[];
extern pwr_Status_Type pwr_Status;
extern UBYTE CurrentBatPicNum;
extern UBYTE BlinkBatPicnum;//2004-03-20 Sunny add
/* zhq, 2004/07/08, add for we use pin_outer_wait to init sub screen
and we do not refresh untile main screen drawIdle. */
extern UBYTE main_sreen_init_complete;
extern void GetTimeDate(int year,short month,short day,TIMEDATE *today);
extern int iconsShowSignal_Sub (U8 signalstatus);
extern void SetChargingIcon_Sub( U8 BatteryCount);
extern void GetBatPicnum(void);
extern void draw_popup_background_sub(void);//2004-04-01 Sunny add
/* 2004/04/16 sunsj add */
int DisplayOuterNumber(int coor_x, int coor_y, int iconwidth, int iconheight, void * BmpPtr);
int DisplayOuterDate(char *date);
int DisplayOuterTime(char *time, int time_type_flag);
void InitNeedAnimID();
void DrawAnimation(U8 index);
void GetTimeString(char * line);
void outerIdleInit()
{
GlobalIconStatus_Outer = 0; //2004/03/11 Sunny add
InitialIconState();//2004/03/11 Sunny add
memset(&outerIdledata,0,sizeof(outerIdledata) );
outerIdledata.outeridletimer = timCreate(0,TIME_OUTERIDLEANIM,(MfwCb)outerIdle_tim);
//2004-03-20 Sunny remove
//outerIdledata.chargetimer = timCreate(0,1000,(MfwCb)outerIdleCharge_tim);
outerIdledata.refreshtimer = timCreate(0,1000,(MfwCb)outerIdleRefresh_tim);
/* 2004/07/08 sunsj remove. Outer lcd initialize before ffs, so the wallpaper of outer idle is always 0. */
//setOuterState(OUTERIDLESTATE_REFRESH,1,0);
InitNeedAnimID(); //2004-04-22 Sunny add
}//
void outerIdleExit()
{
timDelete(outerIdledata.outeridletimer);
//timDelete(outerIdledata.chargetimer);//2004-03-20 Sunny remove
}
/****************************************
$Descriptio:外屏动画timer
******************************************/
int outerIdle_tim (MfwEvt e, MfwTim *t)
{
U8 uScreenType;
timStop(outerIdledata.outeridletimer);
if( outerIdledata.nAnimTimes != -1 ) //-1:forever
{
if( outerIdledata.nAnimTimes==0 )
{
setOuterState(outerIdledata.nIdleCurState,0,0);//2004-03-23 Sunny modify
return 1;
}
else if( outerIdledata.nAnimTimes >0 )
{
outerIdledata.nAnimTimes --;
}
}
//2004-04-22 Sunny add
if( !(outerIdledata.nIdleCurState & outerIdledata.nIdleState) )
{
return 1;//stop
}
DrawAnimation(outerIdledata.nIdxAnim);
outerIdledata.nIdxAnim++;
outerIdledata.nIdxAnim = outerIdledata.nIdxAnim % outerIdledata.nTotalAnim;
//2004-04-22 Sunny add end
#if 0 //2004-04-22 Sunny remove
uScreenType = dspl_SetScreenType(1);
outerIdledata.nIdxAnim = drawAnimIcons(outerIdledata.curIcnAttr,outerIdledata.nIdxAnim);
dspl_SetScreenType(uScreenType);
#endif
if( outerIdledata.nIdxAnim != 0xff )
timStart(outerIdledata.outeridletimer);
else
outerIdledata.nIdxAnim = 0;
return MFW_EVENT_CONSUMED;
}
#if 0 //2004-03-18 Sunny remove
/****************************************
$Description:外屏 charge 动画 timer
******************************************/
int outerIdleCharge_tim (MfwEvt e, MfwTim *t)
{
U8 uScreenType = dspl_SetScreenType(1);
timStop(outerIdledata.chargetimer);
if( outerIdledata.nChargeCurIcn==4 )
outerIdledata.nChargeCurIcn-=1;
outerIdledata.nOldChargePicNum = outerIdledata.nChargeCurIcn + outerIdledata.nChargeOffset;
if( outerIdledata.nChargeState == OUTERIDLECHARGE_NORMAL )
SetChargingIcon_Sub(outerIdledata.nOldChargePicNum );
else
SetChargingIcon_Sub(outerIdledata.nOldChargePicNum );
//2004-03-18 Sunny modify
if( outerIdledata.nOldChargePicNum==4 )
{
//2004-03-10 Sunny add
outerIdledata.nChargeOffset=(outerIdledata.nChargeOffset+1)%(5-outerIdledata.nChargeCurIcn);
GetBatPicnum();
outerIdledata.nChargeCurIcn=CurrentBatPicNum;
//2004-03-10 Sunny add end
}
else
{
outerIdledata.nChargeOffset=(outerIdledata.nChargeOffset+1)%(5-outerIdledata.nChargeCurIcn);
}
//2004-03-18 Sunny modify end
if( pwr_Status.charger_plugged == 1 && pwr_Status.charging_state!=0 )
{
timStart(outerIdledata.chargetimer);
}
//2004-03-10 Sunny add for displaying the actual value.
else if( (pwr_Status.charger_plugged == 0) || (pwr_Status.charging_state == 0) )//no charging and full
{
pdspl_colorTextOut(10,15,DSPL_TXTATTR_WHITE_EDGE,"UnPlug",0);
GetBatPicnum();
SetChargingIcon_Sub(CurrentBatPicNum);
outerIdledata.nChargeState = OUTERIDLECHARGE_NONE;
timStop(outerIdledata.chargetimer);
}
//2004-03-10 Sunny add end
dspl_SetScreenType(uScreenType);
return MFW_EVENT_CONSUMED;
}
#endif
/****************************************
$Description:外屏 charge 动画 timer
********2004/03/11,Sunny create
******************************************/
void DisplayOuterIdleCharge(U8 curBatNum)
{
U8 uScreenType = dspl_SetScreenType(1);
SetChargingIcon_Sub(curBatNum);
dspl_SetScreenType(uScreenType);
}
/*********************************************************
$Function:outerIdleRefresh_tim
$Description:refresh the outer screen
$History:
********2004/03/11,Sunny create
**********************************************************/
int outerIdleRefresh_tim(MfwEvt e, MfwTim *t)
{
timStop(outerIdledata.refreshtimer);
drawOuterIdle();
timStart(outerIdledata.refreshtimer);
return MFW_EVENT_CONSUMED;
}
#if 0 //2004-03-21 Sunny remove
/****************************************
$Arguments:
flags:OUTERIDLECHARGE_XXX
$History:
**********2003/12/23,talcon create
*************************************************/
void setChargeState(U8 flags,void *para)
{
//2004-03-18 Sunny add
U8 uScreenType = dspl_SetScreenType(1);
if( flags && pwr_Status.charger_plugged==0 )
{
flags = OUTERIDLECHARGE_NONE;
}
switch( flags )
{
case OUTERIDLECHARGE_NONE:
if( outerIdledata.nChargeState )
{
//2004-03-10 Sunny add for displaying the actual value.
GetBatPicnum();
SetChargingIcon_Sub(CurrentBatPicNum);
//2004-03-10 Sunny add end
outerIdledata.nChargeState = OUTERIDLECHARGE_NONE;
//timStop(outerIdledata.chargetimer);//2004-03-20 Sunny remove
}
break;
case OUTERIDLECHARGE_NORMAL:
case OUTERIDLECHARGE_OFF:
if( outerIdledata.nChargeState == OUTERIDLECHARGE_NONE )
{
outerIdledata.nChargeState = OUTERIDLECHARGE_NORMAL;
//2004-03-10 Sunny add
GetBatPicnum();
outerIdledata.nChargeCurIcn = CurrentBatPicNum;
outerIdledata.nChargeOffset = 0;
//2004-03-10 Sunny add end
//timStart(outerIdledata.chargetimer);//2004-03-20 Sunny remove
}
break;
}
//2004-03-18 Sunny add
dspl_SetScreenType(uScreenType);
}//end setChargeState
#endif
/****************************************
$Arguments:
reason:OUTERIDLEEVENT_XXX
$History:
**********2003/12/22,talcon create
*************************************************/
void outeridleExec (int reason,void* para)
{
U8 uScreenType ;
if( reason & OUTERIDLEEVENT_TIME )
{
//drawOuterIdleZone2();
drawOuterIdle();
return;
}
uScreenType = dspl_SetScreenType(1);
if( reason & OUTERIDLEEVENT_SIGNAL )
{
iconsShowSignal_Sub(globalSignalPicNumber);
}
if( reason & OUTERIDLEEVENT_BATTERY )
{
//2004-03-26 Sunny add
if( (pwr_Status.charger_plugged==0) ||(pwr_Status.charging_state == 0) )
{
GetBatPicnum();
SetChargingIcon_Sub(CurrentBatPicNum);
}
//2004-03-26 Sunny add end
}
//2004/03/11 Sunny add for refresh the outer screen.
if( reason & OUTERIDLEEVENT_REFRESH )
{
drawOuterIdle();
}
//2004/03/11 Sunny add for refresh the outer screen end
dspl_SetScreenType(uScreenType);
}
/****************************************
$Arguments:
@flags:OUTERIDLESTATE_XXX
@mask: 1 启动该通知事件
0 结束该通知事件
$History:
**********2003/12/13,talcon create
**********2003-03-23 Sunny add a parameter par
*************************************************/
void setOuterState(U32 flags,UBYTE mask,char *par)
{
char strDebug[100];
U32 oldflags = outerIdledata.nIdleCurState;
//2004-04-07 Sunny add. Only refresh the outer screen.
if( flags == OUTERIDLESTATE_REFRESH )
{
drawOuterIdle();
return;
}
//2004-04-07 Sunny add end
if( mask == 0 )
{
/* 2004/07/12 sunsj modify for outer event priority */
if( flags > outerIdledata.nIdleCurState )
{
timStop(outerIdledata.outeridletimer);
}
outerIdledata.nIdleState &= ~flags;
//2004-04-07 Sunny add
if( flags == OUTERIDLESTATE_INCOMING )
{
GlobalPar_Outer = 0;
}
//2004-04-07 Sunny add end
}
else
{
/* 2004/07/09 sunsj Judge the state priority if the new state is the highter so
Clear the state because there is only one state can be exist at the same time */
if( flags == OUTERIDLESTATE_INCOMING )
{
outerIdledata.nIdleState &= ~( OUTERIDLESTATE_ALERT|OUTERIDLESTATE_SMS );
outerIdledata.nIdleState |= flags;
}
else if( flags == OUTERIDLESTATE_SMS )
{
outerIdledata.nIdleState &= ~OUTERIDLESTATE_ALERT;
outerIdledata.nIdleState |= flags;
}
outerIdledata.nIdleState |= flags;
//2004-04-07 Sunny add
if( flags == OUTERIDLESTATE_INCOMING )
{
GlobalPar_Outer = par;
}
//2004-04-07 Sunny add end
}
drawOuterIdle();// refresh zone1
//get state of highest priority
outerIdledata.nIdleCurState = 0x80000000;
while( outerIdledata.nIdleCurState )
{
if( outerIdledata.nIdleCurState & outerIdledata.nIdleState )
{
break;
}
outerIdledata.nIdleCurState >>= 1;
}
drawOuterIdle();// refresh zone2
if( flags < outerIdledata.nIdleCurState )
{
return;
}
//2004/06/04 yhf modify
/*switch(outerIdledata.nIdleCurState)
{
case OUTERIDLESTATE_INCOMING:
outerIdledata.nAnimTimes = -1;
outerIdledata.nIdxAnim = 0;
outerIdledata.nTotalAnim = sizeof(CallIcns) / sizeof(MfwIcnAttr);
outerIdledata.curIcnAttr = (MfwIcnAttr*)CallIcns;
outerIdledata.curIcnAttr_mask = (MfwIcnAttr*)CallIcns_mask;
timStart(outerIdledata.outeridletimer);
break;
case OUTERIDLESTATE_ALERT:
outerIdledata.nAnimTimes = -1;
outerIdledata.nIdxAnim = 0;
outerIdledata.nTotalAnim = sizeof(AlarmIcns) / sizeof(MfwIcnAttr);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?