📄 auiwap.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:
$Project code:
$Module:
$File: AUIWap.c
$Revision:
$Author: Condat(UK)
$Date:
********************************************************************************
Description:
The user interface for WAP. Provides the required menus, lists, dialogs and
utilises the functionality of the ATB appropriately.
********************************************************************************
$History: AUIWap.c
$End
*******************************************************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#if defined (NEW_FRAME)
#include "typedefs.h"
#include "vsi.h"
#include "pei.h"
#include "custom.h"
#include "gsm.h"
#else /* NEW_FRAME */
#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"
#endif /* NEW_FRAME */
#include "Mfw_sys.h"
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_edt.h"
#include "mfw_tim.h"
#include "mfw_phb.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"
//GW Removed T9 references
#include "Mfw_cm.h"
#include "dspl.h"
#include "MmiMmi.h"
#include "MmiMain.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiCall.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MmiResources.h"
#include "MmiBlkLangDB.h"
#include "MmiBookUtils.h"
#include "MmiEditor.h"
#include "MmiEditor_i.h"
#include "MmiBookshared.h"
#include "ATBData.h"
#include "wap_types.h"
#include "ATBWapAUI.h"
#include "mmiSmsMenu.h"
#include "Mmismssend.h"
#include "AUIWap.h"
/* SPR#1574 - SH */
#ifdef MMI_GPRS_ENABLED
#include "MmiGprs.h"
#endif
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "mmiusersymbolinput.h" //zhaowm 2002.11.28
#include "MmiWapFfs.h" //zhaowm 2002.12.09
#include "MmiIcons.h" //zhaowm
#include "mmitextinput.h" /* 2004/04/28 sunsj add */
#include "listicn.h"
// wyj
//#define TRACE_AUIWAP
//#define TRACE_FUNCTION MI_dbgPrintf_
#ifdef MMS_WAP_ENABLED
#include "MMSAgent.h"
#include "wap_interface.h"
#include "mmimmsffs.h"
#endif
#define TRACE_AUIWAP
#define WAP_TRACE 1
#include "mmiutilapi.h"
#define TRACE_EVENT(f) WAP_TRACE_EVENT(("hyl,Auiwap.c,%s",f));
#define TRACE_FUNCTION(f) TRACE_EVENT(f);
#undef TRACE_MEMALLOC // Define this to trace memory allocations & freeings
#define ALLOC_MEMORY mfwAlloc
#define FREE_MEMORY mfwFree
#define PIN_MAX_LEN 8 // Max no of characters to enter for a PIN
// Events
#define WAP_INIT 200 // initialise WAP browser
#define WAP_SHOW_CARD 201 // display the WAP card
// Size of options menu
/* 2004/05/28 sunsj modify */
/*talcon add for M288*/
#if (MAIN_LCD_SIZE==4)/*128x160*/
#define WAP_MENU_LEFT 0
#define WAP_MENU_RIGHT 128
#define WAP_MENU_TOP 0
#define WAP_MENU_BOTTOM 144
// Size of editor screen
#define WAP_EDITOR_LEFT 4
#define WAP_EDITOR_RIGHT 124
#define WAP_EDITOR_TOP 18
#define WAP_EDITOR_BOTTOM 124
#elif (MAIN_LCD_SIZE==3)/*128x128*/
#define WAP_MENU_LEFT 0
#define WAP_MENU_RIGHT 128
#define WAP_MENU_TOP 0
#define WAP_MENU_BOTTOM 110
// Size of editor screen
#define WAP_EDITOR_LEFT 4
#define WAP_EDITOR_RIGHT 124
#define WAP_EDITOR_TOP 18
#define WAP_EDITOR_BOTTOM 124
#endif
/* Edit modes
*
* Specify what to do after editing a URL.
*/
enum
{
WAP_GOTO_URL,
WAP_ADD_BOOKMARK,
WAP_ADD_BOOKMARK_NAME,
WAP_EDIT_BOOKMARK,
WAP_EDIT_BOOKMARK_URL,
WAP_EDIT_HISTORY,
WAP_EDIT_HISTORY_URL,
WAP_EDIT_HOMEPAGE,
//WAP_DIALOGE_ID,
WAP_EDIT_APN
};
/* Delete modes
*
* Specify what to do after delete confirmation screen.
*/
enum
{
WAP_DELETE_BOOKMARK,
WAP_DELETE_HISTORY,
WAP_CLEAR_HISTORY
};
/* Number edit modes
*
* Specify what to do after a numeric edit screen
*/
enum
{
WAP_DIALUP_NUMBER,
WAP_IP_ADDRESS1,
WAP_IP_ADDRESS2,
WAP_PORT1,
WAP_PORT2,
WAP_RESPONSE_TIMER
};
/* Options menu items
*
* These are the menu items in the options menu.
*/
enum
{
WAP_ADDBOOKMARK,
WAP_BOOKMARKS,
WAP_GOTO,
WAP_HOMEPAGE,
WAP_BACK,
WAP_RELOAD,
WAP_EXIT,
MAX_OPTIONS // Always have this at the end of the list
};
/* Options menu items
*
* These are the menu items in the options menu.
*/
enum
{
WAP_SELECT,
WAP_CustSoftKey,
MAX__CUST_OPTIONS // Always have this at the end of the list
};
/* T_WAP_BROWSER
*
* This structure holds all information about the wap browser window.
*/
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND win;
T_MFW_HND kbd;
T_MFW_HND kbd_long;
USHORT TextId1; // The first text string...
USHORT TextId2; // ..and the second
char *TextString1; // The first line of plain text...
char *TextString2; // ...and the second line.
} T_WAP_BROWSER;
/* T_WAP_DATA
*
* All data for WAP can be accessed through this structure.
*/
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND win; // The WAP data window (sits behind all other windows)
T_MFW_HND edit_win; // ...input window
T_MFW_HND options_win; // ...options window
T_MFW_HND menu_win; // ...main WAP menu window
T_MFW_HND browser_win; // The browser window
T_MFW_HND list_win; // List window (bookmarks etc)
ListMenuData *list_data; // ...and its list data
T_MFW_HND optionsmenu_win; // The options menu window, accessible from browser
ListMenuData *optionsmenu_data; // ...and its list data
T_WAP_LIST *OptionsList; // The list of options menu items
T_MFW_HND temp_win; // Temporary window pointer storage
T_MFW_HND connect_win; // The "connecting" dialog window
T_MFW_HND error_win; /* SPR#1739 - SH - Error dialog */
T_MFW_HND main_kbd;
char *Buffer; // Buffer for text input
char *Buffer2; // Second buffer for dual input dialogs
char *Format; // Input format string
char *Message; // Buffer for text output
char *LeftSoftKey; // Text for custom left soft key
char *RightSoftKey; // Text for custom right soft key
char *URLSelect; // The current URL that is selected in a list menu
UBYTE OptionSelect; // The number of the selected URL
T_WAP_VIEW *View; // Pointer to current view
BOOL connected; // Are we connected?
void *gen_pointer; // Pointer to generic data
BOOL update_forbid; // If TRUE, forbids update to the WAP browser window
T_MFW_HND timer; /* SPR#1569 - SH - Mfw timer */
T_MFW_HND other_menu_win; // wyj WAP menu window
#ifdef MMS_WAP_ENABLED
T_MMS_WAP_DATA *mmsdata;
#endif
} T_WAP_DATA;
/* List menu attributes
*
* Needed for creating the menu.
*/
static MfwRect list_menuArea = // menus display area
{
WAP_MENU_LEFT, WAP_MENU_TOP, WAP_MENU_RIGHT, WAP_MENU_BOTTOM
};
static MfwMnuAttr list_menuAttrib =
{
0,
&list_menuArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, // centered page menu
-1, // use default font
NULL, // with these items
0 // number of items
};
/*
Local Handler the wap window (At the moment only one instance possible in BMI
*/
MfwHnd wap_main_window = 0;
int text_input_flag = 0;
/* Prototypes for functions */
T_MFW_HND AUI_please_wait(T_MFW_HND parent_win); /* SPR#1569 - SH - Added this function */
void AUI_please_wait_cb(T_MFW_HND win, USHORT identifier, SHORT reason); /* SPR#1569 - SH - Added this function */
static void AUI_menu_cb(T_MFW_HND parent_win, UBYTE identifier, UBYTE reason);
int AUI_homepage(MfwMnu* menu, MfwMnuItem* item);
int AUI_wap_startup_begin(MfwEvt evt, MfwTim timer); /* SPR#1569 - SH - Added this function */
void AUI_destroy (T_MFW_HND own_window, USHORT windows);
static int AUI_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static int AUI_main_kbd_cb(T_MFW_EVENT event, T_MFW_KBD *keyboard);
void AUI_control (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
//T_MFW_HND AUI_connecting_dialog (T_MFW_HND win, ULONG status);
static int AUI_connecting_dialog (T_MFW_HND win, ULONG status);
void AUI_connecting_dialog_cb (T_MFW_HND win, UBYTE identifier, UBYTE reason);
//void AUI_connect_URL (T_MFW_HND win, char *URL);
T_MFW_HND AUI_win_create (T_MFW_HND parent_win);
int AUI_win_destroy (T_MFW_HND win);
static int AUI_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
void AUI_win_control (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int AUI_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard);
static int AUI_kbd_long_cb(T_MFW_EVENT event, T_MFW_KBD *keyboard);
int AUI_edit(char *shortcut, USHORT identifier, int prompt, USHORT maxlen);
static T_MFW_HND AUI_edit_create(MfwHnd parent_win, USHORT identifier, int prompt, USHORT maxlen);
static void AUI_edit_cb(T_MFW_HND win, USHORT identifier, USHORT reason);
static void AUI_bookmarks_list_cb(T_MFW_HND win, ListMenuData *EntryListData);
static void AUI_history_list_cb(T_MFW_HND parent_win, ListMenuData *EntryListData);
static void AUI_profiles_list_cb(T_MFW_HND parent_win, ListMenuData *EntryListData);
static void AUI_profiles_setup_cb(T_MFW_HND win, ListMenuData *EntryListData);
static int AUI_entry_list (T_MFW_HND win, T_WAP_LIST *EntryList, ListCbFunc Callback, UBYTE pos,int prompt);
static ListMenuData* AUI_entry_list_create (T_MFW_HND win, T_WAP_LIST *EntryList, ListCbFunc Callback, UBYTE pos,int prompt);
int AUI_entry_goto(WAP_LIST_TYPE identifier);
int AUI_entry_delete(UBYTE identifier);
void AUI_entry_delete_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
int AUI_entry_sendSMS(void);
static void AUI_profile_name_edit_cb(T_MFW_HND parent_win, UBYTE identifier, UBYTE reason);
static void AUI_username_cb(T_MFW_HND parent_win, UBYTE identifier, UBYTE reason);
static void AUI_password_cb(T_MFW_HND parent_win, UBYTE identifier, UBYTE reason);
int AUI_number_edit(T_MFW_HND parent_win, int identifier, int prompt);
static void AUI_number_edit_cb(T_MFW_HND parent_win, UBYTE identifier, UBYTE reason);
static void AUI_error_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
static void AUI_info_dialog(T_MFW_HND win, USHORT TxtId1, USHORT TxtId2);
static void AUI_standard_editor(T_EDITOR_DATA *editor_data, char *buffer, U16 size, UBYTE mode, T_EDIT_CB callback);
static void AUI_input_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
static void AUI_password_cb_1(T_MFW_HND win, UBYTE identifier, UBYTE reason);
static void AUI_password_cb_2(T_MFW_HND win, UBYTE identifier, UBYTE reason);
static void AUI_confirm_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
static void AUI_info_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
static void AUI_options_menu_cb(T_MFW_HND win, ListMenuData *EntryListData);
static void AUI_CustSoftKey_menu_cb(T_MFW_HND win, ListMenuData *EntryListData);
static void AUI_goto_cb(T_MFW_HND parent_win, UBYTE identifier, UBYTE reason);
static void info_screen (T_MFW_HND win, USHORT TextId, USHORT TextId2, T_VOID_FUNC Callback);
T_MFW_HND AUI_Exit_Inquire_dialog (T_MFW_HND win);
void AUI_Exit_Inquire_Dialog_cb (T_MFW_HND win, UBYTE identifier, UBYTE reason);
static BOOL wap_callActive = FALSE;
int WapTitle=0;//zhaowm 2002.12.08 add for wap menu title
int optiongoback=0; //zhaowm 2002.12.08 add for going back to the browser.
extern int IsGprsSupported(void); //zhaowm 2003.1.14 to check whether GPRS is supported in current cell.
int URlconnect=0;//zhaowm 2003.2.14 add for enter internet by one step ,1--enter internet by one step,0--enter wap menu
/* Set up variables and functions for tracing purposes */
#ifdef TRACE_MEMALLOC
U16 memUsed = 0;
UBYTE memTracker[110] = {0};
#endif
static char test_string[40];
int check_memory()
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -