mmicphs.c

来自「是一个手机功能的模拟程序」· C语言 代码 · 共 1,743 行 · 第 1/4 页

C
1,743
字号
 $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)/* CphsPresent()|| cphs_E_plus_ALS_supported()*/)
#endif
	{

		cphs_select_line(MFW_SERV_LINE1);
		//cphs_get_divert_status();  //hu binhao 2002-2-26 commented

		FlashDCTbData.lineselectflag=1;
		flash_DCTbwrite(); 
		ShowMessage(parent, TxtLine1, TxtActivated,REMIND_SUCCEED);  //hubin 2002-11-27
        als_status_checkicon();//zy add 12/23 for lineicon
	}
#ifndef CPHS_PROV_TEST
	else
		ShowMessage(parent, TxtNull, TxtNotSupported,REMIND_FAILURE);
#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)/*CphsPresent()|| cphs_E_plus_ALS_supported()*/)
#endif
	{	cphs_select_line(MFW_SERV_LINE2);
		//cphs_get_divert_status();  //hu binhao 2002-2-26 commented
		FlashDCTbData.lineselectflag=2;
		flash_DCTbwrite(); //wufei 0827
		ShowMessage(parent, TxtLine2, TxtActivated,REMIND_SUCCEED); //hubin 2002-11-27
		als_status_checkicon();//zy add 12/23 for lineicon
	}
#ifndef CPHS_PROV_TEST
	else
		ShowMessage(parent, TxtNull, TxtNotSupported,REMIND_FAILURE);  //hu binhao 
#endif

	return MFW_EVENT_CONSUMED;
}

/*****************************wufei 0827**************************************************

 $Function:	line_check

 $Description:	check the status of line select 
 
 $Returns:		

 $Arguments:	menu, tag 
		
*******************************************************************************/
USHORT line_check (struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi)
{

if( ALSPresent(NULL, NULL, NULL))
   return FLAGFUNC_FALSE_ICON;    //hu binhao 10-31 ,fix bug of 6110
	

if( ((FlashDCTbData.lineselectflag==1)&&(((int)mi->str)==TxtLine1))||
     ((FlashDCTbData.lineselectflag==2)&&(((int)mi->str)==TxtLine2)))
     
    return FLAGFUNC_TRUE_ICON;
 
  else

    return FLAGFUNC_FALSE_ICON;
 

}

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

 $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,REMIND_FAILURE);
	}
	else
		ShowMessage(parent_win, TxtNotSupported, TxtNull,REMIND_FAILURE);
	
	return MFW_EVENT_CONSUMED;
}


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

 $Function:	CphsRequestOperatorName()

 $Description:	returns operator name data structure from CPHS SIM data
 				SPR 1815, re-wrote function to return host network name or a roaming
 				indicator when roaming.

 $Returns:		see above

 $Arguments:	network data structure 
 
*******************************************************************************/
T_MFW_CPHS_OP_NAME* CphsRequestOperatorName(T_network* network_data)
{	BOOL roaming = network_data->roaming_indicator;/*get roaming indicator*/
	UBYTE selection_mode = nm_get_mode();/*get registration mode*/
	BOOL home_country;
	T_MFW_NETWORK_STRUCT home_network_info;

	nm_home_plmn(&home_network_info);/*get home PLMN info*/

	/*find out if we're in home country*/
	if (!strncmp((char*)network_data->network_name, (char*)home_network_info.network_numeric,3))
		home_country = TRUE;
	else
		home_country = FALSE;

	/* if we're not roaming, use the network name on SIM*/
	if (!roaming)
		return &operator_name;
	else
	{	/*if we aren't in home country OR we're using manual selection, display current PLMN MCC/MNC*/
		if (home_country == FALSE || selection_mode == NM_MANUAL)
		{ 	memcpy((char*)display_operator_name.longName.data, (char*)network_data->plmn_name, LONG_NAME);
			memcpy((char*)display_operator_name.shortName.data, (char*)network_data->network_name, SHORT_NAME);
		}
		else /*show ROAMING indicator*/
		{ 	memcpy((char*)display_operator_name.longName.data, MmiRsrcGetText(TxtRoaming), LONG_NAME);
			memcpy((char*)display_operator_name.shortName.data, (char*)network_data->network_name, SHORT_NAME);
		}	
	
		return &display_operator_name;
	}
}

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

 $Function:	CphsPresent()

 $Description:	indicates whether CPHS sim or not

 $Returns:		TRUE if it is, FALSe if it isn't
 $Arguments:	none
 
*******************************************************************************/
UBYTE CphsPresent()
{

	if (cphs_status == CPHS_OK)
		return TRUE;
	else
	 {	 if (cphs_status == CPHS_NotPresent)
			return FALSE;
		else /*MC 21/05/02, CONQ5999->6007 Helps diagnose initialisation probs*/
			return CPHS_ERR;
	}
}
/*******************************************************************************

 $Function:	CphsMailboxPresent

 $Description:	indicates whether a CPHS SIM which supports mailbox numbers

 $Returns:		TRUE if it is, FALSe if it isn't
 $Arguments:	none
 
*******************************************************************************/
USHORT CphsMailboxPresent( /*struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi*/ )
{	T_MFW_CPHS_INFO config_info;

	cphs_config(&config_info);

	if (config_info.mbNum &0x03 && CphsPresent())
		return /*0*/TRUE;
	else
		return /*1*/FALSE;

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

 $Function:	ALSPresent

 $Description:	indicates whether a CPHS SIM supports ALS by checking CSP

 $Returns:		0 if it does, 1 if it doesn't
 $Arguments:	menu tag, menu attribute tag, menu item tag (none of them used, 
				this is merely the format for menu display/suppression functions)
 
*******************************************************************************/
USHORT ALSPresent( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
{	int i;
	char debug[50];
	TRACE_EVENT("glowing: ALSPresent -- the following is customer_service_profile table list");
	for(i=0; i< 20/*length of CSP*/; i+=2)	
	{	sprintf(debug, "CSP: %d, %d", customer_service_profile.csp[i], customer_service_profile.csp[i+1]);
		TRACE_EVENT(debug);
		if (customer_service_profile.csp[i] ==CPHS_TELESERVICES_BYTE_VALUE)
		{	if (customer_service_profile.csp[i+1] & ALS_MASK)
			{	
				return 0; //ALS is supported
			}
		}
	}
	TRACE_EVENT("glowing: ALSPresent -- end of customer_service_profile table list");
	return	!(cphs_E_plus_ALS_supported()); //check if E-plus ALS supported
	//return 1;
}
/*******************************************************************************

 $Function:	InfoNumbersPresent

 $Description:	indicates whether a CPHS SIM has Info Numbers by checking CSP

 $Returns:		0 if it does, 1 if it doesn't
 $Arguments:	none
 
*******************************************************************************/
USHORT InfoNumbersPresent( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
{	T_MFW_CPHS_INFO config_info;
	char debug[30];
	int i;
	cphs_config(&config_info);
	sprintf(debug, "InfoNum config: %d", config_info.iNum);

	for(i=0; i< strlen((char*)customer_service_profile.csp); i+=2)	
	{
		if (customer_service_profile.csp[i] ==CPHS_INFONUMS_BYTE_VALUE)
			if (customer_service_profile.csp[(i+1)] & INFONUM_MASK)
				return 0; //ALS is supported
	}
	return 1;
}
/*******************************************************************************

 $Function:	GetCphsVoicemailStatus

 $Description:	Asks MFW to check voicemail status on CPHS SIM
				cphs_mfw_cb handles callback from this
 $Returns:		status of line passed as parameter
 $Arguments:	line
 
*******************************************************************************/
T_MFW_CFLAG_STATUS GetCphsVoicemailStatus(UBYTE line)
{	MfwHnd idle_win = idle_get_window();
	UBYTE temp =1;
	cphs_get_mailbox_status (); 
	TRACE_EVENT("Requesting voicemail status");
	
	switch (line)
	{
		case LINE1:	return cphs_voicemail_status->line1; break;
		case LINE2:		return cphs_voicemail_status->line2; break;
		case FAX:		return cphs_voicemail_status->fax; break;
		case DATA:		return cphs_voicemail_status->data; break;
		default:		return MFW_CFLAG_NotPresent;
	}
}
/*******************************************************************************

 $Function:	GetCphsDivertStatus

 $Description:	get call forwarding status of specified line
				cphs_mfw_cb handles callback from this
 $Returns:		status of line passed as parameter
 $Arguments:	line
 
*******************************************************************************/

T_MFW_CFLAG_STATUS GetCphsDivertStatus(UBYTE line)
{	
	switch (line)
	{
		case MFW_SERV_LINE1:	return call_forwarding_status.line1; break;
		case MFW_SERV_LINE2:		return call_forwarding_status.line2; break;
		case MFW_SERV_FAX:		return call_forwarding_status.fax; break;
		case MFW_SERV_DATA:		return call_forwarding_status.data; break;
		default:		return MFW_CFLAG_NotPresent;
	}
}
/*******************************************************************************

 $Function:	GetAlsLine
 $Description:	gets current als line
 $Returns:		current als line
 $Arguments:	line
 
*******************************************************************************/
UBYTE GetAlsLine()
{	
	return FlashDCTbData.lineselectflag;
}

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

 $Function:	ShowMessage
 $Description:	Displays screen with passed text ids
 $Returns:		nothing
 $Arguments:	parent window, 2 text ids
 
*******************************************************************************/
void ShowMessage(T_MFW_HND win, USHORT TextId1, USHORT TextId2,USHORT  IconIndex)
{

	T_DISPLAY_DATA Dialog;

	/* Initialise the dialog control block with default information
	*/
	dialog_info_init(&Dialog);//gdy add 
	Dialog.KeyEvents	= KEY_LEFT| KEY_RIGHT|KEY_CLEAR;
	Dialog.TextId		= TextId1;
	Dialog.TextId2		= TextId2;
	Dialog.TextString	= '\0';
	Dialog.TextString2	= '\0';
	Dialog.LeftSoftKey	= 0;
	Dialog.RightSoftKey	= 0;
	Dialog.Callback 	= (T_VOID_FUNC) NULL;
	Dialog.Identifier	= 0;
	Dialog.Time = TWO_SECS;  //xsf change THREE_SECS to TWO_SECS 2002.10.11
    Dialog.iconindex= IconIndex;
	/* Show the dialog
	*/
	info_dialog( win, &Dialog );
}



/******************************************************************************
									      
			     Private functions
									      
*******************************************************************************/

T_MFW_HND	edit_mailbox_start(T_MFW_HND parent_window)
{
		T_MFW_HND		win	      = mmi_cphs_create(parent_window);
		TRACE_FUNCTION("calc_start()");
	    if (win NEQ NULL)

⌨️ 快捷键说明

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