📄 mmicall.c
字号:
/*******************************************************************************
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: Call
$File: MmiCall.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description
This module provides the call functionality
********************************************************************************
$History: MmiCall.c
Date .................. Modification ......................................
25/10/00 Original Condat(UK) BMI version.
01/08/02 version 0.100 zy add "addNewCall(),endOneExec()"two functions for call menu
15/08/02 zy add adjust volume
29/08/02 zy adjust volume
$End
*******************************************************************************/
/******************************************************************************
Include Files
*******************************************************************************/
#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 "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_lng.h"
#include "mfw_edt.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_tim.h"
#include "mfw_sim.h"
#include "mfw_cm.h"
#include "mfw_nm.h"
#include "mfw_phb.h"
#include "mfw_mme.h"
#include "mfw_sat.h"
#include "mfw_sms.h"
#include "dspl.h"
#include "ksd.h"
#include "psa.h"
#include "MmiMain.h"
#include "MmiBookController.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMenu.h"
#include "MmiCall.h"
#include "MmiIcons.h"
#include "MmiIdle.h"
#include "Mmimemo.h"
#include "MmiSoftKeys.h"
#include "MmiSounds.h"
#include "MmiIdle.h"
#include "MmiNetwork.h"
#include "MmiSat_i.h"
#include "MmiAoc.h"
#include "MmiResources.h" /* sbh */
#include "gdi.h"
#include "audio.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "mfw_ffs.h"
#include "MmiTimers.h"
#include "Mmihost.h" //xsf add 2002.08.05
//glowing: add it to fix the bug of record call */
#include "mmivoicememo.h"
#include "psa_cc.h"
/* SPR#1656 - SH - Required for WAP disconnect event */
#ifdef MMI_WAP_ENABLED
#include "AUIWapExt.h"
#endif
#include "pwr.h" //zym added 09/05/02
#include "Rtc_api.h" //wufei 1009
#include "Mmisettings.h"
#include "GameDisplay.h"
//#define TDTRACE 1
#include "Mmiutilapi.h"
#include "mmiouterIdle.h" /*2003/12/27, wangyan add incoming call outsidescreen*/
//#include "mmiicndialogs.h"
#include "mmiiconresource.h"/* 2004/06 sunsj modify for icon manage */
//2004.08.02 Added by Cathy for Camera
#ifdef CAMERA_ENABLED
#include "mmicamera.h"
#endif
/*******************************************************************************
External Function Prototypes.
*******************************************************************************/
static char InterNat_Plus[33];
extern UBYTE getCurrentRingerSettings(void );
extern T_RTC_DATE_TIME timedate;//wufei 1009
extern int M_callSendNew(MfwMnu* m, MfwMnuItem* i); // 2003-04-01 zy add add new message in call
extern pwr_Status_Type pwr_Status; ///zym added 09/05/02
extern driver_Parameter drvpara;//zy 10/22 for hall action in call
extern uint8 SimReadyFlag; //for 3120 (change in findnumber()) hu binhao2002-12-26
extern UINT32 driverFlag;// wms added 03-01-22
extern uint8 CallListFlag; //hu binhao 2003-1-21
extern MfwHnd cugwindows; //hu binhao 2003-1-21
extern uint8 MCallHintDleteFlag; //hu binhao 2003-1-29 the flag will set 1 when browse recent call neme and a missed call happened.
extern UINT8 melody_status;//zy 2003-03-3 if before is play sound we couldn't set handsetmode
extern char oldringstr[20];//wsm added 03-04-07
extern void voice_memo_destroy (T_MFW_HND own_window);//zy 2003-04-01
//extern int incoming_call_kbd_long_cb (MfwEvt e, MfwKbd *k);/*2004/3/31, wangyan add*/
extern int incoming_call_kbd_long_KeyAction ();/*2004/3/31, wangyan add*/
/* Marcus: Issue 1057: 21/01/2003: Added the following two external prototypes
zy checkin 2003-04-16
*/
extern T_MFW_HND sat_get_setup_menu_win (void);
extern T_MFW_HND sat_get_call_setup_win (void);
/*end of zy change 2003-04-16*/
/*******************************************************************************
End
*******************************************************************************/
#define TRACE_MMI_CALL
#ifndef TRACE_MMI_CALL
//#define TRACE_EVENT(a)
#endif
#if defined (WIN32)
#define TONES_AUTH_NUM 3
#define TONES_BUSY 4
#define TONES_DROPPED 5
#define TONES_CONGEST 6
#endif
#ifndef MFW_EVENT_PASSED
#define MFW_EVENT_PASSED 0
#endif
//#define FIELD_TEST_MODE /* 2003/12/1, wangyan modify */
#define NUMERIC_KEYS 0x8FF /*MC for setting up dialogue key events*/
#define MAX_SOUND 255
static UBYTE LocalRing=FALSE;
UBYTE call_SATCall = FALSE;//zy 2003-04-16 make it be global
static UBYTE InCallTimer = TRUE; //This ought to be stored in ffs
BOOL call_win_flag=FALSE;
extern char currTryAccept;
static int notavailtryone=1;//zy 2003-04-04 "1" not try yet,"0" have tryed one time
int removeCall (SHORT cid);
int addCall (SHORT cid);
void call_scratchpad_destroy (T_MFW_HND own_window);
int callCmEvent (MfwEvt e, void *para);
static int InformationTimerEvent(MfwEvt e, MfwTim *t);
static int callWaitingAnswerKeyEvent (MfwEvt e, MfwKbd *k);
void callAutoRedialKeyEvent(T_MFW_HND win, USHORT identifier, USHORT reason);
static void callSetMode(int mode);
static int contactsExec(MfwMnu* m, MfwMnuItem* i);
static int holdExec(MfwMnu* m, MfwMnuItem* i);
static int muteExec(MfwMnu* m, MfwMnuItem* i);
static int addNewCall(MfwMnu* m, MfwMnuItem* i);//zy Mobile Innovation 01/08/02 add a new call by dialing use scratch window
//static int scratchPadExec(MfwMnu* m, MfwMnuItem* i);
static int mainMenuExec(MfwMnu* m, MfwMnuItem* i);
static int startConferenceExec(MfwMnu* m, MfwMnuItem* i);
static int swapExec(MfwMnu* m, MfwMnuItem* i);
static int endAllExec(MfwMnu* m, MfwMnuItem* i);
static int endConferSingleExec(MfwMnu* m, MfwMnuItem* i);//zy Mobile Innovation 10/08
static int endOneExec(MfwMnu* m, MfwMnuItem* i);//zy Mobile Innovation 01/08/02 end the call active now
static int transferExec(MfwMnu* m, MfwMnuItem* i);
static int privateStartAddConferenceExec(MfwMnu* m, MfwMnuItem* i);
static int exeSendMessage(MfwMnu* m, MfwMnuItem* i);
static int callExeNameEnter(MfwMnu* m, MfwMnuItem* i);
static void showCCNotify (T_MFW_HND win, T_MFW_CM_NOTIFY * cc_notify);
static void showSelectPrivateCall(void);
static void showWaitingAnswer(void);
static void showAutoRedial(void);
static void SaveVolumeSetting (void);
static void endingCall(void);
static void rebuildCalls(void);
static int getCallStatus(SHORT call_number,T_MFW_CM_STATUS* call);
void incomingCall(const T_MFW_CM_CW_INFO* p_pCwInfo);
void callConnect(SHORT cid);
void getTimeString(long time,char *timeString);
static void refreshCallTimer();
static void callFailureCause(UBYTE cause);
static void sendDTMFString(void);
static void callCalcCost(char* line);
//static void saveNumCallRecord(char callrecordtype,const char* num ); //hubinhao 2002-11-20
static void saveNumCallRecord(char callrecordtype, char* num, uint8 IsfindNumRes,uint8 SRFlag,T_FindName * searchdata); //hubinhao 2002-11-20
static int CallRecord(MfwMnu* m, MfwMnuItem* i);
//static int TestModeStart(MfwMnu* m, MfwMnuItem* i); /*2003/12/1, wangyan delete*/
char* getViewStatus(int);//2004-03-8 Sunny add
char* callInformation;
int callIndex(SHORT cid);
char line[MAX_LINE];
static void (*show) (void);
//xsf add 2002.08.05 2 lines
extern char SimLock1;
extern char ProOnLock;//hostkey protect switchon flag
extern MfwHnd gtVibator; //XSF 08.14 static MfwHnd gtVibator;
//static SHORT singleCall;
short singleCall;/*2004/4/14, wangyan modify*/
//char latestInNum[21]; //hu binhao 2002-
char latestInNum[24]; //hu binhao 2002-12-23 for fix 3128
//char latestOutNum[21]; //hu binhao 2002-
char latestOutNum[24]; //hu binhao 2002-12-23 for fix 3128
char latestReceivedNum[24]; //hu binhao 2002-12-23 for fix 3128
//char latestReceivedNum[21]; //
char extnum[CALL_NAME_LENGTH+2];
static tMmiCallTable calls;
int idwithheld;
uint8 SpeakerVols;
uint8 animnum;
uint8 CALLRINGOFF;
uint8 Isfromcallwin,Iscallnumber1;//zy add 0107/2003 judge if is from call win so we can judge if need action to active leave call when a new call is failured;
static uint8 IsIngroup; //hu binhao 2002-12-29 bug 3120 bug 3120
static T_FindName searchPhdata; //hu binhao 2002-12-29 bug 3120
extern uint8 SimReadyFlag; //hu binhao 2002-12-29 for bug 3120
extern BOOL IncallLedisRun;
/*************begin ganchunhui adding*****************/
//#ifdef FIELD_TEST_MODE
//unsigned char gucEarPhoneSupport=1; //flag for supporting earphone or not ,
//#endif
/************end ganchunhui adding******************/
BOOL IncallLedControl;/* zy add 01-23-2003 for led incomingcall light on or off*/
//18/12/2001 MC added sms message option
//2004-03-5 Sunny modify for item icon
extern const MfwIcnAttr colist[];
static T_MFW_MNU_ITEM menuCallSingleItems[] =
{
// {0,0,0,(char *)TxtSoftContacts, 0,(MenuFunc)contactsExec, item_flag_none},//zy Mobile Innovation 01/08/02 seemed not need
{(MfwIcnAttr*)&colist,0,0,(char *)TxtHold, 0,(MenuFunc)holdExec, item_flag_none},
{(MfwIcnAttr*)&colist,0,0,(char *)TxtMute, 0,(MenuFunc)muteExec, item_flag_none},
{(MfwIcnAttr*)&colist,0,0,(char *)TxtAddNewCall, 0,(MenuFunc)addNewCall, item_flag_none},//zy Mobile Innovation 01/08/02 add new call menu
{(MfwIcnAttr*)&colist,0,0,(char*) TxtSendMessage, 0, (MenuFunc)M_callSendNew, item_flag_none},//zy 2003-04-01
{(MfwIcnAttr*)&colist,0,0,(char*) TxtRecVoice, 0, (MenuFunc)CallRecord, item_flag_none},//zy 12/03
{(MfwIcnAttr*)&colist,0,0,(char*) TxtMemo, 0, (MenuFunc)memoAdd, item_flag_none},//gdy add 03/01/07
/*#ifdef FIELD_TEST_MODE
{0,0,0,(char*) TxtTestCommand, 0, (MenuFunc)TestModeStart, item_flag_none}//xzy add 03/02/12 for testmode
#endif*//*2003/12/1, wangyan delete*/
};
static const MfwMnuAttr menuCallSingle =
{
0,
&menuListArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
menuCallSingleItems, /* with these items */
sizeof(menuCallSingleItems)/sizeof(T_MFW_MNU_ITEM) /* number of items */
};
//18/12/2001 MC added sms message option
//2004-03-5 Sunny modify for item icon
static T_MFW_MNU_ITEM menuCallTwoItems[] =
{
// {0,0,0,(char *)TxtContacts, 0,(MenuFunc)contactsExec, item_flag_none},//zy Mobile Innovation 01/08/02 seemed not need
{(MfwIcnAttr*)&colist,0,0,(char *)TxtSwap, 0,(MenuFunc)swapExec, item_flag_none},
{(MfwIcnAttr*)&colist,0,0,(char *)TxtEndAll, 0,(MenuFunc)endAllExec, item_flag_none},
{(MfwIcnAttr*)&colist,0,0,(char *)TxtEndOne, 0,(MenuFunc)endOneExec, item_flag_none},//zy Mobile Innovation 01/08/02 add end active call
// {0,0,0,(char *)TxtMute, 0,(MenuFunc)muteExec, item_flag_none},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -