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

📄 mmismssend.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:		    MmiSmsSend.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
                                                                               
********************************************************************************
                                                                              
 Description:
 
    Implementation template for MMI yyy dynamic menu handling
                        
********************************************************************************

 $History: MmiSmsSend.c

    25/10/00			Original Condat(UK) BMI version.	
  09/08         windy modified
  19/08/02      ver0.111   wangxia  modified 
 $End

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

#define MMI_SMSSEND_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_kbd.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_icn.h"
#include "mfw_mnu.h"
#include "mfw_lng.h"
#include "mfw_sat.h"
#include "mfw_kbd.h"
#include "mfw_nm.h"
#include "mfw_str.h"

#include "dspl.h"

#include "MmiMain.h"
#include "MmiDummy.h"
//#include "MmiLists.h"
#include "MmiMmi.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MmiEditor.h"
#include "phb.h"      /* FDN  */
#include "mmiBookshared.h"
#include "mmiSmsMenu.h"
#include "MmiSmsSend.h"
#include "MmiSmsIdle.h"
#include "MmiSat_i.h"
#ifdef EASY_TEXT_ENABLED
    #include "MmiLatinPredText.h"
#endif

#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "mmiusersymbolinput.h"
#include "Mmiicons.h"
#include "Mfw_cnvt.h"
#include "Mmitextinput.h"			/* 2003/12/04 sunsj add */
//#define TDTRACE 1
#include "mmiutilapi.h" /* 2004/4/20, wangyan modify */
#include "mmiiconresource.h"/* 2004/06 sunsj modify for icon manage */
//#include "rtc_api.h" /*2003/11/10, wangyan, modify sms mo time*/

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

                 DYNAMIC MENU WINDOW. DECLARATION

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


/* General functions */
static void SmsSend_NBEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason);
static int  SmsSend_standard_dialog_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason);
void        SmsSend_loadEditDefault(T_EDITOR_DATA * edit_info);
static void SmsSend_loadUCS2EditDefault(T_EDITOR_DATA *editor_data);

/* prototyps */
static T_MFW_HND SmsSend_SEND_create  (T_MFW_HND parent);
void      SmsSend_SEND_destroy (T_MFW_HND window);

// Main callback function of the frame window
static void      SmsSend_main_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
// Sub-callback functions of the frame window associated to the different emitters
static void      SmsSend_SEND_exec_cb (T_MFW_HND win, USHORT event, void * parameter);
static void      SmsSend_PHBK_exec_cb (T_MFW_HND win, USHORT event, void * parameter);
static void      SmsSend_TEXTEDIT_exec_cb (T_MFW_HND win, USHORT event, void * parameter);
static void      SmsSend_NBEDIT_exec_cb (T_MFW_HND win, USHORT event, void * parameter);
static void      SmsSend_CENTREEDIT_exec_cb (T_MFW_HND win, USHORT event, void * parameter);

// Callback functions of the various editors
static void     SmsSend_TEXTEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason);
static void     SmsSend_NBEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason);
static void     SmsSend_CENTREEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason);
T_MFW_HND smscb_common_msg_start(T_MFW_HND parent_window, void *dummy);
// Callback function for the MFW events
static int       SmsSend_SEND_mfw_cb  (MfwEvt event, void *data);

// This function initiate the sending of the SMS
static int       SmsSend_send_to_mfw    (T_MFW_HND win);
static T_MFW_HND parentWindow4SMS;

UBYTE SmsSend_set_SrvCntr_number (T_MFW_SMS_INFO *config_data);
UBYTE SmsSend_set_dcs_number (T_MFW_SMS_INFO *config_data);
extern UINT8 g_pcsyncstatus ;//hxl add ,if  pcsync run ,return,2003-2-13
extern T_call call_data;

/* 2004/4/20, wangyan modify */
//extern int type;
extern T_MMI_FLASH_SORT_INDEX Flash_sms_sort_index[FLSAH_SMS_NUM];/*2004/4/12, wangyan add*/
extern SHORT g_sms_list_counter;
/* 2004/4/20, wangyan modify */

/***************************************************
****											****
****		MANAGEMENT OF SMS OPTIONS			****
****											****
***************************************************/


typedef struct
{
    /* administrative data */

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

    /* associated handlers */

    /* !!! **************************************** modify here **************************************** !!!*/
    T_MFW_HND       kbd;
    T_MFW_HND       kbd_long;
    T_MFW_HND       menu;
    /* !!! **************************************** end modify here **************************************** !!! */

    /* internal data */

    /* !!! **************************************** modify here **************************************** !!!*/
    BOOL            answer; /* TRUE == YES, FALSE == NO */
    T_MFW_HND       sms;
    T_MFW_HND       dialog_win;
    T_SEND          *parent_data;
    /* !!! **************************************** end modify here **************************************** !!! */
} T_SMSSEND_R_OPT;

typedef struct
{
    /* administrative data */

    T_MMI_CONTROL   mmi_control;
    T_MFW_HND       win;
    T_MFW_HND       parent;
    //    T_MFW_HND       info;  /* to keep the window of SmsSend_info_xxx*/  
    T_MFW_HND       child_dialog;/* to keep the window of dialog          */    
    T_MFW_HND       sms_handler;
    SHORT           id;
    T_SmsUserData   edt_data; /* pointer of text and number */
    /* will call from idle or phonebook  */
} T_SAVE;
typedef struct
{
    /* administrative data */

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

    /* associated handlers */

    /* internal data */
    ListMenuData    list_menu_data;
} T_COMMON_MSG;
static int index;//added by windy for change the common message

static MfwMnuAttr smscb_common_msgAttrib =
{
    0,
    &smscb_M_CB_TOP_CONSArea,
    MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu       */
    -1,                                 /* use default font         */
    NULL,                               /* with these items         */
    0                                   /* number of items     */
};
static void smscb_common_msg_lst_create(T_COMMON_MSG *data);
static int SmsCM_R_OPTExeSave(MfwMnu* m, MfwMnuItem* i);
static int SmsCM_R_OPTExeSend(MfwMnu* m, MfwMnuItem* i);

UINT8 Send_ed_state;
UINT8 Send_save;
static T_MFW_HND    SmsSend_SAVE_create  (T_MFW_HND parent);
static void             SmsSend_SAVE_destroy (T_MFW_HND window);
static void             SmsSend_SAVE_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int              SmsSend_SAVE_mfw_cb (MfwEvt event, void *info);

static T_MFW_HND SmsSend_R_OPT_create (T_MFW_HND parent);
static void SmsSend_R_OPT_destroy (T_MFW_HND window);
static void SmsSend_R_OPT_StandardDialog(T_MFW_HND win, char *text, ULONG duration);
static void SmsSend_R_OPT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int SmsSend_R_OPT_win_cb (MfwEvt e, MfwWin *w);
static int SmsSend_R_OPT_mfw_cb (MfwEvt event, void *parameter);
T_MFW_HND SmsSend_OPT_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr);
static int SmsSend_R_OPT_dialog_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason);
static void SmsSend_SCNBEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason);
/* !!! **************************************** modify here **************************************** !!!*/
static int SmsSend_R_OPT_kbd_cb (MfwEvt e, MfwKbd *k);
static int SmsSend_R_OPT_mnu_cb (MfwEvt e, MfwMnu *m);
/* !!! **************************************** end modify here **************************************** !!! */



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

                 DYNAMIC MENU WINDOW. CONTENTS DECLARATION

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

/* !!! **************************************** modify here **************************************** !!!*/

static int SmsSend_R_OPTExeSave(MfwMnu* m, MfwMnuItem* i);
static int SmsSend_R_OPTExeSend(MfwMnu* m, MfwMnuItem* i);
static int SmsSend_R_OPTExeSendOnly(MfwMnu* m, MfwMnuItem* i);
static int SmsSend_R_OPTExeDiscard(MfwMnu* m, MfwMnuItem* i);
static int SmsSend_R_OPTExeCmMsg(MfwMnu* m, MfwMnuItem* i);

//char TestBuffer[/*TEXT_LENGTH*/162];
/* 2004/06 sunsj modify for icon manage */
extern const MfwIcnAttr colist[];

static MfwMnuItem SmsSend_R_OPTItems [] =
{
    {(MfwIcnAttr *)&colist,0,0,(char *)TxtSendOnly,0,(MenuFunc)SmsSend_R_OPTExeSendOnly,item_flag_none},
    {(MfwIcnAttr *)&colist,0,0,(char *)TxtSendSave,0,(MenuFunc)SmsSend_R_OPTExeSend,item_flag_none},
    {(MfwIcnAttr *)&colist,0,0,(char *)TxtInsertCMmsg,0,(MenuFunc)SmsSend_R_OPTExeCmMsg,item_flag_none},
    {(MfwIcnAttr *)&colist,0,0,(char *)TxtSave,0,(MenuFunc)SmsSend_R_OPTExeSave,item_flag_none}
    // {&colist,0,0,(char *)TxtDiscard,0,(MenuFunc)SmsSend_R_OPTExeDiscard,item_flag_none}
};

static MfwMnuAttr SmsSend_R_OPTAttrib =
{
    0,
    &SmsSend_R_OPTArea,
    MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu       */
    -1,                                 /* use default font         */
    SmsSend_R_OPTItems,                      /* with these items         */
    sizeof(SmsSend_R_OPTItems)/sizeof(MfwMnuItem) /* number of items     */
};
static MfwMnuItem Sms_rpl_fwr_OPTItems [] =
{
    {(MfwIcnAttr *)&colist,0,0,(char *)TxtSendOnly,0,(MenuFunc)SmsSend_R_OPTExeSendOnly,item_flag_none},
    {(MfwIcnAttr *)&colist,0,0,(char *)TxtSendSave,0,(MenuFunc)SmsSend_R_OPTExeSend,item_flag_none},
    {(MfwIcnAttr *)&colist,0,0,(char *)TxtInsertCMmsg,0,(MenuFunc)SmsSend_R_OPTExeCmMsg,item_flag_none},
    {(MfwIcnAttr *)&colist,0,0,(char *)TxtSave,0,(MenuFunc)SmsSend_R_OPTExeSave,item_flag_none}   /* 2004/04/05 sunsj add */
};

static MfwMnuAttr Sms_rpl_fwr_OPTAttrib =
{
    0,
    &SmsSend_R_OPTArea,
    MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu       */
    -1,                                 /* use default font         */
    Sms_rpl_fwr_OPTItems,                      /* with these items         */
    sizeof(Sms_rpl_fwr_OPTItems)/sizeof(MfwMnuItem) /* number of items     */
};
static MfwMnuItem SmsCM_R_OPTItems [] =
{
    {(MfwIcnAttr *)&colist,0,0,(char *)TxtSend,0,(MenuFunc)SmsCM_R_OPTExeSend,item_flag_none},
    {(MfwIcnAttr *)&colist,0,0,(char *)TxtSaveToFfs,0,(MenuFunc)SmsCM_R_OPTExeSave,item_flag_none}
};

static MfwMnuAttr SmsCM_R_OPTAttrib =
{
    0,
    &SmsSend_R_OPTArea,
    MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu       */
    -1,                                 /* use default font         */
    SmsCM_R_OPTItems,                      /* with these items         */
    sizeof(SmsCM_R_OPTItems)/sizeof(MfwMnuItem) /* number of items     */
};

UINT8 Send_state;
//UBYTE LastTextBuffer[MAX_MSG_LEN+2];  /* windy */
//UBYTE LastNumberBuffer[NUMBER_LENGTH];
static char buf[80];
extern T_MFW_MEM_INFO     memory;

UBYTE* convertToUnicodeForOutput( UBYTE * ipText, USHORT* outLen)
{
    static UBYTE temp_conv_buffer[MAX_MSG_LEN_ARRAY];
    int i;
    if( ipText[0] == 0x80 )
    {   //skip first 2 chars
        *outLen = 0;
        for( i=0;i<MAX_MSG_LEN/2;i++ )
        {
            temp_conv_buffer[i*2  ] = ipText[i*2+1];
            temp_conv_buffer[i*2+1] = ipText[i*2+1+1];
            if( (*outLen ==0) && 
                (temp_conv_buffer[i*2] == 0x00) && 
                (temp_conv_buffer[i*2+1] == 0x00) )

⌨️ 快捷键说明

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