📄 mmisatinput.c
字号:
/* no default response: provide an empty buffer */
data->edt_buffer[0] = '\0';
}
AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE *)data->edt_buffer, data->max_chars);
/*
* Start the Editor
*/
if (AUI_edit_Start(win, &data->editor_data) == NULL)
{
sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
sat_res[SAT_AI_INDEX] = SatResAiNoCause;
sat_done (sat_command, sat_res, sizeof(T_SAT_RES));
sat_get_string_destroy (data->win);
}
}
#else /* NEW_EDITOR */
/*
* Setup an Editor to get a string
*/
data->editor_data.LeftSoftKey = TxtSoftOK;
if ((sat_command->qual & SAT_M_INPUT_HELP_AVAIL) NEQ 0)
{
data->editor_data.AlternateLeftSoftKey = TxtHelp; /* help available */
}
else
{
data->editor_data.AlternateLeftSoftKey = TxtNull; /* no help available */
}
data->editor_data.RightSoftKey = TxtSoftBack;
data->editor_data.hide = ((sat_command->qual & SAT_M_INPUT_NOECHO) NEQ 0);
if ((sat_command->qual & SAT_M_INPUT_ALPHA) EQ 0) /* 0=digits, 1=alpha */
{
data->editor_data.mode = E_EDIT_DIGITS_MODE;
}
else
{
data->editor_data.mode = E_EDIT_ALPHA_MODE;
}
data->editor_data.TextId = TxtNull;
if (inp->prompt.len > 0)
{
data->editor_data.TextString = sat_create_TEXT_ASCIIZ (&inp->prompt); /* label */
}
else
{
data->editor_data.TextString = NULL; /* no label */
}
data->editor_data.min_enter = inp->rspMin;
data->editor_data.timeout = TWENTY_SECS;
data->editor_data.Identifier = event;
defRsp = &inp->defRsp;
if (defRsp->len > 0) /* default response available? */
{
/* provide a zero terminated buffer, initially containing the default response */
sat_TEXT_to_ASCIIZ (data->edt_buffer, defRsp);
}
else
{
/* no default response: provide an empty buffer */
data->edt_buffer[0] = '\0';
}
/*
* Start the Editor
*/
if (editor_start_common (win, data->edt_buffer, data->max_chars, &data->editor_data, (T_EDIT_CB)sat_editor_cb) == NULL)
{
sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
sat_res[SAT_AI_INDEX] = SatResAiNoCause;
sat_done (sat_command, sat_res, sizeof(T_SAT_RES));
sat_get_string_destroy (data->win);
}
#endif /* NEW_EDITOR */
break;
/* sbh - all window types are being provided with this event to destroy the window */
case SAT_DESTROY_WINDOW:
TRACE_EVENT("SAT_DESTROY_WINDOW");
if (data->win)
{
sat_get_string_destroy (data->win);
data->win = NULL;
}
break;
/* ...sbh */
default:
TRACE_EVENT ("sat_get_string_exec() unexpected event");
break;
}
}
/*********************************************************************
*
* SUB WINDOW SAT_DISPLAY_TEXT
*
*********************************************************************/
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND win;
T_SAT_CMD *sat_command; /* pointer to sat_command in parent */
#ifdef NEW_EDITOR
T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */
#else
T_EDITOR_DATA editor_data;
#endif
char *info_buffer; /* buffer for info */
T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */
} T_sat_display_text;
static void sat_display_text_destroy (T_MFW_HND own_window);
static void sat_display_text_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command);
/*******************************************************************************
$Function: sat_get_string_exec
$Description: Creation of an instance for the SAT DISPLAY TEXT dialog.Window
must be available after reception of SAT command,only one instance.
$Returns: Window handle
$Arguments: parent_window - parent window
*******************************************************************************/
T_MFW_HND sat_display_text_create (T_MFW_HND parent_window)
{
T_sat_display_text * data = (T_sat_display_text *)ALLOC_MEMORY (sizeof (T_sat_display_text));
T_MFW_WIN * win;
TRACE_FUNCTION("sat_display_text_create");
data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)sat_win_cb); // c030 rsa
if (data->win EQ NULL)
return NULL;
/*
* Create window handler
*/
data->mmi_control.dialog = (T_DIALOG_FUNC)sat_display_text_exec;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (MfwUserDataPtr)data;
data->kbd = kbdCreate( data->win, KEY_ALL, (T_MFW_CB) sat_kbd_cb); /* sbh - add keyboard handler */
/*
* return window handle
*/
win_show(data->win);
return data->win;
}
/*******************************************************************************
$Function: sat_display_text_destroy
$Description: Destroy the sat play tone dialog.
$Returns: none
$Arguments: own_window - current window
*******************************************************************************/
static void sat_display_text_destroy (T_MFW_HND own_window)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *)own_window)->data;
T_sat_display_text * data = (T_sat_display_text *)win_data->user;
TRACE_FUNCTION("sat_display_text_destroy");
if (own_window == NULL)
{
TRACE_EVENT ("Error : Called with NULL Pointer");
return;
}
if (data)
{
/*
* Delete WIN Handler
*/
win_delete (data->win);
/*
* Free Memory
*/
sat_destroy_TEXT_ASCIIZ (data->info_buffer); /* displayed text */
FREE_MEMORY ((U8 *)data, sizeof (T_sat_display_text));
}
}
/*******************************************************************************
$Function: sat_display_text_exec
$Description: Dialog function for sat_display_text_exec window.
$Returns: none
$Arguments: win - window
event - window event
value - unique id
sat_command - sat command data.
*******************************************************************************/
static void sat_display_text_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_sat_display_text * data = (T_sat_display_text *)win_data->user;
T_SAT_RES sat_res;
ULONG time;
TRACE_FUNCTION ("sat_display_text_exec()");
switch (event)
{
case SAT_DISPLAY_TEXT:
data->sat_command = sat_command;
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
/*
* Setup an Editor to display a string
*/
AUI_edit_SetDefault(&data->editor_data);
/* SPR#1559 - SH - Now use ZONE_FULLSOFTKEYS */
AUI_edit_SetDisplay(&data->editor_data, ZONE_FULLSOFTKEYS, COLOUR_EDITOR, EDITOR_FONT);
AUI_edit_SetTextStr(&data->editor_data, TxtSoftOK, TxtSoftBack, TxtNull, NULL);
AUI_edit_SetMode(&data->editor_data, ED_MODE_READONLY, ED_CURSOR_NONE);
if ((data->sat_command->qual & SAT_M_TEXT_WAIT) NEQ 0)
{
AUI_edit_SetEvents(&data->editor_data, SAT_DISPLAY_TEXT_WAIT, TRUE, TWO_MIN, (T_AUI_EDIT_CB)sat_editor_cb);
}
else
{
AUI_edit_SetEvents(&data->editor_data, event, TRUE, TEN_SECS, (T_AUI_EDIT_CB)sat_editor_cb);
}
/* provide a buffer, containing the string to be displayed */
data->info_buffer = sat_create_TEXT_ASCIIZ (&sat_command->c.text);
/*
* Start the Editor
*/
/* SPR#1559 - SH - Check for unicode strings */
if (data->info_buffer[0]==0x80)
AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_UNICODE, (UBYTE *)&data->info_buffer[2], sat_command->c.text.len+1);
else
AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE *)data->info_buffer, sat_command->c.text.len+1);
if (AUI_edit_Start(win, &data->editor_data) == NULL)
{
sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
sat_res[SAT_AI_INDEX] = SatResAiNoCause;
sat_done (sat_command, sat_res, sizeof(T_SAT_RES));
sat_display_text_destroy (data->win);
}
break;
#else /* NEW_EDITOR */
/*
* Setup an Editor to display a string
*/
data->editor_data.LeftSoftKey = TxtSoftOK;
data->editor_data.AlternateLeftSoftKey = TxtNull;
data->editor_data.RightSoftKey = TxtSoftBack;
data->editor_data.hide = FALSE;
data->editor_data.mode = E_EDIT_READ_ONLY_MODE;
data->editor_data.TextId = TxtNull;
data->editor_data.TextString = NULL; /* no label */
data->editor_data.min_enter = 0;
if ((data->sat_command->qual & SAT_M_TEXT_WAIT) NEQ 0)
{
data->editor_data.timeout = TWO_MIN;
data->editor_data.Identifier = SAT_DISPLAY_TEXT_WAIT;
}
else
{
data->editor_data.timeout = TEN_SECS;
data->editor_data.Identifier = event;
}
/* provide a buffer, containing the string to be displayed */
data->info_buffer = sat_create_TEXT_ASCIIZ (&sat_command->c.text);
/*
* Start the Editor
*/
if (editor_start_common (win, data->info_buffer, sat_command->c.text.len+1, &data->editor_data, (T_EDIT_CB)sat_editor_cb) == NULL)
{
sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
sat_res[SAT_AI_INDEX] = SatResAiNoCause;
sat_done (sat_command, sat_res, sizeof(T_SAT_RES));
sat_display_text_destroy (data->win);
}
break;
#endif /* NEW_EDITOR */
/* SH - all window types are being provided with this event to destroy the window */
case SAT_DESTROY_WINDOW:
sat_display_text_destroy (data->win);
break;
default:
TRACE_EVENT ("sim_display_text_exec() unexpected event");
break;
}
}
/*******************************************************************************
$Function: sat_ASCII_to_TEXT
$Description: This routine converts an ASCIIZ string into an MFW SAT text
descriptor the coding scheme is taken accordign to the code in <txt>
$Returns: none
$Arguments: txt - text info
destination - text destination
source - text source
*******************************************************************************/
static void sat_ASCII_to_TEXT (T_SAT_TXT * txt, UBYTE * destination, UBYTE * source)
{
UBYTE * temp_buffer;
switch (txt->code)
{
case MFW_DCS_7bits:
temp_buffer = (UBYTE *)ALLOC_MEMORY(txt->len+1);
sat_ascii_to_gsm ((char *)temp_buffer, (char *)source, (U16)(txt->len));
utl_cvt8To7 (temp_buffer, txt->len, destination, 0);
FREE_MEMORY ((U8 *)temp_buffer, txt->len+1);
break;
case MFW_DCS_8bits:
sat_ascii_to_gsm ((char *)destination, (char *)source, (U16)(txt->len));
break;
case MFW_DCS_UCS2:
sat_ascii_to_ucode ((wchar_t *)destination, (char *)source, (U16)(txt->len));
break;
default:
sat_ascii_to_gsm ((char *)destination, (char *)source, (U16)(txt->len));
TRACE_EVENT("sat_ASCII_to_TEXT() unexp. DCS");
break;
}
}
#ifdef INTEGRATION_SEPT00
/*******************************************************************************
$Function: sat_UCODE_to_TEXT
$Description: This routine converts an UCODE string into an MFW SAT text descriptor
the coding scheme is taken accordign to the code in <txt>
$Returns: none
$Arguments: txt - text info
destination - text destination
source - text source
*******************************************************************************/
static void sat_UCODE_to_TEXT (T_SAT_TXT * txt, UBYTE * destination, cp_wstring_t source)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -