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

📄 mmismsidle.c

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

					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.	
	   
 $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"
/* SPR#1428 - SH - New Editor changes */
#ifndef NEW_EDITOR
#include "mfw_edt.h"
#endif
#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 "mfw_mme.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"

/* 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"

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

				 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;
/*********************************************************************

						Function Prototypes
						
**********************************************************************/
static SHORT smsidle_get_new_cb_messages_count(void);
static T_smsidle smsidle_data;


// Used to count the number of deleted messages in delete all
SHORT g_ListLength2;


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);

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

 $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;
}

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

 $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;

	/*JVJ SPR1298 Converted to dynamic variable */
    T_MFW_SMS_IDX* msg_list= (T_MFW_SMS_IDX*)ALLOC_MEMORY(MAX_MESSAGES*sizeof(T_MFW_SMS_IDX));
    T_MFW_SMS_IDX* urd_msg_list=  (T_MFW_SMS_IDX*)ALLOC_MEMORY(MAX_MESSAGES*sizeof(T_MFW_SMS_IDX));
	SHORT urd_count;
	UBYTE alphabet;
    /*JVJ SPR1298 Converted to dynamic variable */
    char* temp_buffer = (char*)ALLOC_MEMORY(MAX_CBMSG_LEN);
    int result = MFW_EVENT_CONSUMED;


    TRACE_EVENT ("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;

	    	    
		smscb_getCBsettings();  /* Get CB info from SIM or phone */
#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 */

		// 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.
		if(msg_list[0].msg_type == MFW_SMS_VOICE )
		{	
			if(iconsGetState(iconIdVoice) == ICON_VISIBLE || (Delete_1_2_1_vm_icon == TRUE))
			{
				if (iconsGetState(iconIdVoice) == ICON_VISIBLE && Display_1_2_1_vm_icon == TRUE)
				{
					// one-2-one only functionality, do nothing as icon is already being displayed.
					break;
				}
				else 
				{
					Delete_1_2_1_vm_icon  = FALSE;

⌨️ 快捷键说明

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