📄 smi_ui.c
字号:
/*
+-----------------------------------------------------------------------------
| Project : GSM-F&D (8411)
| Modul : SMI_UI
+-----------------------------------------------------------------------------
| Copyright 2002 Texas Instruments Berlin, AG
| All rights reserved.
|
| This file is confidential and a trade secret of Texas
| Instruments Berlin, AG
| The receipt of or possession of this file does not convey
| any rights to reproduce or disclose its contents or to
| manufacture, use, or sell anything it may describe, in
| whole, or in part, without the specific written consent of
| Texas Instruments Berlin, AG.
+-----------------------------------------------------------------------------
| Purpose : This Modul defines the user interface of the
| SMI componente of the mobile station
+-----------------------------------------------------------------------------
*/
#ifndef SMI_UI_C
#define SMI_UI_C
#endif
#define ENTITY_SMI
/*==== INCLUDES ===================================================*/
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include "typedefs.h"
#include "vsi.h"
#include "custom.h"
#include "gsm.h"
#include "prim.h"
#include "tok.h"
#include "message.h"
#include "aci_cmh.h"
#include "ksd.h"
#include "aca.h"
#include "smi.h"
#include "gdi.h"
#include "light.h"
#include "pwr.h"
#include "rx.h"
#include "audio.h"
#include "l4_tim.h"
#include "cus_smi.h"
/*==== CONSTANTS ==================================================*/
/*
*-------------------------------------------------------------------
* conversion of the keycodes, for adaptation of the UI to different
* hardware environments
*-------------------------------------------------------------------
*/
#define convertKeyCode(A) (A)
/*
*-------------------------------------------------------------------
* states of UI
*-------------------------------------------------------------------
*/
#define UI_IDLE 0
#define UI_INPUT 1
#define UI_SELECT 2
#define UI_BLOCKED 9
/*
*-------------------------------------------------------------------
* the timer mode is used to identify the current usage of timer
* with identity TUNIVERSAL
*-------------------------------------------------------------------
*/
typedef enum
{
TIMER_MOD_NONE,
TIMER_MOD_WELCOME,
TIMER_MOD_LCD_TEST,
TIMER_MOD_BOOTING,
TIMER_MOD_NIBT
#ifdef BT_ADAPTER
, TIMER_MOD_BT
#endif
}
T_TIMER_MOD;
/*
*-------------------------------------------------------------------
* input mode
*-------------------------------------------------------------------
*/
typedef enum
{
INP_MOD_PIN, /* input of PIN active */
INP_MOD_NPIN, /* input of new PIN active */
INP_MOD_NPIN_TWICE, /* input of new PIN confirmed */
INP_MOD_PUK, /* input of PUK active */
INP_MOD_DIAL, /* input of phone number or keystroke */
/* sequence is active */
INP_MOD_SM, /* input of short message active */
INP_MOD_SCA, /* input of service center address active */
INP_MOD_DA, /* input of destination address active */
INP_MOD_VP, /* input of validity period active */
INP_MOD_MEM, /* input of memory type active */
INP_MOD_IDX, /* input of index */
INP_MOD_NONE /* no input is active */
}
T_INP_MOD;
/*
*-------------------------------------------------------------------
* menu mode
*-------------------------------------------------------------------
*/
typedef enum
{
MEN_MOD_MAIN, /* main menu is active */
MEN_MOD_PLMN, /* PLMN menu is active */
MEN_MOD_CTB, /* call table menu is active */
MEN_MOD_SMS_LIST, /* SMS list is active */
MEN_MOD_MSG_VIEW, /* SM or CBM will be shown */
MEN_MOD_NONE /* no menu is active */
}
T_MEN_MOD;
/*
*-------------------------------------------------------------------
* identifies the input sequence to be carried out by the user
*-------------------------------------------------------------------
*/
typedef enum
{
INP_SEQ_SMS_SUBMIT, /* a short message is send */
INP_SEQ_SMS_SUBMIT_FROM_MEM, /* a short message in memory is */
/* send */
INP_SEQ_SMS_WRITE, /* a short message is written to */
/* memory */
INP_SEQ_SMS_DELETE, /* a short message is deleted */
INP_SEQ_SMS_READ, /* a short message will be read */
INP_SEQ_SMS_LIST, /* all short messages will be */
/* listed */
INP_SEQ_SMS_READ_SINGLE, /* a short message will be read */
INP_SEQ_NONE /* no input sequence defined */
}
T_INP_SEQ;
/*
*-------------------------------------------------------------------
* formats of the battery and fieldstrength level output
*-------------------------------------------------------------------
*/
#define FIELDSTRENGTH_FORMAT_L "F%1d"
#define BATTLEVEL_FORMAT_L "B%1d"
#define FIELDSTRENGTH_FORMAT_S "%1d"
#define BATTLEVEL_FORMAT_S "%1d"
/*
*-------------------------------------------------------------------
* keypad related constants
*-------------------------------------------------------------------
*/
#define MAX_KEYPAD_MODE 3
/*
*-------------------------------------------------------------------
* area related constants
*-------------------------------------------------------------------
*/
#define SRVC_WIDTH_L 8
#define SRVC_WIDTH_S 1
/*
*-------------------------------------------------------------------
* menu related constants
*-------------------------------------------------------------------
*/
#define LINES_PER_SMS_LIST 3
#define MENU_WIDTH_L 16
#define MENU_WIDTH_S 16
#define MENU_PRMPT_WIDTH 1
#define MENU_ENTRY_WIDTH_L (MENU_WIDTH_L - MENU_PRMPT_WIDTH)
#define MENU_ENTRY_WIDTH_S (MENU_WIDTH_S - MENU_PRMPT_WIDTH)
#define MAX_LINES_PER_MSG ((MAX_SM_LEN / MENU_ENTRY_WIDTH_S) + 1)
/*==== TYPES ======================================================*/
typedef struct
{
UBYTE state;
T_INP_MOD inputMode;
T_INP_SEQ inputSeq;
T_TIMER_MOD timerMod;
BOOL powerOn;
BOOL ringerOn;
BOOL waitingOn;
BOOL nibtOn;
BOOL normalService;
BOOL sliderActive;
BOOL inSubmenu;
T_MEN_MOD menuMode;
BOOL sendDTMF;
BOOL keyBeep;
BOOL backlightOn;
BOOL shiftOn;
UBYTE lastShiftedKey;
USHORT lastKeyIdx;
USHORT lastKeyRep;
USHORT keypadMode;
USHORT mainMenuIdx;
CHAR lastDialedNumber[MAX_INPUT_SIZE + 1];
} T_UI_DATA;
typedef struct
{
UBYTE keypadCode;
CHAR *keyCode[MAX_KEYPAD_MODE];
BOOL pressed;
} T_KEYTABLE;
/*==== EXPORT =====================================================*/
/*==== VARIABLES ==================================================*/
LOCAL T_KEYTABLE keyTable[] = {
/*
keypadcode normalkey keycode1 keycode2 pressed
*/
'0', "0", " ", "\000", FALSE,
'1', "1", NULL, "\001", FALSE,
'2', "2", "ABC", "\002", FALSE,
'3', "3", "DEF", "\003", FALSE,
'4', "4", "GHI", "\004", FALSE,
'5', "5", "JKL", "\005", FALSE,
'6', "6", "MNO", "\006", FALSE,
'7', "7", "PQRS", "\007", FALSE,
'8', "8", "TUV", "\010", FALSE,
'9', "9", "WXYZ", "\011", FALSE,
KP_CLEAR, "b", NULL, NULL, FALSE,
KP_ON_HOOK, "c", NULL, NULL, FALSE,
KP_OFF_HOOK, "d", "\177", NULL, FALSE,
KP_SHIFT, "g", NULL, NULL, FALSE,
KP_POWER, "j", NULL, NULL, FALSE,
KP_UP, "e", "h", NULL, FALSE,
KP_DOWN , "f", "a", NULL, FALSE,
KP_STAR, "*", "+", "\012", FALSE,
KP_HASH, "#", "-", "\013", FALSE,
/* must be the last entry */
NULL_TERM, NULL, NULL, NULL, FALSE
};
#if defined (NEW_FRAME)
GLOBAL T_HANDLE t_slider_running;
GLOBAL T_HANDLE t_backlight_running;
GLOBAL T_HANDLE t_shiftkey_running;
GLOBAL T_HANDLE t_universal_running;
#else
GLOBAL T_VSI_THANDLE t_slider_handle;
GLOBAL T_VSI_THANDLE t_backlight_handle;
GLOBAL T_VSI_THANDLE t_shiftkey_handle;
GLOBAL T_VSI_THANDLE t_universal_handle;
#endif
GLOBAL USHORT screensize_x;
GLOBAL USHORT screensize_y;
GLOBAL USHORT keyboardType;
LOCAL T_UI_DATA ui_data_base;
LOCAL T_UI_DATA* ui_data = &ui_data_base;
LOCAL UBYTE oldState;
#ifdef BT_ADAPTER
LOCAL char bd_addr_data[BTI_BD_ADDR_LENGTH*2];
#endif /* BT_ADAPTER */
/*
*-------------------------------------------------------------------
* MAIN menu
*-------------------------------------------------------------------
*/
LOCAL CHAR* menu[4];
/*
*-------------------------------------------------------------------
* PLMN menu
*-------------------------------------------------------------------
*/
LOCAL CHAR* plmnmenu[MAX_OPER + 1];
LOCAL BOOL plmnIsEmpty = TRUE;
/*
*-------------------------------------------------------------------
* CALL TABLE menu
*-------------------------------------------------------------------
*/
LOCAL CHAR ctbstring[MAX_CALL_NR + 1][MENU_ENTRY_WIDTH_L + 1];
LOCAL CHAR* ctbmenu [MAX_CALL_NR + 1];
/*
*-------------------------------------------------------------------
* SMS LIST menu
*-------------------------------------------------------------------
*/
LOCAL CHAR smsstring[LINES_PER_SMS_LIST + 1][MENU_ENTRY_WIDTH_L + 1];
LOCAL CHAR* smsmenu [LINES_PER_SMS_LIST + 1];
/*
*-------------------------------------------------------------------
* used for reading a single SMS entry
*-------------------------------------------------------------------
*/
T_ACI_SMS_STOR actMem = SMS_STOR_NotPresent;
UBYTE actIdx = ACI_NumParmNotPresent;
/*
*-------------------------------------------------------------------
* MESSAGE VIEW menu
*-------------------------------------------------------------------
*/
LOCAL CHAR msgstring[MAX_LINES_PER_MSG + 1][MENU_ENTRY_WIDTH_L + 1];
LOCAL CHAR* msgmenu [MAX_LINES_PER_MSG + 1];
/*
*-------------------------------------------------------------------
* handles for the output areas
*-------------------------------------------------------------------
*/
LOCAL USHORT areaUser, areaProvider, areaMenu, areaSlider,
areaState, areaFS, areaBAT, areaCaller,
areaSubMenu, areaHook, areaService, areaShift,
areaUniversal;
/*
*-------------------------------------------------------------------
* state of the power key
*-------------------------------------------------------------------
*/
LOCAL BOOL powerKeyOn = FALSE;
/*
*-------------------------------------------------------------------
* temporary storing of PUK and new PIN input
*-------------------------------------------------------------------
*/
LOCAL CHAR puk[MAX_PUK_LEN + 1];
LOCAL CHAR pin[MAX_PIN_LEN + 1];
/*==== PROTOTYPES =================================================*/
LOCAL void ui_processDefaultKey (UBYTE key_pressed,
UBYTE key_stat);
#if defined (NEW_FRAME)
LOCAL char *ui_getCauseName (char* source,
USHORT cause);
#else
LOCAL CHAR *ui_getCauseName (BYTE* source,
USHORT cause);
#endif
LOCAL void ui_startNewInput (USHORT aHandle,
UBYTE row,
UBYTE col,
CHAR* prompt,
UBYTE length,
UBYTE type,
T_INP_MOD inputMode,
CHAR* value,
BOOL show);
/*==== FUNCTIONS ==================================================*/
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_UI |
| STATE : code ROUTINE : ui_handleNibt |
+--------------------------------------------------------------------+
PURPOSE :
*/
LOCAL void ui_handleNibt (UBYTE nibt)
{
if (screensize_y EQ 4)
{
wm_clearArea (areaCaller);
switch (nibt)
{
case (NIBT_OFF):
if (ui_data->nibtOn)
{
#if defined (NEW_FRAME)
TIMERSTOP (SMI_TUNIVERSAL);
t_universal_running = FALSE;
#else
TIMERSTOP (t_universal_handle);
#endif
ui_data->timerMod = TIMER_MOD_NONE;
ui_data->nibtOn = FALSE;
}
break;
case (NIBT_ALERT):
wm_areaWrite (areaCaller, 0, 0, "NIBT_ALERT");
break;
case (NIBT_DISC):
wm_areaWrite (areaCaller, 0, 0, "NIBT_DISC");
#if defined (NEW_FRAME)
TIMERSTART (TNIBT_VALUE, SMI_TUNIVERSAL);
t_universal_running = TRUE;
#else
TIMERSTART (TNIBT_VALUE, t_universal_handle);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -