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

📄 mmismsidle.c

📁 是一个手机功能的模拟程序
💻 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                                                            
 $Module:		SMS
 $File:		    MmiSmsIdle.c
 $Revision:		1.0                                                       
																			  
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
																			   
********************************************************************************
																			  
 Description: Implementation for MMI smsidle unsolicited event handling
 
   
						
********************************************************************************

 $History: MmiSmsIdle.c

	25/10/00			Original Condat(UK) BMI version.	
	09/08         windy modified
 $End

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

#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"
#include "mfw_edt.h"
#include "mfw_lng.h"
#include "mfw_icn.h"
#include "mfw_phb.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_sms.h"
#include "mfw_smsi.h"
#include "mfw_mnu.h"
#include "mfw_sat.h"
#include "mfw_tim.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 "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MmiSounds.h"
#include "MmiCall.h"

#include "MmiBookController.h"


#include "MmiIdle.h"
#include "MmiIcons.h"
#include "mmiSmsIdle.h"
#include "mmiSmsBroadcast.h"
#include "mmismsmenu.h"

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

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

#include "gdi.h"
#include "audio.h"

#include "mfw_cnvt.h"//hxl addd for 

#include "l1tm_cust_add.h"  //hxl add for pcsync 20020925

#include "mmiQQSwitch.h" //hxl add for check qq func
#ifdef QQFUNC//hxl add for qq func switch,2003-3-24
	#include "mmiqq.h" 
#endif

//#define TDTRACE 1
#include "mmiutilapi.h"

extern char sms_text_ascii[MAX_MSG_LEN+3];//[MAX_LISTSMS_LEN];
/*********************************************************************
**********************************************************************

				 STATIC MENU WINDOW. DECLARATION

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

typedef struct
{
	/* administrative data */

	T_MMI_CONTROL   mmi_control;
	T_MFW_HND       win;
	SHORT           id;
	T_MFW_HND       parent;

	/* associated handlers */

	T_MFW_HND       sms;

	/* internal data */

	BOOL sms_initialised;
	BOOL sms_store_free;
} T_smsidle;


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

						External Function Prototypes

**********************************************************************/                     
extern UBYTE getcurrentSMSTone(void);
extern UBYTE Delete_1_2_1_vm_icon;
extern UBYTE Display_1_2_1_vm_icon;
extern UINT8 g_pcsyncstatus ;//hxl add ,if  pcsync run ,return,2003-2-13
/*********************************************************************

						Function Prototypes
						
**********************************************************************/
static SHORT smsidle_get_new_cb_messages_count(void);
static int smsidle_sr_status_to_text_id(UBYTE status); /* Marcus: Issue 1170: 07/10/2002 */
static T_smsidle smsidle_data;
static char temp_buffer [MAX_CBMSG_LEN+3];


// Used to count the number of deleted messages in delete all
SHORT g_ListLength2;
static char status_report[160];	/* Marcus: Issue 1170: 07/10/2002 */


static T_MFW_HND smsidle_create (T_MFW_HND parent);
static void smsidle_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
int smsidle_sms_cb (MfwEvt e, MfwWin *w);
extern void save_send_sms(T_MFW_SMS_MO_TYPE type);	//hxl add for pc get 2002-11-1
//int new_sms_index;
extern T_MFW_MEM_INFO     memory;
extern T_call call_data;  //windy add 0225
extern USHORT*  charPtrToUSHORTPtr  (char* data);
extern char*    USHORTPtrToCharPtr  ( USHORT* data);
#ifdef QQFUNC//hxl add for qq func switch,2003-3-24
extern uint8    In_QQ;//2003-2-28,indicate in qq menu
extern uint8    CanReadQQ;//in new qq read dialog,can't read new qq
extern uint8    In_QQInfo;//if in qq info dialog,don't show read button
extern uint8    HavenewQQ;//have unread qq
extern uint8    nsms;//for check qq,2003-3-16
extern uint8    ReadbtnShow;//if read btn has been shown,it is 1;etherwise it is 0
#endif
/*******************************************************************************

 $Function:    	smsidle_start

 $Description:	This function will be call once.It is create a static sms handle
 
 $Returns:		mfw window handler 

 $Arguments:	parent_window - Parent window handler
				param - optional data
 
*******************************************************************************/

T_MFW_HND smsidle_start(T_MFW_HND parent_window, void *param)
{
	T_MFW_HND win;

	TRACE_FUNCTION ("smsidle_start()");

	win = smsidle_create (parent_window);

	if (win NEQ NULL)
	{
		SEND_EVENT (win, E_INIT, 0, NULL);
	}
	return win;
}
T_MFW_SMS_MEM_INFO l_sms_mem; //static,hxl changed for pc use
char CBmid[5];
static int playdelaysmstone=0;
//extern unsigned char no_wait;

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

 $Function:    	smsidle_create

 $Description:	Create sms Idle window
 
 $Returns:		mfw window handler 

 $Arguments:	parent_window - Parent window handler
 
*******************************************************************************/
static T_MFW_HND smsidle_create(MfwHnd parent_window)
{
	T_smsidle  * data = &smsidle_data;
	T_MFW_WIN  * win;

	TRACE_FUNCTION ("smsidle_create()");

	/*
	 * Create window handler
	 */

	if (data->win EQ NULL)
	{
		data->win = 
		win_create (parent_window, 0, 0, NULL);
		if (data->win EQ NULL)
		{
			return NULL;
		}
	}
	else
	{
		TRACE_EVENT ("smsidle_create() called twice");
		return NULL;
	}

	/* 
	 * connect the dialog data to the MFW-window
	 */

	data->mmi_control.dialog = (T_DIALOG_FUNC)smsidle_exec_cb;
	data->mmi_control.data   = data;
	win                      = (T_MFW_WIN *)((T_MFW_HDR *)data->win)->data;
	win->user                = (void *)data;
	data->parent             = parent_window;

	/*
	 * return window handle
	 */

	win_show(data->win);
	return data->win;
}

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

 $Function:    	smsidle_destroy

 $Description:	Destroy the sms Idle window.
 
 $Returns:		none

 $Arguments:	none
 
*******************************************************************************/
void smsidle_destroy(void)
{
	T_MFW_WIN     * win_data;
	MfwHnd          own_window;
	T_smsidle     * data;

	own_window = smsidle_data.win;

	TRACE_FUNCTION ("smsidle_destroy()");

	if (own_window)
	{
		win_data = (T_MFW_WIN *)((T_MFW_HDR *)own_window)->data;
		data = (T_smsidle *)win_data->user;

		if (data)
		{
			/*
			 * Delete WIN handler
			 */ 
			win_delete (data->win);

			/*     
			 * Free Memory
			 */
			/* Memory is static! */
		}
		else
		{
			TRACE_EVENT ("smsidle_destroy() called twice");
			return;
		}
	}
}



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

 $Function:    	smsidle_exec_cb

 $Description:	Call back function for the sms Idle window.
 
 $Returns:		none

 $Arguments:	win - current window
				event - window event
				value - unique id
				parameter - pointer to optional data.
 
*******************************************************************************/

void smsidle_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
/* callback handler for events sent to to trigger execution */
{
	T_MFW_WIN      * win_data = (T_MFW_WIN *)((T_MFW_HDR *) win)->data;
	T_smsidle      * data     = (T_smsidle *)win_data->user;
	T_MFW_EVENT    smsEvents;

	TRACE_FUNCTION ("smsidle_exec_cb()");

	switch (event)
	{
	case E_INIT:
		/* initialization of administrative data */
		data->id = value;

		/* initialization of the dialog data */

		sms_init();	/* startup sms in MFW */

		smsEvents = 
		E_SMS_MO_AVAIL | E_SMS_CMD_AVAIL | E_SMS_SAVE_AVAIL
		| E_SMS_MT       | E_SMS_MO        | E_SMS_MT_RECEIVED | E_SMS_STATUS
		| E_SMS_MEM      | E_SMS_OK        | E_SMS_ERR         | E_SMS_BUSY   
		| E_SMS_MEM_FULL | E_SMS_MEM_FREE  | E_SMS_RECEIVED    | E_SMS_CB
		| E_SMS_READY    | E_SMS_CB_RECEIVED;


		data->sms = sms_create(win, smsEvents, (T_MFW_CB) smsidle_sms_cb);

		/* "sms_initialised"  indicates that the SMS is ready or not */
		/*api - 10-05-02 - Set To True so the SMS can be recieved (Event not Generated) */
		data->sms_initialised  = FALSE;	/* SMS not ready yet */

		/* "sms_store_free"  indicates that the SMS Memory is full or not */
		/* Set default to True !*/
		data->sms_store_free   = TRUE; // ??? 

		break;
	case E_BACK:
	case E_ABORT:
	case E_EXIT:
		smsidle_destroy(); /* there's no default reaction */
		sms_delete(data->sms);
		sms_exit();	/* ??? implementation of routine is actually empty */
		break;
	default:
		TRACE_EVENT("unhandled event in smsidle_exec_cb()");
		return;
	}
}

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

 $Function:    	smsidle_sms_cb

 $Description:	Call back function for the sms Idle window.
 
 $Returns:		none

 $Arguments:	event - window event
				w - current window 
*******************************************************************************/
int smsidle_sms_cb (MfwEvt event, MfwWin *w)
/* smsidle's sms event handler */
{
	T_MFW_HND    win      = mfwParent((MfwHdr *)mfw_header());
	T_MFW_WIN  * win_data = (T_MFW_WIN *)((T_MFW_HDR *)win)->data;
	T_smsidle  * data     = (T_smsidle *)win_data->user;
	UBYTE currentSMSTone;
	static int  nsmsold=0;//for save the old new sms before check new sms,hxl add ,2003-3-25
	static int  noldqq=0;//for save the old qq sms before check new sms,hxl add ,2003-3-25

	/* 
	 * Marcus: Issue 1262: 17/12/2002: Made the msg_list and urd_msg_list arrays
	 * static so that they are not on the stack, in case that causes problems
	 * when the value of MAX_MESSAGES increases.
	 */
	static T_MFW_SMS_IDX msg_list[MAX_MESSAGES];
	static T_MFW_SMS_IDX urd_msg_list[MAX_MESSAGES];
	SHORT urd_count;
	UBYTE alphabet;
	char buf[100];
	T_MFW_SMS_INFO sms_info;

	TRACE_EVENT ("smsidle_sms_cb()");
	MmiTrace("smsidle_sms_cb()");
	switch (event)
	{
	case E_SMS_READY: 
		TRACE_EVENT ("E_SMS_READY");
		/* now sms is now ready for using */
		data->sms_initialised = TRUE;

		/* this function do following :                    */
		/* message will be stored to memory and            */
		/* the index will be indicated "E_SMS_MT_RECEIVED" */
//JVJE	    sms_set_mt_ind(MT_IND_IDX); 



		/* this function do following :                    */
		/* message will be indicated to MMI "E_SMS_CB"     */
		/* but not stored on the memory                    */
		//nm sms_set_mt_ind(MT_CB_MSG);  

		//windysmscb_getCBsettings();  /* Get CB info from SIM or phone */
		Get_CB_Info();/*windy modify Get CB info from  phone */
		//SmsSend_get_config_data(&sms_parameter);
		sms_parameter(&sms_info, TRUE);
		switch (FFS_flashData.SRRONOFF)
		{
		case 0:
			sms_info.srr = SMS_NOT_REQUESTED_SRR;
			sms_parameter(&sms_info, FALSE);
			//sms_set_mt_ind(MT_IND_SRR_OFF);
			break;

		case 1:
			sms_info.srr = SMS_REQUESTED_SRR;
			sms_parameter(&sms_info, FALSE);
			//sms_set_mt_ind(MT_IND_SRR_ON);
			break;

		}
#ifdef MMI_HOMEZONE_ENABLED
		homezoneActivateCB();	/* SPR759 - SH - Activate Cell Broadcast channel for homezone */
#endif

		break;
	case E_SMS_MT_RECEIVED:	/* new SMS received, automatically saved     */
	case E_SMS_MT:			/* new SMS received, NOT automatically saved */
		{   
			/* take the SMS data from MFW  */
			//  T_MFW_SMS_MT *Message = (T_MFW_SMS_MT *) w;

			// check for SMS indicating voice mail.
			urd_count=sms_index_list(MFW_SMS_UNREAD,urd_msg_list,MAX_MESSAGES);

			sms_index_list(MFW_SMS_VOICE,msg_list,MAX_MESSAGES);

			TRACE_EVENT_P4("urd_count %d urd_msg_list-> index %d stat %d msg_type %d",
						   urd_count,urd_msg_list[0].index,urd_msg_list[0].stat,urd_msg_list[0].msg_type);

			//Check SMS indicating voice mail is the received SMS, by checking index is the same.
//#ifdef STEVE_TEST
			if (msg_list[0].msg_type == MFW_SMS_VOICE )
			{
				if (iconsGetState(iconIdVoice) == ICON_VISIBLE || (Delete_1_2_1_vm_icon == TRUE))
				{

⌨️ 快捷键说明

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