📄 mmiservices.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: Supplementary services
$File: MmiServices.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description
This module provides the supplementary services functionality
********************************************************************************
$History: MmiServices.c
25/10/00 Original Condat(UK) BMI version.
$End
*******************************************************************************/
/******************************************************************************
Include Files
*******************************************************************************/
#define BUGS 0
#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 "p_sim.h"
#include "mfw_sys.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 /* NEW_EDITOR */
#include "mfw_lng.h"
#include "mfw_icn.h"
#include "mfw_tim.h"
#include "mfw_mnu.h"
#include "mfw_phb.h"
#include "mfw_sat.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_sms.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "mfw_cm.h"
#include "mfw_ss.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 "MmiIdle.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MmiIcons.h"
#include "MmiCall.h"
#include "MmiServices.h"
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
#include "ATBCommon.h"
#include "ATBDisplay.h"
#include "ATBEditor.h"
#include "AUIEditor.h"
#include "AUITextEntry.h"
#else /* NEW_EDITOR */
#include "MmiEditor.h"
#endif /* NEW_EDITOR */
#include "MmiCPHS.h"
#include "MmiBookUtils.h"
#include "MmiBookShared.h " // MZ 26/02/01
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "mmicolours.h"
#include "aci_cmh.h" // Marcus: Issue 1494: 18/12/2002: for MAX_USSD_LEN
extern void msgsGetVoiceAddress(CHAR *Buffer);
static void (*show) (void);
static void showWait (T_MFW_HND win);
static void showOk (T_MFW_HND win);
static void showFailed (T_MFW_HND win);
static void showError (T_MFW_HND win, T_MFW_SS_ERROR ss_error);
static void showCLIStatus (T_MFW_HND win, T_MFW_SS_PARA * ss_cnf );
static void showSSNotify (T_MFW_HND win, T_MFW_SS_NOTIFY * ss_notify);
static void showIMEI2 (T_MFW_HND win, T_MFW_SS_PARA * ss_cnf);
static void showUSSDREQ (T_MFW_HND win, T_MFW_SS_PARA * ss_cnf);
static void showUSSDCNF (T_MFW_HND win, T_MFW_SS_PARA * ss_cnf);
static void showUSSDEnter (void);
static void showUSSDFull (T_MFW_HND win);
static void sendUSSD (T_MFW_SS_PARA *ussd_senddata);
static int servicesSendCallDivert(char * divert_number);
int servicesUSSDEdit(struct MfwMnuTag* m, struct MfwMnuItemTag* i);
int servicesUSSDDelete(struct MfwMnuTag* m, struct MfwMnuItemTag* i);
static void servicesShowUSSDMenu(void);
static void servicesStoreUSSD(void);
static void ServicesGetOtherNumber(T_MFW_HND win);
static void servicesStoreVoiceMailNumber( void );
#ifdef NEW_EDITOR
static void services_get_voice_number_cb(T_MFW_HND win, USHORT identifier, SHORT reason);
#else /* NEW_EDITOR */
static void services_get_voice_number_cb(T_MFW_HND win, USHORT reason);
#endif /* NEW_EDITOR */
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND info_win;
T_MFW_HND info_tim;
T_MFW_HND info_kbd;
T_MFW_HND info_kbd_long;
USHORT LeftSoftKey; /* used for Ok */
USHORT RightSoftKey; /* Used for Back */
ULONG Time;
T_MFW_EVENT KeyEvents;
USHORT TextId1; /* Line 1 */
USHORT TextId2; /* Line 2 */
char * TextString4;
USHORT Identifier;
T_VOID_FUNC Callback;
} T_dialog_ext_info;
T_MFW_HND dialog_ext_info_dialog (T_MFW_HND parent_win,
T_dialog_ext_info * display_info);
static MfwHnd lastFocus; /* store old focus */
static MfwHnd win; /* our window */
static MfwHnd kbd; /* our keyboard handler */
static MfwHnd times; /* timeout */
static MmiState nextState; /* next state when finished */
static int servicesState; /* current state of module */
static T_MFW_SS_PARA *ss_cnf; /* union container for all SS confirmations */
/* decode service type - tele/bearer */
static unsigned int serviceGetServiceType( UBYTE ss_telecom_type, UBYTE ss_telecom_service);
static unsigned int serviceGetCategory( T_MFW_SS_CATEGORY cat );
static unsigned int serviceGetType( T_MFW_SS_CODES type );
static unsigned int ServiceGetStatus( UBYTE pStatus);
static unsigned int serviceGetError( T_MFW_SS_ERROR ss_error);
#define CB_PSW_LEN 4
typedef enum
{
CFBusy = 0,
CFNoReach,
CFNoReply,
CFAllConditional,
CFUnconditional,
CFAllCalls
} SERVICE_CF_TYPE;
typedef enum
{
CBAllOutgoing = 0,
CBInternational,
CBInternationalHome,
CBAllIncoming,
CBIncomingRoaming
} SERVICE_CB_TYPE;
typedef enum
{
CFVoice = 0,
CFAuxVoice, /*MC, ALS line 2*/
CFFax,
CFData,
CFAll
} SERVICE_CF_SERVICE;
typedef enum
{
CFActivate = 0,
CFDeactivate,
CFCheck
} SERVICE_CF_ACTION;
typedef enum
{
CBActivate = 0,
CBDeactivate,
CBCheck,
CBCheckPassword,
CBNewPassword,
CBConfirmNewPassword
} SERVICE_CB_ACTION;
/* NOTE that these are needed in new architecture */
static SERVICE_CF_TYPE CFType; /* Type of Call Forwarding */
static SERVICE_CF_SERVICE CFService; /* basic service for Call Forwarding */
static SERVICE_CF_ACTION CFAction; /* action for Call Forwarding */
static SERVICE_CB_TYPE CBType; /* Type of Call Barring */
static SERVICE_CB_ACTION CBAction; /* action for Call Barring */
static char CFNumber[MAX_LEN]; /* number to forward calls to */
/* end of bits for USSD */
#define CF_ACTIVE_STATUS 1
#define CF_INACTIVE_STATUS 2
/* Marcus: Issue 1652: 03/02/2003 */
#define CF_PROVISIONED_STATUS 3
#define CF_UNKNOWN_STATUS 4
typedef struct
{
USHORT service;
USHORT status;
char forwarded_to_number[16];
} T_ss_feature_cf_data;
typedef struct
{
T_ss_feature_cf_data ss[MFW_MAX_FEAT_NR];
} T_ss_feature_cf;
typedef struct
{
USHORT service;
} T_ss_feature_cw_data;
typedef struct
{
USHORT status;
T_ss_feature_cw_data ss[MFW_MAX_FEAT_NR];
} T_ss_feature_cw;
typedef struct
{
USHORT service;
USHORT status;
} T_ss_feature_cb_data;
typedef struct
{
T_ss_feature_cb_data ss[MFW_MAX_FEAT_NR];
} T_ss_feature_cb;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND win; // window handle
T_MFW_HND ss_handle; /* MFW services handler */
T_MFW_HND kbd;
T_MFW_HND kbd_long;
T_MFW_CM_AOC_INFO aocInfo;
T_MFW_HND info_win; /* handle to info dialog */
T_MFW_HND info_wait; /* handle to wait dialog */
T_MFW_HND cb_menu_win; /* handle to ussd number dialog */
T_MFW_HND input_number_win; /* handle to call forward dialog */
USHORT event;
char edt_buf_name[MAX_ALPHA_LEN];/*MC SPR 1257*/
char edt_buf_number[PHB_MAX_LEN];
char edt_buf_cb_password[CB_PSW_LEN+1];
char edt_buf_cb_new_password[CB_PSW_LEN+1];
char edt_buf_cb_conf_new_password[CB_PSW_LEN+1];
#ifndef NEW_EDITOR /* SPR#1428 - SH - New Editor changes - no longer required */
MfwEdtAttr edt_attr_name;
MfwEdtAttr edt_attr_number;
#endif /* ifndef NEW_EDITOR */
T_ss_feature_cf * mfw_ss_cf;
T_ss_feature_cw * mfw_ss_cw;
T_ss_feature_cb * mfw_ss_cb;
UBYTE current_feature;
UBYTE max_feature;
UBYTE dcs; /* need it for sending ussd to mfw */
} T_ss;
T_ss ss_data = {0};
static void srv_empty_list_result (UBYTE ss_category, USHORT event, UBYTE ss_status); /* Marcus: Issue 1652: 03/02/2002 */
static void showCFStatus (T_MFW_HND win , T_ss * data );
static UBYTE srv_copy_feature_list_cf (T_ss_feature_cf * out_list, T_MFW_SS_CF_CNF * in_list);
static void srv_get_forwarded_to_number ( char * textString,
char * forwarded_to_number);
static UBYTE srv_get_service_type ( USHORT * textId,
UBYTE ss_telecom_type, UBYTE ss_telecom_service);
static void srv_get_status (USHORT *textId, UBYTE pStatus);
static UBYTE srv_check_CF_telephony_status (T_MFW_SS_CF_CNF * in_list);
static void showCWStatus (T_MFW_HND win, T_ss * data );
static UBYTE srv_copy_feature_list_cw (T_ss_feature_cw * out_list, T_MFW_SS_CW_CNF * in_list);
static void showCBStatus (T_MFW_HND win, T_ss * data );
static UBYTE srv_copy_feature_list_cb (T_ss_feature_cb * out_list, T_MFW_SS_CB_CNF * in_list);
static int services_win_cb(T_MFW_EVENT e, T_MFW_SS_PARA * para);
static int services_ss_cb(T_MFW_EVENT e, T_MFW_HND para);
static int services_info_cb(T_MFW_HND win, USHORT identifier, UBYTE reason);
static void srv_display_status (UBYTE ss_status);
typedef struct
{
int text;
#ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes */
T_ED_ATTR *editor_attr_input;
#else /* NEW_EDITOR */
MfwEdtAttr* edt_attr_input;
#endif /* NEW_EDITOR */
int left_soft_key;
int right_soft_key;
short abc; /* numeric or alpha? */
#ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes */
T_AUI_EDIT_CB callback;
#else /* NEW_EDITOR */
void (* callback)(T_MFW_HND win,USHORT reason);
#endif /* NEW_EDITOR */
} T_input_properties;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND win;
T_MFW_HND kbd;
T_MFW_HND kbd_long;
#ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes */
T_MFW_HND edit_win;
#else /* NEW_EDITOR */
T_MFW_HND edt_input;
#endif /* NEW_EDITOR */
T_input_properties properties;
} T_services_input;
/* SPR#1428 - SH - New Editor changes - no longer required*/
#ifndef NEW_EDITOR
void services_number_input_cb(T_MFW_HND win, UBYTE identifier, USHORT reason);
#endif
static T_MFW_HND services_input_create (MfwHnd parent);
static void services_input_destroy (MfwHnd window);
static MfwHnd services_input_start(MfwHnd parent,T_input_properties *properties);
void services_input (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int services_input_win_cb(MfwEvt e, MfwWin *w);
/* SPR#1428 - SH - New Editor changes - no longer required*/
#ifndef NEW_EDITOR
static int services_input_kbd_cb(MfwEvt e, MfwKbd *k);
static int services_input_kbd_long_cb(MfwEvt e, MfwKbd *k);
#endif
/* editor */
//GW Moved editor definitions to mmiresources.h
#define SAT_EDITOR_COLOR 0
#define SAT_EDITOR_FONT 0
#define SAT_EDITOR_CONTROLS 0
#define SAT_EDITOR_BUFFER_SIZE 32
/* */
/*******************************************************************************
$Function: servicesInit
$Description:
$Returns:
$Arguments:
*******************************************************************************/
T_MFW_HND servicesInit (T_MFW_HND parent)
{
TRACE_FUNCTION("servicesInit function");
/*
* Initialise MFW
*/
ss_mfw_init();
/*
* Create any other handler
*/
ss_data.ss_handle = ss_create (0,
0x0FFF,
(T_MFW_CB)services_ss_cb);
ss_data.win = 0;
return (services_create (0));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -