📄 mmismssend.c
字号:
/*******************************************************************************
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.
$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"
/* SPR#1428 - SH - New Editor changes */
#ifndef NEW_EDITOR
#include "mfw_edt.h"
#endif
#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 "MmiMmi.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "phb.h" /* FDN */
#include "mmiBookutils.h"
#include "mmiBookshared.h"
#include "mmiSmsMenu.h"
#include "MmiSmsSend.h"
#include "MmiSmsIdle.h"
#include "MmiSat_i.h"
#include "mfw_ffs.h"
#ifdef EASY_TEXT_ENABLED
#include "MmiChineseInput.h"
#endif
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
#include "ATBCommon.h"
#include "ATBDisplay.h"
#include "ATBEditor.h"
#include "AUIEditor.h"
#else /* NEW_EDITOR */
#ifdef EASY_TEXT_ENABLED
#include "MmiLatinPredText.h"
#endif /* EASY_TEXT_ENABLED */
#include "MmiEditor.h"
#endif /* NEW_EDITOR */
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "mmiColours.h"
/*********************************************************************
**********************************************************************
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);
/* SPR#1428 - SH - New Editor: no longer required */
#ifndef NEW_EDITOR
void SmsSend_loadEditDefault(T_EDITOR_DATA * edit_info);
static void SmsSend_loadUCS2EditDefault(T_EDITOR_DATA *editor_data);
#endif
/* prototyps */
static T_MFW_HND SmsSend_SEND_create (T_MFW_HND parent);
static 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);
// 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);
/***************************************************
**** ****
**** 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 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;
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_OPTExeDiscard(MfwMnu* m, MfwMnuItem* i);
//1227 - API - 05/10/02 - Moved from ConvertToUnicodeForOutput to solve memory problem
static UBYTE temp_conv_buffer[MAX_MSG_LEN_ARRAY];
static const MfwMnuItem SmsSend_R_OPTItems [] =
{
{0,0,0,(char *)TxtSave,0,(MenuFunc)SmsSend_R_OPTExeSave,item_flag_none},
{0,0,0,(char *)TxtSend,0,(MenuFunc)SmsSend_R_OPTExeSend,item_flag_none},
{0,0,0,(char *)TxtDiscard,0,(MenuFunc)SmsSend_R_OPTExeDiscard,item_flag_none}
};
static const MfwMnuAttr SmsSend_R_OPTAttrib =
{
&SmsSend_R_OPTArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
(MfwMnuItem*)SmsSend_R_OPTItems, /* with these items */
sizeof(SmsSend_R_OPTItems)/sizeof(MfwMnuItem), /* number of items */
COLOUR_LIST_SMS, TxtNull, NULL, MNUATTRSPARE
};
/*JVJ SPR1298 added a new output parameter to avoid stack overload */
void convertToUnicodeForOutput( UBYTE * ipText,UBYTE* outText, USHORT* outLen)
{
int i;
UBYTE* temp_conv_buffer = outText;
if (ipText[0] == 0x80)
{ //skip first 2 chars
*outLen = 0;
for (i=0;i<MAX_MSG_LEN/2;i++)
{ /*SPR 1752, swap bytes, as this no longer done in Chinese editor*/
temp_conv_buffer[i*2+1] = ipText[i*2+2];
temp_conv_buffer[i*2] = ipText[i*2+2+1];
if ((*outLen ==0) &&
(temp_conv_buffer[i*2] == 0x00) &&
(temp_conv_buffer[i*2+1] == 0x00))
*outLen = i*2+2;
}
if (*outLen == 0)
{//Reached end of message without finding 0x0000 - set last word to 0x0000
*outLen = MAX_MSG_LEN;
temp_conv_buffer[MAX_MSG_LEN-2] = 0x00;
temp_conv_buffer[MAX_MSG_LEN-1] = 0x00;
}
return;
}
else
{
*outLen = strlen((char*)ipText);
/*MC SPR1319, use string's actual length to convert to GSM alphabet*/
SmsRead_convertSMSmsg(ipText, MFW_ASCII, /*MAX_MSG_LEN*/*outLen, temp_conv_buffer, MFW_DCS_8bits,MAX_MSG_LEN , FALSE);
return;
}
}
/*******************************************************************************
$Function: SmsSend_R_OPTExeSend
$Description: Start the creation of the main window for SMS Send.
$Returns: none
$Arguments: m - Menu handle
i - Menu item selected.
*******************************************************************************/
static int SmsSend_R_OPTExeSend(MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND win = mfwParent(mfw_header());
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user;
/* access to data from parent */
T_SEND * parent_data = (T_SEND *)data->parent_data;
#ifdef NEW_EDITOR
T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */
#else
T_EDITOR_DATA editor_data;
#endif
TRACE_FUNCTION("SmsSend_R_OPTExeSend");
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
AUI_edit_SetDefault(&editor_data);
AUI_edit_SetDisplay(&editor_data, PHNO_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT);
AUI_edit_SetEvents(&editor_data, SMSSEND_ID_NBEDIT, FALSE, FOREVER, (T_AUI_EDIT_CB)SmsSend_NBEDIT_edit_cb);
AUI_edit_SetTextStr(&editor_data, TxtSend, TxtDelete, TxtSmsEnterNumber, NULL);
AUI_edit_SetAltTextStr(&editor_data, 1, TxtNames, TRUE, TxtSoftBack);
AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE);
AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, parent_data->edt_data.NumberBuffer, PHB_MAX_LEN);
parent_data->number_editor = AUI_edit_Start(parent_data->win, &editor_data);
#else /* NEW_EDITOR */
SmsSend_loadEditDefault(&editor_data);
bookSetEditAttributes( PHNO_EDITOR, COLOUR_EDITOR_XX, 0, edtCurBar1, 0,
(char *) parent_data->edt_data.NumberBuffer, /*MAX_SEARCH_CHAR*/NUMBER_LENGTH, &editor_data.editor_attr);
editor_data.editor_attr.text = (char *)parent_data->edt_data.NumberBuffer;
editor_data.editor_attr.size = PHB_MAX_LEN;
editor_data.TextId = TxtSmsEnterNumber;
editor_data.LeftSoftKey = TxtSend;
editor_data.AlternateLeftSoftKey = TxtNames;
editor_data.RightSoftKey = TxtDelete;
editor_data.Identifier = SMSSEND_ID_NBEDIT ;
editor_data.mode = E_EDIT_DIGITS_MODE;
editor_data.Callback = (T_EDIT_CB)SmsSend_NBEDIT_edit_cb;
editor_data.destroyEditor = FALSE;
parent_data->number_editor = editor_start(parent_data->win, &editor_data); /* start the editor */
#endif /* NEW_EDITOR */
}
/*******************************************************************************
$Function: SmsSend_R_OPTExeDiscard
$Description:
$Returns: execution status
$Arguments: m - Menu handle
i - Menu item selected.
*******************************************************************************/
static int SmsSend_R_OPTExeDiscard(MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND win = mfwParent(mfw_header());
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user;
/* access to data from parent */
T_SEND * parent_data = (T_SEND *)data->parent_data;
TRACE_FUNCTION("SmsSend_R_OPTExeDiscard");
SmsSend_R_OPT_destroy(parent_data->options_win);
#if defined(CHINESE_MMI) && defined(EASY_TEXT_ENABLED)
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
chinese_input_destroy(parent_data->text_editor);
else
#endif
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
AUI_edit_Destroy(parent_data->text_editor);
#else /* NEW_EDITOR */
editor_destroy(parent_data->text_editor);
#endif /* NEW_EDITOR */
parent_data->text_editor = 0;
SmsSend_SEND_destroy(parent_data->win);
return 1;
}
/*******************************************************************************
$Function: SmsSend_R_OPTExeSave
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -