📄 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
25/10/00 Original Condat(UK) BMI version.
$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"
/* SPR#1428 - SH - New Editor changes */
#ifndef NEW_EDITOR
#include "mfw_edt.h"
#endif
#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 "mfw_cm.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"
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
#include "ATBCommon.h"
#include "ATBDisplay.h"
#include "ATBEditor.h"
#include "AUIEditor.h"
#else
#include "MmiEditor.h"
#include "MmiEditor_i.h"
#endif
#include "MmiMenu.h"
#include "MmiCall.h"
#include "MmiIcons.h"
#include "MmiIdle.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 "MmiCphs.h"
#include "gdi.h"
#include "audio.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "mfw_ffs.h"
#include "MmiTimers.h"
#include "mmiColours.h"
/* SPR#1983 - SH - Required for WAP disconnect event */
#ifdef MMI_WAP_ENABLED
#include "AUIWapExt.h"
#endif
/* Marcus: Issue 1057: 21/01/2003: Added the following two external prototypes */
extern T_MFW_HND sat_get_setup_menu_win (void);
extern T_MFW_HND sat_get_call_setup_win (void);
/*******************************************************************************
External Function Prototypes.
*******************************************************************************/
extern UBYTE getCurrentRingerSettings(void );
//API - 826 - Character Buffer For International Call '+' sign
static char InterNat_Plus[33];
extern int M_exeSendNew(MfwMnu* m, MfwMnuItem* i); // MZ
void deflect_destroy(BOOL delete_call_windows); //GW
/*******************************************************************************
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 MMI_OUTGOING_CALL_DIALOG_NORMAL (1)
#define MMI_OUTGOING_CALL_DIALOG_SAT (2)
#define NUMERIC_KEYS 0x8FF /*MC for setting up dialogue key events*/
#define MAX_SOUND 255
/* Marcus: CCBS: 14/11/2002: Start */
/* CCBS related constants */
#define MAX_CCBS_LIST_ITEMS 5
#define MIN_CCBS_IDX 1
#define MAX_CCBS_IDX (MAX_CCBS_LIST_ITEMS)
/* CCBS list structure type definitions */
typedef struct
{
SHORT idx; /* ACI's index to this callback */
UBYTE number[MFW_NUM_LEN]; /* Phone number of callback */
/* Name in phonebook corresponding to phone number of callback, if any */
#ifdef NO_ASCIIZ
T_MFW_PHB_TEXT name;
#else
UBYTE name[PHB_MAX_LEN];
#endif
} T_CCBS_LIST_ITEM_STR;
typedef struct
{
T_MFW_HND win; /* Parent window of active callbacks list */
ListMenuData *list_menu_data; /* allocated list menu memory */
UBYTE count; /* Number of valid items 0..MAX_CCBS_LIST_ITEMS */
UBYTE sel; /* Currently selected item 0..MAX_CCBS_LIST_ITEMS-1 */
T_CCBS_LIST_ITEM_STR item[MAX_CCBS_LIST_ITEMS];
} T_CCBS_LIST_STR;
/* CCBS recall type definitions */
typedef struct
{
T_MFW_HND win; /* Parent window of active callbacks list */
T_MFW_CM_CALL_TYPE type; /* type of this call */
UBYTE number[MFW_NUM_LEN]; /* Phone number of callback */
/* Name in phonebook corresponding to phone number of callback, if any */
#ifdef NO_ASCIIZ
T_MFW_PHB_TEXT name;
#else
UBYTE name[PHB_MAX_LEN];
#endif
} T_CCBS_RECALL_STR;
/* CCBS related local module global data */
static T_CCBS_LIST_STR ccbs_list; // CCBS list information structure
static T_MFW_HND ccbs_registration_win = NULL; // Callback registration window handle
static T_CCBS_RECALL_STR ccbs_recall; // Callback recall information structure
static char ccbs_recall_text_buffer[80];
/* Data for the list of registered CCBS */
static MfwRect ccbs_list_menuArea = {0,0,10,10};
static MfwMnuAttr ccbs_list_menuAttrib =
{
&ccbs_list_menuArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
NULL, /* with these items */
0, /* number of items */
COLOUR_LIST_NETWORK, TxtNull, NULL, MNUATTRSPARE
};
/* CCBS related local function prototypes */
static void call_ccbs_show_status(void);
static void call_initialise_ccbs_list(T_MFW_HND win); // Marcus: CCBS: 14/11/2002
static int call_ccbs_callback(T_MFW_HND win, USHORT identifier, UBYTE reason);
static void call_cm_ccbs_event(T_MFW_CM_CCBS_INFO *para);
static void call_add_to_ccbs_list(T_MFW_CM_CCBS_INFO *para);
static void call_delete_from_ccbs_list(void);
static void call_create_ccbs_menu_list (void);
static void call_ccbs_menu_list_cb(T_MFW_HND win, ListMenuData * ListData);
static void call_show_ccbs_menu_list(void);
static int call_offer_ccbs_registration_callback(T_MFW_HND win, USHORT identifier, UBYTE reason);
static void call_offer_ccbs_registration(T_MFW_CM_CCBS_INFO *para);
static void call_withdraw_ccbs_registration(LangTxt TxtId);
static void call_offer_ccbs_recall(T_MFW_CM_CCBS_INFO *para);
static int call_offer_ccbs_recall_callback(T_MFW_HND win, USHORT identifier, UBYTE reason);
static void call_withdraw_ccbs_recall(LangTxt TxtId);
/* Marcus: CCBS: 14/11/2002: End */
static UBYTE LocalRing=FALSE;
UBYTE call_SATCall = FALSE; // Marcus: Issue 1057: 21/01/2003: Made public
static UBYTE InCallTimer = TRUE; //This ought to be stored in ffs
int removeCall (SHORT cid);
int addCall (SHORT cid);
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 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 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 int call_incoming_animation_cb(MfwEvt e, MfwTim *t);
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);
char* callInformation;
int callIndex(SHORT cid);
char line[MAX_LINE];
static void (*show) (void);
static SHORT singleCall;
int idwithheld;
/* SPR#1985 - SH - TTY - If TRUE, updates will display a window*/
static UBYTE TTYDisplayDialog = FALSE;
//18/12/2001 MC added sms message option
static T_MFW_MNU_ITEM menuCallSingleItems[] =
{
{0,0,0, (char*) TxtSoftContacts, 0,(MenuFunc)contactsExec, item_flag_none},
{0,0,0, (char*) TxtHold, 0,(MenuFunc)holdExec, item_flag_none},
{0,0,0, (char*) TxtMute, 0,(MenuFunc)muteExec, item_flag_none},
{0,0,0, (char*) TxtSendMessage, 0, (MenuFunc)M_exeSendNew, item_flag_none }
};
static const MfwMnuAttr menuCallSingle =
{
&menuArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
(T_MFW_MNU_ITEM*)menuCallSingleItems, /* with these items */
sizeof(menuCallSingleItems)/sizeof(T_MFW_MNU_ITEM), /* number of items */
COLOUR_LIST_XX, TxtNull, NULL, MNUATTRSPARE
};
//18/12/2001 MC added sms message option
static T_MFW_MNU_ITEM menuCallTwoItems[] =
{
{0,0,0, (char*) TxtMultiparty, 0,(MenuFunc)startConferenceExec, item_flag_none},
{0,0,0, (char*) TxtContacts, 0,(MenuFunc)contactsExec, item_flag_none},
{0,0,0, (char*) TxtSwap, 0,(MenuFunc)swapExec, item_flag_none},
{0,0,0, (char*) TxtEndAll, 0,(MenuFunc)endAllExec, item_flag_none},
{0,0,0, (char*) TxtMute, 0,(MenuFunc)muteExec, item_flag_none},
{0,0,0, (char*) TxtCallTransfer, 0,(MenuFunc)transferExec, item_flag_none},//MC
{0,0,0, (char*) TxtSendMessage, 0, (MenuFunc)M_exeSendNew, item_flag_none }
};
static const MfwMnuAttr menuCallTwo =
{
&menuArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
menuCallTwoItems, /* with these items */
sizeof(menuCallTwoItems)/sizeof(T_MFW_MNU_ITEM), /* number of items */
COLOUR_LIST_XX, TxtNull, NULL, MNUATTRSPARE
};
//18/12/2001 MC added sms message option
static T_MFW_MNU_ITEM menuCallConferenceItems[] =
{
{0,0,0, (char*) TxtPrivateCall, 0,(MenuFunc)privateStartAddConferenceExec, item_flag_none},
{0,0,0, (char*) TxtSwap, 0,(MenuFunc)swapExec, item_flag_none},
{0,0,0, (char*) TxtEndAll, 0,(MenuFunc)endAllExec, item_flag_none},
{0,0,0, (char*) TxtContacts, 0,(MenuFunc)contactsExec, item_flag_none},
{0,0,0, (char*) TxtHold, 0,(MenuFunc)holdExec, item_flag_none},
{0,0,0, (char*) TxtMute, 0,(MenuFunc)muteExec, item_flag_none},
{0,0,0, (char*) TxtScratchPad, 0,(MenuFunc)scratchPadExec, item_flag_none},
{0,0,0, (char*) TxtMainMenu, 0,(MenuFunc)mainMenuExec, item_flag_none},
{0,0,0, (char*) TxtSendMessage, 0, (MenuFunc)M_exeSendNew, item_flag_none }
};
static const MfwMnuAttr menuCallConference =
{
&menuArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
(T_MFW_MNU_ITEM *)menuCallConferenceItems, /* with these items */
sizeof(menuCallConferenceItems)/sizeof(T_MFW_MNU_ITEM), /* number of items */
COLOUR_LIST_XX, TxtNull, NULL, MNUATTRSPARE
};
static const T_MFW_MNU_ITEM menuDTMFItems [] =
{
{0,0,0, (char*) TxtSendMessage, 0,(MenuFunc)exeSendMessage, item_flag_none},
{0,0,0, (char*) TxtAddNew, 0,(MenuFunc)callExeNameEnter, item_flag_none}
};
static const T_MFW_MNU_ATTR menuDTMF =
{
&menuArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
(T_MFW_MNU_ITEM *)menuDTMFItems, /* with these items */
sizeof(menuDTMFItems)/sizeof(T_MFW_MNU_ITEM), /* number of items */
COLOUR_LIST_XX, TxtNull,NULL, MNUATTRSPARE
};
enum {
CALL_STATUS_CALL,
CALL_TIMER_CALL,
CALL_ID_NAME_CALL,
CALL_ID_NUM_CALL
};
/*********************************************************************
**********************************************************************
CALL WINDOW. DECLARATION
*********************************************************************
**********************************************************************/
T_call call_data;
void call(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int call_win_cb(MfwEvt e, MfwWin *w);
static int call_kbd_cb (MfwEvt e, MfwKbd *k);
static int call_kbd_long_cb (MfwEvt e, MfwKbd *k);
/*********************************************************************
**********************************************************************
MENU WINDOW. DECLARATION
*********************************************************************
**********************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -