mmismssend.c
来自「是一个手机功能的模拟程序」· C语言 代码 · 共 1,785 行 · 第 1/5 页
C
1,785 行
strcpy((char*)sms_parameter.sc_addr,(char*)data->edt_data.CentreBuffer);
// store the Service center number into the SIM.
SmsSend_set_SrvCntr_number (&sms_parameter);
editor_destroy(data->sc_number_editor);
data->sc_number_editor = NULL;
}
//added by windy I think this win is no use
#if 1
if( data->text_editor != NULL )
{
/* 2003/12/04 sunsj modify for new editor mode */
text_input_destroy(data->text_editor);
//editor_destroy(data->text_editor);
data->text_editor = 0;
}
#endif
SmsSend_SEND_destroy(data->win);
if( !call_data.win )
SEND_EVENT (parent, E_BACK, data->id, NULL);
break;
default:
TRACE_EVENT("Err: Default");
break;
}
}
/*******************************************************************************
$Function: SmsSend_PHBK_exec_cb
$Description: Callback handler for events sent by the phonebook window
$Returns: none
$Arguments: win - current window
event - event id
parameter - optional data.
*******************************************************************************/
static void SmsSend_PHBK_exec_cb(T_MFW_HND win, USHORT event, void *parameter)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_SEND * data = (T_SEND *)win_data->user;
T_EDITOR_DATA editor_data;
TRACE_FUNCTION ("SmsSend_PHBK_exec_cb()");
switch( event )
{
case SMS_PHBK_NUMBER:
memcpy(data->edt_data.NumberBuffer, (char *)parameter, MINIMUM(sizeof(data->edt_data.NumberBuffer) - 1, strlen((char *)parameter)+1));
// NO BREAK!
/* 2004/05/26 sunsj modify */
SetPhbkIN(0);
break;
default:
TRACE_EVENT("Err: Default");
break;
}
}
/*******************************************************************************
$Function: SmsSend_TEXTEDIT_exec_cb
$Description: Callback handler for events sent by the TEXTEDIT editor
$Returns: none
$Arguments: win - current window
event - event id
parameter - optional data.
*******************************************************************************/
static void SmsSend_TEXTEDIT_exec_cb(T_MFW_HND win, USHORT event, void *parameter)
{
TRACE_FUNCTION ("SmsSend_TEXTEDIT_exec_cb()");
switch( event )
{
case E_RETURN:
// Destroy itself
SmsSend_SEND_destroy(win);
break;
default:
TRACE_EVENT("Err: Default");
break;
}
}
/*******************************************************************************
$Function: SmsSend_NBEDIT_exec_cb
$Description: Callback handler for events sent by the NBEDIT editor
$Returns: none
$Arguments: win - current window
event - event id
parameter - optional data.
*******************************************************************************/
static void SmsSend_NBEDIT_exec_cb(T_MFW_HND win, USHORT event, void *parameter)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_SEND * data = (T_SEND *)win_data->user;
T_MFW_SMS_INFO sms_parameter;
T_EDITOR_DATA editor_data;
T_MFW_HDR * parent = data->parent;
TRACE_FUNCTION ("SmsSend_NBEDIT_exec_cb()");
#ifdef _INNOVATION_EMULATOR_
memset((void*)&editor_data, 0, sizeof(T_EDITOR_DATA));
#endif
switch( event )
{
case E_INIT:
if( (phb_get_mode() EQ PHB_RESTRICTED)
&& (phb_check_number(data->edt_data.NumberBuffer) EQ MFW_PHB_FAIL) )
{
mmi_dialog_information_screen(win,TxtNotImplemented, 0, (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_NOT_ALLOWED);
}
else
{
if( !smsidle_get_ready_state() )
{
// SMS init processing not ready to access SIM to store the SMS
mmi_dialog_information_screen(win,TxtPleaseWait,TxtSimNot, (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_SC_NOT_READY);
// Recreate the editor on dialog callback
}
else
{
//END TB
// First check if the SMS center is specified
SmsSend_get_config_data(&sms_parameter);
if( sms_parameter.sc_addr[0] EQ '\0' )
{
memset(data->edt_data.CentreBuffer,0,NUMBER_LENGTH);
}
else
{
strcpy((char *)data->edt_data.CentreBuffer, (char *)sms_parameter.sc_addr);
}
/* start the editor */
editor_attr_init_fullscr(&editor_data.editor_attr,1,TxtServiceCentre,
(char *)data->edt_data.CentreBuffer,PHB_MAX_LEN,edtCurBar1);
if( data->edt_data.CentreBuffer[0] EQ '\0' )
{
editor_data.LeftSoftKey = TxtNull;
editor_data.AlternateLeftSoftKey = TxtSave;
}
else
{
editor_data.LeftSoftKey = TxtSave;
editor_data.AlternateLeftSoftKey = TxtSave;
}
/*if don't set edtInpbk's value will cause crash when you press up and down key*/
editor_data.edtInPbk = 0;
editor_data.RightSoftKey = TxtDelete;
editor_data.Identifier = NULL;
editor_data.Callback = (T_EDIT_CB)SmsSend_SCNBEDIT_edit_cb;
editor_data.mode = PHONENUMONLY_MODE;
editor_data.destroyEditor = FALSE;
editor_data.timeout= FOREVER;
editor_data.hide= FALSE;
data->number_editor = editor_start(data->win,&editor_data);
}
}
break;
case E_RETURN: //added by windy
SmsSend_SEND_destroy(data->win);
SEND_EVENT (parent, E_RETURN, data->id, NULL);
break;
case E_BACK: //added by windy
break;
default:
TRACE_EVENT("Err: Default");
break;
}
}
/*******************************************************************************
$Function: SmsSend_CENTREEDIT_exec_cb
$Description: Callback handler for events sent by the CENTREEDIT editor
$Returns: none
$Arguments: win - current window
event - event id
parameter - optional data.
*******************************************************************************/
static void SmsSend_CENTREEDIT_exec_cb(T_MFW_HND win, USHORT event, void *parameter)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_SEND * data = (T_SEND *)win_data->user;
T_MFW_HDR * parent = data->parent;
T_EDITOR_DATA editor_data;
TRACE_FUNCTION ("SmsSend_CENTREEDIT_exec_cb()");
switch( event )
{
case E_INIT:
SmsSend_loadEditDefault(&editor_data);
editor_attr_init_fullscr(&editor_data.editor_attr,1,TxtServiceCentre,(char *)data->edt_data.CentreBuffer,
NUMBER_LENGTH,edtCurBar1);
editor_data.edtInPbk = 0;
editor_data.LeftSoftKey = TxtSoftOK;
editor_data.RightSoftKey = TxtDelete;
//memcpy(&editor_data.Identifier,(USHORT*)parameter,sizeof(USHORT));
editor_data.Identifier =*(USHORT*)parameter;
editor_data.Callback = (T_EDIT_CB)SmsSend_CENTREEDIT_edit_cb;
editor_data.mode = PHONENUMONLY_MODE;
editor_data.destroyEditor = FALSE ;
data->sc_number_editor = editor_start(data->win,&editor_data);
/* start the Service Centre Number editor */
break;
case E_RETURN:
case E_EXIT:
editor_destroy(data->sc_number_editor);
data->sc_number_editor = 0;
SmsSend_R_OPT_destroy(data->options_win);
SmsSend_SEND_destroy(data->win);
SEND_EVENT (parent, E_RETURN, data->id, NULL);
break;
default:
TRACE_EVENT("Err: Default");
return;
}
}
/*******************************************************************************
$Function: SmsSend_TEXTEDIT_edit_cb
$Description: Callback function for the text editor
$Returns: none
$Arguments: win - current window
Identifier - unique id
reason - event cause
*******************************************************************************/
static void SmsSend_TEXTEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_SEND * data = (T_SEND *)win_data->user;
T_MFW_HDR * parent = data->parent;
T_EDITOR_DATA editor_data;
T_MFW_SMS_INFO sms_parameter;
USHORT parameter;
TRACE_FUNCTION ("SmsSend_TEXTEDIT_edit_cb()");
switch( reason )
{
case INFO_KCD_ALTERNATELEFT:
case INFO_KCD_LEFT:
if( Send_state==E_COMMON_MSG )
data->options_win = SmsSend_OPT_start(win,&SmsCM_R_OPTAttrib);
else
{
//memset((char*)LastTextBuffer,0, sizeof(LastTextBuffer));
//memcpy((char*)LastTextBuffer,(char*)data->edt_data.TextBuffer, sizeof(LastTextBuffer));
data->options_win = SmsSend_OPT_start(win,&SmsSend_R_OPTAttrib);
}
#if 0
if( Send_state == E_FORWARD )
{
#if 0
Send_save=E_SENDSAVE;
SmsSend_loadEditDefault(&editor_data);
editor_attr_init_fullscr(&editor_data.editor_attr,1,TxtEnterNumber,
(char *)data->edt_data.NumberBuffer,PHB_MAX_LEN,edtCurBar1);
/*if don't set edtInpbk's value will cause crash when you press up and down key*/
editor_data.edtInPbk = 0;
editor_data.LeftSoftKey =TxtSend ;
editor_data.AlternateLeftSoftKey = TxtFind;
editor_data.RightSoftKey = TxtDelete;
editor_data.Identifier = SMSSEND_ID_NBEDIT ;
editor_data.Callback = (T_EDIT_CB)SmsSend_NBEDIT_edit_cb;
editor_data.destroyEditor = FALSE;
editor_data.mode=PHONENUMONLY_MODE ;
data->number_editor = editor_start(data->win, &editor_data); /* start the editor */
#endif
memset((char*)LastTextBuffer,0, sizeof(LastTextBuffer));
memcpy((char*)LastTextBuffer,(char*)data->edt_data.TextBuffer, sizeof(LastTextBuffer));
data->options_win = SmsSend_OPT_start(win,&SmsSend_R_OPTAttrib);
}
else if( Send_state==E_REPLY )
{
if( (phb_get_mode() EQ PHB_RESTRICTED)
&& (phb_check_number(data->edt_data.NumberBuffer) EQ MFW_PHB_FAIL) )
{
mmi_dialog_information_screen(win,TxtNotImplemented, 0,
(T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_NOT_ALLOWED);
}
else
{
if( !smsidle_get_ready_state() )
{
// SMS init processing not ready to access SIM to store the SMS
mmi_dialog_information_screen(win,TxtPleaseWait, 0, (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_SC_NOT_READY);
// Recreate the editor on dialog callback
}
else
{
//END TB
// First check if the SMS center is specified
SmsSend_get_config_data(&sms_parameter);
if( sms_parameter.sc_addr[0] EQ '\0' )
{
//setup identifier value.
parameter = SMSSEND_ID_CENTREEDIT;
SmsSend_CENTREEDIT_exec_cb(win, E_INIT,(void*)¶meter);
}
else
{
/*NM FTA 34.2.8*/
if( data->edt_data.called_from_reply_item EQ FALSE )
{
TRACE_EVENT("take the own serviceCenternum");
strcpy((char *)data->edt_data.CentreBuffer, (char *)sms_parameter.sc_addr);
{
char buf[30];
sprintf(buf,"serviceNr:%s",data->edt_data.CentreBuffer);
TRACE_EVENT(buf);
}
}
else
{
TRACE_EVENT("from the caller, reply");
/* in case of reply the sms, we took already the
the service center number from the caller !!!*/
{
char buf[30];
sprintf(buf,"serviceNr:%s",data->edt_data.CentreBuffer);
TRACE_EVENT(buf);
}
}
/*NM FTA 34.2.8*/
Send_save=E_SENDSAV
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?