📄 mmitimers.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: MMI
$File: MmiTimers.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 22/02/01
********************************************************************************
Description: This handles the storage of call times.
********************************************************************************
$History: MmiTimers.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 "p_sim.h"
#include "vsi.h"
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
/* SPR#1428 - SH - New Editor changes */
#ifndef NEW_EDITOR
#include "mfw_edt.h"
#endif
#include "mfw_lng.h"
#include "mfw_tim.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_phb.h"
#include "mfw_cm.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "mfw_sat.h"
#include "mfw_phb.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_sms.h"
#include "mfw_sat.h"
#include "dspl.h"
#include "gdi.h" //ES!!
#include "MmiMmi.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiSoftkeys.h"
#include "MmiIcons.h"
#include "MmiMenu.h"
#include "MmiMain.h"
#include "MmiIdle.h"
#include "MmiStart.h"
#include "MmiPins.h"
#include "MmiSounds.h"
#include "audio.h"
#include "cus_aci.h"
#include "MmiTimers.h"
#include "mfw_ffs.h"
#include "mmicolours.h"
/*******************************************************************************
Local Function Prototypes
*******************************************************************************/
static T_MFW_HND timer_create(MfwHnd parent_window);
void timer_destroy(MfwHnd own_window);
unsigned long getLastCallDuration();
void getTimerString(unsigned long time, char* timeString);
void setIncomingCallsDuration(long call_time);
unsigned long getIncomingCallsDuration( void );
void setOutgoingCallsDuration(long call_time);
unsigned long getOutgoingCallsDuration();
static int timer_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason);
static int timer_reset_OK_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason);
void reset_timer_OK(T_MFW_HND parent, UBYTE Identifier);
void reset_timer(T_MFW_HND parent);
/*******************************************************************************
Local Data
*******************************************************************************/
static char timeString[30]; //static string for dialogs
/*******************************************************************************
Public Methods
*******************************************************************************/
/*******************************************************************************
$Function: setLastCallDuration
$Description: writes the duration of the last call to PCM and adds that duration to the
outgoing or incoming call total.
$Returns: none.
$Arguments: The call time and the call's direction (incoming or outgoing)
*******************************************************************************/
void setLastCallDuration(long call_time, UBYTE call_direction)
{
TRACE_FUNCTION("setLastCallDuration()");
FFS_flashData.last_call_duration = call_time;
if (call_direction == INCOMING)
setIncomingCallsDuration(call_time);
if (call_direction == OUTGOING)
setOutgoingCallsDuration(call_time);
return;
}
/*******************************************************************************
$Function: timerLastCall
$Description: handles user selction of "Last Call" in Call Timers Menu.
$Returns: status int
$Arguments: menu and menu item (neither used)
*******************************************************************************/
int timerLastCall(MfwMnu* m, MfwMnuItem* i)
{ T_MFW_HND parent = mfwParent( mfw_header() );
T_DISPLAY_DATA display_info;
T_MFW_HND win = timer_create(parent);
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tTimerData *data = (tTimerData *) win_data->user;
memset(timeString,'\0',sizeof(timeString));
data->timer_type = LAST_CALL;
TRACE_FUNCTION("timerLastCall()");
getTimerString((int)getLastCallDuration(), (char*)timeString);
dlg_initDisplayData_TextStr( &display_info, TxtSoftOK, TxtReset, timeString, NULL, COLOUR_STATUS_OKRESET);
dlg_initDisplayData_events( &display_info, (T_VOID_FUNC) timer_cb, SIX_SECS, KEY_CLEAR|KEY_LEFT|KEY_RIGHT );
/* Call Info Screen
*/
info_dialog( win, &display_info );
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: timerIncomingCalls
$Description: handles user selction of "Incoming Calls" in Call Timers Menu.
$Returns: status int
$Arguments: menu and menu item (neither used)
*******************************************************************************/
int timerIncomingCalls(MfwMnu* m, MfwMnuItem* i)
{ T_MFW_HND parent = mfwParent( mfw_header() );
T_DISPLAY_DATA display_info;
T_MFW_HND win = timer_create(parent);
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tTimerData *data = (tTimerData *) win_data->user;
//clear the editor-buffer before
data->timer_type = INCOMING_CALLS;
TRACE_FUNCTION("timerLastCall()");
getTimerString((int)getIncomingCallsDuration(), (char*)timeString);
dlg_initDisplayData_TextStr( &display_info, TxtSoftOK, TxtReset, timeString, NULL, COLOUR_STATUS_OKRESET);
dlg_initDisplayData_events( &display_info, (T_VOID_FUNC) timer_cb, SIX_SECS, KEY_CLEAR|KEY_LEFT|KEY_RIGHT );
/* Call Info Screen
*/
info_dialog( win, &display_info );
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: timerOutgoingCalls
$Description: handles user selction of "Outgoing Calls" in Call Timers Menu.
$Returns: status int
$Arguments: menu and menu item (neither used)
*******************************************************************************/
int timerOutgoingCalls(MfwMnu* m, MfwMnuItem* i)
{ T_MFW_HND parent = mfwParent( mfw_header() );
T_DISPLAY_DATA display_info;
T_MFW_HND win = timer_create(parent);
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tTimerData *data = (tTimerData *) win_data->user;
//clear the editor-buffer before
memset(timeString,'\0',sizeof(timeString));
data->timer_type = OUTGOING_CALLS;
TRACE_EVENT("timerLastCall()");
getTimerString((int)getOutgoingCallsDuration(), (char*)timeString);
dlg_initDisplayData_TextStr( &display_info, TxtSoftOK, TxtReset, timeString, NULL, COLOUR_STATUS_OKRESET);
dlg_initDisplayData_events( &display_info, (T_VOID_FUNC) timer_cb, SIX_SECS, KEY_CLEAR|KEY_LEFT|KEY_RIGHT );
/* Call Info Screen
*/
info_dialog( win, &display_info );
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
Private Methods
*******************************************************************************/
static T_MFW_HND timer_create(MfwHnd parent_window)
{
tTimerData * data = (tTimerData *)ALLOC_MEMORY (sizeof(tTimerData));
T_MFW_WIN * win;
if (data EQ NULL)
{
return NULL;
}
// Create window handler
data->win = win_create (parent_window, 0, E_WIN_VISIBLE, NULL);
if (data->win EQ NULL)
{
return NULL;
}
// connect the dialog data to the MFW-window
data->mmi_control.dialog = (T_DIALOG_FUNC)NULL;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (tTimerData *)data;
data->parent_win = parent_window;
return data->win;
}
/*******************************************************************************
$Function: timer_destroy
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -