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

📄 mmicphs.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 4 页
字号:
/*******************************************************************************

					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)	
	28/08/02      wufei modified
	   
 $End

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


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

#include "MmiCPHS.h"
#include "MmiEditor.h"
#include "Mfw_edt.h"
#include "MmiDialogs.h"
#include <string.h>

/*kk tracing*/
//#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"

/*kk tracing end*/



//#include "stddefs.h"	  // needed for mfw_mfw.h

#include "p_sim.h"

//#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_edt.h"
#include "mfw_tim.h"
#include "mfw_phb.h"
#include "ksd.h"
#include "psa.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 "dspl.h"

#include "MmiMain.h"
#include "MmiDummy.h"
#include "MmiLists.h"
#include "MmiMmi.h"


#include "MmiDialogs.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MmiEditor.h"
#include "MmiBookShared.h"
#include "MmiSmsMenu.h"
#include "MmiIcons.h"

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

#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"





/******************************************************************************
									      
			       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 =
{
    0,
    &melody_menuArea,
    MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu	    */
    -1, 				/* use default font	    */
    NULL,				/* with these items	    */
    0					/* number of items     */
};

typedef struct 
{
	 /* administrative data */

    T_MMI_CONTROL	mmi_control;
    T_MFW_HND		win;
    T_MFW_HND		parent_win;
	T_EDITOR_DATA		editor_data;
	
    /* 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;/*operator name on SIM*/
static T_MFW_CPHS_OP_NAME display_operator_name;	/*operator name to display*/
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  */
	//if (cphs_operator_name()== CPHS_NotPresent)//get operator name
	//	TRACE_EVENT("CPHS not supported");
	//cphs_get_csp();
	//cphs_get_info_num(1, info_num_index); 
		
}
/*******************************************************************************

 $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)
	{
	    TRACE_EVENT_P1("glowing: cphs_E_plus_ALS_supported IMSI=%s", IMSI );
		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;
	/*begin of zy change 2003-02-28,line0,1all as LINE1*/
	line = GetAlsLine();
		if (ALSPresent(NULL, NULL, NULL))
		{
		ShowMessage(parent,TxtNull , TxtNotSupported,REMIND_FAILURE);
		return MFW_EVENT_CONSUMED;
		}
#ifndef CPHS_PROV_TEST
	if (CphsPresent() == TRUE || cphs_E_plus_ALS_supported())
#endif
	{
		//if (als_status.selectedLine != MFW_SERV_NotPresent)
		if (FlashDCTbData.lineselectflag<= 2&&FlashDCTbData.lineselectflag>= 0)
			switch(line)
			{
				case (0)://MFW_SERV_LINE1):
				case (1)://(MFW_SERV_LINE1):
					ShowMessage(parent, TxtLine1, TxtActivated,REMIND_SUCCEED);
		            return MFW_EVENT_CONSUMED;
					break;
				case (2)://(MFW_SERV_LINE2): 
				    ShowMessage(parent, TxtLine2, TxtActivated,REMIND_SUCCEED);
		            return MFW_EVENT_CONSUMED;
				    break;
				default: 
					ShowMessage(parent, TxtNull,TxtReadError ,REMIND_FAILURE);break;
					/*end of zy 2003-02-28*/
			}
		else
			ShowMessage(parent,TxtNull , TxtReadError,REMIND_FAILURE);
	}
#ifndef CPHS_PROV_TEST
	else
		ShowMessage(parent,TxtNull , TxtNotSupported,REMIND_FAILURE);
#else
		cphs_support_check();
#endif

	return MFW_EVENT_CONSUMED;
}

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

 $Function:	als_status_checkicon

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

 $Arguments:	menu, tag (not used)
		
*******************************************************************************/
int als_status_checkicon(void)
{	UBYTE line;    
	line = GetAlsLine();
/*#ifndef CPHS_PROV_TEST
	if (CphsPresent() == TRUE || cphs_E_plus_ALS_supported())
#endif zy move 2003-03-10
needn't check if it is cphs card just judge it by flashdata
*/
	{TRACE_EVENT("zy:CphsPresent E_plus_ALS_supported ok!");
	//	if (als_status.selectedLine != MFW_SERV_NotPresent)zy2003_02-28
			switch(line)
			{
				case (MFW_SERV_LINE1)://zy noselectline let it as line1
					TRACE_EVENT("zy:is line1");
					iconsSetState(iconServices1);
					iconsDeleteState(iconServices2);
					return 0;
					break;
				case (MFW_SERV_LINE2): //zy serverline1
					TRACE_EVENT("zy:is line2");
					iconsSetState(iconServices1); 
					iconsDeleteState(iconServices2);
					return 1;
					break;
				case (2)://zy serverline2 
					TRACE_EVENT("zy:is line2");
					iconsSetState(iconServices2); 
					iconsDeleteState(iconServices1);
					return 2;
					break;
				default: 
			      iconsDeleteState(iconServices1);
                  iconsDeleteState(iconServices2);
                  return 0;
				break;
				
			}
         }
	/*	else
				 {
				  TRACE_EVENT("zy:Not CphsPresent E_plus_ALS_supported!");
				  iconsDeleteState(iconServices1);
                  iconsDeleteState(iconServices2);
                  return 0;
			      }zy move 2003-03-10*/
}

/*******************************************************************************
 $Function:	cphs_line1_select

 $Description:	Enable ALS Line1 from menu 
 

⌨️ 快捷键说明

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