📄 mmisatcall.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
$Module: SMS
$File: mmiSatInfo.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description:
Implementation of MMI SIM Application Toolkit (SAT)
********************************************************************************
$History: mmiSatInfo.c
25/10/00 Original Condat(UK) BMI version.
$End
*******************************************************************************/
#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_edt.h"
#include "mfw_lng.h"
#include "mfw_icn.h"
#include "mfw_phb.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "mfw_sms.h"
#include "mfw_mnu.h"
#include "mfw_sat.h"
#include "mfw_tim.h"
#include "dspl.h"
#include "MmiMmi.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMain.h"
#include "MmiStart.h"
#include "MmiPins.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MmiSounds.h"
#include "MmiCall.h"
#include "mmiSat_i.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
/*********************************************************************
*
* SUB WINDOW SAT_CALL_SETUP
*
*********************************************************************/
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND win;
T_SAT_CMD *sat_command; /* pointer to sat_command in parent */
T_SAT_call_setup_parameter * call_setup_parameter;
T_MFW_HND redial_tim;
} T_sat_call_setup;
static void sat_call_setup_destroy (T_MFW_HND own_window);
static void sat_call_setup_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_call_setup_parameter * call_setup_parameter);
static void sat_call_setup_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
static int sat_call_setup_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc);
/*******************************************************************************
$Function: sat_call_setup_create
$Description: Creation of an instance for the SAT CALL dialog.Window must be
available after reception of SAT command only one instance.
$Returns: mfw window handler
$Arguments: parent_window - Parent window handler
*******************************************************************************/
T_MFW_HND sat_call_setup_create (T_MFW_HND parent_window)
{
T_sat_call_setup * data = (T_sat_call_setup *)ALLOC_MEMORY (sizeof (T_sat_call_setup));
T_MFW_WIN * win;
data->win = win_create (parent_window, 0, 0,NULL);
sat_set_call_setup_win(data->win);
if (data->win EQ NULL)
return NULL;
/*
* Create window handler
*/
data->mmi_control.dialog = (T_DIALOG_FUNC)sat_call_setup_exec;
data->mmi_control.data = data;
data->parent_win = parent_window;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (MfwUserDataPtr)data;
/*
* return window handle
*/
winShow(data->win);
return data->win;
}
/*******************************************************************************
$Function: sat_call_setup_destroy
$Description: Destroy the sat call dialog.
$Returns: none
$Arguments: own_window - Current window
*******************************************************************************/
static void sat_call_setup_destroy (T_MFW_HND own_window)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *)own_window)->data;
T_sat_call_setup * data = (T_sat_call_setup *)win_data->user;
if (data)
{
/*
* Delete WIN Handler
*/
win_delete (data->win);
/*
* Free Memory
*/
FREE_MEMORY ((void *)data, sizeof (T_sat_call_setup));
sat_set_call_setup_win(NULL);
}
}
/*******************************************************************************
$Function: sat_call_setup_exec
$Description: Dialog function for sat_call_setup_exec window.
$Returns: none
$Arguments: win - current window
event - window event
value - unique id
call_setup_parameter - call setup info
*******************************************************************************/
static void sat_call_setup_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_call_setup_parameter * call_setup_parameter)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_sat_call_setup * data = (T_sat_call_setup *)win_data->user;
T_DISPLAY_DATA display_info;
TRACE_FUNCTION ("sat_call_setup_exec()");
if ((win EQ NULL) || (win_data EQ NULL) || (data EQ NULL))
return;
dialog_info_init(&display_info);//gdy add
switch (event)
{
case SAT_CALL_ALERT:
/* start an info screen to accept or reject the call setup */
data->call_setup_parameter = call_setup_parameter;
if (wstrlen(call_setup_parameter->TextString) == 0) //zhaowm 2003.0325
display_info.TextString = "\x80\x5e\xfa\x7a\xcb\x54\x7c\x53\xeb\x00\x3f\x00\x00" ;//"Setup Call?"; // ??? rsa for test only
else
display_info.TextString = call_setup_parameter->TextString;
display_info.TextString2 = '\0';
display_info.LeftSoftKey = TxtAccept;
display_info.RightSoftKey = TxtReject;
display_info.Time = FOREVER;
display_info.KeyEvents = KEY_LEFT | KEY_RIGHT;
display_info.TextId = 0;
display_info.TextId2 = 0;
display_info.Identifier = event;
display_info.iconindex=REMIND_REQUIRE;/*2003/12/4, wangyan add*/
display_info.Callback = (T_VOID_FUNC)sat_call_setup_cb;
/*
* Call Info Screen
*/
info_dialog (win, &display_info);
break;
case SAT_CALL_REDIAL:
/* attempt a redial if the timer has not yet elapsed */
/* if redial is not commanded by SAT_CALL_ALERT the timer will be NULL (see sat_call_setup_cb()) */
/* if the timer has already elapsed it is set to NULL (see sat_call_setup_tim_cb()) */
if ((data->redial_tim NEQ NULL) || (call_setup_parameter->redialTime EQ FOREVER))
{
// ??? rsa according to ES we shall use a satAccept() at this point (but it returns an error)
if (!call_get_window())
call_create(0);
SEND_EVENT(call_get_window(),CALL_OUTGOING_SAT,0,call_setup_parameter);
}
else
{
SEND_EVENT(data->parent_win, SAT_CALL_END, 0, NULL); /* inform the parent */
}
break;
case SAT_CALL_END:
/*zy 2003-04-16 checkin SPR#1779 - DS - If call was a 'with redial' call, send a call reject to the SIM. */
if (get_sat_redial_flag() == 1)
{
satReject();
/* Reset the satWithRedial flag */
set_sat_redial_flag(0);
}
/*end of zy change*/
/* clean up after end of call */
sat_call_setup_destroy(win);
break;
default:
TRACE_EVENT("sim_call_setup_exec() unexpected event");
return;
}
}
/*******************************************************************************
$Function: sat_call_setup_cb
$Description: Callback function information dialog.
$Returns: none
$Arguments: win - current window
identifier - unique id
reason - window event id
*******************************************************************************/
static void sat_call_setup_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
{
T_MFW_WIN * info_win_data = ((T_MFW_HDR *) win)->data;
T_sat_call_setup * data = (T_sat_call_setup *)info_win_data->user;
if ((win EQ NULL) || (info_win_data EQ NULL) || (data EQ NULL))
return;
switch (reason)
{
case INFO_KCD_LEFT: /* the user has accepted the call setup */
/* start the call */
/*begin of zy change 2003-04-16*/
if (!call_get_window()) //zhaowm 2003 0325 this part will result in memory leak
call_create(0);
// data->call_setup_parameter->TextString = '\0'; //temp
SEND_EVENT(call_get_window(),CALL_OUTGOING_SAT,0,data->call_setup_parameter);
satAccept();
SEND_EVENT(data->parent_win, SAT_CALL_END, 0, NULL); /* inform the parent who will take care of destroying */
/*end of zy change 2003-04-16*/
#if 0
/* create and start the redial timer handler */
if ((data->call_setup_parameter->redialTime NEQ 0) &&
(data->call_setup_parameter->redialTime NEQ FOREVER))
{
data->redial_tim =
tim_create (win, data->call_setup_parameter->redialTime, (T_MFW_CB)sat_call_setup_tim_cb);
tim_start (data->redial_tim);
}
else
{
data->redial_tim = NULL; /* timer not used */
}
/* destroying will be done in response to SAT_CALL_END */
#endif
break;
case INFO_KCD_RIGHT: /* the user has rejected the call setup */
satReject();
data->redial_tim = NULL; /* timer not used */
SEND_EVENT(data->parent_win, SAT_CALL_END, 0, NULL); /* inform the parent who will take care of destroying */
break;
default:
break;
}
}
/*******************************************************************************
$Function: sat_call_setup_tim_cb
$Description: Callback function for the redial timer.
$Returns: Execution status
$Arguments: event - window event
tc - timer info
*******************************************************************************/
static int sat_call_setup_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc)
{
T_MFW_HND win = mfw_parent (mfw_header());
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_sat_call_setup * data = (T_sat_call_setup *)win_data->user;
if ((win EQ NULL) || (win_data EQ NULL) || (data EQ NULL))
return MFW_EVENT_CONSUMED;
data->redial_tim = NULL; /* timer has elapsed */
return MFW_EVENT_CONSUMED;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -