📄 mmimain.c
字号:
break;
case KEY_4:
audio_PlaySoundID(0, TONES_DTMF_4, 0, 0 );
break;
case KEY_5:
audio_PlaySoundID(0, TONES_DTMF_5, 0, 0 );
break;
case KEY_6:
audio_PlaySoundID(0, TONES_DTMF_6, 0, 0 );
break;
case KEY_7:
audio_PlaySoundID(0, TONES_DTMF_7, 0, 0 );
break;
case KEY_8:
audio_PlaySoundID(0, TONES_DTMF_8, 0, 0 );
break;
case KEY_9:
audio_PlaySoundID(0, TONES_DTMF_9, 0, 0 );
break;
case KEY_STAR:
audio_PlaySoundID(0, TONES_DTMF_STAR, 0, 0 );
break;
case KEY_HASH:
audio_PlaySoundID(0, TONES_DTMF_HASH, 0, 0 );
break;
default:
break;
}
}
}
// toggle the variable
if( toggle )
{
toggle = FALSE;
}
else
{
toggle = TRUE;
}
return 0;
}
/*******************************************************************************
$Function: key
$Description: keyboard event handler
$Returns: none.
$Arguments:
*******************************************************************************/
// switching the mobile on
static int key (MfwEvt e, MfwKbd *kc)
{
TRACE_FUNCTION("Initial key");
//---------------start : Mobile On-------------------
TRACE_EVENT(" Mobile ON");
/* set the state of mobile on */
globalMobileMode = (globalMobileMode | GlobalMobileOn);
//startExec(PhoneInit,0); /* get it rolling */
return 1;
}
/*******************************************************************************
$Function: globalMme
$Description: MME event handler
$Returns: none.
$Arguments:
*******************************************************************************/
int globalMme(MfwEvt e, MfwHnd para) ///zym revised
{
MfwMme* mc = (MfwMme*)para;
U8 value;
// char buf[40]; //nm test only
//TRACE_EVENT("globalMme");
switch( e )
{
case MfwMmeSignal :
value = (U8)mc->value;//JVJE
globalSignalUpdate(value); /*Update the value of the fieldstrength */
//2003/12/24,talcon add fout outerIdle
outeridleExec(OUTERIDLEEVENT_SIGNAL,0);
break;
case MfwMmeBattery://no charger
value = (U8)mc->value;
globalBatteryUpdate(value); /* this update the BatPicNum */
/* only if Mobile on, Battery inside and Charger Disconnect */
//2003/12/24,talcon add fout outerIdle
outeridleExec(OUTERIDLEEVENT_BATTERY,0);
break;
case MfwMmeBaState://charger in it,hxl add
value = (U8)mc->value;
switch( value )
{
/* External Power Plugged Off */
case 0:
globalMobileMode = globalMobileMode & (~GlobalCharging);
globalMobileMode = globalMobileMode & (~GlobalBatteryPower);
///zym
// power_battery_information(); ///zym 030109 no use
break;
/* Mme Event: External Power Connected or End of Charge */
case 1:
globalMobileMode = globalMobileMode & (~GlobalCharging);
globalMobileMode = (globalMobileMode | GlobalBatteryPower);
/* indicate that the battery is full*/
globalBatteryMode = GlobalBatteryFull;
idleEvent(IdleUpdate);
break;
/* Mme Event: Start of Charge */
case 2:
globalMobileMode = globalMobileMode & (~GlobalBatteryPower);
globalMobileMode = (globalMobileMode | GlobalCharging);
// globalFlashBattery (); //hxl delete,for deal the charger in phone
break;
default:
break;
}
break;
default:
return 1;
}
return 1;
}
/*******************************************************************************
$Function: backlight
$Description: switch on backlight for certain time
$Returns: none.
$Arguments:
*******************************************************************************/
static void backlight (void)
{
//JVJE scrLight(1);
// nm15.02.01
// this timer is used for backlight
// the B-Sample dont support backlight
//nm timStart(tim);
}
/*******************************************************************************
$Function: timesEvent
$Description: times event clock
$Returns: none.
$Arguments:
*******************************************************************************/
extern UINT32 status_reg_value1;
extern UINT32 status_reg_value2;
extern UINT32 status_reg_value3;
static int timesEvent (MfwEvt e, MfwTim *t)
{
int minold,GprsStatusResult,GPRSAutoAttachResult,gprsStatus;/*zy add 2003-03-19 gprsStatus*/
static int ffsWaitWrite=20;
#ifdef QQFUNC//hxl add for qq func switch,2003-3-24
static int QQreadtim=0;//hxl for qq read sms check,if don't have this element,check malloc will don't be free,2003-3-14
#endif
static int GPRSTryControl=2;
static int UartInit=1;
//zhonghz,get time from rtc every 30 second
//DO NOT via soft-timer
////below zym added for check Modem/Pcsync line status
QueryPcsyncHandsetStatus();
GetBatPicnum();///zym added for low voltage warning 0319
RTC_GetDateTime(&timedate);
currclock.hour=timedate.hour;
currclock.min=timedate.minute;
currclock.sec=timedate.second;
//RM only for PC testing
//sms_check_memset();//added by windy 1213
//zgz,2002.8.15 also get date from rtc.
currdate.day = timedate.day;
currdate.month = timedate.month;
currdate.year = timedate.year+2000;
alarm_check();//gdy add
//yq added for set phbwaitflag
if( no_wait>0 )
no_wait--;
/*begin of zy 2003-04-23 if modem is not plug in init it*/
if( g_HandsetPcsycMode!=1&&UartInit==1 )
{
SER_ImmediateSwitch ();//zy 2003-05-14 init ser avoid crash
UartInit=0;
}
if( g_HandsetPcsycMode==1 )
{
UartInit=1;
}
/*end of zy 2003-04-23*/
if( g_HandsetPcsycMode!=1&&winIsFocussed(idle_data.win)&&(!FlashSettingData.gprsattachmode)&&(iconsGetState(iconIdGPRSAttached)==ICON_VISIBLE) )
/*
zy 2003-04-16 judge if need detach gprs
*/
{
#ifdef MMS_WAP_ENABLED
extern int mms_check_status();
if(mms_check_status() == 0)
#endif
{
TRACE_EVENT("zy:it should do gprsdetach");
gprsStatus = mmiGprsStatus();
if( !FlashSettingData.gprsattachmode&&(gprsStatus==2||gprsStatus==1) )
{
gprs_attach(CGATT_STATE_DETACHED);
}
}
}
GPRSTryControl--;
if( GPRSTryControl<0||GPRSTryControl>2 )
GPRSTryControl=2;
if( (GPRSTryControl==0)&&winIsFocussed(idle_data.win)&&FlashSettingData.gprsattachmode )
{
GPRSTryControl=2;
GprsStatusResult=mmiGprsStatus();
if( (GprsStatusResult!=2)&&FlashSettingData.gprsattachmode )
{
GPRSAutoAttachResult=GPRSAutoAttach();
}
}
// flash_settingwrite();///zym added 11/13 tempor
// flash_environmentwrite();//hxl delete for this all will be done later,2002-11-26
/*begin of zy change 2003-02-28*/
if( LineControl )
{
if( (FlashDCTbData.lineselectflag==1||FlashDCTbData.lineselectflag==0) )
{
if( !ALSPresent(NULL, NULL, NULL) )
{
TRACE_EVENT("zy:tim30atline1");
LineControl=sAT_PercentALS(CMD_SRC_LCL, ALS_MOD_SPEECH);
als_status_checkicon();
}
else
{
LineControl=0;
FlashDCTbData.lineselectflag=0;
als_status_checkicon();
flash_DCTbwrite();
}
}
else if( FlashDCTbData.lineselectflag==2 )
{
if( !ALSPresent(NULL, NULL, NULL) )
{
LineControl=sAT_PercentALS(CMD_SRC_LCL, ALS_MOD_AUX_SPEECH);
TRACE_EVENT("zy:tim30atline2");
als_status_checkicon();
}
else
{
LineControl=0;
FlashDCTbData.lineselectflag=0;
als_status_checkicon();
flash_DCTbwrite();
}
}
}
/*end of zy change 2003-02-28*/
#if 0
second += 60; /* increase seconds */
minold = currclock.min;
currclock.hour = second/3600;
if( currclock.hour EQ 24 )
{
second = 0;
currclock.hour = currclock.min = currclock.sec = 0;
minold = 0;
DateSet(&currdate);
}
else
{
currclock.min = (second-currclock.hour*3600)/60;
currclock.sec = (second-currclock.hour*3600-currclock.min*60);
}
RTC_GetDateTime(&timedate);
currclock.hour=timedate.hour;
currclock.min=timedate.minute;
currclock.sec=timedate.second;
#endif
//hxl add for qq read sms free memory,2003-3-14
#ifdef QQFUNC//hxl add for qq func switch,2003-3-24
if( (QQReadNewSms) )
QQreadtim+=30;
else
QQreadtim=0;
if( QQreadtim>30 )
{
MmiTrace("main check");
QQreadtim=0;
check_new_sms(0,0);
}
#endif
//end of hxl add,2003-3-14--------
ffsWaitWrite--;
if( ffsWaitWrite==0 )
{
FfsWriteOneEvent(); //hxl add for write ffs file
ffsWaitWrite=20;
}
if( !isLcdOff() )//inner Idle
{
idleEvent(IdleUpdate);
}
// else//outer Idle
{
outeridleExec(OUTERIDLEEVENT_TIME,0);//add
}
/*MC CONQUEST 5999->6007,21/05/02 if CPHS reading didn't work on switch-on, try again*/
if( CphsPresent() == CPHS_ERR )
cphs_support_check();
//}
if( g_pcsyncstatus )
{//hxl add for check if the line have been take out,2003-2-13
if( IsPcsyncRemove() )
g_pcsyncstatus=0;
}
timStart(times);
#ifdef _ResetProtectionEnabled_
if( !call_get_window() ) //no call connected
{
CheckNetWork();
if( ShouldBeReseted() )
{
FfsWriteAllEvent();//hxl add for save file completely 20021125
//unsigned char x=1/0; //reset it
while( 1 ); //resetted
}
}
#endif
return 1;
}
/*******************************************************************************
$Function: showCLOCK
$Description: display clock
$Returns: none.
$Arguments:
*******************************************************************************/
void showCLOCK(void)
{
extern GLOBAL int get_StringWidth(char *string);
char line[MAX_LINE];/* RM only for PC testing */
char *AmPm; //zgz, 2002.8.23
int hour;
TIMEDATE today;
UINT8 weekpositionX;
UINT8 weekpositionY;
GetTimeDate(currdate.year, currdate.month, currdate.day, &today); //xsf add for get weekday 12.06
if( FFS_flashData.time_format == TWELVE_HOUR )
{
if( currclock.hour / 12 )
{
if( FFS_flashData.language==0 )
AmPm = "PM";
else
AmPm = "PM"; /* 2004/04/10 sunsj modify */
}
else
{
if( FFS_flashData.language==0 )
AmPm = "AM";
else
AmPm = "AM"; /* 2004/04/10 sunsj modify */
}
if( currclock.hour>12 )
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -