⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmicphs.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 3 页
字号:
/*******************************************************************************

					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:		CPHS
 $File: 	    MmiCPHS.c
 $Revision:		1.0							  
									      
 $Author:		Condat(UK)							   
 $Date: 	    25/01/02							  
									       
********************************************************************************
									      
 Description

    This module provides the CPHS functionality

  
********************************************************************************
 $History: MmiCall.c

	25/01/02			Original Condat(UK) BMI version. (MC)	
	   
 $End

*******************************************************************************/


/******************************************************************************
									      
				Include Files
									      
*******************************************************************************/

/* 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 "cus_aci.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_tim.h"
#include "mfw_phb.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_sms.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_lng.h"
#include "mfw_sat.h"
#include "mfw_kbd.h"
#include "mfw_nm.h"
#include "mfw_str.h"

#include "dspl.h"

#include "MmiMain.h"
#include "MmiDummy.h"
#include "MmiMmi.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiDialogs.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.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"
#endif
#include "MmiBookShared.h"
#include "MmiSmsMenu.h"
#include "MmiIcons.h"
#include "MmiColours.h"

#include "MmiCphs.h"

/* SPR759 - SH */
#ifdef MMI_HOMEZONE_ENABLED
#include "MmiHomezone.h"
#endif




/******************************************************************************
									      
			       Definitions
									      
*******************************************************************************/
//#define CPHS_PROV_TEST /*Test to bypass the reading of the CPHS field from the SIM card*/

typedef enum


{
	INFO_NUM_LIST,
	MAILBOX_LIST, 
	MAILBOX_LIST_CALL
}
	T_MENU_TYPE;


static MfwMnuAttr InfoNum_menuAttrib =
{
    &melody_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_XX, TxtNull, NULL, MNUATTRSPARE

};

typedef struct 
{
	 /* administrative data */

    T_MMI_CONTROL	mmi_control;
    T_MFW_HND		win;
    T_MFW_HND		parent_win;
#ifdef NEW_EDITOR
	T_AUI_EDITOR_DATA	editor_data;	/* SPR#1428 - SH - New Editor data */
#else /* NEW_EDITOR */
	T_EDITOR_DATA		editor_data;
#endif /* NEW_EDITOR */

    /* associated handlers */

    T_MFW_HND		kbd;
    T_MFW_HND		kbd_long;
    T_MFW_HND		menu;
	T_MFW_HND		menu_tim;
	UBYTE				status_of_timer; /* use for the keypadlock */

	T_MFW_HND mailbox_win;
	T_MFW_CPHS_ENTRY cphs_voicemail_num;
	T_MFW_CPHS_VC_STAT* cphs_voicemail_status;
	T_MFW_CPHS_STATUS cphs_status;
	T_MFW_CPHS_OP_NAME* operator_name;

}  T_MMI_CPHS_DATA;


typedef struct
{
  T_MMI_CONTROL    mmi_control;
  T_MFW_HND	   numbers_win; 				   /* MFW win handler	   */
  T_MFW_HND	   parent;
  T_MFW_HND	   melody_handler;	   /* MFW sms handler	   */
  unsigned char      local_status;
  ListMenuData	   * menu_list_data;
} T_INFO_NUM_INFO;

#define E_INIT 1



#define CPHS_TELESERVICES_BYTE_VALUE	0x06
#define ALS_MASK						0x80

#define CPHS_INFONUMS_BYTE_VALUE		0xC0
#define INFONUM_MASK					0xFF


/******************************************************************************
									      
			       Static Global variables
									      
*******************************************************************************/

static T_MFW_CPHS_ENTRY cphs_voicemail_num;
static T_MFW_CPHS_INFONUM_ENTRY current_info_num;
static T_MFW_CPHS_VC_NUM cphs_voicemail_numbers;
static T_MFW_CPHS_VC_STAT* cphs_voicemail_status;
static T_MFW_CPHS_STATUS cphs_status = CPHS_NotPresent;
static T_MFW_CPHS_OP_NAME operator_name;
static T_MFW_CPHS_DV_STAT call_forwarding_status;
static T_MFW_CPHS_ALS_STATUS als_status;
static T_MFW_CPHS_CSP customer_service_profile;
static T_MFW_CPHS_INFONUM_LIST* info_numbers[4]= {NULL, NULL, NULL, NULL};

static UBYTE info_num_level;
static USHORT info_num_index;

static T_MENU_TYPE type_of_list = INFO_NUM_LIST;

static T_MFW_PHB_TEXT text ; //test variables
static T_MFW_CPHS_INFO_NUMBER directory;
static	T_MFW_CPHS_INFO_NUMBER number;
static	T_MFW_CPHS_INFONUM_LIST test_info_numbers;

static T_MFW_PHB_TEXT text2 ; //test variables
static T_MFW_CPHS_INFO_NUMBER directory2;
static	T_MFW_CPHS_INFO_NUMBER number2;
static	T_MFW_CPHS_INFONUM_LIST test_info_numbers2;
/******************************************************************************
									      
			       Function Prototypes
									      
*******************************************************************************/


int show_cphs_mb_number(T_MFW_CPHS_ENTRY* mb_number);
static void mailbox_edit_cb( T_MFW_HND win, USHORT Identifier,UBYTE reason);
static int cphs_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
int cphs_mfw_cb(T_MFW_EVENT event, void* para);
void cphs_dialog_cb(T_MFW_HND win, USHORT e,  SHORT identifier, void *parameter);
T_MFW_HND mmi_cphs_create(T_MFW_HND parent_window);
T_MFW_HND	edit_mailbox_start(T_MFW_HND parent_window);

static T_MFW_HND  buildInfoNumberMenu( MfwHnd parent_window);
void info_num_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
void InfonumList_cb(T_MFW_HND * Parent, ListMenuData * ListData);
static void InfoNum_destroy(MfwHnd own_window);
static int info_num_win_cb (MfwEvt e, MfwWin *w) ;
void info_num_display_cb(T_MFW_HND win, USHORT identifier, UBYTE reason);


/******************************************************************************
									      
			       Public functions
									      
*******************************************************************************/
/*******************************************************************************

 $Function:	mmi_cphs_init()

 $Description:	initiatialise cphs module
 
 $Returns:		mfw handle

 $Arguments:	none
		
*******************************************************************************/
T_MFW_HND mmi_cphs_init()
{	T_MFW_HND status;
	cphs_init();			//initialise MFW CPHS module

	status = cphs_create(NULL, 0xFFFF, cphs_mfw_cb); //create handler for MFW CPHS EVENTS
	
	info_num_level = 0;
	info_num_index = 1;
	cphs_get_als_info();
	return status;
}

void mmi_cphs_refresh()
{	
	cphs_support_check();	//check if cphs supported
	/*retrieval of other values set off by callback function cphs_mfw_cb
	so when the CPHS status is retrieved, the operator name is then requested and 
	when it has returned, then the CSP is requested etc etec  */
		
}
/*******************************************************************************

 $Function:	cphs_E_plus_ALS_supported

 $Description:	returns TRUE if SIM is from E-plus, FALSE otherwise 
 
 $Returns:		status BOOL

 $Arguments:	none
		
*******************************************************************************/
BOOL cphs_E_plus_ALS_supported()
{	char IMSI[17];
	char MNC_MCC[6];
	char E_plus_MNC_MCC[] = "26203";
	int i=0;
	T_ACI_RETURN result;
	char debug[40];
	
	while ((result = qAT_PlusCIMI(CMD_SRC_LCL, IMSI)) != AT_CMPL  && i < 5)
	{
		i++;
	}
		
	strncpy(MNC_MCC, IMSI, 5);
	MNC_MCC[5] =0;//terminate string
	TRACE_EVENT("E-plus IMSI?");
	TRACE_EVENT(MNC_MCC);
	if (!strncmp(E_plus_MNC_MCC, MNC_MCC, 5)) //if e-plus IMSI
	{	
		return TRUE;

	}
	else
	{	TRACE_EVENT("Not e-plus IMSI");
		return FALSE;
	}

}
/*******************************************************************************

 $Function:	cphs_als_status

 $Description:	display which ALS line is enabled
 
 $Returns:		status int

 $Arguments:	menu, tag (not used)
		
*******************************************************************************/
int cphs_als_status(MfwMnu* m, MfwMnuItem* i)
{	T_MFW_HND		parent	     = mfwParent( mfw_header());
	UBYTE line;
	line = GetAlsLine();
#ifndef CPHS_PROV_TEST
	if (CphsPresent() == TRUE || cphs_E_plus_ALS_supported())
#endif
	{
		if (als_status.selectedLine != MFW_SERV_NotPresent)
			switch(line)
			{
				case (MFW_SERV_LINE1): ShowMessage(parent, TxtLine1, TxtActivated);break;
				case (MFW_SERV_LINE2): ShowMessage(parent, TxtLine2, TxtActivated);break;
				default: ShowMessage(parent, TxtReadError, TxtNull);break;
			}
		else
			ShowMessage(parent, TxtReadError, TxtNull);
	}
#ifndef CPHS_PROV_TEST
	else
		ShowMessage(parent, TxtNotSupported, TxtNull);
#else
		cphs_support_check();
#endif

	return MFW_EVENT_CONSUMED;
}

/*******************************************************************************

 $Function:	cphs_line1_select

 $Description:	Enable ALS Line1 from menu 
 
 $Returns:		status int

 $Arguments:	menu, tag (not used)
		
*******************************************************************************/
int cphs_line1_select(MfwMnu* m, MfwMnuItem* i)
{	
	T_MFW_HND		parent	     = mfwParent( mfw_header());
#ifndef CPHS_PROV_TEST
	if (!ALSPresent(NULL, NULL, NULL))
#endif
	{	cphs_select_line(MFW_SERV_LINE1);
		cphs_get_divert_status();
	}
#ifndef CPHS_PROV_TEST
	else
		ShowMessage(parent, TxtNotSupported, TxtNull);
#endif
	return MFW_EVENT_CONSUMED;
}
/*******************************************************************************

 $Function:	cphs_line2_select

 $Description:	Enable ALS Line2 from menu 
 
 $Returns:		status int

 $Arguments:	menu, tag (not used)
		
*******************************************************************************/
int cphs_line2_select(MfwMnu* m, MfwMnuItem* i)
{	T_MFW_HND		parent	     = mfwParent( mfw_header());

#ifndef CPHS_PROV_TEST
	if (!ALSPresent(NULL, NULL, NULL))
#endif
	{	cphs_select_line(MFW_SERV_LINE2);
		cphs_get_divert_status();
	}
#ifndef CPHS_PROV_TEST
	else
		ShowMessage(parent, TxtNotSupported, TxtNull);
#endif
	return MFW_EVENT_CONSUMED;
}
/*******************************************************************************

 $Function:	menu_cphs_call_mailbox_number

 $Description:	edit mailbox numbers from menu 
 
 $Returns:		status int

 $Arguments:	menu, tag (not used)
		
*******************************************************************************/
int menu_cphs_call_mailbox_number(MfwMnu* m, MfwMnuItem* i)
{   T_MFW_HND		parent	     = mfwParent( mfw_header());
	T_MFW_CPHS_INFO configuration;
	char debug[40];

	type_of_list = MAILBOX_LIST_CALL;
	cphs_config(&configuration);
	sprintf(debug, "CPHS? %d Mailbox config info: %d", configuration.mbNum, CphsPresent());
	TRACE_EVENT(debug);
	
	if (CphsMailboxPresent()==TRUE )
		cphs_get_mailbox();
	else
		M_callVoice(m, i);
    return MFW_EVENT_CONSUMED;		
}
/*******************************************************************************

 $Function:	menu_cphs_edit_mailbox_number

 $Description:	edit mailbox numbers from menu 
 
 $Returns:		status int

 $Arguments:	menu, tag (not used)
		
*******************************************************************************/
int menu_cphs_edit_mailbox_number(MfwMnu* m, MfwMnuItem* i)
{   T_MFW_HND		parent	     = mfwParent( mfw_header());
	T_MFW_CPHS_INFO configuration;
	char debug[40];
	
	type_of_list = MAILBOX_LIST;
	
	cphs_config(&configuration);
	sprintf(debug, "CPHS? %d Mailbox config info: %d", configuration.mbNum, CphsPresent());
	TRACE_EVENT(debug);
	
	if (CphsMailboxPresent()==TRUE )
		cphs_get_mailbox();
	else
		M_exeVoice(m, i);
    return MFW_EVENT_CONSUMED;		
}
/*******************************************************************************

 $Function:	InfoNumbers

 $Description:	displays information number list from CPHS 

 $Returns:		MFW_EVENT_CONSUMED always

 $Arguments:	m, menu, i, item
 
*******************************************************************************/

int InfoNumbers( MfwMnu *m, MfwMnuItem *i )
{
	T_MFW_HND win;
    T_MFW_HND parent_win = mfw_parent(mfw_header());
	char debug[40];
	T_MFW_CPHS_INFO config_info;
	
	cphs_config(&config_info);
	sprintf(debug, "Info Num config info: %d", config_info.iNum);
	TRACE_EVENT(debug);
	
	if (CphsPresent() && config_info.iNum&0x03)
	{	if (info_numbers[0] != NULL&& info_numbers[0]->count != 0)
		{	type_of_list = INFO_NUM_LIST;
			info_num_level = 1;
			win = buildInfoNumberMenu(parent_win);
			
			if (win NEQ NULL)
			{
				SEND_EVENT (win, E_INIT, 0, 0);
			}
		}
		else
			ShowMessage(parent_win, TxtEmptyList, TxtNull);
	}
	else
		ShowMessage(parent_win, TxtNotSupported, TxtNull);
	
	return MFW_EVENT_CONSUMED;
}


/*******************************************************************************

 $Function:	CphsRequestOperatorName()

 $Description:	returns operator name data structure from CPHS SIM data

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -