📄 phone.c
字号:
break;
case PCS_WAIT:
StopRingNotify();
OnRejectCall(1);
break;
case PCS_DTMF:
case PCS_TALK:
OnHangupTalk();
break;
case PCS_STOP:
gMemberActive.rec.seconds = 0;
showIdleStatus();
break;
case PCS_IDLE:
default:
break;
}
return 0;
}
#if 1
static int IDLEpopMenu(void)
{
//int selMenu;
OnMainSelectMenu(1);
//-----------------
/* XClearMenuItem(&g_pDialWnd->tmenu);
XAppendMenuItem(&g_pDialWnd->tmenu,TranslateChar("电话本"), NULL);
XAppendMenuItem(&g_pDialWnd->tmenu,TranslateChar( "短消息"), NULL);
XAppendMenuItem(&g_pDialWnd->tmenu, TranslateChar("通话记录 "), NULL);
XAppendMenuItem(&g_pDialWnd->tmenu, TranslateChar("用户设置"), NULL);
XAppendMenuItem(&g_pDialWnd->tmenu, TranslateChar("通话计时"), NULL);
XAppendMenuItem(&g_pDialWnd->tmenu, TranslateChar("安全设置"), NULL);*/
//-----------------
/*menuLOOP:
selMenu=0;
//selMenu = XPopMenu(&g_pDialWnd->tmenu, 1, LCD_HEIGHT-2, selMenu);//selMenu
selMenu=XSelectWindow(MinMenuChr,MAXMENUname,selMenu);
if (selMenu == -1)
{
showIdleStatus();//yu add 为了分钟的更新
return 0;
}
OnMainSelectMenu(selMenu+1);
*/
XShowComponent(&g_pDialWnd->wnd.comp);
if (g_pDialWnd->input)
Start_Dial_gotoTalk();//yu 5 showDialNumber();
else
showIdleStatus();//goto menuLOOP;//
XSetBaseWindow(&g_pDialWnd->wnd);
return 0;
}
#else
static int IDLEpopMenu(void)
{int temp;
XClearMenuItem(&g_pDialWnd->tmenu);
XAppendMenuItem(&g_pDialWnd->tmenu,TranslateChar("电话本"), NULL);
XAppendMenuItem(&g_pDialWnd->tmenu,TranslateChar( "短消息"), NULL);
XAppendMenuItem(&g_pDialWnd->tmenu, TranslateChar("通话记录 "), NULL);
XAppendMenuItem(&g_pDialWnd->tmenu, TranslateChar("用户设置"), NULL);
XAppendMenuItem(&g_pDialWnd->tmenu, TranslateChar("通话计时"), NULL);
XAppendMenuItem(&g_pDialWnd->tmenu, TranslateChar("安全设置"), NULL);
//-----------------
temp = XPopMenu(&g_pDialWnd->tmenu, 1, LCD_HEIGHT-2, 0);
if (temp == -1)
{
showIdleStatus();//yu add 为了分钟的更新
return 0;
}
OnMainSelectMenu(temp+1);
XShowComponent(&g_pDialWnd->wnd.comp);
if (g_pDialWnd->input)
showDialNumber();
else
showIdleStatus();
XSetBaseWindow(&g_pDialWnd->wnd);
return 0;
}
#endif
static int OnKeyMenu(void)
{//copy from OnKeyOk PCS_IDLE
switch (phoneDialStatus) {
case PCS_IDLE:
IDLEpopMenu();
break;
default:
break;
}
return 0;
}
int en_Return_BACKMAIN(void)
{int rint=0;
if(phoneDialStatus==PCS_INPUT)
rint=1;//允许返回
return rint;
}
void send_DialyNummber(char timeCnt10s)
{
//--------------------------
if(timeCnt10s > 10)
{if((phoneDialStatus==PCS_INPUT)&&(g_pDialWnd->input>0))
{
Start_Dial_gotoTalk();
}
}
//--------------------------
}
//extern void Onkeyok_TalkON(void);
static int OnKeyOK(void)
{
// int temp;
switch (phoneDialStatus) {
case PCS_IDLE:
IDLEpopMenu();
break;
case PCS_INPUT:
if(g_pDialWnd->input)
{
Start_Dial_gotoTalk();
}
else
{
g_pDialWnd->input = 0;
g_pDialWnd->number[g_pDialWnd->input] = 0;
showIdleStatus();
}
break;
case PCS_DIAL:
OnStopDial();
break;
case PCS_FWAIT:
debug_out_str(DM_RUNINFO, "press OK");
StopVoiceMenu();
//yu SetHandleRing(0, 1);
OnAcceptCall(0); /* 不发送ATA命令 */
break;
case PCS_WAIT:
//----------------------------
if(1==gDevicePara.sysdata.en_RecieveCAll)
{//运营商允许接听
StopRingNotify();
OnAcceptCall(1);
}
//----------------------------
break;
case PCS_STOP:
gMemberActive.rec.seconds = 0;
showIdleStatus();
break;
default:
break;
}
return 0;
}
#if 1
extern void GotoPowerOff(void);
#endif
static void OnkeyPauseADD(int keyID)
{
if((PCS_INPUT == phoneDialStatus)&&(0<g_pDialWnd->input))
{
g_pDialWnd->input--;
OnInputKey(keyID);
}
}
/* 长按键 */
static void OnKeyHold(int keyID)
{
debug_print_str(DM_RUNINFO, (info_buffer, "HOLD KEY0x%x", keyID));
/* 只有CANCEL长键才响应 */
// if (keyID != KEY_CANCEL)
switch(keyID)
{
case KEY_D1:
if (PCS_IDLE== phoneDialStatus)
OnKeyD1_PCS_IDLE();//语音信箱
break;
case KEY_D9:
if (PCS_IDLE== phoneDialStatus)
OnKeyD9_PCS_IDLE();//紧急呼叫
break;
case KEY_DEL:
if (PCS_INPUT == phoneDialStatus)
showIdleStatus();
break;
case KEY_POWER:
if (XMessageBox(NULL, TranslateChar(" 关机? "), ID_OK) == ID_OK)
{
GotoPowerOff();
}
break;
break;
case KEY_D0:
OnkeyPauseADD('+');
break;
case KEY_DX:
OnkeyPauseADD('P');
break;
default:
break;
}
}
#if 1
extern void EraseSysData64k64k(void);
extern void ResetSystem(void);
static void RestSystenmWindow(void)
{
EraseSysData64k64k();
debug_out_str(DM_RUNINFO, "Earse 0x800E000~800FFFFF");
XTipWndShow("Erase128k",1);
debug_out_str(DM_RUNINFO, "SYS RESET");
XTipWndShow("SYS RESET",1);
ResetSystem();
}
extern void Erase_mobilearea_A64k(void);
extern void Para_SetToDefault(void);
//参数设置默认设置
static void Para_SetToDefaultWindow(void)
{
Para_SetToDefault();
debug_out_str(DM_RUNINFO, "Para_SetToDefault");
XTipWndShow("SYS RESET",1);
ResetSystem();
}
extern void Clear_SIMLOCK_ServeID(void);
static void Clear_SIMLOCK_ServeID_Window(void)
{
Clear_SIMLOCK_ServeID();
debug_out_str(DM_RUNINFO, "Clear_SIMLOCK_ServeID");
XTipWndShow("SYS RESET",1);
ResetSystem();
}
#endif
#if 1
#define __GYDebug 1
#ifdef __GYDebug
#define BootSize 1024*25/4
typedef void (*GotoBoot_f)(void);
void CopyAndRunLittleBoot(void)
{
uint32 *pSrc, *pDst;
int i;
GotoBoot_f enGotoBoot;
VICIntEnClr = 0xFFFFFFFF; /* disable all int */
pSrc = (uint32*)0x80050000;//0x81000000;
pDst = (uint32*)0x81000000;
for (i = 0; i < BootSize; ++i) {
*pDst++ = *pSrc++;
}
enGotoBoot = (GotoBoot_f)0x81000000;
enGotoBoot();
}
#endif
extern void FactorySet(void);
extern void manage_set(void);
extern void ConfigModule(void);
static int SysSetMode(void)
{
int ret=0;
if(strcmp(g_pDialWnd->number,"*200320032003")==0)
{
g_pDialWnd->input=0;
Clear_SIMLOCK_ServeID_Window();//reset
}
else if(strcmp(g_pDialWnd->number,"*200420042004")==0)
{
g_pDialWnd->input=0;
Para_SetToDefaultWindow();//reset
}
else if(strcmp(g_pDialWnd->number,"*200520052005")==0)
{//
g_pDialWnd->input=0;
RestSystenmWindow();//reset
//showIdleStatus();
}
else if(strcmp(g_pDialWnd->number,"*982004")==0)
{
g_pDialWnd->input=0;
ConfigModule();
showIdleStatus();
}
else if(strcmp(g_pDialWnd->number,"*982005")==0)
{
g_pDialWnd->input=0;
FactorySet();
showIdleStatus();
}
else if(strcmp(g_pDialWnd->number,"*982006")==0)
{
g_pDialWnd->input=0;
manage_set();
showIdleStatus();
}
#ifdef __GYDebug
else if(strcmp(g_pDialWnd->number,"*982008")==0)
{
debug_out_str(DM_RUNINFO, "SYS PROGRAM");
XTipWndShow("PROGRAM",1);
CopyAndRunLittleBoot();
}
#endif
else
{
ret=1;
}
return ret;
}
#endif
/* 有按键 */
extern int checkPassword(void);
extern int select_PB(void);
extern int Select112Number(void);
static void OnKeyDown(int keyID)
{
debug_print_str(DM_RUNINFO, (info_buffer, "Onkey:0x%x", keyID));
switch (keyID) {
//----------------
case KEY_SPK:
OnKeySPK();
break;
/* case KEY_HOOK_UP:
OnHOOKeyUP();
break;
case KEY_HOOK_DOWN:
OnHOOKeyDown();
break;
case KEY_HOOK_FLASH:
OnHOOKFlash();
break;*/
//----------------
case KEY_DEL://yu
OnKeyDEL();
break;
case KEY_CANCEL: // 1
OnKeyCancel();
break;
case KEY_REDIAL:
OnkeyRedial();
break;
case KEY_D0:
case KEY_D1:
case KEY_D2:
case KEY_D3:
case KEY_D4:
case KEY_D5:
case KEY_D6:
case KEY_D7:
case KEY_D8:
case KEY_D9:
OnInputKey((char)(keyID&0xFF));
break;
case KEY_DX:
OnInputKey('*');
break;
case KEY_DH:
if((g_pDialWnd->input==7)||(g_pDialWnd->input==13))
{
if(0==SysSetMode())
break;
}
if((PCS_INPUT==phoneDialStatus)&&
(1==gDevicePara.sysdata.KeyJJSend))
{
if(0 < g_pDialWnd->input)
Start_Dial_gotoTalk();
}
else
{
OnInputKey('#');
}
/*if ((g_pDialWnd->input > 1) && (g_pDialWnd->number[g_pDialWnd->input-2] != '*'))
{
//if (SpecialCommand(g_pDialWnd->number) < 0)
// XMessageBox("111", "未知命令", ID_OK);
//showIdleStatus();
//break;
SpecialCommand(g_pDialWnd->number);
}
*/
//OnKeyDEL();
//Start_Dial_gotoTalk();
break;
case KEY_SHIFT:
if (phoneDialStatus != PCS_IDLE)
break;
/*
temp = XPopMenu(&g_pDialWnd->tmenu, 20, LCD_HEIGHT-13, 0);
if (temp == -1)
break;
OnMainSelectMenu(temp+1);
XShowComponent(&g_pDialWnd->wnd.comp);
if (g_pDialWnd->input)
showDialNumber();
else
showIdleStatus();
PD_ShowScreen();
XSetBaseWindow(&g_pDialWnd->wnd);
*/
break;
case KEY_OK:
OnKeyOK();
break;
case KEY_MENU:
OnKeyMenu();
break;
case KEY_UP:
case KEY_DOWN:
if ((phoneDialStatus == PCS_TALK)||(phoneDialStatus == PCS_DTMF)) {
VolumnAdjust();
}
else if (phoneDialStatus == PCS_IDLE) {
PH_Talk_Record((void*)PH_REC_DIALED);
XShowComponent(&g_pDialWnd->wnd.comp);
if (g_pDialWnd->input)
Start_Dial_gotoTalk();//yu 4 showDialNumber();
else
showIdleStatus();
XSetBaseWindow(&g_pDialWnd->wnd);
}
break;
case KEY_PHONEBOOK:
if (phoneDialStatus == PCS_IDLE) {
select_PB();
XShowComponent(&g_pDialWnd->wnd.comp);
if (g_pDialWnd->input)
Start_Dial_gotoTalk();//yu 3 showDialNumber();
else
showIdleStatus();
XSetBaseWindow(&g_pDialWnd->wnd);
}
break;
case KEY_FN:
if ((phoneDialStatus == PCS_IDLE)||
(phoneDialStatus == PCS_INPUT))
{
Select112Number();
XShowComponent(&g_pDialWnd->wnd.comp);
if (g_pDialWnd->input)
Start_Dial_gotoTalk();//yu 3 showDialNumber();
else
showIdleStatus();
XSetBaseWindow(&g_pDialWnd->wnd);
}
break;
default:
break;
}
}
int Read_Dialwnd_Len(void)
{
return g_pDialWnd->input;
}
extern void onStopDialTone(void);
char gCIDComringTemp;
static int PD_Module_Proc(XMSG *msg)
{
switch (msg->param1) {
case RING:
gRingMsgCount++;
if (1 == gRingMsgCount) {
g_pDialWnd->input = 0;
g_pDialWnd->number[0] = 0;
}
gRingTimeCount = 0;
if ((2 == gRingMsgCount)&&(g_pDialWnd->input == 0)) {
/* 第二个ring还没见号码,显示来电 */
//showMessage(1, TranslateChar("未知来电"));// 有来电
showMessage(0, TranslateChar("未知来电"));// 有来电
phoneDialStatus = PCS_WAIT;
gCIDComringTemp=gDevicePara.dev.ringType;//gDevicePara.dev.ringTell;//yu
RingNotify("0");
}
break;
case INCOMING_NUMBER: /**< 来电号码 */
gRingTimeCount = 0;
//去掉来电的区号;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -