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

📄 mmismsmenu.c

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

          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:       MmiSmsMenu.c
 $Revision:   1.0

 $Author:   Condat(UK)
 $Date:       25/10/00

********************************************************************************

 Description:

    Implementation SMS dynamic menu handling

********************************************************************************

 $History: MmiSmsMenu.c

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

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

#define MMI_SMSMENU_C

#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_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_sms.h"
#include "mfw_smsi.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 "MmiMmi.h"

#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MmiEditor.h"
#include "MmiBookShared.h"
#include "MmiSmsMenu.h"
#include "MmiSmsRead.h"
#include "MmiSmsSend.h"
#include "MmiSmsIdle.h"

#include "cus_aci.h"
#include "p_sim.h"
#include "mfw_ffs.h"
//#include "pcm.h"
#include "mmiusersymbolinput.h"
#include "Mmihost.h"  //xsf add 11.27 for hostkey PRO_MSGBOX

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

extern T_MFW_HND SmsRead_R_start(T_MFW_HND parent_window,T_MFW_SMS_STAT *menuAttr);

// Start functions of the windows
T_MFW_HND M_SND_SAV_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr);
T_MFW_HND M_DEL_ALL_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr);
T_MFW_HND M_DEL_ALL_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr);
T_MFW_HND V_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr);
//T_MFW_HND V_NUM_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr);

// Standard callback function for temporary dialog window
int SmsMenu_StandardDialog_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason);
//int SmsMenu_V_NUM_editor_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason);

/* This structure is used by 'Delete All' function that is common for SMS and SMS-CB */
typedef enum SmsType
{
  SMS_TYPE, /* interfered with macro -> renamed SMS to SMS_TYPE */
  SMS_NVM_TYPE,	
  SMSCB_TYPE
} MySmsType;


typedef enum              /* numbering plan identifier */
{
  MFW_MB_LINE1      = 1,
  MFW_MB_LINE2      = 2,
  MFW_MB_FAX        = 3,
  MFW_MB_DATA       = 4
} T_MFW_MAILBOX_ID;



typedef enum
{
  SMS_DELETING,
  SMS_DISPLAY,
  SMS_READY
} T_SmsMenu_state;

typedef struct
{
    /* administrative data */

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

    /* associated handlers */

    T_MFW_HND       kbd;
    T_MFW_HND       kbd_long;
    T_MFW_HND       menu;

    /* internal data */

  T_SmsUserData * user_data; // text and phone number of the message
} T_M_SND_SAV;

typedef struct
{
    /* administrative data */

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

    /* associated handlers */
  T_MFW_HND       sms_hnd;         /* MFW sms handler      */

    /* internal data */

  enum SmsType  type; // The type of the SMS to delete (SMS or SMS-CB)
  T_MFW_SMS_MSG g_SmsMenu_messages[MAX_MESSAGES];
  T_MFW_HND   child_dialog;
} T_M_DEL_ALL;

typedef struct
{
    /* administrative data */
    T_MMI_CONTROL   mmi_control;
    T_MFW_HND       win;
    SHORT           id;
    T_MFW_HND       parent;

    /* associated handlers */
    //T_MFW_HND       kbd;
    //T_MFW_HND       kbd_long;
    //T_MFW_HND       menu;
    T_MFW_HND       voice_edit;

    /* internal data */
	UBYTE voice_mail[PHB_MAX_LEN + 1];
} T_V;

  //UBYTE voice_mail[PHB_MAX_LEN + 1];


typedef struct
{
    /* administrative data */

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

    /* associated handlers */


    /* internal data */
    UBYTE voice_number_buffer[NUMBER_LENGTH];

} T_V_NUM;

static T_MFW_HND M_SND_SAV_create (T_MFW_HND parent);
static void M_SND_SAV_destroy (T_MFW_HND window);
static void M_SND_SAV_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int M_SND_SAV_win_cb (MfwEvt e, MfwWin *w);
static int M_SND_SAV_kbd_cb (MfwEvt e, MfwKbd *k);
static int M_SND_SAV_mnu_cb (MfwEvt e, MfwMnu *m);

static int ExeSms_sendM_SND_SAV(MfwMnu *, MfwMnuItem *);

static T_MFW_HND M_DEL_ALL_create (T_MFW_HND parent);
static void M_DEL_ALL_destroy (T_MFW_HND window);
static void M_DEL_ALL_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int M_DEL_ALL_mfw_cb (MfwEvt event, void *parameter);
static int M_DEL_ALL_win_cb (MfwEvt e, MfwWin *w);

static T_MFW_HND V_create (T_MFW_HND parent);
static void V_destroy (T_MFW_HND window);
static void V_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int V_win_cb (MfwEvt e, MfwWin *w);
static int V_kbd_cb (MfwEvt e, MfwKbd *k);
static int V_mnu_cb (MfwEvt e, MfwMnu *m);

//static T_MFW_HND V_NUM_create (T_MFW_HND parent);
//static void V_NUM_destroy (T_MFW_HND window);
//static void V_NUM_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
//static int V_NUM_win_cb (MfwEvt e, MfwWin *w);

void SmsMenu_loadEditDefault(T_EDITOR_DATA *editor_data);
int Delete_NVM_ALL_sms();
int Sms_NVM_DEL_ALL_dialog_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason);
int SmsMenu_standard_dialog_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason);

// State of the SMS menu management
T_SmsMenu_state g_SmsMenu_state = SMS_DISPLAY;
// Sometime we need to know the handle of a child window (delete all)
MfwHnd g_ChildWindow2;
UBYTE g_CenterNumber[NUMBER_LENGTH];
//extern UINT8 Send_state;
extern UINT8 g_pcsyncstatus ;//hxl add ,if  pcsync run ,return,2003-2-13
extern T_call call_data;
extern T_MMI_FLASH_SORT_INDEX Flash_sms_sort_index[FLSAH_SMS_NUM];
/*******************************************************************************

 $Function:     M_exeSendNew

 $Description:  This function is called when the user press Send in the
        main SMS menu.

 $Returns:    Execution status

 $Arguments:  m - menu handler
        i - Menu item selected

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

int M_exeSendNew(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND       win  = mfwParent(mfw_header());
    T_SmsUserData   SmsData;

	if(g_pcsyncstatus)//when pcsync run ,return,hxl add 2003-2-13
		return 1;

    /* Copy the number and name information to the SMS buffer
    */
    SmsData.TextBuffer[0] = '\0';
    SmsData.NumberBuffer[0]='\0'; //set the number to null.
    SmsData.called_from_reply_item = FALSE;
    SmsData.Send_state =E_SEND;
   
    SmsSend_SEND_start(win, (void *) &SmsData);
  return 1;
}
/*******************************************************************************

 $Function:     M_callSendNew

 $Description:  This function is called when the user press Send in the
        call menu.If there is already an old send sms win it will copy buffer to new win

 $Returns:    Execution status

 $Arguments:  m - menu handler
        i - Menu item selected

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

int M_callSendNew(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND       win  = mfwParent(mfw_header());
    T_SmsUserData   SmsData;
    char tempt[40];
    sprintf(tempt,"winsms=%d",call_data.win_sms);
    TRACE_EVENT(tempt);
    if(call_data.win_sms)
    {	
    T_MFW_WIN      * win_data = ((T_MFW_HDR *) call_data.win_sms)->data;
	T_SEND         * data = (T_SEND *)win_data->user;
	memset((char*)SmsData.TextBuffer,0,sizeof(SmsData.TextBuffer));/*wx 2003-04-03 copy buffer from out of call old smssend win*/
    memcpy((char*)SmsData.TextBuffer, (char *)data->edt_data.TextBuffer,sizeof(data->edt_data.TextBuffer));
    memcpy((char*)SmsData.NumberBuffer, (char *)data->edt_data.NumberBuffer,sizeof(data->edt_data.NumberBuffer));
    SmsSend_SEND_destroy(call_data.win_sms);
    SmsData.called_from_reply_item = FALSE;
    SmsData.Send_state =E_CALL_SENDER;   
    SmsSend_SEND_start(win, (void *) &SmsData);
    return 1;
    }
	if(g_pcsyncstatus)//when pcsync run ,return,hxl add 2003-2-13
		return 1;

    /* Copy the number and name information to the SMS buffer
    */
    SmsData.TextBuffer[0] = '\0';
    SmsData.NumberBuffer[0]='\0'; //set the number to null.
    SmsData.called_from_reply_item = FALSE;
    SmsData.Send_state =E_SEND;
   
    SmsSend_SEND_start(win, (void *) &SmsData);
  return 1;
}
/*******************************************************************************

 $Function:     M_exeRead

 $Description:  This function is called when the user press Read in the
          main SMS menu

 $Returns:    Execution status

 $Arguments:  m - menu handler
        i - Menu item selected

*******************************************************************************/
/*2003/11/28, wangyan delete*/
#if 0
int M_exeRead(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND       win  = mfwParent(mfw_header());
  T_MFW_SMS_STAT  sms_list_type = MFW_SMS_ALL;

  /* Call the function that manages SMS reading */
  SmsRead_R_start(win, &sms_list_type);

  return 1;
}
#endif
/*******************************************************************************

 $Function:     M_exeDelAll

 $Description:  This function is called when the user press Delete all in the
          main SMS menu

 $Returns:    Execution status

 $Arguments:  m - menu handler
        i - Menu item selected

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

int M_exeDelAll(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND       win  = mfwParent(mfw_header());
  MySmsType sms_type;

  sms_type = SMS_TYPE;
  // Here we have to pass the type of sms to delete (SMS or SMS-CB)
  M_DEL_ALL_start(win, (void *)&sms_type);

  return 1;
}
/*******************************************************************************

 $Function:     M_exeDelNVMAll

 $Description:  This function is called when the user press Delete all in the
          main SMS menu

 $Returns:    Execution status

 $Arguments:  m - menu handler
        i - Menu item selected

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

int M_exeDelNVMAll(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND       win  = mfwParent(mfw_header());
  	MySmsType sms_type;

  sms_type = SMS_NVM_TYPE;
  // Here we have to pass the type of sms to delete (SMS or SMS-CB)
  //M_DEL_ALL_start(win, (void *)&sms_type);
  CheckHostkey2(win, PRO_MSGBOX);  //xsf 11.27
  return 1;
}
/*******************************************************************************

 $Function:     M_exeSendSaved

 $Description:  This function is called when the user press Saved messages
          in the main SMS menu

 $Returns:    Execution status

 $Arguments:  m - menu handler
        i - Menu item selected

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

int M_exeSendSaved(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND       win  = mfwParent(mfw_header());

  M_SND_SAV_start(win, 0);

  return 1;
}



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

 $Function:     voice_mail_init

 $Description:  initialization the voice mail buffer


 $Returns:

 $Arguments:


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

⌨️ 快捷键说明

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