📄 mmisatinput.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: mmiSatInput.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description:
Implementation of MMI SIM Application Toolkit (SAT)
********************************************************************************
$History: mmiSatInput.c
25/10/00 Original Condat(UK) BMI version.
21/02/03 removed all calls to function sat_add_unicode_tag_if_needed()
$End
*******************************************************************************/
#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 "mfw_sys.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_lng.h"
#include "mfw_icn.h"
#include "mfw_phb.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "mfw_sms.h"
#include "mfw_mnu.h"
#include "mfw_sat.h"
#include "mfw_tim.h"
#include "mfw_ss.h"
#include "mfw_str.h"
#include "dspl.h"
#include "MmiMmi.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMain.h"
#include "MmiStart.h"
#include "MmiPins.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MmiSounds.h"
#include "MmiCall.h"
#include "mmiSat_i.h"
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
#include "ATBCommon.h"
#include "ATBDisplay.h"
#include "ATBEditor.h"
#include "AUIEditor.h"
#include "MmiColours.h"
#else
#include "MmiEditor.h"
#endif
#include "psa_util.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
static void sat_editor_cb (T_MFW_HND win, USHORT Identifier, SHORT event);
#else /* NEW_EDITOR */
static void sat_editor_cb (T_MFW_HND win, USHORT Identifier, USHORT event);
#endif /* NEW_EDITOR */
#include "MmiChineseInput.h" /* SPR#1700 - DS - Added to implement Chinese Editor support in SAT */
#define TRACE_SAT_STRING /* SPR#1700 - DS - Debug flag for tracing SAT String */
/*********************************************************************
*
* SUB WINDOW SAT_GET_KEY
*
*********************************************************************/
#define SAT_GET_KEY_BUFFER_SIZE (UBYTE)(1+2) /* two spares for mfwEdt */
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 *edt_buffer; /* buffer for editor */
T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */
} T_sat_get_key;
static void sat_get_key_destroy (T_MFW_HND own_window);
static void sat_get_key_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command);
/*******************************************************************************
$Function: sat_get_key_create
$Description: Creation of an instance for the SAT GET KEY dialog.Window must
be available after reception of SAT command,only one instance.
$Returns: mfw window handler
$Arguments: parent_window - Parent window handler
*******************************************************************************/
T_MFW_HND sat_get_key_create (T_MFW_HND parent_window)
{
T_sat_get_key * data = (T_sat_get_key *)ALLOC_MEMORY (sizeof (T_sat_get_key));
T_MFW_WIN * win;
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_get_key_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_get_key_destroy
$Description: Destroy the sat get inkey dialog.
$Returns: none
$Arguments: own_window - window handler
*******************************************************************************/
static void sat_get_key_destroy (T_MFW_HND own_window)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *)own_window)->data;
T_sat_get_key * data = (T_sat_get_key *)win_data->user;
if (own_window == NULL)
{
TRACE_EVENT ("Error : sat_get_key_destroy called with NULL Pointer");
return;
}
if (data)
{
/*
* Delete WIN Handler
*/
win_delete (data->win);
/*
* Free Memory
*/
FREE_MEMORY ((U8 *)data->edt_buffer,
SAT_GET_KEY_BUFFER_SIZE * sizeof(char));
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
sat_destroy_TEXT_ASCIIZ ((char *)data->editor_data.TitleString); /* label */
#else /* NEW_EDITOR */
sat_destroy_TEXT_ASCIIZ (data->editor_data.TextString); /* label */
#endif /* NEW_EDITOR */
FREE_MEMORY ((U8 *)data, sizeof (T_sat_get_key));
}
}
/*******************************************************************************
$Function: sat_get_key_exec
$Description: Dialog function for sat_get_key_exec window.
$Returns: none
$Arguments: win - window handler
event -window event
value - unique id
sat_command - Sat command info
*******************************************************************************/
static void sat_get_key_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_get_key * data = (T_sat_get_key *)win_data->user;
T_SAT_TXT * txt;
T_SAT_RES sat_res;
/* SPR#1428 - SH - New Editor: we'll put data in these, for efficiency */
#ifdef NEW_EDITOR
USHORT leftSK, rightSK, mode, cursor;
UBYTE *textStr;
#endif
TRACE_FUNCTION ("sat_get_key_exec()");
switch (event)
{
case SAT_GET_KEY:
data->sat_command = sat_command; /* save a pointer to the parameter for later use in callbacks */
txt = (T_SAT_TXT *)&sat_command->c.text;
/* allocate a buffer to hold the edited chars */
data->edt_buffer = (char *)ALLOC_MEMORY (
SAT_GET_KEY_BUFFER_SIZE * sizeof(char));
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
/*
* Setup an Editor to get a single key
*/
AUI_edit_SetDefault(&data->editor_data);
AUI_edit_SetDisplay(&data->editor_data, ZONE_FULL_SK_TITLE, COLOUR_EDITOR, EDITOR_FONT);
if ((sat_command->qual & SAT_M_INKEY_HELP_AVAIL) NEQ 0)
{
leftSK = TxtHelp; /* help available */
}
else
{
leftSK = TxtNull; /* no help available */
}
if ((sat_command->qual & SAT_M_INKEY_YES_NO) NEQ 0)
{
/* yes/no decision */
leftSK = TxtYes;
rightSK = TxtNo;
mode = ED_MODE_READONLY; /* treat as read-only, thus ignoring normal keys */
cursor = ED_CURSOR_NONE;
}
else
{
/* normal single key request */
leftSK = TxtSoftOK;
rightSK = TxtSoftBack;
if ((sat_command->qual & SAT_M_INKEY_ALPHA) EQ 0) /* 0=digits, 1=alpha */
{
mode = 0; /* Digits mode */
cursor = ED_CURSOR_UNDERLINE;
}
else
{
mode = ED_MODE_ALPHA; /* Alphanumeric mode */
cursor = ED_CURSOR_BAR;
}
}
if (txt->len > 0)
{
textStr = (UBYTE *)sat_create_TEXT_ASCIIZ (txt); /* label */
}
else
{
textStr = NULL; /* no label */
}
AUI_edit_SetTextStr(&data->editor_data, leftSK, rightSK, TxtNull, textStr);
AUI_edit_SetEvents(&data->editor_data, event, TRUE, TWENTY_SECS, (T_AUI_EDIT_CB)sat_editor_cb);
AUI_edit_SetMode(&data->editor_data, mode, cursor);
if ((sat_command->qual & SAT_M_INKEY_HELP_AVAIL) NEQ 0)
{
AUI_edit_SetAltTextStr(&data->editor_data, 1, TxtHelp, FALSE, TxtNull); /* help available */
}
/* provide an empty zero terminated buffer */
data->edt_buffer[0] = '\0';
/* SPR#1559 - SH - Set appropriate editor size */
AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE *)data->edt_buffer, strlen(data->edt_buffer)+1);
/*
* 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_key_destroy (data->win);
}
#else /* NEW_EDITOR */
/*
* Setup an Editor to get a single key
*/
if ((sat_command->qual & SAT_M_INKEY_HELP_AVAIL) NEQ 0)
{
data->editor_data.AlternateLeftSoftKey = TxtHelp; /* help available */
}
else
{
data->editor_data.AlternateLeftSoftKey = TxtNull; /* no help available */
}
if ((sat_command->qual & SAT_M_INKEY_YES_NO) NEQ 0)
{
/* yes/no decision */
data->editor_data.LeftSoftKey = TxtYes;
data->editor_data.RightSoftKey = TxtNo;
data->editor_data.mode = E_EDIT_READ_ONLY_MODE; /* treat as read-only, thus ignoring normal keys */
}
else
{
/* normal single key request */
data->editor_data.LeftSoftKey = TxtSoftOK;
data->editor_data.RightSoftKey = TxtSoftBack;
if ((sat_command->qual & SAT_M_INKEY_ALPHA) EQ 0) /* 0=digits, 1=alpha */
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -